1
0
Fork 0

Drop CSync as a dependency from Release builds

Since the rewrite of track selection to a custom netcode, CSync is only
needed for debug/development builds now.
This commit is contained in:
ivan tkachenko 2025-08-09 01:56:16 +03:00
parent 4abd0fb612
commit 3d0795f04d
4 changed files with 26 additions and 6 deletions

View File

@ -41,6 +41,7 @@
<!--
Publicize internal methods, so we could generate config entries for tracks at runtime instead
of generating code at compile time. See https://github.com/lc-sigurd/CSync/issues/11
It is an optional dependency now, but there is no sane way to mark it as such.
-->
<PackageReference Include="Sigurd.BepInEx.CSync" Version="5.0.1" Publicize="true" PrivateAssets="all" Private="false" />
<PackageReference Include="AinaVT-LethalConfig" Version="1.4.6" PrivateAssets="all" Private="false" />

View File

@ -1,7 +1,5 @@
using BepInEx;
using BepInEx.Configuration;
using CSync.Extensions;
using CSync.Lib;
using HarmonyLib;
using LethalConfig;
using LethalConfig.ConfigItems;
@ -21,10 +19,17 @@ using Unity.Netcode;
using UnityEngine;
using UnityEngine.Networking;
#if DEBUG
using CSync.Extensions;
using CSync.Lib;
#endif
namespace MuzikaGromche
{
[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
#if DEBUG
[BepInDependency("com.sigurd.csync", "5.0.1")]
#endif
[BepInDependency("ainavt.lc.lethalconfig", "1.4.6")]
[BepInDependency("watergun.v72lightfix", BepInDependency.DependencyFlags.SoftDependency)]
[BepInDependency("BMX.LobbyCompatibility", BepInDependency.DependencyFlags.HardDependency)]
@ -1433,6 +1438,7 @@ namespace MuzikaGromche
readonly public int TotalWeights { get; }
}
#if DEBUG
static class SyncedEntryExtensions
{
// Update local values on clients. Even though the clients couldn't
@ -1445,8 +1451,12 @@ namespace MuzikaGromche
};
}
}
#endif
class Config : SyncedConfig2<Config>
class Config
#if DEBUG
: SyncedConfig2<Config>
#endif
{
public static ConfigEntry<bool> DisplayLyrics { get; private set; } = null!;
@ -1469,7 +1479,10 @@ namespace MuzikaGromche
public static float? ColorTransitionOutOverride { get; private set; } = null;
public static string? ColorTransitionEasingOverride { get; private set; } = null;
internal Config(ConfigFile configFile) : base(PluginInfo.PLUGIN_GUID)
internal Config(ConfigFile configFile)
#if DEBUG
: base(PluginInfo.PLUGIN_GUID)
#endif
{
DisplayLyrics = configFile.Bind("General", "Display Lyrics", true,
new ConfigDescription("Display lyrics in the HUD tooltip when you hear the music."));
@ -1537,9 +1550,12 @@ namespace MuzikaGromche
LethalConfigManager.AddConfigItem(new IntSliderConfigItem(track.Weight, Default(new IntSliderOptions())));
}
#if DEBUG
ConfigManager.Register(this);
#endif
}
#if DEBUG
// HACK because CSync doesn't provide an API to register a list of config entries
// See https://github.com/lc-sigurd/CSync/issues/11
private void CSyncHackAddSyncedEntry(SyncedEntryBase entryBase)
@ -1547,6 +1563,7 @@ namespace MuzikaGromche
// This is basically what ConfigFile.PopulateEntryContainer does
EntryContainer.Add(entryBase.BoxedEntry.ToSyncedEntryIdentifier(), entryBase);
}
#endif
public static CanModifyResult CanModifyIfHost()
{
@ -1582,6 +1599,7 @@ namespace MuzikaGromche
return CanModifyResult.True();
}
#if DEBUG
private void SetupEntriesToSkipWinding(ConfigFile configFile)
{
var syncedEntry = configFile.BindSyncedEntry("General", "Skip Winding Phase", false,
@ -1789,6 +1807,7 @@ namespace MuzikaGromche
}
}
}
#endif
private T Default<T>(T options) where T : BaseOptions
{

View File

@ -9,7 +9,7 @@ To keep it a surprise, it is adviced that you do not read the detailed descripti
Muzika Gromche is compatible with *Almost Vanilla™* gameplay and [*High Quota Mindset*](https://youtu.be/18RUCgQldGg?t=2553). It slightly changes certain timers, so won't be compatible with leaderboards. If you are a streamer™, be aware that it does play *copyrighted content.*
Muzika Gromche works with all Lethal Company versions from v72 all the way back to v40, and is likely to work on all future versions as long as dependencies ([`CSync`] and [`LethalConfig`]) are working.
Muzika Gromche works with all Lethal Company versions from v72 all the way back to v40, and is likely to work on all future versions as long as dependencies ([`LethalConfig`] and [`LobbyCompatibility`]) are working.
Speaking of dependencies, [`V70PoweredLights_Fix`] is not strictly required, but it doesn't hurt to have it installed on any version, and it makes this mod more enjoyable on new Mansion tiles.
@ -38,4 +38,5 @@ Any player can change their personal preferences locally.
[`CSync`]: https://thunderstore.io/c/lethal-company/p/Sigurd/CSync/
[`LethalConfig`]: https://thunderstore.io/c/lethal-company/p/AinaVT/LethalConfig/
[`LobbyCompatibility`]: https://thunderstore.io/c/lethal-company/p/BMX/LobbyCompatibility/
[`V70PoweredLights_Fix`]: https://thunderstore.io/c/lethal-company/p/WaterGun/V70PoweredLights_Fix/

View File

@ -6,7 +6,6 @@
"website_url": "https://git.vilunov.me/ratijas/muzika-gromche",
"dependencies": [
"BepInEx-BepInExPack-5.4.2100",
"Sigurd-CSync-5.0.1",
"AinaVT-LethalConfig-1.4.6",
"WaterGun-V70PoweredLights_Fix-1.0.0",
"BMX-LobbyCompatibility-1.5.1"