Script v1.7.1.0
- AI
- Animals
- Contracts
- Debug
- Economy
- Effects
- Events
- Farms
- GUI
- Handtools
- I3d
- Materials
- Misc
- Objects
- Placeables
- Player
- Player
- PlayerModelManager
- PlayerPickUpObjectEvent
- PlayerSetFarmAnswerEvent
- PlayerSetFarmEvent
- PlayerSetHandToolEvent
- PlayerStateActivateObject
- PlayerStateAnimalFeed
- PlayerStateAnimalInteract
- PlayerStateAnimalPet
- PlayerStateAnimalRide
- PlayerStateBase
- PlayerStateCrouch
- PlayerStateCycleHandtool
- PlayerStateDrop
- PlayerStateFall
- PlayerStateIdle
- PlayerStateJump
- PlayerStateMachine
- PlayerStatePickup
- PlayerStateRun
- PlayerStateSwim
- PlayerStateThrow
- PlayerStateUseLight
- PlayerStateWalk
- PlayerStyle
- PlayerSwitchedFarmEvent
- PlayerTeleportEvent
- PlayerThrowObjectEvent
- PlayerToggleLightEvent
- Shop
- Sounds
- Specializations
- Triggers
- Utils
- Vehicles
- Weather
Engine v1.7.1.0
- AI
- Animation
- Camera
- Entity
- Fillplanes
- General
- I3D
- Input
- Lighting
- Math
- Network
- Node
- Overlays
- Particle System
- Physics
- Rendering
- Scenegraph
- Shape
- Sound
- Spline
- String
- Terrain Detail
- Text Rendering
- Tire Track
- XML
- general
Foundation Reference
PlayerStateAnimalFeed
ParentPlayerStateBaseFunctions
activate
DescriptionActivate methodDefinition
activate()Code
45 | function PlayerStateAnimalFeed:activate() |
46 | PlayerStateAnimalFeed:superClass().activate(self) |
47 | local dogHouse = g_currentMission:getDoghouse(self.player.farmId) |
48 | if dogHouse ~= nil and dogHouse.dog ~= nil then |
49 | dogHouse.dog:feed() |
50 | end |
51 | self:deactivate() |
52 | end |
deactivate
DescriptionDeactivate methodDefinition
deactivate()Code
56 | function PlayerStateAnimalFeed:deactivate() |
57 | PlayerStateAnimalFeed:superClass().deactivate(self) |
58 | self.isDog = false |
59 | end |
isAvailable
DescriptionCheck if we can feed an animal.Definition
isAvailable()Return Values
bool | returns | true if player can feed an animal |
29 | function PlayerStateAnimalFeed:isAvailable() |
30 | self.isDog = false |
31 | if self.player.isClient and self.player.isEntered and not g_gui:getIsGuiVisible() then |
32 | local playerHandsEmpty = self.player.baseInformation.currentHandtool == nil and not self.player.isCarryingObject |
33 | local dogHouse = g_currentMission:getDoghouse(self.player.farmId) |
34 | |
35 | if playerHandsEmpty and dogHouse ~= nil and dogHouse.isActivatable and dogHouse.dog ~= nil and not getVisibility(dogHouse.foodNode) then |
36 | self.isDog = true |
37 | return true |
38 | end |
39 | end |
40 | return false |
41 | end |
new
DescriptionCreating instance of state.Definition
new(table player, table stateMachine)Arguments
table | player | instance of player |
table | stateMachine | instance of the state machine manager |
table | instance | instance of object |
19 | function PlayerStateAnimalFeed:new(player, stateMachine) |
20 | local self = PlayerStateBase:new(player, stateMachine, PlayerStateAnimalFeed_mt) |
21 | |
22 | self.isDog = false |
23 | return self |
24 | end |