Pyrogenesis  trunk
Public Member Functions | List of all members
ICmpUnitMotion Class Referenceabstract

Motion interface for entities with complex movement capabilities. More...

#include <ICmpUnitMotion.h>

Inheritance diagram for ICmpUnitMotion:
Inheritance graph
[legend]
Collaboration diagram for ICmpUnitMotion:
Collaboration graph
[legend]

Public Member Functions

virtual bool MoveToPointRange (entity_pos_t x, entity_pos_t z, entity_pos_t minRange, entity_pos_t maxRange)=0
 Attempt to walk into range of a to a given point, or as close as possible. More...
 
virtual bool MoveToTargetRange (entity_id_t target, entity_pos_t minRange, entity_pos_t maxRange)=0
 Attempt to walk into range of a given target entity, or as close as possible. More...
 
virtual void MoveToFormationOffset (entity_id_t controller, entity_pos_t x, entity_pos_t z)=0
 Join a formation, and move towards a given offset relative to the formation controller entity. More...
 
virtual void SetMemberOfFormation (entity_id_t controller)=0
 Set/unset the unit as a formation member. More...
 
virtual bool IsTargetRangeReachable (entity_id_t target, entity_pos_t minRange, entity_pos_t maxRange)=0
 Check if the target is reachable. More...
 
virtual void FaceTowardsPoint (entity_pos_t x, entity_pos_t z)=0
 Turn to look towards the given point. More...
 
virtual void StopMoving ()=0
 Stop moving immediately. More...
 
virtual fixed GetCurrentSpeed () const =0
 Get the speed at the end of the current turn. More...
 
virtual bool IsMoveRequested () const =0
 
virtual fixed GetWalkSpeed () const =0
 Get the unit template walk speed after modifications. More...
 
