Add config for max building volume
This commit is contained in:
@@ -111,6 +111,9 @@ namespace InfectionFreeZone {
|
|||||||
public static ConfigEntry<bool> towerEchoSelection;
|
public static ConfigEntry<bool> towerEchoSelection;
|
||||||
public static List<WeakReference<StructureDefenceModule>> towerEchoSelectionList;
|
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)
|
// See System.Void UI.InfoPanels.NestedUIElements.SelectWeaponPanel::OnWeaponItemClicked(UI.InfoPanels.NestedUIElements.WeaponItem)
|
||||||
|
|
||||||
public void Awake() {
|
public void Awake() {
|
||||||
@@ -188,6 +191,9 @@ namespace InfectionFreeZone {
|
|||||||
towerEchoSelection = Config.Bind("General", "Tower Echo Selection", false);
|
towerEchoSelection = Config.Bind("General", "Tower Echo Selection", false);
|
||||||
towerEchoSelectionList = new List<WeakReference<StructureDefenceModule>>();
|
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");
|
Logger.LogInfo("Cyka mod loaded");
|
||||||
HarmonyFileLog.Enabled = true;
|
HarmonyFileLog.Enabled = true;
|
||||||
Harmony harmony = new Harmony(pluginGuid);
|
Harmony harmony = new Harmony(pluginGuid);
|
||||||
@@ -707,9 +713,25 @@ namespace InfectionFreeZone {
|
|||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
[HarmonyPatch(typeof(WallConstructor), MethodType.Constructor,
|
[HarmonyPatch(typeof(WallConstructor), MethodType.Constructor,
|
||||||
typeof(Wall.Factory), typeof(WorkersRadio), typeof(WallConfig))]
|
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");
|
Console.WriteLine($"Wall config created");
|
||||||
wallConfig.maxAngel = 2f;
|
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}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -66,6 +66,9 @@
|
|||||||
<Reference Include="Sirenix.Serialization">
|
<Reference Include="Sirenix.Serialization">
|
||||||
<HintPath>$(GAME_MANAGED)/Sirenix.Serialization.dll</HintPath>
|
<HintPath>$(GAME_MANAGED)/Sirenix.Serialization.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="JutsuGamesConfig">
|
||||||
|
<HintPath>$(GAME_MANAGED)/JutsuGamesConfig.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets"/>
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets"/>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
Reference in New Issue
Block a user