Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 30, 2018, 2:37:02 PM (6 years ago)
Author:
patricwi
Message:

Merged Scriptable Controller

Location:
code/branches/PresentationFS18
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/PresentationFS18

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

    r11099 r12016  
    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/PresentationFS18/src/orxonox/infos/GametypeInfo.h

    r11720 r12016  
    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/PresentationFS18/src/orxonox/infos/HumanPlayer.cc

    r11071 r12016  
    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.