/* * 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: * Fabian 'x3n' Landau * Co-authors: * ... * */ /** @file @author remartin @brief An asteroid which can be destroyed. Some smaller asteroids are created and a pickup spawns. HANDBUCH: o Die Collision Shape kann nur im Konstruktor hinzugefügt werden. Die XML-Argumente werden aber erst nach dem Konstruktor gesetzt. Darum wird hier beim ersten Aufruf der tick()-Methode via putStuff() ein komplett neuer Asteroid generiert und der alte zerstört. o im Level-File includes/pickups.oxi importieren. OFFEN/Weiterentwicklung: o @TODO Add resource pickups. --> data_extern/images/effects: PNG's für die Pickups --> https://www.orxonox.net/jenkins/view/Management/job/orxonox_doxygen_trunk/javadoc/group___pickup.html o Density doesn't add up to 1... o Does collision damage work properly o Add sound effect (crunching etc. ) (No sound in space...) o Explosion parts ANDERORTS VERÄNDERTE SACHEN: Pickup-Zeug: o Pickup.h: createSpawner() neu public statt private o PickupSpawner.h: Zugriffsrechte setPickupTemplateName() und setMaxSpawnedItems() o PickupSpawner.h: In Tick() zwei Testbedingungen eingefügt. o Pawn.h: Attribut acceptsPickups_ inklusive get/set. ERLEGTE FEHLER: o Grössenabhängige Collision Shape -> putStuff-Methode, Werte noch nicht durchgesickert. o setHealth: maxHealth() des pawns setzen! o Asteroiden fressen Pickups: Argument in Pawn, Test darauf in Tick() von PickupSpawner. o i++ einfach ganz verhindern, ++i stattdessen. o Velocity didn-t get passed properly through the 2nd constructor. Used get/set instead. o Rand() geht bis zu riesigen Nummern! rnd() ist zwischen 0 und 1 NOTIZEN: o SUPER o Warnungsverhinderung anderswo: (void)pickedUp; // To avoid compiler warning. o friend class Pickupable; */ #ifndef _AsteroidMinable_H__ #define _AsteroidMinable_H__ #include "AsteroidMiningPrereqs.h" #include #include #include "interfaces/PickupCarrier.h" #include "interfaces/RadarViewable.h" #include "worldentities/ControllableEntity.h" #include "worldentities/ExplosionPart.h" #include "../../orxonox/worldentities/pawns/Pawn.h" namespace orxonox{ class _AsteroidMiningExport AsteroidMinable : public Pawn{ public: // @brief This constructor is for XML access only! AsteroidMinable(Context* context); // @brief Call this Constructor from other C-files. AsteroidMinable(Context* c, float size, Vector3 position, bool dS); virtual ~AsteroidMinable(); virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) override; virtual void tick(float dt) override; // @brief overloading that to prevent asteroids from taking damage from each other (domino effect etc. ) virtual void hit(Pawn* originator, const Vector3& force, const btCollisionShape* cs, float damage, float healthdamage = 0.0f, float shielddamage = 0.0f); virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, const btCollisionShape* cs, float damage, float healthdamage = 0.0f, float shielddamage = 0.0f); inline void setSize(int s){this->size = s;} inline int getSize(){return this->size;} inline void toggleShattering(bool b){this->generateSmaller = b;} inline bool doesShatter(){return this->generateSmaller;} inline void toggleDropStuff(bool b){this->dropStuff = b;} inline bool doesDropStuff(){return this->dropStuff;} protected: Context* context; int size; //!< Implies health and type of dropped pickups bool generateSmaller; //!< Whether this asteroid leaves fragments bool dropStuff; //!< Whether this asteroid yields valuable stuff // @brief Überschreibt die Methode in Pawn virtual void death(); private: bool initialised; //!< Used in relation to the constructor detour described above void registerVariables(); // @brief Helper method. virtual void putStuff(); // @brief If the option generateSmaller is enabled, individual fragments are added with this method. virtual void spawnChildren(); }; // tolua_export } // tolua_export #endif /* _AsteroidMinable_H__ */