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:
4 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
  • code/branches/mergeFS18/src/orxonox/infos/GametypeInfo.h

    r11720 r12028  
    8383            inline bool isStartCountdownRunning() const
    8484                { return this->bStartCountdownRunning_; }
     85
    8586            void changedStartCountdownRunning(void); // Is called when the start countdown has been either started or stopped.
    8687
     
    166167            bool spawned_; //!< Whether the local Player is currently spawned.
    167168            bool readyToSpawn_; //!< Whether the local Player is ready to spawn.
     169            bool isFirstSpawn_;
    168170    };
    169171}
  • code/branches/mergeFS18/src/orxonox/infos/HumanPlayer.cc

    r11071 r12028  
    3838#include "gametypes/Gametype.h"
    3939#include "overlays/OverlayGroup.h"
     40#include "Level.h"
     41#include "scriptablecontroller/scriptable_controller.h"
    4042
    4143namespace orxonox
Note: See TracChangeset for help on using the changeset viewer.