/* * ORXONOX - the hottest 3D action shooter ever to exist * > www.orxonox.net < * * * License notice: * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * Author: * Martin Polak * Co-authors: * ... * */ #ifndef _WeaponSlot_H__ #define _WeaponSlot_H__ #include "OrxonoxPrereqs.h" #include "worldentities/StaticEntity.h" namespace orxonox { /** @brief The a WeaponSlot defines where a @ref orxonox::Weapon "Weapon" is placed on a pawn. A WeaponSlot is a @ref orxonox::StaticEntity, therefore it has a position and orientation. In a WeaponSlot there can be only one "Weapon", but a Weapon can have several @ref orxonox::WeaponMode "WeaponModes". A WeaponMode is what one intuitively imagines as weapon. (E.g. RocketFire, LightningGun, LaserFire are weaponmodes) A WeaponSlot is created in XML (in a weaponsettings file), which can be done in the following fashion: @code @endcode A WeaponSlot can be attached to a @ref orxonox::Pawn because WeaponSlot inherits from @ref orxonox::StaticEntity. @author Martin Polak @ingroup Weaponsystem */ class _OrxonoxExport WeaponSlot : public StaticEntity { public: WeaponSlot(Context* context); virtual ~WeaponSlot(); virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; void attachWeapon(Weapon * weapon); void removeWeapon(); Weapon * getWeapon() const { return this->weapon_; } /** @brief Checks whether there is a Weapon attached to this WeaponSlot. */ inline bool isOccupied() const { return (this->weapon_ != nullptr); } inline void setWeaponSystem(WeaponSystem * weaponSystem) { this->weaponSystem_ = weaponSystem; } inline WeaponSystem * getWeaponSystem() const { return this->weaponSystem_; } private: WeaponSystem * weaponSystem_; // Pointer to the WeaponSystem Weapon * weapon_; // If the WeaponSlot is occupied a pointer to the attached Weapon is stored here. }; } #endif /* _WeaponSlot_H__ */