Skip to content

Commit 6a6267a

Browse files
authored
Send pregame timing events to ingame
1 parent fd2f559 commit 6a6267a

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Shared/LobbyClient/DedicatedServer.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class DedicatedServer : IDisposable
2222
public static EventHandler<SpringBattleContext> AnyDedicatedExited;
2323

2424
private readonly SpringPaths paths;
25-
private readonly Timer timer = new Timer(20000);
25+
private readonly Timer timer = new Timer(1000);
2626

2727
private Dictionary<string, HashSet<byte> > gamePrivateMessages = new Dictionary<string, HashSet<byte> >();
2828

@@ -514,8 +514,7 @@ private void timer_Elapsed(object sender, ElapsedEventArgs e)
514514
try
515515
{
516516
var timeSinceStart = DateTime.UtcNow.Subtract(Context.StartTime).TotalSeconds;
517-
const int timeToWait = 160; // force start after 180s
518-
const int timeToWarn = 100; // warn people after 120s
517+
const int timeToWait = 160; // force start after this many seconds
519518

520519
if (Context.IsHosting && IsRunning && (Context.IngameStartTime == null))
521520
{
@@ -524,7 +523,10 @@ private void timer_Elapsed(object sender, ElapsedEventArgs e)
524523
Context.IsTimeoutForceStarted = true;
525524
ForceStart();
526525
}
527-
else if (timeSinceStart > timeToWarn) SayGame($"Game will be force started in {Math.Max(20, timeToWait - Math.Round(timeSinceStart))} seconds");
526+
else
527+
{
528+
talker.SendText($"/luarules pregame_timer_seconds {Convert.ToInt32(timeToWait - timeSinceStart)}");
529+
}
528530
}
529531
}
530532
catch (Exception ex)

0 commit comments

Comments
 (0)