Class NPCMovement
Modder-facing movement wrapper for an S1API.Entities.NPCMovement.NPC. Provides navigation, warping, facing, and reachability helpers.
public class NPCMovement
- Inheritance
-
NPCMovement
- Inherited Members
- Extension Methods
Properties
CurrentDestination
Current destination being navigated to, if any.
public Vector3 CurrentDestination { get; }
Property Value
- Vector3
DefaultWalkSpeed
Gets the default walking speed of the NPC.
public float DefaultWalkSpeed { get; }
Property Value
FootPosition
Current foot position of the NPC in world space.
public Vector3 FootPosition { get; }
Property Value
- Vector3
IsMoving
Whether the NPC is currently moving along a path.
public bool IsMoving { get; }
Property Value
SpeedMultiplier
Gets or sets the overall speed multiplier that affects all movement.
public float SpeedMultiplier { get; set; }
Property Value
Methods
AddSpeedControl(string, int, float)
Adds or updates a speed control with the specified parameters. Higher priority values override lower ones.
public void AddSpeedControl(string id, int priority, float speed)
Parameters
idstringUnique identifier for this speed control.
priorityintPriority level (higher values take precedence).
speedfloatMovement speed multiplier.
CanGetTo(Vector3)
Returns whether the NPC can path to a position.
public bool CanGetTo(Vector3 position)
Parameters
positionVector3Target position.
Returns
CanGetTo(Vector3, float)
Returns whether the NPC can path to a position within a threshold.
public bool CanGetTo(Vector3 position, float within)
Parameters
positionVector3Target position.
withinfloatAcceptable distance to target.
Returns
DoesSpeedControlExist(string)
Checks if a speed control with the given ID exists.
public bool DoesSpeedControlExist(string id)
Parameters
idstringThe ID to check for.
Returns
- bool
True if the speed control exists, false otherwise.
FaceDirection(Vector3)
Rotates to face a world-space direction.
public void FaceDirection(Vector3 forward)
Parameters
forwardVector3Forward vector to face.
FacePoint(Vector3)
Rotates to face a world-space point.
public void FacePoint(Vector3 position)
Parameters
positionVector3World position to face.
RemoveSpeedControl(string)
Removes a speed control by its ID.
public void RemoveSpeedControl(string id)
Parameters
idstringThe ID of the speed control to remove.
SetDestination(Vector3)
Sets a new pathfinding destination in world space.
public void SetDestination(Vector3 position)
Parameters
positionVector3Target destination.
Stop()
Stops any active movement/pathing immediately.
public void Stop()
Warp(Vector3)
Instantly moves the NPC to the given world position.
public void Warp(Vector3 position)
Parameters
positionVector3Target position.