Changeset 7482 for code/trunk/src/modules/objects/Script.h
- Timestamp:
- Sep 23, 2010, 11:12:22 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/modules/objects/Script.h
r7474 r7482 1 1 2 /* 2 3 * ORXONOX - the hottest 3D action shooter ever to exist … … 36 37 37 38 #include "core/BaseObject.h" 38 #include "tools/interfaces/Tickable.h"39 39 #include "network/synchronisable/Synchronisable.h" 40 40 #include "network/ClientConnectionListener.h" … … 83 83 Damian 'Mozork' Frick 84 84 */ 85 class _ObjectsExport Script : public BaseObject, public Synchronisable, public ClientConnectionListener , public Tickable85 class _ObjectsExport Script : public BaseObject, public Synchronisable, public ClientConnectionListener 86 86 { 87 87 public: … … 92 92 virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode); //!< Creates a port that can be used to channel events and react to them. 93 93 94 virtual void tick(float dt);95 96 94 bool trigger(bool triggered, BaseObject* trigger); //!< Is called when an event comes in trough the event port. 97 95 void execute(unsigned int clientId, bool fromCallback = false); //!< Executes the Scripts code for the input client, depending on the mode. 96 static void executeHelper(const std::string& code, const std::string& mode, bool needsGraphics); //!< Helper method that is used to reach this Script object on other clients. 98 97 99 98 /** … … 160 159 { return this->forAll_; } 161 160 162 virtual void clientConnected(unsigned int clientId); 161 virtual void clientConnected(unsigned int clientId); //!< Callback that is called when a new client has connected. 163 162 virtual void clientDisconnected(unsigned int clientid) {} 164 163 … … 171 170 std::string code_; //!< The code that is executed by this Script. 172 171 ScriptMode::Value mode_; //!< The mode the Script is in. Determines whether the code is executed the normal way or in lua. 172 std::string modeStr_; //!< The mode the Script is in, as a string. Is used for networking purposes. 173 173 bool onLoad_; //!< Whether the Scripts code is executed upon loading (creation) of this Script. 174 174 int times_; //!< The number of times the Scripts code is executed at the most. -1 denotes infinity. … … 176 176 bool forAll_; //!< Whether the code is executed for all players (in a multiplayer setup) or just for the one triggering the Script. 177 177 178 std::string modeStr_; 179 180 std::vector<unsigned int> clientCallbacks_; 181 float counter_; 182 183 LuaState* luaState_; //!< The LuaState to execute the code in lua. 178 static LuaState* LUA_STATE; //!< The LuaState to execute the code in lua. 184 179 int remainingExecutions_; //!< The number of remainign executions. -1 denotes infinity. 185 180 186 void registerVariables(void); 187 void modeChanged(); 181 void modeChanged(); //!< Sets the mode to the mode specified in this->modeStr_. 188 182 189 183 /**
Note: See TracChangeset
for help on using the changeset viewer.