hedgewars/uScript.pas
changeset 12576 1fb961480b3c
parent 12536 e54039ea3934
child 12596 c9711561f947
equal deleted inserted replaced
12575:0c5ce463949b 12576:1fb961480b3c
  3158 end;
  3158 end;
  3159 
  3159 
  3160 procedure SetGlobals;
  3160 procedure SetGlobals;
  3161 begin
  3161 begin
  3162 ScriptSetInteger('TurnTimeLeft', TurnTimeLeft);
  3162 ScriptSetInteger('TurnTimeLeft', TurnTimeLeft);
       
  3163 ScriptSetInteger('ReadyTimeLeft', ReadyTimeLeft);
  3163 ScriptSetInteger('GameTime', GameTicks);
  3164 ScriptSetInteger('GameTime', GameTicks);
  3164 ScriptSetInteger('TotalRounds', TotalRounds);
  3165 ScriptSetInteger('TotalRounds', TotalRounds);
  3165 ScriptSetInteger('WaterLine', cWaterLine);
  3166 ScriptSetInteger('WaterLine', cWaterLine);
  3166 if isCursorVisible and (not bShowAmmoMenu) then
  3167 if isCursorVisible and (not bShowAmmoMenu) then
  3167     begin
  3168     begin
  3204 // Otherwise globals might be changed by Lua, but then unexpectatly overwritten by engine when a ScriptCall is triggered by whatever Lua is doing!
  3205 // Otherwise globals might be changed by Lua, but then unexpectatly overwritten by engine when a ScriptCall is triggered by whatever Lua is doing!
  3205 // Sure, one could work around that in engine (e.g. by setting writable globals in SetGlobals only when their engine-side value has actually changed since SetGlobals was called the last time...), but things just get messier and messier then.
  3206 // Sure, one could work around that in engine (e.g. by setting writable globals in SetGlobals only when their engine-side value has actually changed since SetGlobals was called the last time...), but things just get messier and messier then.
  3206 // It is inconsistent anyway to have some globals be read-only and others not with no indication whatsoever.
  3207 // It is inconsistent anyway to have some globals be read-only and others not with no indication whatsoever.
  3207 // -- sheepluva
  3208 // -- sheepluva
  3208 TurnTimeLeft:= ScriptGetInteger('TurnTimeLeft');
  3209 TurnTimeLeft:= ScriptGetInteger('TurnTimeLeft');
       
  3210 ReadyTimeLeft:= ScriptGetInteger('ReadyTimeLeft');
  3209 end;
  3211 end;
  3210 
  3212 
  3211 procedure ScriptCall(fname : shortstring);
  3213 procedure ScriptCall(fname : shortstring);
  3212 begin
  3214 begin
  3213 if (not ScriptLoaded) or (not ScriptExists(fname)) then
  3215 if (not ScriptLoaded) or (not ScriptExists(fname)) then