virtual fixed GetRunMultiplier () const =0
 Get the unit template running (i.e. More...
 
virtual fixed GetSpeedMultiplier () const =0
 Returns the ratio of GetSpeed() / GetWalkSpeed(). More...
 
virtual void SetSpeedMultiplier (fixed multiplier)=0
 Set the current movement speed. More...
 
virtual fixed GetSpeed () const =0
 Get the speed at which the unit intends to move. More...
 
virtual CFixedVector2D EstimateFuturePosition (const fixed dt) const =0
 
virtual fixed GetAcceleration () const =0
 Get the current acceleration. More...
 
virtual void SetAcceleration (fixed acceleration)=0
 Set the current acceleration. More...
 
virtual void SetFacePointAfterMove (bool facePointAfterMove)=0
 Set whether the unit will turn to face the target point after finishing moving. More...
 
virtual bool GetFacePointAfterMove () const =0
 
virtual pass_class_t GetPassabilityClass () const =0
 Get the unit's passability class. More...
 
virtual std::string GetPassabilityClassName () const =0
 Get the passability class name (as defined in pathfinder.xml) More...
 
virtual void SetPassabilityClassName (const std::string &passClassName)=0
 Sets the passability class name (as defined in pathfinder.xml) More...
 
virtual entity_pos_t GetUnitClearance () const =0
 Get the unit clearance (used by the Obstruction component) More...
 
virtual void SetDebugOverlay (bool enabled)=0
 Toggle the rendering of debug info. More...
 
- Public Member Functions inherited from IComponent
virtual ~IComponent ()
 
virtual void Init (const CParamNode &paramNode)=0
 
virtual void Deinit ()=0
 
virtual void HandleMessage (const CMessage &msg, bool global)
 
CEntityHandle GetEntityHandle () const
 
void SetEntityHandle (CEntityHandle ent)
 
entity_id_t GetEntityId () const
 
CEntityHandle GetSystemEntity () const
 
const CSimContextGetSimContext () const
 
void SetSimContext (const CSimContext &context)
 
virtual void Serialize (ISerializer &serialize)=0
 
virtual void Deserialize (const CParamNode &paramNode, IDeserializer &deserialize)=0
 
virtual bool NewJSObject (const ScriptInterface &scriptInterface, JS::MutableHandleObject out) const
 Returns false by default, indicating that a scripted wrapper of this IComponent is not supported. More...
 
virtual JS::Value GetJSInstance () const
 
virtual int GetComponentTypeId () const =0
 

Additional Inherited Members

- Public Types inherited from IComponent
using AllocFunc = IComponent *(*)(const ScriptInterface &scriptInterface, JS::HandleValue ctor)
 
using DeallocFunc = void(*)(IComponent *)
 
- Static Public Member Functions inherited from IComponent
static std::string GetSchema ()
 
static void RegisterComponentType (CComponentManager &mgr, EInterfaceId iid, EComponentTypeId cid, AllocFunc alloc, DeallocFunc dealloc, const char *name, const std::string &schema)
 
static void RegisterComponentTypeScriptWrapper (CComponentManager &mgr, EInterfaceId iid, EComponentTypeId cid, AllocFunc alloc, DeallocFunc dealloc, const char *name, const std::string &schema)
 
static u8 GetSerializationVersion ()
 

Detailed Description

Motion interface for entities with complex movement capabilities.

(Simpler motion is handled by ICmpMotion instead.)

It should eventually support different movement speeds, moving to areas instead of points, moving as part of a group, moving as part of a formation, etc.

Member Function Documentation

◆ EstimateFuturePosition()

virtual CFixedVector2D ICmpUnitMotion::EstimateFuturePosition ( const fixed  dt) const
pure virtual
Returns
the estimated position of the unit in
Parameters
dtseconds, following current paths. This is allowed to 'look into the future'.

Implemented in CCmpUnitMotion, and CCmpUnitMotionScripted.

◆ FaceTowardsPoint()

virtual void ICmpUnitMotion::FaceTowardsPoint ( entity_pos_t  x,
entity_pos_t  z 
)
pure virtual

Turn to look towards the given point.

Implemented in CCmpUnitMotion, and CCmpUnitMotionScripted.

◆ GetAcceleration()

virtual fixed ICmpUnitMotion::GetAcceleration ( ) const
pure virtual

Get the current acceleration.

Implemented in CCmpUnitMotion, and CCmpUnitMotionScripted.

◆ GetCurrentSpeed()

virtual fixed ICmpUnitMotion::GetCurrentSpeed ( ) const
pure virtual

Get the speed at the end of the current turn.

Implemented in CCmpUnitMotion, and CCmpUnitMotionScripted.

◆ GetFacePointAfterMove()

virtual bool ICmpUnitMotion::GetFacePointAfterMove ( ) const
pure virtual

Implemented in CCmpUnitMotion, and CCmpUnitMotionScripted.

◆ GetPassabilityClass()

virtual pass_class_t ICmpUnitMotion::GetPassabilityClass ( ) const
pure virtual

Get the unit's passability class.

Implemented in CCmpUnitMotion, and CCmpUnitMotionScripted.

◆ GetPassabilityClassName()

virtual std::string ICmpUnitMotion::GetPassabilityClassName ( ) const
pure virtual

Get the passability class name (as defined in pathfinder.xml)

Implemented in CCmpUnitMotion, and CCmpUnitMotionScripted.

◆ GetRunMultiplier()

virtual fixed ICmpUnitMotion::GetRunMultiplier ( ) const
pure virtual

Get the unit template running (i.e.

max) speed after modifications.

Implemented in CCmpUnitMotion, and CCmpUnitMotionScripted.

◆ GetSpeed()

virtual fixed ICmpUnitMotion::GetSpeed ( ) const
pure virtual

Get the speed at which the unit intends to move.

(regardless of whether the unit is moving or not right now).

Implemented in CCmpUnitMotion, and CCmpUnitMotionScripted.

◆ GetSpeedMultiplier()

virtual fixed ICmpUnitMotion::GetSpeedMultiplier ( ) const
pure virtual

Returns the ratio of GetSpeed() / GetWalkSpeed().

Implemented in CCmpUnitMotion, and CCmpUnitMotionScripted.

◆ GetUnitClearance()

virtual entity_pos_t ICmpUnitMotion::GetUnitClearance ( ) const
pure virtual

Get the unit clearance (used by the Obstruction component)

Implemented in CCmpUnitMotion, and CCmpUnitMotionScripted.

◆ GetWalkSpeed()

virtual fixed ICmpUnitMotion::GetWalkSpeed ( ) const
pure virtual

Get the unit template walk speed after modifications.

Implemented in CCmpUnitMotion, and CCmpUnitMotionScripted.

◆ IsMoveRequested()

virtual bool ICmpUnitMotion::IsMoveRequested ( ) const
pure virtual
Returns
true if the unit has a destination.

Implemented in CCmpUnitMotion, and CCmpUnitMotionScripted.

◆ IsTargetRangeReachable()

virtual bool ICmpUnitMotion::IsTargetRangeReachable ( entity_id_t  target,
entity_pos_t  minRange,
entity_pos_t  maxRange 
)
pure virtual

Check if the target is reachable.

Don't take this as absolute gospel since there are things that the pathfinder may not detect, such as entity obstructions in the way, but in general it should return satisfactory results. The interface is similar to MoveToTargetRange but the move is not attempted.

Returns
true if the target is assumed reachable, false otherwise.

Implemented in CCmpUnitMotion, and CCmpUnitMotionScripted.

◆ MoveToFormationOffset()

virtual void ICmpUnitMotion::MoveToFormationOffset ( entity_id_t  controller,
entity_pos_t  x,
entity_pos_t  z 
)
pure virtual

Join a formation, and move towards a given offset relative to the formation controller entity.

The unit will remain 'in formation' fromthe perspective of UnitMotion until SetMemberOfFormation(INVALID_ENTITY) is passed.

Implemented in CCmpUnitMotion, and CCmpUnitMotionScripted.

◆ MoveToPointRange()

virtual bool ICmpUnitMotion::MoveToPointRange ( entity_pos_t  x,
entity_pos_t  z,
entity_pos_t  minRange,
entity_pos_t  maxRange 
)
pure virtual

Attempt to walk into range of a to a given point, or as close as possible.

The range is measured from the center of the unit. If cannot move anywhere at all, or if there is some other error, then returns false. Otherwise, returns true. If maxRange is negative, then the maximum range is treated as infinity.

Implemented in CCmpUnitMotion, and CCmpUnitMotionScripted.

◆ MoveToTargetRange()

virtual bool ICmpUnitMotion::MoveToTargetRange ( entity_id_t  target,
entity_pos_t  minRange,
entity_pos_t  maxRange 
)
pure virtual

Attempt to walk into range of a given target entity, or as close as possible.

The range is measured between approximately the edges of the unit and the target, so that maxRange=0 is not unreachably close to the target. If the unit cannot move anywhere at all, or if there is some other error, then returns false. Otherwise, returns true. If maxRange is negative, then the maximum range is treated as infinity.

Implemented in CCmpUnitMotion, and CCmpUnitMotionScripted.

◆ SetAcceleration()

virtual void ICmpUnitMotion::SetAcceleration ( fixed  acceleration)
pure virtual

Set the current acceleration.

Parameters
accelerationThe acceleration.

Implemented in CCmpUnitMotion, and CCmpUnitMotionScripted.

◆ SetDebugOverlay()

virtual void ICmpUnitMotion::SetDebugOverlay ( bool  enabled)
pure virtual

Toggle the rendering of debug info.

Implemented in CCmpUnitMotion, and CCmpUnitMotionScripted.

◆ SetFacePointAfterMove()

virtual void ICmpUnitMotion::SetFacePointAfterMove ( bool  facePointAfterMove)
pure virtual

Set whether the unit will turn to face the target point after finishing moving.

Implemented in CCmpUnitMotion, and CCmpUnitMotionScripted.

◆ SetMemberOfFormation()

virtual void ICmpUnitMotion::SetMemberOfFormation ( entity_id_t  controller)
pure virtual

Set/unset the unit as a formation member.

Parameters
controller- if INVALID_ENTITY, the unit is no longer a formation member. Otherwise it is and this is the controller.

Implemented in CCmpUnitMotion, and CCmpUnitMotionScripted.

◆ SetPassabilityClassName()

virtual void ICmpUnitMotion::SetPassabilityClassName ( const std::string &  passClassName)
pure virtual

Sets the passability class name (as defined in pathfinder.xml)

Implemented in CCmpUnitMotion, and CCmpUnitMotionScripted.

◆ SetSpeedMultiplier()

virtual void ICmpUnitMotion::SetSpeedMultiplier ( fixed  multiplier)
pure virtual

Set the current movement speed.

Parameters
speedA multiplier of GetWalkSpeed().

Implemented in CCmpUnitMotion, and CCmpUnitMotionScripted.

◆ StopMoving()

virtual void ICmpUnitMotion::StopMoving ( )
pure virtual

Stop moving immediately.

Implemented in CCmpUnitMotion, and CCmpUnitMotionScripted.


The documentation for this class was generated from the following file: