Skip to content

Commit cef8cc3

Browse files
authored
Merge pull request #132 from RLBot/spawning
Wait 3 ticks (vs 1) to flush queued spawn cmds
2 parents 0798dff + 8509507 commit cef8cc3

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

RLBotCS/Main.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
if (args.Length > 0 && args[0] == "--version")
1111
{
1212
Console.WriteLine(
13-
"RLBotServer v5.beta.7.6\n"
13+
"RLBotServer v5.beta.7.7\n"
1414
+ $"Bridge {BridgeVersion.Version}\n"
1515
+ "@ https://www.rlbot.org & https://github.com/RLBot/core"
1616
);

RLBotCS/Server/BridgeContext.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ MatchStarter matchStarter
2020
public readonly ILogger Logger = Logging.GetLogger("BridgeHandler");
2121

2222
public int ticksSkipped = 0;
23+
public uint ticksSinceMapLoad = 0;
2324
public GameState GameState = new();
2425
public MatchStarter MatchStarter { get; } = matchStarter;
2526
public MatchConfigurationT? MatchConfig => MatchStarter.GetMatchConfig();

RLBotCS/Server/BridgeHandler.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,10 @@ private async Task HandleServer()
8888
float deltaTime = _context.GameState.SecondsElapsed - prevTime;
8989
bool timeAdvanced = deltaTime > 0.001;
9090
if (timeAdvanced)
91+
{
9192
_context.ticksSkipped = 0;
93+
_context.ticksSinceMapLoad += 1;
94+
}
9295
else
9396
_context.ticksSkipped++;
9497

@@ -105,6 +108,7 @@ private async Task HandleServer()
105108
var mapJustLoaded = MessageHandler.ReceivedMatchInfo(messageClump);
106109
if (mapJustLoaded)
107110
{
111+
_context.ticksSinceMapLoad = 0;
108112
if (_context.GameState.MatchPhase != MatchPhase.Paused)
109113
{
110114
// LAN matches don't set the MatchPhase to paused, which breaks Continue & Spawn
@@ -161,6 +165,7 @@ private async Task HandleServer()
161165

162166
if (
163167
_context.MatchStarter.HasSpawnedMap
168+
&& _context.ticksSinceMapLoad >= 2
164169
&& _context.GameState.MatchPhase == MatchPhase.Paused
165170
&& _context.SpawnCommandQueue.Count > 0
166171
)

0 commit comments

Comments
 (0)