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

Flags an entity as obstructing movement for other units, and handles the processing of collision queries. More...

#include <ICmpObstruction.h>

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

Public Types

enum  EFoundationCheck {
  FOUNDATION_CHECK_SUCCESS , FOUNDATION_CHECK_FAIL_ERROR , FOUNDATION_CHECK_FAIL_NO_OBSTRUCTION , FOUNDATION_CHECK_FAIL_OBSTRUCTS_FOUNDATION ,
  FOUNDATION_CHECK_FAIL_TERRAIN_CLASS
}
 
enum  EObstructionType { STATIC , UNIT , CLUSTER }
 
- Public Types inherited from IComponent
using AllocFunc = IComponent *(*)(const ScriptInterface &scriptInterface, JS::HandleValue ctor)
 
using DeallocFunc = void(*)(IComponent *)
 

Public Member Functions

virtual ICmpObstructionManager::tag_t GetObstruction () const =0
 
virtual bool GetObstructionSquare (ICmpObstructionManager::ObstructionSquare &out) const =0
 Gets the square corresponding to this obstruction shape. More...
 
virtual bool GetPreviousObstructionSquare (ICmpObstructionManager::ObstructionSquare &out) const =0
 Same as the method above, but returns an obstruction shape for the previous turn. More...
 
virtual entity_pos_t GetSize () const =0
 
virtual CFixedVector2D GetStaticSize () const =0
 
virtual EObstructionType GetObstructionType () const =0
 
virtual void SetUnitClearance (const entity_pos_t &clearance)=0
 
virtual bool IsControlPersistent () const =0
 
virtual bool CheckShorePlacement () const =0
 Test whether the front of the obstruction square is in the water and the back is on the shore. More...
 
virtual EFoundationCheck CheckFoundation (const std::string &className) const =0
 Test whether this entity is colliding with any obstruction that are set to block the creation of foundations. More...
 
virtual EFoundationCheck CheckFoundation (const std::string &className, bool onlyCenterPoint) const =0
 
virtual std::string CheckFoundation_wrapper (const std::string &className, bool onlyCenterPoint) const
 CheckFoundation wrapper for script calls, to return friendly strings instead of an EFoundationCheck. More...
 
virtual bool CheckDuplicateFoundation () const =0
 Test whether this entity is colliding with any obstructions that share its control groups and block the creation of foundations. More...
 
virtual std::vector< entity_id_tGetEntitiesByFlags (ICmpObstructionManager::flags_t flags) const =0
 Returns a list of entities that have an obstruction matching the given flag and intersect the current obstruction. More...
 
virtual std::vector< entity_id_tGetEntitiesBlockingMovement () const =0
 Returns a list of entities that are blocking movement. More...
 
virtual std::vector< entity_id_tGetEntitiesBlockingConstruction () const =0
 Returns a list of entities that are blocking construction of a foundation. More...
 
virtual std::vector< entity_id_tGetEntitiesDeletedUponConstruction () const =0
 Returns a list of entities that shall be deleted when a construction on this obstruction starts, for example sheep carcasses. More...
 
virtual void ResolveFoundationCollisions () const =0
 Detects collisions between foundation-blocking entities and tries to fix them by setting control groups, if appropriate. More...
 
virtual void SetActive (bool active)=0
 
virtual void SetMovingFlag (bool enabled)=0
 
virtual void SetDisableBlockMovementPathfinding (bool movementDisabled, bool pathfindingDisabled, int32_t shape)=0
 
virtual bool GetBlockMovementFlag (bool templateOnly) const =0
 
virtual void SetControlGroup (entity_id_t group)=0
 Change the control group that the entity belongs to. More...
 
virtual entity_id_t GetControlGroup () const =0
 See SetControlGroup. More...
 
virtual void SetControlGroup2 (entity_id_t group2)=0
 
virtual entity_id_t GetControlGroup2 () const =0
 
- 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

- 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

Flags an entity as obstructing movement for other units, and handles the processing of collision queries.

Member Enumeration Documentation

◆ EFoundationCheck

Enumerator
FOUNDATION_CHECK_SUCCESS 
FOUNDATION_CHECK_FAIL_ERROR 
FOUNDATION_CHECK_FAIL_NO_OBSTRUCTION 
FOUNDATION_CHECK_FAIL_OBSTRUCTS_FOUNDATION 
FOUNDATION_CHECK_FAIL_TERRAIN_CLASS 

◆ EObstructionType

Enumerator
STATIC 
UNIT 
CLUSTER 

Member Function Documentation

◆ CheckDuplicateFoundation()

virtual bool ICmpObstruction::CheckDuplicateFoundation ( ) const
pure virtual

Test whether this entity is colliding with any obstructions that share its control groups and block the creation of foundations.

Returns
true if foundation is valid (not obstructed)

Implemented in CCmpObstruction.

◆ CheckFoundation() [1/2]

virtual EFoundationCheck ICmpObstruction::CheckFoundation ( const std::string &  className) const
pure virtual

Test whether this entity is colliding with any obstruction that are set to block the creation of foundations.

Parameters
ignoredEntitiesList of entities to ignore during the test.
Returns
FOUNDATION_CHECK_SUCCESS if check passes, else an EFoundationCheck value describing the type of failure.

Implemented in CCmpObstruction.

◆ CheckFoundation() [2/2]

virtual EFoundationCheck ICmpObstruction::CheckFoundation ( const std::string &  className,
bool  onlyCenterPoint 
) const
pure virtual

Implemented in CCmpObstruction.

