Emergency 20 Dokumentation  4.2.0
em5::ComplexFireComponent Class Reference

EMERGENCY 5 complex fire component class. More...

#include <ComplexFireComponent.h>

Inheritance diagram for em5::ComplexFireComponent:
em5::FireReceiverComponent qsf::JobProxyMovableObjectRenderingListener qsf::Component qsf::MovableObjectRenderingListener qsf::InheritedObject qsf::WeakPtrTarget qsf::Object

Public Member Functions

 ComplexFireComponent (qsf::Prototype *prototype)
 Constructor. More...
 
virtual ~ComplexFireComponent ()
 Destructor. More...
 
void balancingFireEnergy ()
 Collect the energy of all connected child entities and give them nearly the same amount. More...
 
void startFire (FreeplayEvent *freeplayEvent=nullptr)
 Set on random component of the entity on fire; use this as easy access function. More...
 
void startFireOnAllFireComponents (FreeplayEvent *freeplayEvent)
 Set all fire components of the entity on fire; use this as easy access function. More...
 
void stopFire ()
 Immediately stops the fire of all fire components; use this as easy access function. More...
 
void destroyByFire ()
 Immediately destroy the entity; use this as easy access function. More...
 
bool isReadyForCleanup () const
 Ask all child entities if they are ready for cleanup and return "true" if the cleanup process can start. More...
 
void cleanup ()
 Reset all linked fire components. More...
 
float getRelativeCombustionEnergy () const
 
void setEnergyPercent (float fraction)
 
float getEnergyPercent () const
 Get the complex fire's current fire energy in interval [0.0, 1.0]. More...
 
float getTotalDamagePercentage () const
 
void updateHitPointBar ()
 Draw the hit point bar for the entity. More...
 
FireComponentgetBurningFireComponent () const
 Return one burning fire component. More...
 
void getAllFireComponents (std::vector< FireComponent * > &fireComponents) const
 Adds all assigned fire components to the given container. More...
 
const std::vector< uint64 > & getAllFireParticleIds () const
 Return all assigned fire particle IDs. More...
 
bool isBurnable () const
 Returns "true" if the fire component is burnable at all. More...
 
void updateParticlesVisibility ()
 
virtual bool canCountedForExtinguishAchievement () const override
 Is the current fire component counted for the extinguish fires achievement. More...
 
virtual void setCountedForExtinguishAchievement (bool canCounted) override
 Enable or disable counting for the extinguishing fires achievement. More...
 
virtual bool isBurned () const override
 Return "true" if the total amount of material energy is used; in this case the fire is over. More...
 
virtual bool isBurning () const override
 Return true if the fire is active, in this case the fire will charge by themself. More...
 
virtual void addCoolingEnergySource (uint64 entityId, float extinguishEnergy, float coolingEnergy) override
 Adds the entity and its cooling/extinguish energy. More...
 
virtual void removeCoolingEnergySource (uint64 entityId) override
 Removes the entity and its cooling/extinguish energy. More...
 
- Public Member Functions inherited from em5::FireReceiverComponent
 FireReceiverComponent (qsf::Prototype *prototype)
 Constructor. More...
 
virtual ~FireReceiverComponent ()
 Destructor. More...
 
float getCoolingEnergy () const
 Returns the amount of cooling energy which is currently applied to this component. More...
 
uint32 getCoolingEnergySourceCount () const
 Returns the amount of cooling energy sources that interact with this component. More...
 
void getCoolingSources (std::vector< uint64 > &coolingSourceIds) const
 
qsf::TransformComponentgetTransformComponent () const
 Returns the owning entity's transform component, in case this component is in simulating state. More...
 
- Public Member Functions inherited from qsf::Component
virtual ~Component ()
 Destructor. More...
 
PrototypegetPrototype () const
 Return the prototype this component is in. More...
 
EntitygetEntity () const
 Return a reference to the entity this component is in. More...
 
uint32 getId () const
 Return the unique component identifier. More...
 
ComponentManagergetComponentManager () const
 Return the component manager that's responsible for this component instance. More...
 
ComponentCollectiongetComponentCollection () const
 Return the component collection that's responsible for this component instance. More...
 
