Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 15, 2014, 3:53:11 PM (11 years ago)
Author:
noep
Message:

Expanded functionality of PartDestructionEvents, fixed cursor not showing when flying a ModularSpaceShip

Location:
code/branches/modularships/src/orxonox/worldentities
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/modularships/src/orxonox/worldentities/StaticEntity.cc

    r9667 r10058  
    3434#include "util/OrxAssert.h"
    3535#include "core/CoreIncludes.h"
     36#include "worldentities/BigExplosion.h"
    3637
    3738namespace orxonox
     
    115116        worldTrans.setRotation(btQuaternion(node_->getOrientation().x, node_->getOrientation().y, node_->getOrientation().z, node_->getOrientation().w));
    116117    }
     118
    117119}
  • code/branches/modularships/src/orxonox/worldentities/pawns/ModularSpaceShip.cc

    r10055 r10058  
    4040
    4141#include "items/ShipPart.h"
     42#include "items/Engine.h"
    4243#include "worldentities/StaticEntity.h"
    4344#include "collisionshapes/WorldEntityCollisionShape.h"
     
    230231    /**
    231232    @brief
     233        Looks for an attached ShipPart with a certain name.
     234    @param name
     235        The name of the ShipPart to be returned.
     236    @return
     237        Pointer to the ShipPart with the given name, or NULL if not found.
     238    */
     239    ShipPart* ModularSpaceShip::getShipPartByName(std::string name)
     240    {
     241        for(std::vector<ShipPart*>::iterator it = this->partList_.begin(); it != this->partList_.end(); ++it)
     242        {
     243            if(orxonox_cast<ShipPart*>(*it)->getName() == name)
     244            {
     245                return orxonox_cast<ShipPart*>(*it);
     246            }
     247        }
     248        orxout(internal_warning) << "Couldn't find ShipPart with name \"" << name << "\"." << endl;
     249        return NULL;
     250    }
     251
     252    /**
     253    @brief
    232254        Check whether the SpaceShip has a particular Engine.
    233255    @param engine
     
    285307    /**
    286308    @brief
     309        Looks for an attached Engine with a certain name.
     310    @param name
     311        The name of the engine to be returned.
     312    @return
     313        Pointer to the engine with the given name, or NULL if not found.
     314    */
     315    Engine* ModularSpaceShip::getEngineByName(std::string name)
     316    {
     317        for(std::vector<Engine*>::iterator it = this->engineList_.begin(); it != this->engineList_.end(); ++it)
     318        {
     319            if(orxonox_cast<Engine*>(*it)->getName() == name)
     320            {
     321                return orxonox_cast<Engine*>(*it);
     322            }
     323        }
     324        orxout(internal_warning) << "Couldn't find Engine with name \"" << name << "\"." << endl;
     325        return NULL;
     326    }
     327
     328    /**
     329    @brief
    287330        Detaches a child WorldEntity from this instance.
    288331    */
     
    297340
    298341        // collision shapes
    299         orxout() << "MSS: detach()" << endl;
    300342
    301343        //this->printBtChildShapes((btCompoundShape*)(this->getWorldEntityCollisionShape()->getCollisionShape()), 2, 0);
     
    314356
    315357        object->notifyDetached();
    316         orxout() << "MSS: detach() completed." << endl;
    317358    }
    318359}
  • code/branches/modularships/src/orxonox/worldentities/pawns/ModularSpaceShip.h

    r10055 r10058  
    117117            void addShipPart(ShipPart* part);
    118118            ShipPart* getShipPart(unsigned int index);
     119            ShipPart* getShipPartByName(std::string name);
    119120            bool hasShipPart(ShipPart* part) const;
    120121            void removeShipPart(ShipPart* part);
    121122
     123            inline void setRotationThrust(float val)
     124                { this->rotationThrust_ = val; }
     125            inline float getRotationThrust()
     126                { return this->rotationThrust_; }
     127
     128            Engine* getEngineByName(std::string name);
    122129            void detach(WorldEntity* object);
    123130
  • code/branches/modularships/src/orxonox/worldentities/pawns/SpaceShip.h

    r9667 r10058  
    270270            float stallSpeed_; //!< The forward speed where no more lift is added.
    271271
     272            std::vector<Engine*> engineList_; //!< The list of all Engines mounted on this SpaceShip.
     273
    272274        private:
    273275            void registerVariables();
     
    284286            void backupCamera(); // Save the original position and orientation of the camera.
    285287            void resetCamera(); // Reset the camera to its original position.
    286 
    287             std::vector<Engine*> engineList_; //!< The list of all Engines mounted on this SpaceShip.
    288288
    289289            Timer timer_;                          //!< Timer for the cooldown duration.
Note: See TracChangeset for help on using the changeset viewer.