Skip to content

Commit

Permalink
Change fetching to earlier stage
Browse files Browse the repository at this point in the history
  • Loading branch information
Lacyway committed Jan 9, 2025
1 parent b307943 commit 820e4f4
Showing 1 changed file with 16 additions and 20 deletions.
36 changes: 16 additions & 20 deletions Fika.Core/Coop/GameMode/CoopGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ public sealed class CoopGame : BaseLocalGame<EftGamePlayerOwner>, IBotGame, IFik
{
public string InfiltrationPoint;
public ExitStatus ExitStatus { get; set; } = ExitStatus.Survived;
public string ExitLocation { get; set; } = null;
public string ExitLocation { get; set; }
public ISpawnSystem SpawnSystem;
public Dictionary<string, Player> Bots = [];
public List<int> ExtractedPlayers { get; } = [];
public string SpawnId;
public bool InteractablesInitialized { get; set; } = false;
public bool HasReceivedLoot { get; set; } = false;
public bool InteractablesInitialized { get; set; }
public bool HasReceivedLoot { get; set; }
public List<ThrowWeapItemClass> ThrownGrenades;
public bool WeatherReady;
public bool WeatherReady { get; internal set; }
public bool RaidStarted { get; set; }

private readonly Dictionary<int, int> botQueue = [];
Expand Down Expand Up @@ -1479,6 +1479,8 @@ private async Task SetStatus(LocalPlayer myPlayer, LobbyEntry.ELobbyStatus statu
/// <returns></returns>
public override async Task vmethod_1(BotControllerSettings controllerSettings, ISpawnSystem spawnSystem)
{
await GenerateWeathers();

GameWorld gameWorld = Singleton<GameWorld>.Instance;
gameWorld.RegisterRestrictableZones();

Expand Down Expand Up @@ -1599,20 +1601,15 @@ public override async Task vmethod_1(BotControllerSettings controllerSettings, I
GameWorld_0.RegisterBorderZones();
}

public override IEnumerator vmethod_5(Action runCallback)
private async Task GenerateWeathers()
{
if (WeatherController.Instance != null)
{
SetMatchmakerStatus(LocaleUtils.UI_INIT_WEATHER.Localized());
Logger.LogInfo("Generating and initializing weather...");
if (isServer)
{
Task<GClass1310> weatherTask = iSession.WeatherRequest();
while (!weatherTask.IsCompleted)
{
yield return new WaitForEndOfFrame();
}
GClass1310 weather = weatherTask.Result;
GClass1310 weather = await iSession.WeatherRequest();
Season = weather.Season;
SeasonsSettings = weather.SeasonsSettings;
if (!OfflineRaidSettingsMenuPatch_Override.UseCustomWeather)
Expand All @@ -1623,28 +1620,27 @@ public override IEnumerator vmethod_5(Action runCallback)
}
else
{
Task getWeather = GetWeather();
while (!getWeather.IsCompleted)
{
yield return new WaitForEndOfFrame();
}
await GetWeather();
WeatherController.Instance.method_0(WeatherClasses);
}
}

WeatherReady = true;
OfflineRaidSettingsMenuPatch_Override.UseCustomWeather = false;
}

public override IEnumerator vmethod_5(Action runCallback)
{
SetMatchmakerStatus(LocaleUtils.UI_FINISHING_RAID_INIT.Localized());

GameWorld_0.TriggersModule = gameObject.AddComponent<LocalClientTriggersModule>();
GameWorld_0.FillLampControllers();

WeatherReady = true;
OfflineRaidSettingsMenuPatch_Override.UseCustomWeather = false;

Class442 seasonController = new();
GameWorld_0.GInterface29_0 = seasonController;

#if DEBUG
Logger.LogWarning("Running season handler");
Logger.LogWarning($"Running season handler for season: {Season}");
#endif
Task runSeason = seasonController.Run(Season, SeasonsSettings);
while (!runSeason.IsCompleted)
Expand Down

0 comments on commit 820e4f4

Please sign in to comment.