bool isSimulating () const
 Return whether or not the component is in simulating mode. More...
 
bool isActive () const
 Return whether or not the component is considered to be active. More...
 
void setActive (bool active)
 Set whether or not the component is considered to be active. More...
 
bool isDebug () const
 Return whether or not the component is considered to be in debug mode. More...
 
bool isHidden () const
 Return whether or not the component is hidden. More...
 
void setHidden (bool hidden)
 Set whether or not the component is hidden. More...
 
bool isGloballyHidden () const
 Return whether or not the component is globally hidden. More...
 
void setGloballyHidden (bool globallyHidden)
 Set whether or not the component is globally hidden. More...
 
bool isReallyHidden () const
 Return whether or not the component is really hidden. More...
 
bool startup (bool ownerIsRunning)
 Startup the component. More...
 
bool isRunning () const
 Return whether or not the component is up-and-running. More...
 
void shutdown ()
 Shutdown the component. More...
 
uint64 getPrototypeId () const
 Return the ID of the prototype this component is in. More...
 
uint64 getEntityId () const
 Return the ID of the entity this component is in. More...
 
virtual void onInvalidation ()
 Invalidate the component. More...
 
virtual void setDebug (bool debugMode)
 Set whether or not the component is considered to be in debug mode. More...
 
virtual void serialize (BinarySerializer &serializer)
 Serialize or deserialize the component using a binary serializer. More...
 
- Public Member Functions inherited from qsf::InheritedObject
void copyPropertyOverrideStateFrom (const InheritedObject &object, bool add=false)
 
void setAllPropertyOverrideFlags (bool value)
 
void autoCreatePropertyOverrideState ()
 
virtual camp::Value getPropertyDefaultValue (const StringHash &propertyId) const override
 
virtual PropertyOverrideState getPropertyOverrideState (const StringHash &propertyId) const override
 
virtual bool setPropertyOverrideState (const StringHash &propertyId, PropertyOverrideState overrideState) override
 
- Public Member Functions inherited from qsf::Object
virtual ~Object ()
 Destructor. More...
 
const camp::Class & getCampClass () const
 Return the CAMP class. More...
 
int getPropertyIndexById (const StringHash &propertyId) const
 Return the CAMP property index by using the unique class property ID. More...
 
uint32 getPropertyIdByIndex (int index) const
 Return the unique class property ID with the given index. More...
 
std::string getPropertyNameById (const StringHash &propertyId) const
 Return the CAMP property name by using the unique class property ID. More...
 
const camp::Property * getCampPropertyById (const StringHash &propertyId) const
 Return the CAMP property by using the unique class property ID. More...
 
void setPropertyValuesByString (const std::string &values)
 Set CAMP reflection property values by using a given string. More...
 
void setPropertiesToDefaultValues ()
 Set all CAMP reflection system properties to their default values. More...
 
void serializeToBoostPTree (boost::property_tree::ptree &pTree, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL) const
 
void serializeToBoostPTree (boost::property_tree::ptree &pTree, const camp::Class &campClass, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL) const
 
bool deserializeFromBoostPTree (const boost::property_tree::ptree &pTree, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL)
 
bool deserializeFromBoostPTree (const boost::property_tree::ptree &pTree, const camp::Class &campClass, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL)
 
void serializeToBinarySerializer (BinarySerializer &serializer, SerializationMode mode=MODE_MINIMAL, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL) const
 
void deserializeFromBinarySerializer (BinarySerializer &serializer, SerializationMode mode=MODE_MINIMAL, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL, bool setOverrideState=true)
 
virtual void onPreDeserialize ()
 Called right before the object is deserialized using any of the above methods. Default implementation is empty. More...
 
virtual void onPostDeserialize ()
 Called right after the object was deserialized using any of the above methods. Default implementation is empty. More...
 
virtual ScriptgetAssociatedScript () const
 Return the script instance associated with this object instance. More...
 
- Public Member Functions inherited from qsf::JobProxyMovableObjectRenderingListener
 JobProxyMovableObjectRenderingListener ()
 Constructor. More...
 
