/* core/slot.h This file is part of the Osirion project and is distributed under the terms of the GNU General Public License version 2. */ #ifndef __INCLUDED_CORE_SLOT_H__ #define __INCLUDED_CORE_SLOT_H__ #include "math/vector3f.h" #include "math/axis.h" #include "core/item.h" #include namespace core { /** * @brief A mount point for a weapon or a piece of equipment * */ class Slot { public: enum Flags {Active = 1}; /** * @brief default constructor * Creates an empty slot * */ Slot(); /** * @brief creates and empty slot at a given location * */ Slot(const math::Vector3f & location); /** * @brief default destructor * */ ~Slot(); /** * @brief location of the slot within the parent model * */ inline const math::Vector3f & location() const { return slot_location; } /** * @brief axis indication the slot's orientation * */ inline const math::Axis & axis() const { return slot_axis; } /** * @brief the name of the particlesystem used to render * projectiles generated by this slot * */ /** * */ inline unsigned long last_fired() const { return slot_last_fired; } inline unsigned long interval() const { return slot_interval; } inline unsigned long lifespan() const { return slot_lifespan; } inline float speed() const { return slot_speed; } /* --- mutators -------------------------------------------- */ /** * @brief set the slot's location * */ inline void set_location(const math::Vector3f &location) { slot_location.assign(location); } /** * @brief set the slot's orientation */ inline void set_axis(const math::Axis & axis) { slot_axis.assign(axis); } /** * @brief set the slot's timestamp * The timestamp indicates when the slot's configuration was last changed. * */ inline void set_timestamp(unsigned long timestamp) { slot_timestamp = timestamp; } /** * @brief * */ inline void set_last_fired(unsigned long last_fired) { slot_last_fired = last_fired; } inline void set_interval(unsigned long interval) { slot_interval = interval; } inline void set_lifespan(unsigned long lifespan) { slot_lifespan = lifespan; } inline void set_speed(float speed) { slot_speed = speed; } /** * @brief set the item this slot is holding * */ void set_item(Item *item); private: math::Vector3f slot_location; math::Axis slot_axis; // slot flags unsigned int slot_flags; unsigned long slot_timestamp; unsigned long slot_last_fired; // interval between two shots, in milliseconds unsigned long slot_interval; // projectile lifespane unsigned long slot_lifespan; // projectile speed, in gameunits / second float slot_speed; // item mounted in this slot Item *slot_item; std::string slot_particlesystem_name; }; } // namespace core #endif // __INCLUDED_CORE_SLOTS_H__