mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-10 01:09:50 +00:00
Avoid redundant per-frame calls to getDbProp in outpost.xml and outpost.lua
--HG-- branch : kaetemi-optimize
This commit is contained in:
parent
70ea479714
commit
16783449a7
2 changed files with 6 additions and 12 deletions
|
@ -62,17 +62,10 @@ end
|
|||
|
||||
------------------------------------------------------------------------------------------------------------
|
||||
function game:outpostUpdateTimeZone()
|
||||
-- update time zone auto?
|
||||
local tzAuto= getDbProp('UI:SAVE:OUTPOST:TIME_ZONE_AUTO');
|
||||
if(tzAuto==0) then
|
||||
return;
|
||||
end
|
||||
-- every 5 seconds?
|
||||
local curTick= getDbProp('UI:VARIABLES:CURRENT_SERVER_TICK');
|
||||
if(curTick - game.Outpost.LastTimeZoneUpdate > 50) then
|
||||
game.Outpost.LastTimeZoneUpdate= curTick;
|
||||
runAH(nil,'outpost_update_time_zone_auto','');
|
||||
end
|
||||
local curTick = getDbProp('UI:VARIABLES:CURRENT_SERVER_TICK');
|
||||
setDbProp('UI:TEMP:OUTPOST:TIME_ZONE_NEXT_UPDATE', curTick + 50);
|
||||
game.Outpost.LastTimeZoneUpdate = curTick;
|
||||
runAH(nil,'outpost_update_time_zone_auto','');
|
||||
end
|
||||
|
||||
------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -21,8 +21,9 @@
|
|||
<!-- Save the Time Zone config -->
|
||||
<variable entry="UI:SAVE:OUTPOST:TIME_ZONE" type="sint32" value="0" />
|
||||
<variable entry="UI:SAVE:OUTPOST:TIME_ZONE_AUTO" type="sint32" value="1" />
|
||||
<variable entry="UI:TEMP:OUTPOST:TIME_ZONE_NEXT_UPDATE" type="sint32" value="0" />
|
||||
<!-- just a script called at init and every 5 seconds, to setup TIME_ZONE, if time_zone is auto-->
|
||||
<link expr="depends(@UI:SAVE:OUTPOST:TIME_ZONE_AUTO, @UI:VARIABLES:CURRENT_SERVER_TICK)" action="lua:game:outpostUpdateTimeZone()" />
|
||||
<link expr="depends(@UI:SAVE:OUTPOST:TIME_ZONE_AUTO, @UI:VARIABLES:CURRENT_SERVER_TICK)" cond="and(eq(@UI:SAVE:OUTPOST:TIME_ZONE_AUTO, 1), ge(@UI:VARIABLES:CURRENT_SERVER_TICK, @UI:TEMP:OUTPOST:TIME_ZONE_NEXT_UPDATE))" action="lua:game:outpostUpdateTimeZone()" />
|
||||
|
||||
|
||||
<!-- Temp Variables -->
|
||||
|
|
Loading…
Reference in a new issue