virtual ~JobProxyMovableObjectRenderingListener ()
 Destructor. More...
 
const TimegetNonvisibleUpdateTimeout () const
 Return the nonvisible update timeout. More...
 
void setNonvisibleUpdateTimeout (const Time &nonvisibleUpdateTimeout)
 Set the nonvisible update timeout. More...
 
- Public Member Functions inherited from qsf::MovableObjectRenderingListener
 MovableObjectRenderingListener ()
 Constructor. More...
 
virtual ~MovableObjectRenderingListener ()
 Destructor. More...
 
bool isMovableObjectRenderingListenerRegistered () const
 Return whether or not the movable object rendering listener is registered. More...
 
State getState () const
 Return the state of the listener. More...
 

Static Public Attributes

static const uint32 COMPONENT_ID
 "em5::ComplexFireComponent" unique component ID More...
 
static const uint32 FIREENTITIES_ARRAY
 Property id for the fire entities array. More...
 
static const float MAXIMUM_BALANCING_PERCENT
 
- Static Public Attributes inherited from em5::FireReceiverComponent
static const uint32 COMPONENT_ID
 "em5::FireReceiverComponent" unique component ID More...
 
- Static Public Attributes inherited from qsf::Component
static const uint32 COMPONENT_ID
 "qsf::Component" unique component ID More...
 

Protected Member Functions

virtual bool checkFireReceiver (qsf::Component *senderComponent) override
 Return "true" if the fire receiver is a valid target for the sender, ask the health component for dead state by default. More...
 
virtual void receiveFireEnergy (float fireEnergy, const qsf::Time &timePassed, qsf::Component *senderComponent) override
 Handle the received energy and gives it to the special receiver. More...
 
virtual void updateSimulation (const qsf::Time &timePassed) override
 Update the simulation state of this component. More...
 
virtual void onSetActive (bool active) override
 Set whether or not the component is considered to be active. More...
 
virtual void onSetSimulating (bool simulating) override
 Set whether or not the component is in simulating mode. More...
 
virtual qsf::ComponentgetMovableObjectRenderingListenerComponent () override
 Return the component the listener will spy on. More...
 
virtual void onObjectRenderingStartup () override
 Called when an OGRE movable object is about to be rendered for the first time after it has not been rendered for some time. More...
 
virtual void onUpdateMovableObjectRenderingJob (const qsf::JobArguments &jobArguments) override
 Main update function that is passed to the job manager. More...
 
- Protected Member Functions inherited from em5::FireReceiverComponent
void internalActive (bool simulating, bool active)
 Updates the registration at the fire system for getting simulation updates and taking part at the fire spread calculation. More...
 
virtual void onComponentTransformChange (const qsf::Transform &transform, TransformChangeFlags flags) override
 Called in case a component transformation value was changed. More...
 
- Protected Member Functions inherited from qsf::Component
 Component (Prototype *prototype)
 Constructor. More...
 
void promotePropertyChange (uint32 propertyId)
 A component property value was changed. More...
 
template<typename T , typename S >
bool assignAndPromoteChange (T &variable, const S &newValue, uint32 propertyId)
 Comfort function for updating an exported member variable and promoting any change that happened. More...
 
void setRegisterForSimulationTransformChanges (bool enable)
 Register or unregister this component as simulation transform listener. More...
 
void setRegisterForAnimationTransformChanges (bool enable)
 Register or unregister this component as animation transform listener. More...
 
virtual const ObjectgetPropertyDefaultsProvider () const override
 
virtual bool ignoreOwnerRunningState () const
 Return whether or not the component will only startup if the owner is in running state. More...
 
virtual bool implementsOnComponentPropertyChange () const
 Signal whether this component needs the "onComponentPropertyChange" callback at all. More...
 
virtual void onComponentPropertyChange (const Component &component, uint32 propertyId)
 Called in case a component property value was changed. More...
 
virtual void onSetDebug (bool debug)
 Set whether or not the component is considered to be in debug mode. More...
 
virtual void onSetHidden (bool hidden)
 Set whether or not the component is considered to be hidden. More...
 
virtual bool onStartup ()
 Startup the component. More...
 
