Thrive
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
thrive::CompoundAbsorberComponent Class Reference

Absorbs compound particles. More...

#include <compound_absorber_system.h>

Inheritance diagram for thrive::CompoundAbsorberComponent:
thrive::Component

Public Member Functions

float absorbedCompoundAmount (CompoundId id) const
 The absorbed amount in the last time step. More...
 
bool canAbsorbCompound (CompoundId id) const
 Whether an compound can be absorbed. More...
 
void setAbsorbtionCapacity (double capacity)
 Sets the absorbtion capacity. More...
 
void enable ()
 
void disable ()
 
void load (const StorageContainer &storage) override
 Loads the component. More...
 
void setAbsorbedCompoundAmount (CompoundId id, float amount)
 Sets the amount of absorbed compounds. More...
 
BoostAbsorbedMapIterator getAbsorbedCompounds ()
 
void setCanAbsorbCompound (CompoundId id, bool canAbsorb)
 Sets whether an compound can be absorbed. More...
 
StorageContainer storage () const override
 Serializes the component. More...
 
- Public Member Functions inherited from thrive::Component
virtual ~Component ()=0
 Destructor.
 
bool isVolatile () const
 A volatile component is not serialized during a save. More...
 
EntityId owner () const
 The entity this component belongs to. More...
 
void setVolatile (bool isVolatile)
 Sets the volatile flag. More...
 
void setOwner (EntityId owner)
 Sets the component's owner. More...
 
virtual ComponentTypeId typeId () const =0
 The component's type id.
 
virtual std::string typeName () const =0
 The component's type name.
 

Static Public Member Functions

static luabind::scope luaBindings ()
 Lua bindings. More...
 
- Static Public Member Functions inherited from thrive::Component
static luabind::scope luaBindings ()
 Lua bindings. More...
 

Public Attributes

std::unordered_map< CompoundId, float > m_absorbedCompounds
 The compounds absorbed in the last time step.
 
std::unordered_set< CompoundId > m_canAbsorbCompound
 Whether a particular compound id can be absorbed.
 
bool m_enabled = true
 Whether anything can be absorbed.
 
double m_absorbtionCapacity = 0
 The amount of compound volume that can be absorbed.
 

Detailed Description

Absorbs compound particles.

Member Function Documentation

float CompoundAbsorberComponent::absorbedCompoundAmount ( CompoundId  id) const

The absorbed amount in the last time step.

Parameters
idThe compound id to get the amount for
Returns
bool CompoundAbsorberComponent::canAbsorbCompound ( CompoundId  id) const

Whether an compound can be absorbed.

Parameters
idThe compound id to check
Returns
void CompoundAbsorberComponent::disable ( )

Sets m_enabled to false

void CompoundAbsorberComponent::enable ( )

Sets m_enabled to true

void CompoundAbsorberComponent::load ( const StorageContainer &  storage)
overridevirtual

Loads the component.

Parameters
storage

Implements thrive::Component.

luabind::scope CompoundAbsorberComponent::luaBindings ( )
static
void CompoundAbsorberComponent::setAbsorbedCompoundAmount ( CompoundId  id,
float  amount 
)

Sets the amount of absorbed compounds.

Use this for e.g. resetting the absorbed amount down to zero.

Parameters
idThe compound id to change the amount for
amountThe new amount
void CompoundAbsorberComponent::setAbsorbtionCapacity ( double  capacity)

Sets the absorbtion capacity.

Parameters
capacityThe new capacity
void CompoundAbsorberComponent::setCanAbsorbCompound ( CompoundId  id,
bool  canAbsorb 
)

Sets whether an compound can be absorbed.

Parameters
idThe compound id to set the flag for
canAbsorbWhether to absorb the compound
StorageContainer CompoundAbsorberComponent::storage ( ) const
overridevirtual

Serializes the component.

Returns

Implements thrive::Component.


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