Script v1_7_1_0
- AI
- Animals
- Collections
- Contracts
- Debug
- Economy
- Elements
- EnvironmentalScore
- Errors
- Events
- GUI
- Handtools
- Hud
- I3d
- Input
- Jobs
- Maps
- Materials
- Misc
- Objects
- Parameters
- Placeables
- Placement
- Player
- Shop
- Sounds
- Specialization
- Specializations
- StateMachine
- Statistics
- Tasks
- Triggers
- Utils
- Vehicles
Engine v1_7_1_0
- AI
- Animation
- Camera
- Entity
- Fillplanes
- general
- General
- I3D
- Input
- Lighting
- Math
- Network
- Node
- NoteNode
- Overlays
- Particle System
- Physics
- Rendering
- Scenegraph
- Shape
- Sound
- Spline
- String
- Terrain Detail
- Text Rendering
- Tire Track
- VoiceChat
- XML
Foundation Reference
PlayerStateFall
ParentPlayerStateBaseFunctions
isAvailable
DescriptionCheck if state is available. If player is not on the ground and is not in water and vertical velocity lower thanDefinition
isAvailable()Return Values
bool | true | if state is available |
28 | function PlayerStateFall:isAvailable() |
29 | local isOnGround = self.player.baseInformation.isOnGround |
30 | local isInWater = self.player.baseInformation.isInWater |
31 | local verticalVelocity = self.player.motionInformation.currentSpeedY |
32 | |
33 | if not isOnGround and not isInWater and (verticalVelocity < self.player.motionInformation.minimumFallingSpeed) then |
34 | return true |
35 | end |
36 | return false |
37 | 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 PlayerStateFall.new(player, stateMachine) |
20 | local self = PlayerStateBase.new(player, stateMachine, PlayerStateFall_mt) |
21 | |
22 | return self |
23 | end |
update
DescriptionUpdate method. Will deactivate when player hits the ground or is in waterDefinition
update(float dt)Arguments
float | dt | delta time in ms |
42 | function PlayerStateFall:update(dt) |
43 | local isOnGround = self.player.baseInformation.isOnGround |
44 | local isInWater = self.player.baseInformation.isInWater |
45 | |
46 | if isOnGround or isInWater then |
47 | self:deactivate() |
48 | end |
49 | end |