◆ CheckFoundation_wrapper()

std::string ICmpObstruction::CheckFoundation_wrapper ( const std::string &  className,
bool  onlyCenterPoint 
) const
virtual

CheckFoundation wrapper for script calls, to return friendly strings instead of an EFoundationCheck.

Returns
"success" if check passes, else a string describing the type of failure.

◆ CheckShorePlacement()

virtual bool ICmpObstruction::CheckShorePlacement ( ) const
pure virtual

Test whether the front of the obstruction square is in the water and the back is on the shore.

Implemented in CCmpObstruction.

◆ GetBlockMovementFlag()

virtual bool ICmpObstruction::GetBlockMovementFlag ( bool  templateOnly) const
pure virtual
Parameters
templateOnly- whether to return the raw template value or the current value.

Implemented in CCmpObstruction.

◆ GetControlGroup()

virtual entity_id_t ICmpObstruction::GetControlGroup ( ) const
pure virtual

See SetControlGroup.

Implemented in CCmpObstruction.

◆ GetControlGroup2()

virtual entity_id_t ICmpObstruction::GetControlGroup2 ( ) const
pure virtual

Implemented in CCmpObstruction.

◆ GetEntitiesBlockingConstruction()

virtual std::vector< entity_id_t > ICmpObstruction::GetEntitiesBlockingConstruction ( ) const
pure virtual

Returns a list of entities that are blocking construction of a foundation.

Returns
vector of blocking entities

Implemented in CCmpObstruction.

◆ GetEntitiesBlockingMovement()

virtual std::vector< entity_id_t > ICmpObstruction::GetEntitiesBlockingMovement ( ) const
pure virtual

Returns a list of entities that are blocking movement.

Returns
vector of blocking entities

Implemented in CCmpObstruction.

◆ GetEntitiesByFlags()

virtual std::vector< entity_id_t > ICmpObstruction::GetEntitiesByFlags ( ICmpObstructionManager::flags_t  flags) const
pure virtual

Returns a list of entities that have an obstruction matching the given flag and intersect the current obstruction.

Returns
vector of blocking entities

Implemented in CCmpObstruction.

◆ GetEntitiesDeletedUponConstruction()

virtual std::vector< entity_id_t > ICmpObstruction::GetEntitiesDeletedUponConstruction ( ) const
pure virtual

Returns a list of entities that shall be deleted when a construction on this obstruction starts, for example sheep carcasses.

Implemented in CCmpObstruction.

◆ GetObstruction()

virtual ICmpObstructionManager::tag_t ICmpObstruction::GetObstruction ( ) const
pure virtual

Implemented in CCmpObstruction.

◆ GetObstructionSquare()

virtual bool ICmpObstruction::GetObstructionSquare ( ICmpObstructionManager::ObstructionSquare out) const
pure virtual

Gets the square corresponding to this obstruction shape.

Returns
true and updates out on success; false on failure (e.g. object not in the world).

Implemented in CCmpObstruction.

◆ GetObstructionType()

virtual EObstructionType ICmpObstruction::GetObstructionType ( ) const
pure virtual

Implemented in CCmpObstruction.

◆ GetPreviousObstructionSquare()

virtual bool ICmpObstruction::GetPreviousObstructionSquare ( ICmpObstructionManager::ObstructionSquare out) const
pure virtual

Same as the method above, but returns an obstruction shape for the previous turn.

Implemented in CCmpObstruction.

◆ GetSize()

virtual entity_pos_t ICmpObstruction::GetSize ( ) const
pure virtual
Returns
the size of the obstruction (either the clearance or a circumscribed circle).

Implemented in CCmpObstruction.

◆ GetStaticSize()

virtual CFixedVector2D ICmpObstruction::GetStaticSize ( ) const
pure virtual
Returns
the size of the static obstruction or (0,0) for a unit shape.

Implemented in CCmpObstruction.

◆ IsControlPersistent()

virtual bool ICmpObstruction::IsControlPersistent ( ) const
pure virtual

Implemented in CCmpObstruction.

◆ ResolveFoundationCollisions()

virtual void ICmpObstruction::ResolveFoundationCollisions ( ) const
pure virtual

Detects collisions between foundation-blocking entities and tries to fix them by setting control groups, if appropriate.

Implemented in CCmpObstruction.

◆ SetActive()

virtual void ICmpObstruction::SetActive ( bool  active)
pure virtual

Implemented in CCmpObstruction.

◆ SetControlGroup()

virtual void ICmpObstruction::SetControlGroup ( entity_id_t  group)
pure virtual

Change the control group that the entity belongs to.

Control groups are used to let units ignore collisions with other units from the same group. Default is the entity's own ID.

Implemented in CCmpObstruction.

◆ SetControlGroup2()

virtual void ICmpObstruction::SetControlGroup2 ( entity_id_t  group2)
pure virtual

Implemented in CCmpObstruction.

◆ SetDisableBlockMovementPathfinding()

virtual void ICmpObstruction::SetDisableBlockMovementPathfinding ( bool  movementDisabled,
bool  pathfindingDisabled,
int32_t  shape 
)
pure virtual

Implemented in CCmpObstruction.

◆ SetMovingFlag()

virtual void ICmpObstruction::SetMovingFlag ( bool  enabled)
pure virtual

Implemented in CCmpObstruction.

◆ SetUnitClearance()

virtual void ICmpObstruction::SetUnitClearance ( const entity_pos_t clearance)
pure virtual

Implemented in CCmpObstruction.


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