virtual void onShutdown ()
 Shutdown the component. More...
 
- Protected Member Functions inherited from qsf::InheritedObject
 InheritedObject ()
 Default constructor. More...
 
- Protected Member Functions inherited from qsf::Object
 Object ()
 Default constructor. More...
 
- Protected Member Functions inherited from qsf::WeakPtrTarget
 WeakPtrTarget ()
 Default constructor. More...
 
 WeakPtrTarget (const WeakPtrTarget &other)
 Copy constructor. More...
 
 WeakPtrTarget (WeakPtrTarget &&)=delete
 Delete the move constructor, as WeakPtrTarget would need a proper move constructor-implementation that ensures that its pointer gets updated in the WeakPtrBase as well. More...
 
 ~WeakPtrTarget ()
 Destructor. More...
 
void invalidateAllWeakPtr ()
 Invalidate all weak pointers to this object. More...
 
void operator= (const WeakPtrTarget &other)
 Copy operator. More...
 
- Protected Member Functions inherited from qsf::JobProxyMovableObjectRenderingListener
virtual void onObjectRendering (const Component &component, const Ogre::Camera &ogreCamera) override
 Called when an OGRE movable object of the camera to be used for rendering. More...
 
virtual void onObjectRenderingShutdown () override
 Called when an OGRE movable object is no longer be rendered for some time. More...
 
- Protected Member Functions inherited from qsf::MovableObjectRenderingListener
virtual void registerMovableObjectRenderingListener ()
 Register movable object rendering listener. More...
 
virtual void unregisterMovableObjectRenderingListener ()
 Unregister movable object rendering listener. More...
 
virtual void onObjectDestroyed ()
 Movable object has been destroyed. More...
 

Friends

class FireComponent
 

Additional Inherited Members

- Public Types inherited from qsf::Component
enum  TransformChangeFlag {
  TRANSFORM_CHANGE_POSITION = 0x01, TRANSFORM_CHANGE_ROTATION = 0x02, TRANSFORM_CHANGE_SCALE = 0x04, TRANSFORM_CHANGE_TRANSFORM = 0x07,
  TRANSFORM_CHANGE_FOR_SIMULATION = 0x08, TRANSFORM_CHANGE_FOR_ANIMATION = 0x10
}
 
typedef BitFlagSet< uint8, TransformChangeFlagTransformChangeFlags
 
- Public Types inherited from qsf::Object
enum  PropertyOverrideState { PROPERTY_INVALID, PROPERTY_DEFAULT, PROPERTY_OVERRIDE, PROPERTY_REMOVED }
 
enum  SerializationMethod { SERIALIZE_FLAT, SERIALIZE_COMPLETE, SERIALIZE_DIFFERENTIAL, SERIALIZE_IGNORE_UNKNOWN }
 
enum  SerializationMode { MODE_MINIMAL, MODE_COMPATIBLE }
 
- Public Types inherited from qsf::MovableObjectRenderingListener
enum  State { SLEEPING, AWAKE }
 State of the listener. More...
 
- Protected Attributes inherited from em5::FireReceiverComponent
qsf::WeakPtr< qsf::TransformComponentmTransformComponent
 
qsf::WeakPtr< HealthComponentmHealthComponent
 
qsf::WeakPtr< DamageComponentmDamageComponent
 
- Protected Attributes inherited from qsf::InheritedObject
std::bitset< 128 > mPropertyOverrideFlags
 One bit for each property; if set, the property is overridden. More...
 
- Protected Attributes inherited from qsf::JobProxyMovableObjectRenderingListener
JobProxy mAnimationJobProxy
 Regular animation job proxy; for updates once a frame. More...
 
- Protected Attributes inherited from qsf::MovableObjectRenderingListener
bool mAllowRegistration
 Actually only for internal builds (additional check to find erroneous behavior), but we need to make sure end-user SDK is the same with or without ENDUSER define. More...
 

Detailed Description

EMERGENCY 5 complex fire component class.

