CLuaLocomotion
This class is essentially what controls a NextBot NPC. You can access it in a NextBot NPC by using self.loco variable.
Methods
CLuaLocomotion:Approach( Vector goal, number goalweight )
Sets the location we want to get to.
Each call of Approach moves the NextBot 1 unit towards the specified goal. The size of this unit is determined by SetDesiredSpeed; the default is 0 (each call of Approach moves the NextBot 0).
To achieve smooth movement with Approach, it should be called in a hook like Think, as shown in the example.
CLuaLocomotion:ClearStuck()
Removes the stuck status from the bot
boolean CLuaLocomotion:GetAvoidAllowed()
Returns whether the Nextbot is allowed to avoid obstacles or not.
number CLuaLocomotion:GetDesiredSpeed()
Returns the desired movement speed set by CLuaLocomotion:SetDesiredSpeed
Vector CLuaLocomotion:GetGroundMotionVector()
Return unit vector in XY plane describing our direction of motion - even if we are currently not moving
boolean CLuaLocomotion:GetJumpGapsAllowed()
Returns whether the Nextbot is allowed to jump gaps or not.
boolean CLuaLocomotion:IsAreaTraversable( CNavArea area )
Returns whether this CLuaLocomotion can reach and/or traverse/move in given CNavArea.
boolean CLuaLocomotion:IsClimbingOrJumping()
Returns true of the locomotion engine is jumping or climbing
boolean CLuaLocomotion:IsOnGround()
Returns whether the nextbot this locomotion is attached to is on ground or not.
boolean CLuaLocomotion:IsUsingLadder()
Returns whether or not the target in question is on a ladder or not.
CLuaLocomotion:Jump()
Makes the bot jump. It must be on ground (Entity:IsOnGround) and its model must have ACT_JUMP activity.
CLuaLocomotion:JumpAcrossGap( Vector landingGoal, Vector landingForward )
Makes the bot jump across a gap. The bot must be on ground (Entity:IsOnGround) and its model must have ACT_JUMP activity.
CLuaLocomotion:SetAvoidAllowed( boolean allowed )
Sets whether the Nextbot is allowed try to to avoid obstacles or not. This is used during path generation. Works similarly to nb_allow_avoiding convar. By default bots are allowed to try to avoid obstacles.
CLuaLocomotion:SetClimbAllowed( boolean allowed )
Sets whether the Nextbot is allowed to climb or not. This is used during path generation. Works similarly to nb_allow_climbing convar. By default bots are allowed to climb.
CLuaLocomotion:SetGravity( number gravity )
Sets the locomotion's gravity.
With values 0 or below, or even lower positive values, the nextbot will start to drift sideways, use CLuaLocomotion:SetVelocity to counteract this.
CLuaLocomotion:SetJumpGapsAllowed( boolean allowed )
Sets whether the Nextbot is allowed to jump gaps or not. This is used during path generation. Works similarly to nb_allow_gap_jumping convar. By default bots are allowed to jump gaps.
CLuaLocomotion:SetMaxYawRate( number yawRate )
Sets the max rate at which the NextBot can visually rotate. This will not affect moving or pathing.