Class EntityControls
- Namespace
- Vintagestory.API.Common
- Assembly
- VintagestoryAPI.dll
The available controls to move around a character in a game world
public class EntityControls
- Inheritance
-
EntityControls
- Inherited Members
- Extension Methods
Fields
DetachedMode
If true, the entity is either flying, gliding or swimming.
public bool DetachedMode
Field Value
Dirty
Whether or not this entity is dirty.
public bool Dirty
Field Value
FlyPlaneLock
the axis lock for the fly plane.
public EnumFreeMovAxisLock FlyPlaneLock
Field Value
FlyVector
Current flying direction
public Vec3d FlyVector
Field Value
GlideSpeed
public double GlideSpeed
Field Value
HandUse
If the player is currently using the currently held item in a special way (e.g. attacking with smithing hammer or eating an edible item)
public EnumHandInteract HandUse
Field Value
HandUsingBlockSel
The block pos the player started using
public BlockSelection HandUsingBlockSel
Field Value
IsAiming
Whether or not the entity is aiming
public bool IsAiming
Field Value
IsClimbing
Whether or not the entity is climbing
public bool IsClimbing
Field Value
IsFlying
Whether or not the entity is flying.
public bool IsFlying
Field Value
IsStepping
Whether or not the entity is currently stepping up a block
public bool IsStepping
Field Value
LeftUsingHeldItemTransformBefore
public ModelTransform LeftUsingHeldItemTransformBefore
Field Value
MovespeedMultiplier
The movement speed multiplier.
public float MovespeedMultiplier
Field Value
NoClip
If true, the entity has NoClip active.
public bool NoClip
Field Value
OnAction
To execute a call handler registered by the engine. Don't use this one, use api.Input.InWorldAction instead.
public OnEntityAction OnAction
Field Value
UsingBeginMS
public long UsingBeginMS
Field Value
UsingCount
public int UsingCount
Field Value
UsingHeldItemTransformAfter
[Obsolete("Setting this value has no effect anymore. Add an animation to the seraph instead")]
public ModelTransform UsingHeldItemTransformAfter
Field Value
UsingHeldItemTransformBefore
[Obsolete("Setting this value has no effect anymore. Add an animation to the seraph instead")]
public ModelTransform UsingHeldItemTransformBefore
Field Value
WalkVector
Current walking direction.
public Vec3d WalkVector
Field Value
Properties
Backward
A check for if the entity is moving the opposite direction it's facing.
public virtual bool Backward { get; set; }
Property Value
CtrlKey
A check to see if the entity is holding down the Ctrl key (which may be the same as the Sprint key or one or other may have been remapped).
Should normally be used in conjunction with a mouse button, including OnHeldInteractStart() methods etc
public virtual bool CtrlKey { get; set; }
Property Value
Down
A check to see whether the entity is moving down.
public virtual bool Down { get; set; }
Property Value
Flags
public bool[] Flags { get; }
Property Value
- bool[]
FloorSitting
A check to see whether the entity is sitting on the floor.
public virtual bool FloorSitting { get; set; }
Property Value
Forward
A check for if the entity is moving in the direction it's facing.
public virtual bool Forward { get; set; }
Property Value
Gliding
A check to see whether the entity is gliding
public virtual bool Gliding { get; set; }
Property Value
this[EnumEntityAction]
public virtual bool this[EnumEntityAction action] { get; set; }
Parameters
action
EnumEntityAction
Property Value
Jump
A check whether to see if the entity is jumping.
public virtual bool Jump { get; set; }
Property Value
Left
A check to see if the entity is moving left the direction it's facing.
public virtual bool Left { get; set; }
Property Value
LeftMouseDown
A check to see if the entity is holding the in-world rleft mouse button down.
public virtual bool LeftMouseDown { get; set; }
Property Value
Right
A check to see if the entity is moving right the direction it's facing.
public virtual bool Right { get; set; }
Property Value
RightMouseDown
A check to see if the entity is holding the in-world right mouse button down.
public virtual bool RightMouseDown { get; set; }
Property Value
ShiftKey
A check to see if the entity is holding down the Shift key (which may be the same as the Sneak key or one or other may have been remapped).
Should normally be used in conjunction with a mouse button, including OnHeldInteractStart() methods etc
public virtual bool ShiftKey { get; set; }
Property Value
Sneak
A check whether to see if the entity is sneaking. Use Controls.ShiftKey instead for mouse interaction modifiers, as it is a separable control.
A test for Sneak should be used only when we want to know whether the entity is crouching or using Sneak motion, which affects things like whether it is detectable by other entities, seen on the map, or how the shield is used
public virtual bool Sneak { get; set; }
Property Value
Sprint
A check to see whether the entity is sprinting. Use Controls.CtrlKey instead for mouse interaction modifiers, as it is a separable control.
A test for Sprint should be used only when we want to know whether the entity is sprinting.
public virtual bool Sprint { get; set; }
Property Value
TriesToMove
Checks to see if the entity is attempting to move in any direction (excluding jumping)
public bool TriesToMove { get; }
Property Value
Up
A check to see whether the entity is moving up.
public virtual bool Up { get; set; }
Property Value
Methods
AttemptToggleAction(EnumEntityAction, bool)
protected virtual void AttemptToggleAction(EnumEntityAction action, bool on)
Parameters
action
EnumEntityActionon
bool
CalcMovementVectors(EntityPos, float)
Calculates the movement vectors for the player.
public virtual void CalcMovementVectors(EntityPos pos, float dt)
Parameters
FromBytes(BinaryReader, bool)
public virtual void FromBytes(BinaryReader reader, bool ignoreData)
Parameters
reader
BinaryReaderignoreData
bool
FromInt(int)
Converts the int flags to movement controls.
public virtual void FromInt(int flagsInt)
Parameters
flagsInt
intThe compressed integer.
SetFrom(EntityControls)
Copies the controls from the provided controls to this set of controls.
public virtual void SetFrom(EntityControls controls)
Parameters
controls
EntityControlsThe controls to copy over.
StopAllMovement()
Forces the entity to stop all movements, resets all flags to false
public virtual void StopAllMovement()
ToBytes(BinaryWriter)
public virtual void ToBytes(BinaryWriter writer)
Parameters
writer
BinaryWriter
ToInt()
Converts the values to a single int flag.
public virtual int ToInt()
Returns
- int
the compressed integer.
UpdateFromPacket(bool, int)
Updates the data from the packet.
public virtual void UpdateFromPacket(bool pressed, int action)