Remarks
Is a optional container of fire components. The complex fire component need one or more entities in the "FireEntityIdArray" slot to work correctly. It handle the multiple fire components for the entity. We are able to create entities with more than one fire source inside, having for e.g. a building with one fire on the roof, one from a window and an other one in the entry door. For avoiding flooding the message system with "StartBurning"-messages from all individual fire component, the complex fire component checks if this message was send before.

Additional it starts swapping fire material energy in case one fire component reaches its limit. It is also able to ignite/extinguish/destroy all fire component at once

Constructor & Destructor Documentation

em5::ComplexFireComponent::ComplexFireComponent ( qsf::Prototype prototype)
inlineexplicit

Constructor.

Parameters
[in]prototypeThe prototype this component is in, no null pointer allowed
em5::ComplexFireComponent::~ComplexFireComponent ( )
inlinevirtual

Destructor.

Member Function Documentation

virtual void em5::ComplexFireComponent::addCoolingEnergySource ( uint64  entityId,
float  extinguishEnergy,
float  coolingEnergy 
)
overridevirtual

Adds the entity and its cooling/extinguish energy.

Parameters
[in]entityIdId of the entity which applies cooling energy to the fire receiver component
[in]extinguishEnergyThe amount of extinguish energy applied (as positive value)
[in]coolingEnergyThe amount of cooling energy applied (as positive value)
Remarks
This method delegates the energy to the child fire components in this way
  • All burning fire components get the exinguishEnergy/<burning firecomponents>="">
  • All not burning fire components get full coolingEnergy

Reimplemented from em5::FireReceiverComponent.

void em5::ComplexFireComponent::balancingFireEnergy ( )

Collect the energy of all connected child entities and give them nearly the same amount.

virtual bool em5::ComplexFireComponent::canCountedForExtinguishAchievement ( ) const
overridevirtual

Is the current fire component counted for the extinguish fires achievement.

Reimplemented from em5::FireReceiverComponent.

virtual bool em5::ComplexFireComponent::checkFireReceiver ( qsf::Component sender)
overrideprotectedvirtual

Return "true" if the fire receiver is a valid target for the sender, ask the health component for dead state by default.

Reimplemented from em5::FireReceiverComponent.

void em5::ComplexFireComponent::cleanup ( )

Reset all linked fire components.

void em5::ComplexFireComponent::destroyByFire ( )

Immediately destroy the entity; use this as easy access function.

void em5::ComplexFireComponent::getAllFireComponents ( std::vector< FireComponent * > &  fireComponents) const

Adds all assigned fire components to the given container.

const std::vector<uint64>& em5::ComplexFireComponent::getAllFireParticleIds ( ) const

Return all assigned fire particle IDs.

FireComponent* em5::ComplexFireComponent::getBurningFireComponent ( ) const

Return one burning fire component.

float em5::ComplexFireComponent::getEnergyPercent ( ) const

Get the complex fire's current fire energy in interval [0.0, 1.0].

virtual qsf::Component* em5::ComplexFireComponent::getMovableObjectRenderingListenerComponent ( )
overrideprotectedvirtual

Return the component the listener will spy on.

Returns
The component the listener will spy on, can be a null pointer, do not destroy the instance
Note
  • The default implementation is empty and returns a null pointer
  • Ease of use method in case a listener just listens to a single movable object (the common use case)

Reimplemented from qsf::MovableObjectRenderingListener.

float em5::ComplexFireComponent::getRelativeCombustionEnergy ( ) const
float em5::ComplexFireComponent::getTotalDamagePercentage ( ) const
bool em5::ComplexFireComponent::isBurnable ( ) const

Returns "true" if the fire component is burnable at all.

bool em5::ComplexFireComponent::isBurned ( ) const
inlineoverridevirtual

Return "true" if the total amount of material energy is used; in this case the fire is over.

Reimplemented from em5::FireReceiverComponent.

bool em5::ComplexFireComponent::isBurning ( ) const
inlineoverridevirtual

Return true if the fire is active, in this case the fire will charge by themself.

Reimplemented from em5::FireReceiverComponent.

bool em5::ComplexFireComponent::isReadyForCleanup ( ) const

Ask all child entities if they are ready for cleanup and return "true" if the cleanup process can start.

