Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
|
Obstruction implementation. More...
Classes | |
struct | Shape |
Public Types | |
typedef ICmpObstructionManager::tag_t | tag_t |
typedef ICmpObstructionManager::flags_t | flags_t |
Public Types inherited from ICmpObstruction | |
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 | |
int | GetComponentTypeId () const override |
void | Init (const CParamNode ¶mNode) override |
void | Deinit () override |
template<typename S > | |
void | SerializeCommon (S &serialize) |
void | Serialize (ISerializer &serialize) override |
void | Deserialize (const CParamNode ¶mNode, IDeserializer &deserialize) override |
void | HandleMessage (const CMessage &msg, bool global) override |
void | SetActive (bool active) override |
void | SetDisableBlockMovementPathfinding (bool movementDisabled, bool pathfindingDisabled, int32_t shape) override |
bool | GetBlockMovementFlag (bool templateOnly) const override |
EObstructionType | GetObstructionType () const override |
ICmpObstructionManager::tag_t | GetObstruction () const override |
bool | GetPreviousObstructionSquare (ICmpObstructionManager::ObstructionSquare &out) const override |
Same as the method above, but returns an obstruction shape for the previous turn. More... | |
bool | GetObstructionSquare (ICmpObstructionManager::ObstructionSquare &out) const override |
Gets the square corresponding to this obstruction shape. More... | |
virtual bool | GetObstructionSquare (ICmpObstructionManager::ObstructionSquare &out, bool previousPosition) const |
entity_pos_t | GetSize () const override |
CFixedVector2D | GetStaticSize () const override |
void | SetUnitClearance (const entity_pos_t &clearance) override |
bool | IsControlPersistent () const override |
bool | CheckShorePlacement () const override |
Test whether the front of the obstruction square is in the water and the back is on the shore. More... | |
EFoundationCheck | CheckFoundation (const std::string &className) const override |
Test whether this entity is colliding with any obstruction that are set to block the creation of foundations. More... | |
EFoundationCheck | CheckFoundation (const std::string &className, bool onlyCenterPoint) const override |
bool | CheckDuplicateFoundation () const override |
Test whether this entity is colliding with any obstructions that share its control groups and block the creation of foundations. More... | |
std::vector< entity_id_t > | GetEntitiesByFlags (flags_t flags) const override |
Returns a list of entities that have an obstruction matching the given flag and intersect the current obstruction. More... | |
std::vector< entity_id_t > | GetEntitiesBlockingMovement () const override |
Returns a list of entities that are blocking movement. More... | |
std::vector< entity_id_t > | GetEntitiesBlockingConstruction () const override |
Returns a list of entities that are blocking construction of a foundation. More... | |
std::vector< entity_id_t > | GetEntitiesDeletedUponConstruction () const override |
Returns a list of entities that shall be deleted when a construction on this obstruction starts, for example sheep carcasses. More... | |
void | SetMovingFlag (bool enabled) override |
void | SetControlGroup (entity_id_t group) override |
Change the control group that the entity belongs to. More... | |
void | SetControlGroup2 (entity_id_t group2) override |
entity_id_t | GetControlGroup () const override |
See SetControlGroup. More... | |
entity_id_t | GetControlGroup2 () const override |
void | UpdateControlGroups () |
void | ResolveFoundationCollisions () const override |
Detects collisions between foundation-blocking entities and tries to fix them by setting control groups, if appropriate. More... | |
Public Member Functions inherited from ICmpObstruction | |
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_t > | GetEntitiesByFlags (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_t > | GetEntitiesBlockingMovement () const =0 |
Returns a list of entities that are blocking movement. More... | |
virtual std::vector< entity_id_t > | GetEntitiesBlockingConstruction () const =0 |
Returns a list of entities that are blocking construction of a foundation. More... | |
virtual std::vector< entity_id_t > | GetEntitiesDeletedUponConstruction () 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 ¶mNode)=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 CSimContext & | GetSimContext () const |
void | SetSimContext (const CSimContext &context) |
virtual void | Serialize (ISerializer &serialize)=0 |
virtual void | Deserialize (const CParamNode ¶mNode, 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 |
Static Public Member Functions | |
static void | ClassInit (CComponentManager &componentManager) |
static IComponent * | Allocate (const ScriptInterface &, JS::HandleValue) |
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 () |
Public Attributes | |
EObstructionType | m_Type |
entity_pos_t | m_Size0 |
entity_pos_t | m_Size1 |
flags_t | m_TemplateFlags |
entity_pos_t | m_Clearance |
std::vector< Shape > | m_Shapes |
bool | m_Active |
Whether the obstruction is actively obstructing or just an inactive placeholder. More... | |
bool | m_Moving |
Whether the entity associated with this obstruction is currently moving. More... | |
bool | m_ControlPersist |
Whether an obstruction's control group should be kept consistent and used to set control groups for entities that collide with it. More... | |
bool | m_IsDestroyed = false |
entity_id_t | m_ControlGroup |
Primary control group identifier. More... | |
entity_id_t | m_ControlGroup2 |
Optional secondary control group identifier. More... | |
tag_t | m_Tag |
Identifier of this entity's obstruction shape, as registered in the obstruction manager. More... | |
std::vector< tag_t > | m_ClusterTags |
flags_t | m_Flags |
Set of flags affecting the behaviour of this entity's obstruction shape. More... | |
Protected Member Functions | |
void | AddClusterShapes (entity_pos_t x, entity_pos_t z, entity_angle_t a) |
void | RemoveClusterShapes () |
Obstruction implementation.
This keeps the ICmpPathfinder's model of the world updated when the entities move and die, with shapes derived from ICmpFootprint.
|
inlineprotected |
|
inlinestatic |
|
inlineoverridevirtual |
Test whether this entity is colliding with any obstructions that share its control groups and block the creation of foundations.
Implements ICmpObstruction.
|
inlineoverridevirtual |
Test whether this entity is colliding with any obstruction that are set to block the creation of foundations.
ignoredEntities | List of entities to ignore during the test. |
Implements ICmpObstruction.
|
inlineoverridevirtual |
Implements ICmpObstruction.
|
inlineoverridevirtual |
Test whether the front of the obstruction square is in the water and the back is on the shore.
Implements ICmpObstruction.
|
inlinestatic |
|
inlinestatic |
|
inlineoverridevirtual |
Implements IComponent.
|
inlineoverridevirtual |
Implements IComponent.
|
inlineoverridevirtual |
templateOnly | - whether to return the raw template value or the current value. |
Implements ICmpObstruction.
|
inlineoverridevirtual |
Implements IComponent.
|
inlineoverridevirtual |
See SetControlGroup.
Implements ICmpObstruction.
|
inlineoverridevirtual |
Implements ICmpObstruction.
|
inlineoverridevirtual |
Returns a list of entities that are blocking construction of a foundation.
Implements ICmpObstruction.
|
inlineoverridevirtual |
Returns a list of entities that are blocking movement.
Implements ICmpObstruction.
|
inlineoverridevirtual |
Returns a list of entities that have an obstruction matching the given flag and intersect the current obstruction.
Implements ICmpObstruction.
|
inlineoverridevirtual |
Returns a list of entities that shall be deleted when a construction on this obstruction starts, for example sheep carcasses.
Implements ICmpObstruction.
|
inlineoverridevirtual |
Implements ICmpObstruction.
|
inlineoverridevirtual |
Gets the square corresponding to this obstruction shape.
out
on success; false on failure (e.g. object not in the world). Implements ICmpObstruction.
|
inlinevirtual |
|
inlineoverridevirtual |
Implements ICmpObstruction.
|
inlineoverridevirtual |
Same as the method above, but returns an obstruction shape for the previous turn.
Implements ICmpObstruction.
|
inlinestatic |
|
inlineoverridevirtual |
Implements ICmpObstruction.
|
inlineoverridevirtual |
Implements ICmpObstruction.
|
inlineoverridevirtual |
Reimplemented from IComponent.
|
inlineoverridevirtual |
Implements IComponent.
|
inlineoverridevirtual |
Implements ICmpObstruction.
|
inlineprotected |
|
inlineoverridevirtual |
Detects collisions between foundation-blocking entities and tries to fix them by setting control groups, if appropriate.
Implements ICmpObstruction.
|
inlineoverridevirtual |
Implements IComponent.
|
inline |
|
inlineoverridevirtual |
Implements ICmpObstruction.
|
inlineoverridevirtual |
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.
Implements ICmpObstruction.
|
inlineoverridevirtual |
Implements ICmpObstruction.
|
inlineoverridevirtual |
Implements ICmpObstruction.
|
inlineoverridevirtual |
Implements ICmpObstruction.
|
inlineoverridevirtual |
Implements ICmpObstruction.
|
inline |
bool CCmpObstruction::m_Active |
Whether the obstruction is actively obstructing or just an inactive placeholder.
entity_pos_t CCmpObstruction::m_Clearance |
std::vector<tag_t> CCmpObstruction::m_ClusterTags |
entity_id_t CCmpObstruction::m_ControlGroup |
Primary control group identifier.
Indicates to which control group this entity's shape belongs. Typically used in combination with obstruction test filters to have member shapes ignore each other during obstruction tests. Defaults to the entity's ID. Must never be set to INVALID_ENTITY.
entity_id_t CCmpObstruction::m_ControlGroup2 |
Optional secondary control group identifier.
Similar to m_ControlGroup; if set to a valid value, then this field identifies an additional, secondary control group to which this entity's shape belongs. Set to INVALID_ENTITY to not assign any secondary group. Defaults to INVALID_ENTITY.
These are only necessary in case it is not sufficient for an entity to belong to only one control group. Otherwise, they can be ignored.
bool CCmpObstruction::m_ControlPersist |
Whether an obstruction's control group should be kept consistent and used to set control groups for entities that collide with it.
flags_t CCmpObstruction::m_Flags |
Set of flags affecting the behaviour of this entity's obstruction shape.
bool CCmpObstruction::m_IsDestroyed = false |
bool CCmpObstruction::m_Moving |
Whether the entity associated with this obstruction is currently moving.
Only applicable for UNIT-type obstructions.
std::vector<Shape> CCmpObstruction::m_Shapes |
entity_pos_t CCmpObstruction::m_Size0 |
entity_pos_t CCmpObstruction::m_Size1 |
tag_t CCmpObstruction::m_Tag |
Identifier of this entity's obstruction shape, as registered in the obstruction manager.
Contains structure, but should be treated as opaque here.
flags_t CCmpObstruction::m_TemplateFlags |
EObstructionType CCmpObstruction::m_Type |