3 #include <boost/range/adaptor/map.hpp>
5 #include "engine/component.h"
6 #include "engine/system.h"
7 #include "engine/touchable.h"
8 #include "scripting/luabind.h"
9 #include "engine/typedefs.h"
11 #include <luabind/object.hpp>
13 #include <OgreCommon.h>
15 #include <OgreVector3.h>
16 #include <unordered_set>
20 using BoostCompoundMapIterator = boost::range_detail::select_second_mutable_range<std::unordered_map<std::string, CompoundId>>;
21 using BoostAbsorbedMapIterator = boost::range_detail::select_first_range<std::unordered_map<CompoundId, float>>;
27 COMPONENT(CompoundAbsorber)
139 BoostAbsorbedMapIterator
140 getAbsorbedCompounds();
177 static luabind::scope
205 void update(
int,
int)
override;
209 struct Implementation;
210 std::unique_ptr<Implementation> m_impl;
std::unordered_set< CompoundId > m_canAbsorbCompound
Whether a particular compound id can be absorbed.
Definition: compound_absorber_system.h:56
CompoundAbsorberSystem()
Constructor.
Definition: compound_absorber_system.cpp:187
std::unordered_map< CompoundId, float > m_absorbedCompounds
The compounds absorbed in the last time step.
Definition: compound_absorber_system.h:51
static luabind::scope luaBindings()
Lua bindings.
Definition: compound_absorber_system.cpp:161
void load(const StorageContainer &storage) override
Loads the component.
Definition: compound_absorber_system.cpp:99
float absorbedCompoundAmount(CompoundId id) const
The absorbed amount in the last time step.
Definition: compound_absorber_system.cpp:56
Despawns compounds for CompoundAbsorberComponent.
Definition: compound_absorber_system.h:165
bool m_enabled
Whether anything can be absorbed.
Definition: compound_absorber_system.h:61
void init(GameState *gameState) override
Initializes the system.
Definition: compound_absorber_system.cpp:197
Base class for components.
Definition: component.h:31
A system handles one specific part of the game.
Definition: system.h:23
void setAbsorbedCompoundAmount(CompoundId id, float amount)
Sets the amount of absorbed compounds.
Definition: compound_absorber_system.cpp:115
StorageContainer storage() const override
Serializes the component.
Definition: compound_absorber_system.cpp:138
void enable()
Definition: compound_absorber_system.cpp:89
bool canAbsorbCompound(CompoundId id) const
Whether an compound can be absorbed.
Definition: compound_absorber_system.cpp:75
Definition: bullet_ogre_conversion.h:6
void shutdown() override
Shuts the system down.
Definition: compound_absorber_system.cpp:208
GameState * gameState() const
Returns the system's game state.
Definition: system.cpp:183
Represents a distinct set of active systems and entities.
Definition: game_state.h:41
void setCanAbsorbCompound(CompoundId id, bool canAbsorb)
Sets whether an compound can be absorbed.
Definition: compound_absorber_system.cpp:124
void update(int, int) override
Updates the system.
Definition: compound_absorber_system.cpp:217
~CompoundAbsorberSystem()
Destructor.
Definition: compound_absorber_system.cpp:193
void disable()
Definition: compound_absorber_system.cpp:94
static luabind::scope luaBindings()
Lua bindings.
Definition: compound_absorber_system.cpp:34
double m_absorbtionCapacity
The amount of compound volume that can be absorbed.
Definition: compound_absorber_system.h:66
Absorbs compound particles.
Definition: compound_absorber_system.h:26
A key-value storage for serialization.
Definition: serialization.h:36
void setAbsorbtionCapacity(double capacity)
Sets the absorbtion capacity.
Definition: compound_absorber_system.cpp:82