Pyrogenesis  trunk
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
CCmpUnitMotionScripted Class Reference
Inheritance diagram for CCmpUnitMotionScripted:
Inheritance graph
[legend]
Collaboration diagram for CCmpUnitMotionScripted:
Collaboration graph
[legend]

Public Member Functions

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

Static Public Member Functions

static void ClassInit (CComponentManager &componentManager)
 
static IComponentAllocate (const ScriptInterface &scriptInterface, JS::HandleValue instance)
 
static void Deallocate (IComponent *cmp)
 
static std::string GetSchema ()
 
- 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 ()
 

Private Attributes

CComponentTypeScript m_Script
 

Additional Inherited Members

- Public Types inherited from IComponent
using AllocFunc = IComponent *(*)(const ScriptInterface &scriptInterface, JS::HandleValue ctor)
 
using DeallocFunc = void(*)(IComponent *)
 

Constructor & Destructor Documentation

◆ CCmpUnitMotionScripted()

CCmpUnitMotionScripted::CCmpUnitMotionScripted ( const ScriptInterface scriptInterface,
JS::HandleValue  instance 
)
inline

Member Function Documentation

◆ Allocate()

static IComponent* CCmpUnitMotionScripted::Allocate ( const ScriptInterface scriptInterface,
JS::HandleValue  instance 
)
inlinestatic

◆ ClassInit()

static void CCmpUnitMotionScripted::ClassInit ( CComponentManager componentManager)
inlinestatic

◆ Deallocate()

static void CCmpUnitMotionScripted::Deallocate ( IComponent cmp)
inlinestatic

◆ Deinit()

void CCmpUnitMotionScripted::Deinit ( )
inlineoverridevirtual

Implements IComponent.

◆ Deserialize()

void CCmpUnitMotionScripted::Deserialize ( const CParamNode paramNode,
IDeserializer deserialize 
)
inlineoverridevirtual

Implements IComponent.

◆ EstimateFuturePosition()

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

Implements ICmpUnitMotion.

◆ FaceTowardsPoint()

void CCmpUnitMotionScripted::FaceTowardsPoint ( entity_pos_t  x,
entity_pos_t  z 
)
inlineoverridevirtual

Turn to look towards the given point.

Implements ICmpUnitMotion.

◆ GetAcceleration()

fixed CCmpUnitMotionScripted::GetAcceleration ( ) const
inlineoverridevirtual

Get the current acceleration.

Implements ICmpUnitMotion.

◆ GetComponentTypeId()

int CCmpUnitMotionScripted::GetComponentTypeId ( ) const
inlineoverridevirtual

Implements IComponent.

◆ GetCurrentSpeed()

fixed CCmpUnitMotionScripted::GetCurrentSpeed ( ) const
inlineoverridevirtual

Get the speed at the end of the current turn.

Implements ICmpUnitMotion.

◆ GetFacePointAfterMove()

bool CCmpUnitMotionScripted::GetFacePointAfterMove ( ) const
inlineoverridevirtual

Implements ICmpUnitMotion.

◆ GetJSInstance()

JS::Value CCmpUnitMotionScripted::GetJSInstance ( ) const
inlineoverridevirtual

Reimplemented from IComponent.

◆ GetPassabilityClass()

pass_class_t CCmpUnitMotionScripted::GetPassabilityClass ( ) const
inlineoverridevirtual

Get the unit's passability class.

Implements ICmpUnitMotion.

◆ GetPassabilityClassName()

std::string CCmpUnitMotionScripted::GetPassabilityClassName ( ) const
inlineoverridevirtual

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

Implements ICmpUnitMotion.

◆ GetRunMultiplier()

fixed CCmpUnitMotionScripted::GetRunMultiplier ( ) const
inlineoverridevirtual

Get the unit template running (i.e.

max) speed after modifications.

Implements ICmpUnitMotion.

◆ GetSchema()

static std::string CCmpUnitMotionScripted::GetSchema ( )
inlinestatic

◆ GetSpeed()

fixed CCmpUnitMotionScripted::GetSpeed ( ) const
inlineoverridevirtual

Get the speed at which the unit intends to move.

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

Implements ICmpUnitMotion.

