Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

merged HS17 into FS18

Location:
code/branches/ScriptableController_FS18
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/ScriptableController_FS18

  • code/branches/ScriptableController_FS18/src/orxonox/infos/GametypeInfo.cc

    r11099 r11855  
    4343#include "interfaces/GametypeMessageListener.h"
    4444#include "interfaces/NotificationListener.h"
     45#include "scriptablecontroller/scriptable_controller.h"
     46#include "Level.h"
    4547
    4648#include "PlayerInfo.h"
     
    7678        this->spawned_ = false;
    7779        this->readyToSpawn_ = false;
     80        this->isFirstSpawn_ = true;
    7881
    7982        this->registerVariables();
     
    310313        {
    311314            if(this->hasStarted() && !this->hasEnded())
    312 
    313315                this->setSpawnedHelper(player, true);
     316        }
     317
     318        // TODO We might want to handle the subsequent spawns as well somehow
     319        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' directory
     325            std::string script = this->getLevel()->getScript();
     326            if(script.at(0) != '/')
     327                script = "../levels/" + script; // Not very dynamic
     328            this->getLevel()->getScriptableController()->runScript(script);
    314329        }
    315330    }
Note: See TracChangeset for help on using the changeset viewer.