Skip to content

Commit

Permalink
Adds support for server-side transit toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
Lacyway committed Dec 12, 2024
1 parent 60d1049 commit 679a378
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
8 changes: 6 additions & 2 deletions Fika.Core/Coop/GameMode/CoopGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,10 @@ private void SyncTransitControllers()
TransitControllerAbstractClass transitController = Singleton<GameWorld>.Instance.TransitController;
if (transitController == null)
{
Logger.LogError("SyncTransitControllers: TransitController was null!");
if (FikaPlugin.Instance.EnableTransits)
{
Logger.LogError("SyncTransitControllers: TransitController was null!");
}
return;
}

Expand Down Expand Up @@ -1060,14 +1063,15 @@ public async Task InitPlayer(BotControllerSettings botsSettings, string backendU
BackendConfigSettingsClass.GClass1529 transitSettings = instance.transitSettings;
transitActive = transitSettings != null && transitSettings.active;
}
if (transitActive)
if (transitActive && FikaPlugin.Instance.EnableTransits)
{
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);
}
else
{
Logger.LogInfo("Transits are disabled");
TransitControllerAbstractClass.DisableTransitPoints();
}

Expand Down
3 changes: 3 additions & 0 deletions Fika.Core/FikaPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using Fika.Core.Coop.Patches.Lighthouse;
using Fika.Core.Coop.Patches.SPTBugs;
using Fika.Core.EssentialPatches;
using Fika.Core.Models;
using Fika.Core.Networking.Http;
using Fika.Core.Networking.Websocket;
using Fika.Core.UI;
Expand Down Expand Up @@ -208,6 +209,7 @@ public ManualLogSource FikaLogger
public bool UseInertia;
public bool SharedQuestProgression;
public bool CanEditRaidSettings;
public bool EnableTransits;
#endregion

#region natpunch config
Expand Down Expand Up @@ -403,6 +405,7 @@ private void GetClientConfig()
UseInertia = clientConfig.UseInertia;
SharedQuestProgression = clientConfig.SharedQuestProgression;
CanEditRaidSettings = clientConfig.CanEditRaidSettings;
EnableTransits = clientConfig.EnableTransits;

clientConfig.LogValues();
}
Expand Down
8 changes: 6 additions & 2 deletions Fika.Core/Models/ClientConfigModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Reflection;
using System.Runtime.Serialization;

namespace Fika.Core.UI.Models
namespace Fika.Core.Models
{
[DataContract]
public struct ClientConfigModel
Expand Down Expand Up @@ -40,8 +40,11 @@ public struct ClientConfigModel
[DataMember(Name = "canEditRaidSettings")]
public bool CanEditRaidSettings;

[DataMember(Name = "enableTransits")]
public bool EnableTransits;

public ClientConfigModel(bool useBTR, bool friendlyFire, bool dynamicVExfils, bool allowFreeCam, bool allowSpectateFreeCam, bool allowItemSending, string[] blacklistedItems, bool forceSaveOnDeath, bool useInertia,
bool sharedQuestProgression, bool canEditRaidSettings)
bool sharedQuestProgression, bool canEditRaidSettings, bool enableTransits)
{
UseBTR = useBTR;
FriendlyFire = friendlyFire;
Expand All @@ -54,6 +57,7 @@ public ClientConfigModel(bool useBTR, bool friendlyFire, bool dynamicVExfils, bo
UseInertia = useInertia;
SharedQuestProgression = sharedQuestProgression;
CanEditRaidSettings = canEditRaidSettings;
EnableTransits = enableTransits;
}

public void LogValues()
Expand Down
1 change: 1 addition & 0 deletions Fika.Core/Networking/Http/FikaRequestHandler.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using EFT;
using Fika.Core.Coop.Custom;
using Fika.Core.Models;
using Fika.Core.Networking.Models.Presence;
using Fika.Core.UI.Models;
using Fuyu.Platform.Common.Http;
Expand Down

0 comments on commit 679a378

Please sign in to comment.