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:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/mergeFS18

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

    r11099 r12028  
    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();
     
    296299            this->setReadyToSpawnHelper(player, false);
    297300            this->setSpawnedHelper(player, false);
     301
    298302        }
    299303    }
     
    310314        {
    311315            if(this->hasStarted() && !this->hasEnded())
    312 
    313316                this->setSpawnedHelper(player, true);
     317        }
     318
     319        // TODO We might want to handle the subsequent spawns as well somehow
     320        if(player->isHumanPlayer() && player->isLocalPlayer()) //&& this->isFirstSpawn_)
     321        {
     322            this->isFirstSpawn_ = false;
     323            this->getLevel()->getScriptableController()->setPlayer(player);
     324
     325            // This handles paths relative to the 'level' directory
     326            std::string script = this->getLevel()->getScript();
     327            if(script.at(0) != '/')
     328                script = "../levels/" + script; // Not very dynamic
     329            this->getLevel()->getScriptableController()->runScript(script);
    314330        }
    315331    }
     
    345361            {
    346362                // Display "Press [Fire] to start the match" if the game has not yet ended.
    347                 if(!this->hasEnded())
     363                if(!this->hasEnded()){
    348364                    NotificationListener::sendNotification("Press [Fire] to start the match", GametypeInfo::NOTIFICATION_SENDER, NotificationMessageType::info, NotificationSendMode::network, player->getClientID());
     365               
     366                    //this->getLevel()->getScriptableController()->setPlayer(player);
     367
     368                    // This handles paths relative to the 'level' directory
     369                    //std::string script = this->getLevel()->getScript();
     370                    //if(script.at(0) != '/')
     371                    //script = "../levels/" + script; // Not very dynamic
     372                    //this->getLevel()->getScriptableController()->runScript(script);
     373                }
    349374                // Else display "Game has ended".
    350375                else
Note: See TracChangeset for help on using the changeset viewer.