Skip to content

Commit

Permalink
Fix nullref on dedi
Browse files Browse the repository at this point in the history
  • Loading branch information
Lacyway committed Dec 7, 2024
1 parent 688c85a commit 01c56d0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
7 changes: 6 additions & 1 deletion Fika.Core/Coop/GameMode/CoopGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1061,7 +1061,7 @@ public async Task InitPlayer(BotControllerSettings botsSettings, string backendU
}
if (transitActive)
{
Singleton<GameWorld>.Instance.TransitController = isServer ? new FikaHostTransitController(instance.transitSettings, Location_0.transitParameters,
gameWorld.TransitController = isServer ? new FikaHostTransitController(instance.transitSettings, Location_0.transitParameters,
Profile_0, localRaidSettings_0) : new FikaClientTransitController(instance.transitSettings, Location_0.transitParameters,
Profile_0, localRaidSettings_0);
}
Expand Down Expand Up @@ -1089,6 +1089,11 @@ public async Task InitPlayer(BotControllerSettings botsSettings, string backendU
PlayerCameraController.Create(gparam_0.Player);
CameraClass.Instance.SetOcclusionCullingEnabled(Location_0.OcculsionCullingEnabled);
CameraClass.Instance.IsActive = false;

if (FikaBackendUtils.IsDedicated && gameWorld.TransitController is FikaHostTransitController hostController)
{
hostController.SetupDedicatedPlayerTransitStash(player);
}
}

await WaitForPlayersToConnect();
Expand Down
11 changes: 5 additions & 6 deletions Fika.Core/Coop/HostClasses/FikaHostTransitController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,12 @@ public FikaHostTransitController(BackendConfigSettingsClass.GClass1529 settings,
playersInTransitZone = [];
dediTransit = false;
transittedPlayers = [];
}

if (FikaBackendUtils.IsDedicated)
{
CoopPlayer dediPlayer = (CoopPlayer)GamePlayerOwner.MyPlayer;
TransferItemsController.InitPlayerStash(dediPlayer);
dediPlayer.UpdateBtrTraderServiceData().HandleExceptions();
}
public void SetupDedicatedPlayerTransitStash(LocalPlayer player)
{
TransferItemsController.InitPlayerStash(player);
player.UpdateBtrTraderServiceData().HandleExceptions();
}

private readonly LocalRaidSettings localRaidSettings;
Expand Down

0 comments on commit 01c56d0

Please sign in to comment.