Add config for max building volume

This commit is contained in:
2024-09-29 02:51:42 +02:00
parent ffc398c202
commit fda4abd0ea
2 changed files with 26 additions and 1 deletions

View File

@@ -111,6 +111,9 @@ namespace InfectionFreeZone {
public static ConfigEntry<bool> towerEchoSelection;
public static List<WeakReference<StructureDefenceModule>> towerEchoSelectionList;
public static ConfigEntry<bool> buildingMaxVolumeDebug;
public static ConfigEntry<float> buildingMaxVolume;
// See System.Void UI.InfoPanels.NestedUIElements.SelectWeaponPanel::OnWeaponItemClicked(UI.InfoPanels.NestedUIElements.WeaponItem)
public void Awake() {
@@ -188,6 +191,9 @@ namespace InfectionFreeZone {
towerEchoSelection = Config.Bind("General", "Tower Echo Selection", false);
towerEchoSelectionList = new List<WeakReference<StructureDefenceModule>>();
buildingMaxVolumeDebug = Config.Bind("General", "Building Max Volume Debug", false);
buildingMaxVolume = Config.Bind("General", "Building Max Volume", 50000f);
Logger.LogInfo("Cyka mod loaded");
HarmonyFileLog.Enabled = true;
Harmony harmony = new Harmony(pluginGuid);
@@ -707,9 +713,25 @@ namespace InfectionFreeZone {
[HarmonyPrefix]
[HarmonyPatch(typeof(WallConstructor), MethodType.Constructor,
typeof(Wall.Factory), typeof(WorkersRadio), typeof(WallConfig))]
public static void PostfixWallConstructor(Wall.Factory factory, WorkersRadio workersRadio, ref WallConfig wallConfig) {
public static void PostfixWallConstructor(Wall.Factory factory, WorkersRadio workersRadio,
ref WallConfig wallConfig) {
Console.WriteLine($"Wall config created");
wallConfig.maxAngel = 2f;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(AdaptController), MethodType.Constructor, typeof(AdaptConfig))]
public static void PostfixAdaptConfig(ref AdaptConfig adaptConfig) {
var trav = Traverse.Create(adaptConfig);
var buildingsMaxVolume = trav.Field<float>("buildingsMaxVolume");
if (Main.buildingMaxVolumeDebug.Value)
Console.WriteLine($"Building max volume is {buildingsMaxVolume.Value}");
buildingsMaxVolume.Value = Main.buildingMaxVolume.Value;
if (Main.buildingMaxVolumeDebug.Value)
Console.WriteLine($"Building max volume modified to {buildingsMaxVolume.Value}");
}
}
}

View File

@@ -66,6 +66,9 @@
<Reference Include="Sirenix.Serialization">
<HintPath>$(GAME_MANAGED)/Sirenix.Serialization.dll</HintPath>
</Reference>
<Reference Include="JutsuGamesConfig">
<HintPath>$(GAME_MANAGED)/JutsuGamesConfig.dll</HintPath>
</Reference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets"/>
</Project>