- Timestamp:
- Sep 17, 2010, 9:41:17 PM (14 years ago)
- Location:
- code/trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/data/levels/Fight in our Back.oxw
r7404 r7463 69 69 > 70 70 71 <Script code="showGUI NotificationLayer false true" />71 <Script code="showGUI NotificationLayer false true" needsGraphics="true" /> 72 72 73 73 <!--Light: noch zu aendern --> -
code/trunk/data/levels/Quest_PirateAttack.oxw
r7404 r7463 35 35 > 36 36 37 <Script code="showGUI NotificationLayer false true" />37 <Script code="showGUI NotificationLayer false true" needsGraphics="true" /> 38 38 39 39 <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" /> -
code/trunk/data/levels/notifications.oxw
r7404 r7463 19 19 > 20 20 21 <Script code="showGUI NotificationLayer false true" />21 <Script code="showGUI NotificationLayer false true" needsGraphics="true" /> 22 22 23 23 <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" /> -
code/trunk/data/levels/old/princessaeryn.oxw
r7404 r7463 18 18 > 19 19 20 <Script code="showGUI NotificationLayer false true" />20 <Script code="showGUI NotificationLayer false true" needsGraphics="true" /> 21 21 22 22 <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" /> -
code/trunk/data/levels/old/questsystem.oxw
r7404 r7463 14 14 > 15 15 16 <Script code="showGUI NotificationLayer false true" />16 <Script code="showGUI NotificationLayer false true" needsGraphics="true" /> 17 17 18 18 <GlobalQuest id="b80c2c60-e62c-4637-80f8-5aa18dc93b34"> -
code/trunk/data/levels/princessaeryn.oxw
r7405 r7463 24 24 > 25 25 26 <Script code="showGUI NotificationLayer false true" />26 <Script code="showGUI NotificationLayer false true" needsGraphics="true" /> 27 27 28 28 <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" /> -
code/trunk/src/modules/notifications/Notification.cc
r7462 r7463 114 114 bool Notification::send(unsigned int clientId, const std::string & sender = NotificationManager::NONE) 115 115 { 116 COUT(0) << "MUP: " << Host::getPlayerID() << "|" << clientId << std::endl; 116 117 if(GameMode::isStandalone() || Host::getPlayerID() == clientId) 117 118 { -
code/trunk/src/modules/objects/Script.cc
r7410 r7463 32 32 #include "core/CoreIncludes.h" 33 33 #include "core/EventIncludes.h" 34 #include "core/GameMode.h" 34 35 #include "core/LuaState.h" 35 36 #include "core/XMLPort.h" … … 57 58 this->luaState_ = NULL; 58 59 this->remainingExecutions_ = Script::INF; 60 this->mode_ = ScriptMode::normal; 61 this->onLoad_ = true; 62 this->times_ = Script::INF; 63 this->needsGraphics_ = false; 59 64 60 65 } … … 86 91 XMLPortParam(Script, "onLoad", setOnLoad, isOnLoad, xmlelement, mode).defaultValues(true); 87 92 XMLPortParam(Script, "times", setTimes, getTimes, xmlelement, mode).defaultValues(Script::INF); 93 XMLPortParam(Script, "needsGraphics", setNeedsGraphics, getNeedsGraphics, xmlelement, mode).defaultValues(false); 88 94 89 95 XMLPortEventSink(Script, BaseObject, "trigger", trigger, xmlelement, mode); … … 127 133 { 128 134 if(this->times_ != Script::INF && this->remainingExecutions_ == 0) 135 return; 136 137 // If the code needs graphics to be executed but the GameMode doesn't show graphics the code isn't executed. 138 if(this->needsGraphics_ && !GameMode::showsGraphics()) 129 139 return; 130 140 -
code/trunk/src/modules/objects/Script.h
r7407 r7463 55 55 'mode': The mode, specifying whether the set code should be executed the normal way ('normal') or in lua ('lua'). Default is 'normal'. 56 56 'onLoad': Whether the code is executed upon loading (creation) of this object. Default is true. 57 'needsGraphics': Whether the code needs graphics to be executed or not. Default is false. 57 58 58 59 Here are two examples illustrating the usage: 59 60 @code 60 <Script code="showGUI QuestGUI" />61 <Script code="showGUI QuestGUI" needsGraphics=true /> 61 62 @endcode 62 This would show the QuestGUI opon creation of the object. The mode is 'normal', not specified here since that is the default, also onLoad is true, also not specified, since it is the default as well. 63 This would show the QuestGUI opon creation of the object. The mode is 'normal', not specified here since that is the default, also onLoad is true, also not specified, since it is the default as well. Also needsGraphics is set to true because showGUI needs graphics to work. 63 64 64 65 @code 65 <Script code="hideGUI QuestGUI" mode="normal" onLoad="false" >66 <Script code="hideGUI QuestGUI" mode="normal" onLoad="false" needsGraphics=true > 66 67 <events> 67 68 <trigger> … … 71 72 </Script> 72 73 @endcode 73 This would hide the QuestGUI as soon as a Pawn got in range of the DistanceTrigger. The mode is 'normal', it is specified here, but could be ommitted as well, since it is the default. OnLoad is false, that is why it can't be ommitted. 74 This would hide the QuestGUI as soon as a Pawn got in range of the DistanceTrigger. The mode is 'normal', it is specified here, but could be ommitted as well, since it is the default. OnLoad is false, that is why it can't be ommitted. Also needsGraphics is set to true because showGUI needs graphics to work. 74 75 @author 75 76 Benjamin Knecht … … 125 126 { return this->times_; } 126 127 128 /** 129 @brief Set whether the code to be executed needs graphics to work. 130 @param needsGraphics True if the cde needs graphics to be executed properly. 131 */ 132 void setNeedsGraphics(bool needsGraphics) 133 { this->needsGraphics_ = needsGraphics; } 134 /** 135 @brief Get whether the code to be executed needs graphics to work. 136 @return Returns true if the code needs graphic, false if not. 137 */ 138 bool getNeedsGraphics(void) 139 { return this->needsGraphics_; } 140 127 141 private: 128 142 //! Static variables to avoid magic strings. … … 135 149 bool onLoad_; //!< Whether the Scripts code is executed upon loading (creation) of this Script. 136 150 int times_; //!< The number of times the Scripts code is executed at the most. -1 denotes infinity. 151 bool needsGraphics_; //!< Whether the code to be executed needs graphics. 137 152 138 153 LuaState* luaState_; //!< The LuaState to execute the code in lua.
Note: See TracChangeset
for help on using the changeset viewer.