LUADOC - Farming Simulator 19

Script v1.7.1.0

Engine v1.7.1.0

Foundation Reference

PlayerStateIdle

Parent
PlayerStateBase
Functions

isAvailable

Description
Check if state is available. Always true
Definition
isAvailable()
Return Values
booltrueif player can idle
Code
28function PlayerStateIdle:isAvailable()
29 return true
30end

new

Description
Creating instance of state.
Definition
new(table player, table stateMachine)
Arguments
tableplayerinstance of player
tablestateMachineinstance of the state machine manager
Return Values
tableinstanceinstance of object
Code
19function PlayerStateIdle:new(player, stateMachine)
20 local self = PlayerStateBase:new(player, stateMachine, PlayerStateIdle_mt)
21
22 return self
23end

update

Description
Update method. Will deactivate if player moves or if not on the ground.
Definition
update(float dt)
Arguments
floatdtdelta time in ms
Code
35function PlayerStateIdle:update(dt)
36 local playerInputsCheck = ( self.player.inputInformation.moveForward ~= 0) or (self.player.inputInformation.moveRight ~= 0)
37
38 if playerInputsCheck or not self.player.baseInformation.isOnGround then
39 self:deactivate()
40 end
41end