Pyrogenesis  trunk
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
CCmpDecay Class Reference

Fairly basic decay implementation, for units and buildings etc. More...

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

Public Member Functions

virtual int GetComponentTypeId () const
 
virtual void Init (const CParamNode &paramNode)
 
virtual void Deinit ()
 
virtual void Serialize (ISerializer &serialize)
 
virtual void Deserialize (const CParamNode &paramNode, IDeserializer &deserialize)
 
virtual void HandleMessage (const CMessage &msg, bool global)
 
- 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 (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
 

Static Public Member Functions

static void ClassInit (CComponentManager &componentManager)
 
static IComponentAllocate (ScriptInterface &, JS::HandleValue)
 
static void Deallocate (IComponent *cmp)
 
static std::string GetSchema ()
 
- Static Public Member Functions inherited from IComponent
static std::string GetSchema ()
 
static u8 GetSerializationVersion ()
 

Public Attributes

bool m_Active
 
bool m_ShipSink
 
float m_DelayTime
 
float m_SinkRate
 
float m_SinkAccel
 
entity_pos_t m_InitialXRotation
 
entity_pos_t m_InitialZRotation
 
float m_SinkingAngleX
 
float m_SinkingAngleZ
 
float m_CurrentTime
 
float m_TotalSinkDepth
 

Detailed Description

Fairly basic decay implementation, for units and buildings etc.

The decaying entity remains stationary for some time period, then falls downwards with some initial speed and some acceleration, until it has fully sunk. The sinking depth is determined from the actor's bounding box and the terrain.

This currently doesn't work with entities whose ICmpPosition has an initial Y offset.

This isn't very efficient (we'll store data and iterate every frame for every entity, not just for corpse entities) - it could be designed more optimally if that's a real problem.

Eventually we might want to adjust the decay rate based on user configuration (low-spec machines could have fewer corpses), number of corpses, etc.

Must not be used on network-synchronised entities, unless <Inactive> is present.

Member Function Documentation

static IComponent* CCmpDecay::Allocate ( ScriptInterface ,
JS::HandleValue   
)
inlinestatic
static void CCmpDecay::ClassInit ( CComponentManager componentManager)
inlinestatic
static void CCmpDecay::Deallocate ( IComponent cmp)
inlinestatic
virtual void CCmpDecay::Deinit ( )
inlinevirtual

Implements IComponent.

virtual void CCmpDecay::Deserialize ( const CParamNode paramNode,
IDeserializer deserialize 
)
inlinevirtual

Implements IComponent.

virtual int CCmpDecay::GetComponentTypeId ( ) const
inlinevirtual

Implements IComponent.

static std::string CCmpDecay::GetSchema ( )
inlinestatic
virtual void CCmpDecay::HandleMessage ( const CMessage msg,
bool  global 
)
inlinevirtual

Reimplemented from IComponent.

virtual void CCmpDecay::Init ( const CParamNode paramNode)
inlinevirtual

Implements IComponent.

virtual void CCmpDecay::Serialize ( ISerializer serialize)
inlinevirtual

Implements IComponent.

Member Data Documentation

bool CCmpDecay::m_Active
float CCmpDecay::m_CurrentTime
float CCmpDecay::m_DelayTime
entity_pos_t CCmpDecay::m_InitialXRotation
entity_pos_t CCmpDecay::m_InitialZRotation
bool CCmpDecay::m_ShipSink
float CCmpDecay::m_SinkAccel
float CCmpDecay::m_SinkingAngleX
float CCmpDecay::m_SinkingAngleZ
float CCmpDecay::m_SinkRate
float CCmpDecay::m_TotalSinkDepth

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