Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 10, 2018, 3:16:51 PM (6 years ago)
Author:
merholzl
Message:

added scriptable controller

Location:
code/branches/mergeFS18
Files:
11 edited
4 copied

Legend:

Unmodified
Added
Removed
  • code/branches/mergeFS18

  • code/branches/mergeFS18/src/orxonox/worldentities/CMakeLists.txt

    r11783 r12028  
    1515  NameableStaticEntity.cc
    1616  Arrow.cc
     17  AutonomousDrone.cc
    1718)
    1819
  • code/branches/mergeFS18/src/orxonox/worldentities/ControllableEntity.cc

    r11071 r12028  
    3939
    4040#include "Scene.h"
     41#include "Level.h"
    4142#include "infos/PlayerInfo.h"
    4243#include "controllers/NewHumanController.h"
     
    6768        this->camera_ = nullptr;
    6869        this->xmlcontroller_ = nullptr;
    69         //this->controller_ = nullptr;
    7070        this->reverseCamera_ = nullptr;
    7171        this->bDestroyWhenPlayerLeft_ = false;
  • code/branches/mergeFS18/src/orxonox/worldentities/ControllableEntity.h

    r11071 r12028  
    175175            inline int getTeam() const
    176176                { return this->team_; }
     177
    177178
    178179        protected:
  • code/branches/mergeFS18/src/orxonox/worldentities/MobileEntity.cc

    r11071 r12028  
    3636
    3737#include "Scene.h"
     38#include "Level.h"
     39#include "scriptablecontroller/scriptable_controller.h"
    3840
    3941namespace orxonox
     
    7274                this->setAngularVelocity(rotationAxis.normalisedCopy() * rotationRate.valueRadians());
    7375        }
     76
     77        if(!this->id_.empty() && this->getLevel() != nullptr)
     78            this->getLevel()->getScriptableController()->registerMobileEntity(this->id_, this);
    7479    }
    7580
  • code/branches/mergeFS18/src/orxonox/worldentities/WorldEntity.cc

    r11795 r12028  
    4444#include "core/XMLPort.h"
    4545#include "Scene.h"
     46#include "Level.h"
    4647#include "collisionshapes/WorldEntityCollisionShape.h"
     48#include "scriptablecontroller/scriptable_controller.h"
    4749
    4850namespace orxonox
     
    7981        this->parentID_ = OBJECTID_UNKNOWN;
    8082        this->bDeleteWithParent_ = true;
     83        this->id_ = -1;
    8184
    8285        this->node_->setPosition(Vector3::ZERO);
     
    160163        XMLPortParamTemplate(WorldEntity, "scale3D",     setScale3D,     getScale3D,     xmlelement, mode, const Vector3&);
    161164        XMLPortParam        (WorldEntity, "scale",       setScale,       getScale,       xmlelement, mode);
     165        XMLPortParamLoadOnly(WorldEntity, "id",          setID,                xmlelement, mode);
    162166        XMLPortParamLoadOnly(WorldEntity, "lookat",      lookAt_xmlport,       xmlelement, mode);
    163167        XMLPortParamLoadOnly(WorldEntity, "direction",   setDirection_xmlport, xmlelement, mode);
     
    181185        // Attached collision shapes
    182186        XMLPortObject(WorldEntity, CollisionShape, "collisionShapes", attachCollisionShape, getAttachedCollisionShape, xmlelement, mode);
     187
     188        if(!this->id_.empty() && this->getLevel() != nullptr)
     189            this->getLevel()->getScriptableController()->registerWorldEntity(this->id_, this);
    183190    }
    184191
  • code/branches/mergeFS18/src/orxonox/worldentities/WorldEntity.h

    r11099 r12028  
    110110            virtual void changedActivity(void) override;
    111111            virtual void changedVisibility(void) override;
     112
     113            inline std::string getID(void)
     114                { return this->id_; }
     115
     116            inline void setID(std::string id)
     117                { this->id_ = id; }
    112118
    113119            virtual void setPosition(const Vector3& position) = 0;
     
    442448
    443449            btRigidBody*  physicalBody_; //!< Bullet rigid body. Everything physical is applied to this instance.
     450            std::string   id_;           //!< Used by the ScriptableController to identify objects
    444451
    445452        private:
  • code/branches/mergeFS18/src/orxonox/worldentities/pawns/CMakeLists.txt

    r11783 r12028  
    44  Pawn.cc
    55  SpaceShip.cc
     6  ScriptableControllerDrone.cc
    67  ModularSpaceShip.cc
    78  TeamBaseMatchBase.cc
  • code/branches/mergeFS18/src/orxonox/worldentities/pawns/Pawn.cc

    r11783 r12028  
    5050#include "sound/WorldSound.h"
    5151#include "core/object/ObjectListIterator.h"
     52#include "Level.h"
     53#include "scriptablecontroller/scriptable_controller.h"
    5254
    5355#include "controllers/FormationController.h"
     
    160162
    161163        XMLPortParam ( RadarViewable, "radarname", setRadarName, getRadarName, xmlelement, mode );
     164
     165        if(!this->id_.empty() && this->getLevel() != nullptr)
     166            this->getLevel()->getScriptableController()->registerPawn(this->id_, this);
    162167    }
    163168
     
    282287        {
    283288            // Health-damage cannot be absorbed by shields.
    284             // Shield-damage only reduces shield health. 
     289            // Shield-damage only reduces shield health.
    285290            // Normal damage can be (partially) absorbed by shields.
    286291
     
    302307                this->setHealth(this->health_ - (damage - shielddamage) - healthdamage);
    303308            }
     309            this->getLevel()->getScriptableController()->pawnHit(this, originator, this->health_, this->shieldHealth_);
    304310
    305311            this->lastHitOriginator_ = originator;
     
    402408            }
    403409        }
     410
     411        this->getLevel()->getScriptableController()->pawnKilled(this);
    404412    }
    405413    void Pawn::goWithStyle()
     
    625633        {
    626634            // delete all debug models
    627             for(Model* model : debugWeaponSlotModels_) 
     635            for(Model* model : debugWeaponSlotModels_)
    628636            {
    629637                model->destroy();
  • code/branches/mergeFS18/src/orxonox/worldentities/pawns/SpaceShip.cc

    r11083 r12028  
    163163            engine->run(dt);
    164164
    165         if (this->hasLocalController())
     165        if (this->hasLocalController() || true)
    166166        {
    167167            // If not in mouse look apply the angular movement to the ship.
  • code/branches/mergeFS18/src/orxonox/worldentities/pawns/SpaceShip.h

    r11052 r12028  
    117117                { this->steering_.y += value.x; }
    118118
     119            inline void moveFrontBack(float value)
     120                { this->moveFrontBack(Vector2(value, 0)); }
     121            inline void moveRightLeft(float value)
     122                { this->moveRightLeft(Vector2(value, 0)); }
     123            inline void moveUpDown(float value)
     124                { this->moveUpDown(Vector2(value, 0)); }   
     125
    119126            virtual void rotateYaw(const Vector2& value); // Rotate in yaw direction.
    120127            virtual void rotatePitch(const Vector2& value); // Rotate in pitch direction.
Note: See TracChangeset for help on using the changeset viewer.