From 5e4ef80dc29a69e1f5f185d1efab323af4a77292 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Wed, 21 Nov 2012 20:49:58 +0000 Subject: Added get/set methods for the weapon-slot API. --- src/core/slot.h | 137 +++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 95 insertions(+), 42 deletions(-) (limited to 'src/core/slot.h') diff --git a/src/core/slot.h b/src/core/slot.h index 6b6c47b..2d636b3 100644 --- a/src/core/slot.h +++ b/src/core/slot.h @@ -29,12 +29,7 @@ public: * Creates an empty slot * */ Slot(); - - /** - * @brief creates and empty slot at a given location - * */ - Slot(const math::Vector3f & location); - + /** * @brief default destructor * */ @@ -55,32 +50,63 @@ public: { return slot_axis; } - - /** - * @brief the name of the particlesystem used to render - * projectiles generated by this slot - * */ /** + * @brief timestamp indicating when the slot was last fired,server-side + * This is a server-side property * */ inline unsigned long last_fired() const { return slot_last_fired; } - inline unsigned long interval() const + /** + * @brief timestamp indicating when the slot was last fire, client-side + * This is a client-side property + * */ + inline unsigned long last_ejected() const + { + return slot_last_ejected; + } + + /** + * @brief interval between two consequtive shots by this slot, in milliseconds + * */ + inline unsigned long projectile_interval() const { - return slot_interval; + return slot_projectile_interval; } - inline unsigned long lifespan() const + /** + * @brief lifespan of a projectile generated by this slot, in milliseconds + * */ + inline unsigned long projectile_lifespan() const { - return slot_lifespan; + return slot_projectile_lifespan; } - inline float speed() const + /** + * @brief speed of a projectile generated by this slot, in game units per second + * */ + inline float projectile_speed() const { - return slot_speed; + return slot_projectile_speed; + } + + /** + * @brief damage done by a projectile generated by this slot + * */ + inline float projectile_damage() const + { + return slot_projectile_damage; + } + + /** + * @brief model name used to draw projectiles generated by this slot + * */ + inline const std::string & projectile_modelname() const + { + return slot_projectile_modelname; } /* --- mutators -------------------------------------------- */ @@ -111,27 +137,46 @@ public: } /** - * @brief + * @brief set the timestamp when the slot last ejected a projectile, server-side + * This is a server-side property, to be set by the game module * */ inline void set_last_fired(unsigned long last_fired) { slot_last_fired = last_fired; } - inline void set_interval(unsigned long interval) + /** + * @brief set the timestamp when the slat last ejected a projectile, client-side + * This is a client-side property, to be set by the client + * */ + inline void set_last_ejected(unsigned long last_ejected) { - slot_interval = interval; + slot_last_ejected = last_ejected; } - inline void set_lifespan(unsigned long lifespan) - { - slot_lifespan = lifespan; - } + /** + * @brief set the interval between two shots, in milliseconds + * */ + void set_projectile_interval(unsigned long projectile_interval); - inline void set_speed(float speed) - { - slot_speed = speed; - } + /** + * @brief set the lifespan of ejected projectiles, in milliseconds + * */ + void set_projectile_lifespan(unsigned long projectile_lifespan); + + /** + * @brief set the speed of ejected projectiles, in game units per second + * */ + void set_projectile_speed(float projectile_speed); + + /** + * @brief set the amount of damage done by a projectile generated by this slot + * */ + void set_projectile_damage(float projectile_damage); + /** + * @brief set the name of model used to draw projectiles generated by this slot + * */ + void set_projectile_modelname(const std::string & projectile_modelname); /** * @brief set the item this slot is holding @@ -139,33 +184,41 @@ public: void set_item(Item *item); private: - math::Vector3f slot_location; + math::Vector3f slot_location; - math::Axis slot_axis; + math::Axis slot_axis; // slot flags - unsigned int slot_flags; + unsigned int slot_flags; + + // timestamp indicating when the slot configuration was last changed + unsigned long slot_timestamp; - unsigned long slot_timestamp; + // timestamp indicating when the slot last generated a projectile, server-side + unsigned long slot_last_fired; - unsigned long slot_last_fired; + // timestamp indicating when the slot last generated a projectile, client-side + unsigned long slot_last_ejected; // interval between two shots, in milliseconds - unsigned long slot_interval; + unsigned long slot_projectile_interval; - // projectile lifespane - unsigned long slot_lifespan; + // projectile lifespan + unsigned long slot_projectile_lifespan; - // projectile speed, in gameunits / second - float slot_speed; + // projectile speed, in game units per second + float slot_projectile_speed; - // item mounted in this slot - Item *slot_item; + // projectile damage + float slot_projectile_damage; + + // name of the model used to draw projectiles generated by this slot + std::string slot_projectile_modelname; - std::string slot_particlesystem_name; + // item mounted in this slot + Item *slot_item; }; } // namespace core #endif // __INCLUDED_CORE_SLOTS_H__ - -- cgit v1.2.3