◆ GetSpeedMultiplier()

fixed CCmpUnitMotionScripted::GetSpeedMultiplier ( ) const
inlineoverridevirtual

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

Implements ICmpUnitMotion.

◆ GetUnitClearance()

entity_pos_t CCmpUnitMotionScripted::GetUnitClearance ( ) const
inlineoverridevirtual

Get the unit clearance (used by the Obstruction component)

Implements ICmpUnitMotion.

◆ GetWalkSpeed()

fixed CCmpUnitMotionScripted::GetWalkSpeed ( ) const
inlineoverridevirtual

Get the unit template walk speed after modifications.

Implements ICmpUnitMotion.

◆ HandleMessage()

void CCmpUnitMotionScripted::HandleMessage ( const CMessage msg,
bool  global 
)
inlineoverridevirtual

Reimplemented from IComponent.

◆ Init()

void CCmpUnitMotionScripted::Init ( const CParamNode paramNode)
inlineoverridevirtual

Implements IComponent.

◆ IsMoveRequested()

bool CCmpUnitMotionScripted::IsMoveRequested ( ) const
inlineoverridevirtual
Returns
true if the unit has a destination.

Implements ICmpUnitMotion.

◆ IsTargetRangeReachable()

bool CCmpUnitMotionScripted::IsTargetRangeReachable ( entity_id_t  target,
entity_pos_t  minRange,
entity_pos_t  maxRange 
)
inlineoverridevirtual

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.

Implements ICmpUnitMotion.

◆ MoveToFormationOffset()

void CCmpUnitMotionScripted::MoveToFormationOffset ( entity_id_t  controller,
entity_pos_t  x,
entity_pos_t  z 
)
inlineoverridevirtual

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.

Implements ICmpUnitMotion.

◆ MoveToPointRange()

bool CCmpUnitMotionScripted::MoveToPointRange ( entity_pos_t  x,
entity_pos_t  z,
entity_pos_t  minRange,
entity_pos_t  maxRange 
)
inlineoverridevirtual

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.

Implements ICmpUnitMotion.

◆ MoveToTargetRange()

bool CCmpUnitMotionScripted::MoveToTargetRange ( entity_id_t  target,
entity_pos_t  minRange,
entity_pos_t  maxRange 
)
inlineoverridevirtual

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.

Implements ICmpUnitMotion.

◆ Serialize()

void CCmpUnitMotionScripted::Serialize ( ISerializer serialize)
inlineoverridevirtual

Implements IComponent.

◆ SetAcceleration()

void CCmpUnitMotionScripted::SetAcceleration ( fixed  acceleration)
inlineoverridevirtual

Set the current acceleration.

Parameters
accelerationThe acceleration.

Implements ICmpUnitMotion.

◆ SetDebugOverlay()

void CCmpUnitMotionScripted::SetDebugOverlay ( bool  enabled)
inlineoverridevirtual

Toggle the rendering of debug info.

Implements ICmpUnitMotion.

◆ SetFacePointAfterMove()

void CCmpUnitMotionScripted::SetFacePointAfterMove ( bool  facePointAfterMove)
inlineoverridevirtual

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

Implements ICmpUnitMotion.

◆ SetMemberOfFormation()

void CCmpUnitMotionScripted::SetMemberOfFormation ( entity_id_t  controller)
inlineoverridevirtual

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.

Implements ICmpUnitMotion.

◆ SetPassabilityClassName()

void CCmpUnitMotionScripted::SetPassabilityClassName ( const std::string &  passClassName)
inlineoverridevirtual

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

Implements ICmpUnitMotion.

◆ SetSpeedMultiplier()

void CCmpUnitMotionScripted::SetSpeedMultiplier ( fixed  multiplier)
inlineoverridevirtual

Set the current movement speed.

Parameters
speedA multiplier of GetWalkSpeed().

Implements ICmpUnitMotion.

◆ StopMoving()

void CCmpUnitMotionScripted::StopMoving ( )
inlineoverridevirtual

Stop moving immediately.

Implements ICmpUnitMotion.

Member Data Documentation

◆ m_Script

CComponentTypeScript CCmpUnitMotionScripted::m_Script
private

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