Skip to content

Commit

Permalink
Fix IBotGame not existing on client (#312)
Browse files Browse the repository at this point in the history
This fixes several errors in the console when using mods like DrakiaXYZ
Waypoints because IBotGame was not being instantiated on the Clients
  • Loading branch information
devbence authored May 7, 2024
2 parents 6343f59 + a4e7ff3 commit b69c66d
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions Source/Coop/SITGameModes/CoopSITGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -948,19 +948,17 @@ public override IEnumerator vmethod_4(float startDelay, BotControllerSettings co
Logger.LogDebug("Bot Spawner System has been turned off - You are running as Client");
}

if (!SITMatchmaking.IsClient)
{

var nonwaves = (WaveInfo[])ReflectionHelpers.GetFieldFromTypeByFieldType(nonWavesSpawnScenario_0.GetType(), typeof(WaveInfo[])).GetValue(nonWavesSpawnScenario_0);

BotsPresets profileCreator =
var nonwaves = (WaveInfo[])ReflectionHelpers.GetFieldFromTypeByFieldType(nonWavesSpawnScenario_0.GetType(), typeof(WaveInfo[])).GetValue(nonWavesSpawnScenario_0);
BotsPresets profileCreator =
new(BackEndSession
, wavesSpawnScenario_0.SpawnWaves
, this.BossWaves
, nonwaves
, true);
BotCreator botCreator = new(this, profileCreator, CreatePhysicalBot);

BotCreator botCreator = new(this, profileCreator, CreatePhysicalBot);
if (!SITMatchmaking.IsClient)
{
BotZone[] botZones = LocationScene.GetAllObjects<BotZone>(false).ToArray();
PBotsController.Init(this
, botCreator
Expand Down Expand Up @@ -1014,6 +1012,10 @@ public override IEnumerator vmethod_4(float startDelay, BotControllerSettings co
Logger.LogError(ex);
}
}
else
{
PBotsController.Init(this, botCreator, [], SpawnSystem, wavesSpawnScenario_0.BotLocationModifier, false, false, false, false, false, Singleton<GameWorld>.Instance, "");
}

yield return new WaitForSeconds(startDelay);

Expand Down

0 comments on commit b69c66d

Please sign in to comment.