Skip to content

Commit 2caff60

Browse files
committed
add command for reusing previous day time
1 parent 46ebe8e commit 2caff60

File tree

4 files changed

+41
-4
lines changed

4 files changed

+41
-4
lines changed

Modules/CaptainsModule/Commands/GruhshaChatCommands.as

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@ void RegisterGruhshaChatCommands(ChatCommandManager@ manager)
2323
manager.RegisterCommand(TeamRandomizer());
2424
manager.RegisterCommand(BrokeResupplies());
2525
manager.RegisterCommand(SetInternalGamemode());
26+
manager.RegisterCommand(RememberTime());
2627
}

Modules/CaptainsModule/Commands/PickingCommands.as

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -633,12 +633,13 @@ class BrokeResupplies : ChatCommand
633633
{
634634
CRules@ rules = getRules();
635635

636-
rules.Tag("fucked resupplies");
637-
638-
if (rules.hasTag("fucked resupplies"))
636+
if (!rules.hasTag("fucked resupplies")) {
637+
rules.Tag("fucked resupplies");
639638
server_AddToChat("Infinity resupplies is on!", SColor(0xff474ac6));
640-
else
639+
} else {
640+
rules.Untag("fucked resupplies");
641641
server_AddToChat("Infinity resupplies is off!", SColor(0xff474ac6));
642+
}
642643
}
643644
}
644645

@@ -688,4 +689,34 @@ class SetInternalGamemode : ChatCommand
688689
//LoadNextMap();
689690
}
690691
}
692+
}
693+
694+
class RememberTime : ChatCommand
695+
{
696+
RememberTime()
697+
{
698+
super("reusetime", "Toggle for save day time of previous match for next matches");
699+
}
700+
701+
bool canPlayerExecute(CPlayer@ player)
702+
{
703+
return (
704+
ChatCommand::canPlayerExecute(player) &&
705+
!ChatCommands::getManager().whitelistedClasses.empty()
706+
);
707+
}
708+
709+
void Execute(string[] args, CPlayer@ player)
710+
{
711+
CRules@ rules = getRules();
712+
713+
if (!rules.hasTag("reuse previous day time")) {
714+
rules.Tag("reuse previous day time");
715+
rules.set_f32("old day time", getMap().getDayTime());
716+
server_AddToChat("Reusing previous day time", SColor(0xff474ac6));
717+
} else {
718+
rules.Untag("reuse previous day time");
719+
server_AddToChat("Using default day time", SColor(0xff474ac6));
720+
}
721+
}
691722
}

Rules/CommonScripts/ChatCommands.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ commands =
5656
setbuilders; 1; 0;
5757
fuckres; 1; 0;
5858
gm; 1; 0;
59+
reusetime; 1; 0;
5960
#sharks; 0; 1;
6061
#bisons; 0; 1;
6162

Rules/CommonScripts/KAG.as

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ void onRestart(CRules@ this)
6262
//(it is on server, but not on client unfortunately)
6363
need_sky_check = true;
6464
}
65+
66+
if (this.hasTag("reuse previous day time")) {
67+
getMap().SetDayTime(this.get_f32("old day time"));
68+
}
6569
}
6670

6771
void onTick(CRules@ this)

0 commit comments

Comments
 (0)