Changeset 11690 for code/branches/Presentation_HS17/src
- Timestamp:
- Dec 18, 2017, 12:40:00 PM (7 years ago)
- Location:
- code/branches/Presentation_HS17
- Files:
-
- 13 deleted
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/Presentation_HS17
- Property svn:mergeinfo changed
/code/branches/Waypoints_HS17 reverse-merged: 11496,11523,11539,11559,11582,11603,11633,11655,11657,11659,11661,11687 /code/branches/ScriptableController_HS17 removed
- Property svn:mergeinfo changed
-
code/branches/Presentation_HS17/src/libraries/core/BaseObject.h
r11686 r11690 58 58 class Gametype; 59 59 class Level; 60 class ScriptableController;61 60 62 61 /// The BaseObject is the parent of all classes representing an instance in the game. … … 192 191 193 192 static void loadAllEventStates(Element& xmlelement, XMLPort::Mode mode, BaseObject* object, Identifier* identifier); 194 195 193 196 194 protected: -
code/branches/Presentation_HS17/src/libraries/tools/Timer.cc
r11686 r11690 158 158 } 159 159 160 Timer::Timer(float interval, bool bLoop, std::function<void ()> func, bool bKillAfterCall)161 {162 this->init();163 RegisterObject(Timer);164 165 this->setTimer(interval, bLoop, func, bKillAfterCall);166 }167 168 160 /** 169 161 @brief Initializes the Timer … … 201 193 this->executor_ = executor; 202 194 this->bActive_ = true; 203 this->isStdFunction_ = false;204 195 205 196 this->time_ = this->interval_; 206 197 this->bKillAfterCall_ = bKillAfterCall; 207 198 208 if(executor != nullptr) 209 executor->getFunctor()->setSafeMode(true); 210 } 211 212 void Timer::setTimer(float interval, bool bLoop, std::function<void ()> func, bool bKillAfterCall) 213 { 214 // Without the cast, the call would be ambiguous, because nullptr is castable to 215 // both, ExecutorPtr and std::function. 216 this->setTimer(interval, bLoop, static_cast<ExecutorPtr>(nullptr), bKillAfterCall); 217 this->function_ = func; 218 this->isStdFunction_ = true; 199 executor->getFunctor()->setSafeMode(true); 219 200 } 220 201 … … 226 207 bool temp = this->bKillAfterCall_; // to avoid errors with bKillAfterCall_=false and an exutors which destroy the timer 227 208 228 if(this->isStdFunction_) 229 this->function_(); 230 else 231 (*this->executor_)(); 209 (*this->executor_)(); 232 210 233 211 if (temp) -
code/branches/Presentation_HS17/src/libraries/tools/Timer.h
r11686 r11690 108 108 109 109 Timer(float interval, bool bLoop, const ExecutorPtr& executor, bool bKillAfterCall = false); 110 Timer(float interval, bool bLoop, std::function<void (void)> func, bool bKillAfterCall = false);111 110 112 111 void setTimer(float interval, bool bLoop, const ExecutorPtr& executor, bool bKillAfterCall = false); 113 void setTimer(float interval, bool bLoop, std::function<void (void)> func, bool bKillAfterCall = false);114 112 115 113 void run(); … … 155 153 156 154 ExecutorPtr executor_; //!< The executor of the function that will be called when the time expires 157 std::function<void (void)> function_;158 155 159 bool isStdFunction_;160 156 long long interval_; //!< The time-interval in micro seconds 161 157 bool bLoop_; //!< If true, the executor gets called every @a interval seconds -
code/branches/Presentation_HS17/src/modules/overlays/hud/CMakeLists.txt
r11685 r11690 11 11 HUDEnemyHealthBar.cc 12 12 HUDEnemyShieldBar.cc 13 HUDWaypoints.cc14 13 HUDWeaponMode.cc 15 14 HUDWeapon.cc -
code/branches/Presentation_HS17/src/modules/questsystem/Quest.cc
r11071 r11690 80 80 XMLPortObject(Quest, QuestEffect, "fail-effects", addFailEffect, getFailEffect, xmlelement, mode); 81 81 XMLPortObject(Quest, QuestEffect, "complete-effects", addCompleteEffect, getCompleteEffect, xmlelement, mode); 82 //XMLPortObject(Quest, Worldentity, "arrowtarget", addArrowTarget, getArrowTarget, xmlelement, mode); 82 83 83 84 QuestManager::getInstance().registerQuest(this); // Registers the Quest with the QuestManager. 84 85 } 86 87 88 /*bool Quest::addArrowTarget(Quest* quest){ 89 90 assert(quest); 91 92 93 }*/ 94 95 85 96 86 97 /** -
code/branches/Presentation_HS17/src/orxonox/CMakeLists.txt
r11686 r11690 52 52 ADD_SUBDIRECTORY(items) 53 53 ADD_SUBDIRECTORY(overlays) 54 ADD_SUBDIRECTORY(scriptablecontroller)55 54 ADD_SUBDIRECTORY(sound) 56 55 ADD_SUBDIRECTORY(weaponsystem) -
code/branches/Presentation_HS17/src/orxonox/Level.cc
r11686 r11690 42 42 #include "overlays/OverlayGroup.h" 43 43 #include "LevelManager.h" 44 #include "scriptablecontroller/scriptable_controller.h"45 44 46 45 namespace orxonox … … 57 56 this->xmlfilename_ = this->getFilename(); 58 57 this->xmlfile_ = nullptr; 59 this->controller_.reset(new ScriptableController());60 58 } 61 59 … … 80 78 XMLPortParam(Level, "plugins", setPluginsString, getPluginsString, xmlelement, mode); 81 79 XMLPortParam(Level, "gametype", setGametypeString, getGametypeString, xmlelement, mode).defaultValues("Gametype"); 82 83 XMLPortParamLoadOnly(Level, "script", setScript, xmlelement, mode);84 80 85 81 XMLPortObject(Level, MeshLodInformation, "lodinformation", addLodInfo, getLodInfo, xmlelement, mode); -
code/branches/Presentation_HS17/src/orxonox/Level.h
r11686 r11690 42 42 namespace orxonox 43 43 { 44 class ScriptableController;45 46 44 class _OrxonoxExport Level : public BaseObject, public Synchronisable, public Context 47 45 { … … 56 54 57 55 MeshLodInformation* getLodInfo(std::string meshName) const; 58 59 inline ScriptableController *getScriptableController(void)60 { return this->controller_.get(); }61 62 inline const std::string &getScript(void)63 { return this->level_script_; }64 56 65 57 … … 86 78 void networkcallback_applyXMLFile(); 87 79 88 inline void setScript(const std::string &script)89 { this->level_script_ = script; }90 91 92 80 std::string pluginsString_; 93 81 std::list<PluginReference*> plugins_; 82 94 83 std::string gametype_; 95 84 std::string xmlfilename_; … … 97 86 std::list<BaseObject*> objects_; 98 87 std::map<std::string,MeshLodInformation*> lodInformation_; 99 100 std::unique_ptr<ScriptableController> controller_;101 std::string level_script_;102 88 }; 103 89 } -
code/branches/Presentation_HS17/src/orxonox/controllers/CMakeLists.txt
r11685 r11690 19 19 FightingController.cc 20 20 MasterController.cc 21 AutonomousDroneController.cc22 ArrowController.cc23 21 ) -
code/branches/Presentation_HS17/src/orxonox/graphics/Model.cc
r11685 r11690 73 73 74 74 XMLPortParam(Model, "lodLevel", setLodLevel, getLodLevel, xmlelement, mode); 75 75 76 XMLPortParam(Model, "mesh", setMeshSource, getMeshSource, xmlelement, mode); 76 77 XMLPortParam(Model, "renderQueueGroup", setRenderQueueGroup, getRenderQueueGroup, xmlelement, mode); -
code/branches/Presentation_HS17/src/orxonox/infos/GametypeInfo.cc
r11686 r11690 43 43 #include "interfaces/GametypeMessageListener.h" 44 44 #include "interfaces/NotificationListener.h" 45 #include "scriptablecontroller/scriptable_controller.h"46 #include "Level.h"47 45 48 46 #include "PlayerInfo.h" … … 78 76 this->spawned_ = false; 79 77 this->readyToSpawn_ = false; 80 this->isFirstSpawn_ = true;81 78 82 79 this->registerVariables(); … … 313 310 { 314 311 if(this->hasStarted() && !this->hasEnded()) 312 315 313 this->setSpawnedHelper(player, true); 316 }317 318 // TODO We might want to handle the subsequent spawns as well somehow319 if(player->isHumanPlayer() && player->isLocalPlayer() && this->isFirstSpawn_)320 {321 this->isFirstSpawn_ = false;322 this->getLevel()->getScriptableController()->setPlayer(player);323 324 // This handles paths relative to the 'level' directory325 std::string script = this->getLevel()->getScript();326 if(script.at(0) != '/')327 script = "../levels/" + script; // Not very dynamic328 this->getLevel()->getScriptableController()->runScript(script);329 314 } 330 315 } -
code/branches/Presentation_HS17/src/orxonox/infos/GametypeInfo.h
r11686 r11690 83 83 inline bool isStartCountdownRunning() const 84 84 { return this->bStartCountdownRunning_; } 85 85 86 86 void changedStartCountdownRunning(void); // Is called when the start countdown has been either started or stopped. 87 87 … … 168 168 bool spawned_; //!< Whether the local Player is currently spawned. 169 169 bool readyToSpawn_; //!< Whether the local Player is ready to spawn. 170 bool isFirstSpawn_;171 170 }; 172 171 } -
code/branches/Presentation_HS17/src/orxonox/infos/HumanPlayer.cc
r11686 r11690 38 38 #include "gametypes/Gametype.h" 39 39 #include "overlays/OverlayGroup.h" 40 #include "Level.h"41 #include "scriptablecontroller/scriptable_controller.h"42 40 43 41 namespace orxonox -
code/branches/Presentation_HS17/src/orxonox/items/ShipPart.cc
r11686 r11690 42 42 #include "items/PartDestructionEvent.h" 43 43 #include "chat/ChatManager.h" 44 #include "Level.h"45 #include "scriptablecontroller/scriptable_controller.h"46 44 47 45 … … 217 215 } 218 216 } 219 220 // This is a bit hacky, but it takes away damage control from the pawn, so it has to handle221 // that as well.222 this->getLevel()->getScriptableController()->pawnHit(parent_, originator, parent_->getHealth(), parent_->getShieldHealth());223 224 217 if (this->health_ < 0) 225 218 this->death(); -
code/branches/Presentation_HS17/src/orxonox/worldentities/CMakeLists.txt
r11685 r11690 13 13 ExplosionPart.cc 14 14 Actionpoint.cc 15 AutonomousDrone.cc16 Arrow.cc17 15 NameableStaticEntity.cc 18 16 ) -
code/branches/Presentation_HS17/src/orxonox/worldentities/ControllableEntity.cc
r11686 r11690 39 39 40 40 #include "Scene.h" 41 #include "Level.h"42 41 #include "infos/PlayerInfo.h" 43 42 #include "controllers/NewHumanController.h" … … 68 67 this->camera_ = nullptr; 69 68 this->xmlcontroller_ = nullptr; 69 //this->controller_ = nullptr; 70 70 this->reverseCamera_ = nullptr; 71 71 this->bDestroyWhenPlayerLeft_ = false; -
code/branches/Presentation_HS17/src/orxonox/worldentities/ControllableEntity.h
r11686 r11690 175 175 inline int getTeam() const 176 176 { return this->team_; } 177 178 177 179 178 protected: -
code/branches/Presentation_HS17/src/orxonox/worldentities/MobileEntity.cc
r11686 r11690 36 36 37 37 #include "Scene.h" 38 #include "Level.h"39 #include "scriptablecontroller/scriptable_controller.h"40 38 41 39 namespace orxonox … … 74 72 this->setAngularVelocity(rotationAxis.normalisedCopy() * rotationRate.valueRadians()); 75 73 } 76 77 if(!this->id_.empty() && this->getLevel() != nullptr)78 this->getLevel()->getScriptableController()->registerMobileEntity(this->id_, this);79 74 } 80 75 -
code/branches/Presentation_HS17/src/orxonox/worldentities/WorldEntity.cc
r11686 r11690 44 44 #include "core/XMLPort.h" 45 45 #include "Scene.h" 46 #include "Level.h"47 46 #include "collisionshapes/WorldEntityCollisionShape.h" 48 #include "scriptablecontroller/scriptable_controller.h"49 47 50 48 namespace orxonox … … 81 79 this->parentID_ = OBJECTID_UNKNOWN; 82 80 this->bDeleteWithParent_ = true; 83 this->id_ = -1;84 81 85 82 this->node_->setPosition(Vector3::ZERO); … … 163 160 XMLPortParamTemplate(WorldEntity, "scale3D", setScale3D, getScale3D, xmlelement, mode, const Vector3&); 164 161 XMLPortParam (WorldEntity, "scale", setScale, getScale, xmlelement, mode); 165 XMLPortParamLoadOnly(WorldEntity, "id", setID, xmlelement, mode);166 162 XMLPortParamLoadOnly(WorldEntity, "lookat", lookAt_xmlport, xmlelement, mode); 167 163 XMLPortParamLoadOnly(WorldEntity, "direction", setDirection_xmlport, xmlelement, mode); … … 185 181 // Attached collision shapes 186 182 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);190 183 } 191 184 -
code/branches/Presentation_HS17/src/orxonox/worldentities/WorldEntity.h
r11686 r11690 110 110 virtual void changedActivity(void) override; 111 111 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; }118 112 119 113 virtual void setPosition(const Vector3& position) = 0; … … 448 442 449 443 btRigidBody* physicalBody_; //!< Bullet rigid body. Everything physical is applied to this instance. 450 std::string id_; //!< Used by the ScriptableController to identify objects451 444 452 445 private: -
code/branches/Presentation_HS17/src/orxonox/worldentities/pawns/Pawn.cc
r11686 r11690 50 50 #include "sound/WorldSound.h" 51 51 #include "core/object/ObjectListIterator.h" 52 #include "Level.h"53 #include "scriptablecontroller/scriptable_controller.h"54 52 55 53 #include "controllers/FormationController.h" … … 162 160 163 161 XMLPortParam ( RadarViewable, "radarname", setRadarName, getRadarName, xmlelement, mode ); 164 165 if(!this->id_.empty() && this->getLevel() != nullptr)166 this->getLevel()->getScriptableController()->registerPawn(this->id_, this);167 162 } 168 163 … … 287 282 { 288 283 // Health-damage cannot be absorbed by shields. 289 // Shield-damage only reduces shield health. 284 // Shield-damage only reduces shield health. 290 285 // Normal damage can be (partially) absorbed by shields. 291 286 … … 307 302 this->setHealth(this->health_ - (damage - shielddamage) - healthdamage); 308 303 } 309 this->getLevel()->getScriptableController()->pawnHit(this, originator, this->health_, this->shieldHealth_);310 304 311 305 this->lastHitOriginator_ = originator; … … 408 402 } 409 403 } 410 411 this->getLevel()->getScriptableController()->pawnKilled(this);412 404 } 413 405 void Pawn::goWithStyle() … … 633 625 { 634 626 // delete all debug models 635 for(Model* model : debugWeaponSlotModels_) 627 for(Model* model : debugWeaponSlotModels_) 636 628 { 637 629 model->destroy();
Note: See TracChangeset
for help on using the changeset viewer.