Skip to content

Commit 5a352da

Browse files
committed
fix timer panel
1 parent 33f6dcd commit 5a352da

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

Rules/CommonScripts/Airdrop/Airdrop.as

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ void onInit(CRules@ this) {
1414

1515
void onRestart(CRules@ this) {
1616
this.set_s32("airdrop timer", airdrop_interval);
17-
this.set_s32("airdrop_in", getGameTime() + airdrop_interval);
1817
}
1918

2019
void onTick(CRules@ this) {
@@ -26,7 +25,6 @@ void onTick(CRules@ this) {
2625
} else if (this.get_s32("airdrop timer") <= 0) {
2726
// reset present timer
2827
this.set_s32("airdrop timer", airdrop_interval);
29-
this.set_s32("airdrop_in", getGameTime() + airdrop_interval);
3028

3129
CMap@ map = getMap();
3230
const f32 mapCenter = map.tilemapwidth * map.tilesize * 0.5;
@@ -37,11 +35,6 @@ void onTick(CRules@ this) {
3735
}
3836
} else {
3937
this.sub_s32("airdrop timer", 1);
40-
41-
s32 airdrop_in = this.get_s32("airdrop_in");
42-
43-
this.set_s32("airdrop will drop in", (s32(airdrop_in) - s32(getGameTime())) / 30);
44-
this.Sync("airdrop will drop in", true);
4538
}
4639
}
4740

@@ -59,15 +52,15 @@ void onRender(CRules@ this)
5952

6053
if (getRules().get_string("airdrop_panel") == "off") return;
6154

62-
s32 airdrop = this.get_s32("airdrop will drop in");
55+
s32 airdrop = this.get_s32("airdrop timer");
6356

6457
if (airdrop > 0)
6558
{
6659
GUI::DrawIcon("airdrop_panel.png", Vec2f(12, 190));
6760
s32 timeToAirDrop = airdrop;
6861

69-
s32 secondsToEnd = timeToAirDrop % 60;
70-
s32 MinutesToEnd = timeToAirDrop / 60;
62+
s32 secondsToEnd = timeToAirDrop / 30 % 60;
63+
s32 MinutesToEnd = timeToAirDrop / 60 / 30;
7164
drawRulesFont(getTranslatedString("{MIN}:{SEC}")
7265
.replace("{MIN}", "" + ((MinutesToEnd < 10) ? "0" + MinutesToEnd : "" + MinutesToEnd))
7366
.replace("{SEC}", "" + ((secondsToEnd < 10) ? "0" + secondsToEnd : "" + secondsToEnd)),

0 commit comments

Comments
 (0)