virtual void em5::ComplexFireComponent::onObjectRenderingStartup ( )
overrideprotectedvirtual

Called when an OGRE movable object is about to be rendered for the first time after it has not been rendered for some time.

Note
  • The default implementation is empty

Reimplemented from qsf::JobProxyMovableObjectRenderingListener.

virtual void em5::ComplexFireComponent::onSetActive ( bool  active)
overrideprotectedvirtual

Set whether or not the component is considered to be active.

Parameters
[in]active"true" if the component is considered to be active, else "false"
Note
  • The default implementation is empty
  • This method is only called in case there's a real state change
  • This method is also called in case the component is currently not running
See also
  • "qsf::Component::setActive()"

Reimplemented from em5::FireReceiverComponent.

virtual void em5::ComplexFireComponent::onSetSimulating ( bool  simulating)
overrideprotectedvirtual

Set whether or not the component is in simulating mode.

Parameters
[in]active"true" if the component is in simulating mode, else "false"
Note
  • The default implementation is empty
  • This method is only called in case there's a real state change
  • In contrast to internal flags (e.g. Active, Debug), the simulating mode state can only be changed globally for a whole map
  • On component shutdown and simulating enabled, "onSetSimulating()" is automatically called with "false" before calling "onShutdown()"

Reimplemented from em5::FireReceiverComponent.

virtual void em5::ComplexFireComponent::onUpdateMovableObjectRenderingJob ( const qsf::JobArguments jobArguments)
overrideprotectedvirtual

Main update function that is passed to the job manager.

Parameters
[in]jobArgumentsJob arguments
Note
  • The default implementation checks the time since last visible and puts the listener to sleep if required

Reimplemented from qsf::JobProxyMovableObjectRenderingListener.

virtual void em5::ComplexFireComponent::receiveFireEnergy ( float  fireEnergy,
const qsf::Time timePassed,
qsf::Component sender 
)
overrideprotectedvirtual

Handle the received energy and gives it to the special receiver.

Parameters
[in]fireEnergyAmount of energy which gets received
[in]timePassedTime passed since last call
[in]senderPointer to the sender of the energy, can be nullptr

Reimplemented from em5::FireReceiverComponent.

virtual void em5::ComplexFireComponent::removeCoolingEnergySource ( uint64  entityId)
overridevirtual

Removes the entity and its cooling/extinguish energy.

Parameters
[in]entityIdID of the entity which stopped applying cooling energy to the fire component
Note
  • This method delegates it to the child fire components

Reimplemented from em5::FireReceiverComponent.

virtual void em5::ComplexFireComponent::setCountedForExtinguishAchievement ( bool  canCounted)
overridevirtual

Enable or disable counting for the extinguishing fires achievement.

Reimplemented from em5::FireReceiverComponent.

void em5::ComplexFireComponent::setEnergyPercent ( float  fraction)
void em5::ComplexFireComponent::startFire ( FreeplayEvent freeplayEvent = nullptr)

Set on random component of the entity on fire; use this as easy access function.

void em5::ComplexFireComponent::startFireOnAllFireComponents ( FreeplayEvent freeplayEvent)

Set all fire components of the entity on fire; use this as easy access function.

void em5::ComplexFireComponent::stopFire ( )

Immediately stops the fire of all fire components; use this as easy access function.

void em5::ComplexFireComponent::updateHitPointBar ( )

Draw the hit point bar for the entity.

void em5::ComplexFireComponent::updateParticlesVisibility ( )
virtual void em5::ComplexFireComponent::updateSimulation ( const qsf::Time timePassed)
overrideprotectedvirtual

Update the simulation state of this component.

Parameters
[in]timePassedTime passed since last call

Reimplemented from em5::FireReceiverComponent.

Friends And Related Function Documentation

friend class FireComponent
friend

Member Data Documentation

const uint32 em5::ComplexFireComponent::COMPONENT_ID
static

"em5::ComplexFireComponent" unique component ID

const uint32 em5::ComplexFireComponent::FIREENTITIES_ARRAY
static

Property id for the fire entities array.

const float em5::ComplexFireComponent::MAXIMUM_BALANCING_PERCENT
static

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