Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 12, 2018, 2:07:03 PM (7 years ago)
Author:
adamc
Message:

merged HS17 into FS18

Location:
code/branches/ScriptableController_FS18
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • code/branches/ScriptableController_FS18

  • code/branches/ScriptableController_FS18/src/orxonox/worldentities/ControllableEntity.cc

    r11071 r11855  
    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/ScriptableController_FS18/src/orxonox/worldentities/ControllableEntity.h

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

    r11071 r11855  
    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/ScriptableController_FS18/src/orxonox/worldentities/WorldEntity.cc

    r11083 r11855  
    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/ScriptableController_FS18/src/orxonox/worldentities/WorldEntity.h

    r11099 r11855  
    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/ScriptableController_FS18/src/orxonox/worldentities/pawns/Pawn.cc

    r11783 r11855  
    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();
Note: See TracChangeset for help on using the changeset viewer.