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
- PlayerStateAnimalInteract
- PlayerStateAnimalPet
- PlayerStateAnimalRide
- PlayerStateBase
- PlayerStateCrouch
- PlayerStateCycleHandtool
- PlayerStateDrop
- PlayerStateFall
- PlayerStateIdle
- PlayerStateJump
- PlayerStateMachine
- PlayerStatePickup
- PlayerStateRun
- PlayerStateSwim
- PlayerStateThrow
- PlayerStateUseLight
- PlayerStateWalk
- 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
PlayerStateSwim
ParentPlayerStateBaseFunctions
isAvailable
DescriptionCheck if state is available if player is in waterDefinition
isAvailable()Return Values
bool | true | if player can swim |
29 | function PlayerStateSwim:isAvailable() |
30 | local isInWater = self.player.baseInformation.isInWater |
31 | |
32 | if isInWater then |
33 | return true |
34 | end |
35 | return false |
36 | 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 |
20 | function PlayerStateSwim.new(player, stateMachine) |
21 | local self = PlayerStateBase.new(player, stateMachine, PlayerStateSwim_mt) |
22 | |
23 | return self |
24 | end |
update
DescriptionUpdate method. Will deactivate if player is not in water anymoreDefinition
update(float dt)Arguments
float | dt | delta time in ms |
41 | function PlayerStateSwim:update(dt) |
42 | if not self.player.baseInformation.isInWater then |
43 | self:deactivate() |
44 | end |
45 | end |