@@ -53,18 +53,22 @@ namespace Fika.Core.Coop.GameMode
53
53
/// </summary>
54
54
public sealed class CoopGame : BaseLocalGame < EftGamePlayerOwner > , IBotGame , IFikaGame
55
55
{
56
- public string InfiltrationPoint ;
56
+ public string InfiltrationPoint { get ; internal set ; }
57
57
public ExitStatus ExitStatus { get ; set ; } = ExitStatus . Survived ;
58
- public string ExitLocation { get ; set ; } = null ;
59
- public ISpawnSystem SpawnSystem ;
58
+ public string ExitLocation { get ; set ; }
59
+ public ISpawnSystem SpawnSystem { get ; internal set ; }
60
60
public Dictionary < string , Player > Bots = [ ] ;
61
61
public List < int > ExtractedPlayers { get ; } = [ ] ;
62
- public string SpawnId ;
63
- public bool InteractablesInitialized { get ; set ; } = false ;
64
- public bool HasReceivedLoot { get ; set ; } = false ;
65
- public List < ThrowWeapItemClass > ThrownGrenades ;
66
- public bool WeatherReady ;
67
- public bool RaidStarted { get ; set ; }
62
+ public string SpawnId { get ; internal set ; }
63
+ public bool InteractablesInitialized { get ; internal set ; }
64
+ public bool HasReceivedLoot { get ; internal set ; }
65
+ public List < ThrowWeapItemClass > ThrownGrenades { get ; internal set ; }
66
+ public bool WeatherReady { get ; internal set ; }
67
+ public bool RaidStarted { get ; internal set ; }
68
+ public FikaDynamicAI DynamicAI { get ; private set ; }
69
+ public RaidSettings RaidSettings { get ; private set ; }
70
+ public byte [ ] HostLootItems { get ; private set ; }
71
+ public GClass1315 LootItems { get ; internal set ; } = [ ] ;
68
72
69
73
private readonly Dictionary < int , int > botQueue = [ ] ;
70
74
private Coroutine extractRoutine ;
@@ -85,11 +89,7 @@ public sealed class CoopGame : BaseLocalGame<EftGamePlayerOwner>, IBotGame, IFik
85
89
private TimeSpan ? sessionTime ;
86
90
private BotStateManager botStateManager ;
87
91
private ESeason season ;
88
-
89
- public FikaDynamicAI DynamicAI { get ; private set ; }
90
- public RaidSettings RaidSettings { get ; private set ; }
91
- public byte [ ] HostLootItems { get ; private set ; }
92
- public GClass1315 LootItems { get ; internal set ; } = [ ] ;
92
+
93
93
BossSpawnScenario IBotGame . BossSpawnScenario
94
94
{
95
95
get
@@ -131,6 +131,7 @@ public ESeason Season
131
131
{
132
132
season = value ;
133
133
Logger . LogInfo ( $ "Setting Season to: { value } ") ;
134
+ WeatherReady = true ;
134
135
}
135
136
}
136
137
@@ -1479,6 +1480,8 @@ private async Task SetStatus(LocalPlayer myPlayer, LobbyEntry.ELobbyStatus statu
1479
1480
/// <returns></returns>
1480
1481
public override async Task vmethod_1 ( BotControllerSettings controllerSettings , ISpawnSystem spawnSystem )
1481
1482
{
1483
+ await GenerateWeathers ( ) ;
1484
+
1482
1485
GameWorld gameWorld = Singleton < GameWorld > . Instance ;
1483
1486
gameWorld . RegisterRestrictableZones ( ) ;
1484
1487
@@ -1599,22 +1602,26 @@ public override async Task vmethod_1(BotControllerSettings controllerSettings, I
1599
1602
GameWorld_0 . RegisterBorderZones ( ) ;
1600
1603
}
1601
1604
1602
- public override IEnumerator vmethod_5 ( Action runCallback )
1605
+ private async Task GenerateWeathers ( )
1603
1606
{
1607
+ if ( Location_0 . Id == "laboratory" )
1608
+ {
1609
+ Logger . LogInfo ( "Location is 'Laboratory', skipping weather generation" ) ;
1610
+ Season = ESeason . Summer ;
1611
+ OfflineRaidSettingsMenuPatch_Override . UseCustomWeather = false ;
1612
+
1613
+ return ;
1614
+ }
1615
+
1604
1616
if ( WeatherController . Instance != null )
1605
1617
{
1606
1618
SetMatchmakerStatus ( LocaleUtils . UI_INIT_WEATHER . Localized ( ) ) ;
1607
1619
Logger . LogInfo ( "Generating and initializing weather..." ) ;
1608
1620
if ( isServer )
1609
1621
{
1610
- Task < GClass1310 > weatherTask = iSession . WeatherRequest ( ) ;
1611
- while ( ! weatherTask . IsCompleted )
1612
- {
1613
- yield return new WaitForEndOfFrame ( ) ;
1614
- }
1615
- GClass1310 weather = weatherTask . Result ;
1616
- Season = weather . Season ;
1617
- SeasonsSettings = weather . SeasonsSettings ;
1622
+ GClass1310 weather = await iSession . WeatherRequest ( ) ;
1623
+ Season = iSession . Season ;
1624
+ SeasonsSettings = iSession . SeasonsSettings ;
1618
1625
if ( ! OfflineRaidSettingsMenuPatch_Override . UseCustomWeather )
1619
1626
{
1620
1627
WeatherClasses = weather . Weathers ;
@@ -1623,28 +1630,26 @@ public override IEnumerator vmethod_5(Action runCallback)
1623
1630
}
1624
1631
else
1625
1632
{
1626
- Task getWeather = GetWeather ( ) ;
1627
- while ( ! getWeather . IsCompleted )
1628
- {
1629
- yield return new WaitForEndOfFrame ( ) ;
1630
- }
1633
+ await GetWeather ( ) ;
1631
1634
WeatherController . Instance . method_0 ( WeatherClasses ) ;
1632
1635
}
1633
1636
}
1634
1637
1638
+ OfflineRaidSettingsMenuPatch_Override . UseCustomWeather = false ;
1639
+ }
1640
+
1641
+ public override IEnumerator vmethod_5 ( Action runCallback )
1642
+ {
1635
1643
SetMatchmakerStatus ( LocaleUtils . UI_FINISHING_RAID_INIT . Localized ( ) ) ;
1636
1644
1637
1645
GameWorld_0 . TriggersModule = gameObject . AddComponent < LocalClientTriggersModule > ( ) ;
1638
1646
GameWorld_0 . FillLampControllers ( ) ;
1639
1647
1640
- WeatherReady = true ;
1641
- OfflineRaidSettingsMenuPatch_Override . UseCustomWeather = false ;
1642
-
1643
1648
Class442 seasonController = new ( ) ;
1644
1649
GameWorld_0 . GInterface29_0 = seasonController ;
1645
1650
1646
1651
#if DEBUG
1647
- Logger . LogWarning ( "Running season handler" ) ;
1652
+ Logger . LogWarning ( $ "Running season handler for season: { Season } ") ;
1648
1653
#endif
1649
1654
Task runSeason = seasonController . Run ( Season , SeasonsSettings ) ;
1650
1655
while ( ! runSeason . IsCompleted )
@@ -1665,10 +1670,13 @@ private async Task GetWeather()
1665
1670
FikaClient client = Singleton < FikaClient > . Instance ;
1666
1671
client . SendData ( ref packet , DeliveryMethod . ReliableUnordered ) ;
1667
1672
1668
- while ( WeatherClasses == null )
1673
+ while ( ! WeatherReady )
1669
1674
{
1670
1675
await Task . Delay ( 1000 ) ;
1671
- client . SendData ( ref packet , DeliveryMethod . ReliableUnordered ) ;
1676
+ if ( ! WeatherReady )
1677
+ {
1678
+ client . SendData ( ref packet , DeliveryMethod . ReliableUnordered ) ;
1679
+ }
1672
1680
}
1673
1681
}
1674
1682
0 commit comments