Code format
This commit is contained in:
@@ -43,7 +43,8 @@ using Zenject;
|
|||||||
// System.Single Gameplay.Units.Movements.Movement::CalculateSpeed()
|
// System.Single Gameplay.Units.Movements.Movement::CalculateSpeed()
|
||||||
// GameConfig looks interesting
|
// GameConfig looks interesting
|
||||||
// See dayLengthInSeconds (defaults to 720 actually)
|
// See dayLengthInSeconds (defaults to 720 actually)
|
||||||
// System.Single Controllers.Time.TimeController::GetSunsetHour(System.Int32,System.Double,System.Double)
|
// System.Single
|
||||||
|
// Controllers.Time.TimeController::GetSunsetHour(System.Int32,System.Double,System.Double)
|
||||||
|
|
||||||
namespace InfectionFreeZone {
|
namespace InfectionFreeZone {
|
||||||
[BepInPlugin(pluginGuid, pluginName, pluginVersion)]
|
[BepInPlugin(pluginGuid, pluginName, pluginVersion)]
|
||||||
@@ -70,7 +71,8 @@ namespace InfectionFreeZone {
|
|||||||
public static ConfigEntry<bool> buildingQuartersCapacityMultiplierDebug;
|
public static ConfigEntry<bool> buildingQuartersCapacityMultiplierDebug;
|
||||||
public static ConfigEntry<float> buildingQuartersCapacityMultiplier;
|
public static ConfigEntry<float> buildingQuartersCapacityMultiplier;
|
||||||
|
|
||||||
public static ConfigEntry<bool> buildingDeconstructionResourcesMultiplierDebug;
|
public static ConfigEntry<bool>
|
||||||
|
buildingDeconstructionResourcesMultiplierDebug;
|
||||||
public static ConfigEntry<float> buildingDeconstructionResourcesMultiplier;
|
public static ConfigEntry<float> buildingDeconstructionResourcesMultiplier;
|
||||||
|
|
||||||
public static ConfigEntry<float> humanMovementSpeedMultiplier;
|
public static ConfigEntry<float> humanMovementSpeedMultiplier;
|
||||||
@@ -102,7 +104,8 @@ namespace InfectionFreeZone {
|
|||||||
public static ConfigEntry<int> adultAge;
|
public static ConfigEntry<int> adultAge;
|
||||||
public static ConfigEntry<int> oldAge;
|
public static ConfigEntry<int> oldAge;
|
||||||
|
|
||||||
public static ConfigEntry<float> rotationTimestepMultiplier; // This is NOT unused!
|
public static ConfigEntry<float>
|
||||||
|
rotationTimestepMultiplier; // This is NOT unused!
|
||||||
public static ConfigEntry<float> sunsetHourOffset;
|
public static ConfigEntry<float> sunsetHourOffset;
|
||||||
public static ConfigEntry<float> sunriseHourOffset;
|
public static ConfigEntry<float> sunriseHourOffset;
|
||||||
|
|
||||||
@@ -112,92 +115,122 @@ namespace InfectionFreeZone {
|
|||||||
|
|
||||||
public static ConfigEntry<bool> towerEchoSelectionDebug;
|
public static ConfigEntry<bool> towerEchoSelectionDebug;
|
||||||
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<bool> buildingMaxVolumeDebug;
|
||||||
public static ConfigEntry<float> buildingMaxVolume;
|
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() {
|
||||||
resourceMultiplierDebug = Config.Bind("General", "Resource Multiplier Debug", false);
|
resourceMultiplierDebug =
|
||||||
|
Config.Bind("General", "Resource Multiplier Debug", false);
|
||||||
resourceMultiplier = Config.Bind("General", "Resource Multiplier", 1f);
|
resourceMultiplier = Config.Bind("General", "Resource Multiplier", 1f);
|
||||||
|
|
||||||
peopleMultiplierDebug = Config.Bind("General", "People Multiplier Debug", false);
|
peopleMultiplierDebug =
|
||||||
|
Config.Bind("General", "People Multiplier Debug", false);
|
||||||
peopleMultiplier = Config.Bind("General", "People Multiplier", 1f);
|
peopleMultiplier = Config.Bind("General", "People Multiplier", 1f);
|
||||||
|
|
||||||
resourceGatheringMultiplierDebug = Config.Bind("General", "Resource Gathering Multiplier Debug", false);
|
resourceGatheringMultiplierDebug =
|
||||||
resourceGatheringMultiplier = Config.Bind("General", "Resource Gathering Multiplier", 1f);
|
Config.Bind("General", "Resource Gathering Multiplier Debug", false);
|
||||||
|
resourceGatheringMultiplier =
|
||||||
|
Config.Bind("General", "Resource Gathering Multiplier", 1f);
|
||||||
|
|
||||||
resourceScavengingMultiplierDebug = Config.Bind("General", "Resource Scavenging Multiplier Debug", false);
|
resourceScavengingMultiplierDebug =
|
||||||
resourceScavengingMultiplier = Config.Bind("General", "Resource Scavenging Multiplier", 1f);
|
Config.Bind("General", "Resource Scavenging Multiplier Debug", false);
|
||||||
|
resourceScavengingMultiplier =
|
||||||
|
Config.Bind("General", "Resource Scavenging Multiplier", 1f);
|
||||||
|
|
||||||
buildingStorageCapacityMultiplierDebug =
|
buildingStorageCapacityMultiplierDebug = Config.Bind(
|
||||||
Config.Bind("General", "Building Storage Capacity Multiplier Debug", false);
|
"General", "Building Storage Capacity Multiplier Debug", false);
|
||||||
buildingStorageCapacityMultiplier = Config.Bind("General", "Building Storage Capacity Multiplier", 1f);
|
buildingStorageCapacityMultiplier =
|
||||||
|
Config.Bind("General", "Building Storage Capacity Multiplier", 1f);
|
||||||
|
|
||||||
buildingQuartersCapacityMultiplierDebug =
|
buildingQuartersCapacityMultiplierDebug = Config.Bind(
|
||||||
Config.Bind("General", "Building Quarters Capacity Multiplier Debug", false);
|
"General", "Building Quarters Capacity Multiplier Debug", false);
|
||||||
buildingQuartersCapacityMultiplier = Config.Bind("General", "Building Quarters Capacity Multiplier", 1f);
|
buildingQuartersCapacityMultiplier =
|
||||||
|
Config.Bind("General", "Building Quarters Capacity Multiplier", 1f);
|
||||||
|
|
||||||
buildingDeconstructionResourcesMultiplierDebug = Config.Bind("General",
|
buildingDeconstructionResourcesMultiplierDebug = Config.Bind(
|
||||||
"Building Deconstruction Resources Multiplier Debug", false);
|
"General", "Building Deconstruction Resources Multiplier Debug", false);
|
||||||
buildingDeconstructionResourcesMultiplier =
|
buildingDeconstructionResourcesMultiplier = Config.Bind(
|
||||||
Config.Bind("General", "Building Deconstruction Resources Multiplier", 1f);
|
"General", "Building Deconstruction Resources Multiplier", 1f);
|
||||||
deconstructionWorkersPer100m =
|
deconstructionWorkersPer100m = Config.Bind(
|
||||||
Config.Bind("General", "Building Deconstruction Workers Per 100m", 0.0045f);
|
"General", "Building Deconstruction Workers Per 100m", 0.0045f);
|
||||||
|
|
||||||
|
humanMovementSpeedMultiplier =
|
||||||
|
Config.Bind("General", "Human Movement Speed Multiplier", 1f);
|
||||||
|
vehicleMovementSpeedMultiplier =
|
||||||
|
Config.Bind("General", "Vehicle Movement Speed Multiplier", 1f);
|
||||||
|
|
||||||
humanMovementSpeedMultiplier = Config.Bind("General", "Human Movement Speed Multiplier", 1f);
|
vehicleTrunkCapacityMultiplierDebug = Config.Bind(
|
||||||
vehicleMovementSpeedMultiplier = Config.Bind("General", "Vehicle Movement Speed Multiplier", 1f);
|
"General", "Vehicle Trunk Capacity Multiplier Debug", false);
|
||||||
|
vehicleTrunkCapacityMultiplier =
|
||||||
|
Config.Bind("General", "Vehicle Trunk Capacity Multiplier", 1f);
|
||||||
|
|
||||||
vehicleTrunkCapacityMultiplierDebug =
|
deconstructionTimeMultiplierDebug =
|
||||||
Config.Bind("General", "Vehicle Trunk Capacity Multiplier Debug", false);
|
Config.Bind("General", "Deconstruction Time Multiplier Debug", false);
|
||||||
vehicleTrunkCapacityMultiplier = Config.Bind("General", "Vehicle Trunk Capacity Multiplier", 1f);
|
deconstructionTimeMultiplier =
|
||||||
|
Config.Bind("General", "Deconstruction Time Multiplier", 1f);
|
||||||
|
|
||||||
deconstructionTimeMultiplierDebug = Config.Bind("General", "Deconstruction Time Multiplier Debug", false);
|
constructionTimeMultiplierDebug =
|
||||||
deconstructionTimeMultiplier = Config.Bind("General", "Deconstruction Time Multiplier", 1f);
|
Config.Bind("General", "Construction Time Multiplier Debug", false);
|
||||||
|
constructionTimeMultiplier =
|
||||||
|
Config.Bind("General", "Construction Time Multiplier", 1f);
|
||||||
|
|
||||||
constructionTimeMultiplierDebug = Config.Bind("General", "Construction Time Multiplier Debug", false);
|
productionTimeMultiplierDebug =
|
||||||
constructionTimeMultiplier = Config.Bind("General", "Construction Time Multiplier", 1f);
|
Config.Bind("General", "Production Time Multiplier Debug", false);
|
||||||
|
productionTimeMultiplier =
|
||||||
|
Config.Bind("General", "Production Time Multiplier", 1f);
|
||||||
|
|
||||||
productionTimeMultiplierDebug = Config.Bind("General", "Production Time Multiplier Debug", false);
|
birthingConfigDebug =
|
||||||
productionTimeMultiplier = Config.Bind("General", "Production Time Multiplier", 1f);
|
Config.Bind("Birthing Config", "Birthing Config Debug", false);
|
||||||
|
maxCitizensInZoneToChildrenBorn = Config.Bind(
|
||||||
birthingConfigDebug = Config.Bind("Birthing Config", "Birthing Config Debug", false);
|
"Birthing Config", "Max Citizens in Zone to Children Born", 600);
|
||||||
maxCitizensInZoneToChildrenBorn =
|
moraleInfluenceFloorParam =
|
||||||
Config.Bind("Birthing Config", "Max Citizens in Zone to Children Born", 600);
|
Config.Bind("Birthing Config", "Morale Influence Floor Param", 0.3f);
|
||||||
moraleInfluenceFloorParam = Config.Bind("Birthing Config", "Morale Influence Floor Param", 0.3f);
|
moraleInfluenceCeilingParam =
|
||||||
moraleInfluenceCeilingParam = Config.Bind("Birthing Config", "Morale Influence Ceiling Param", 2f);
|
Config.Bind("Birthing Config", "Morale Influence Ceiling Param", 2f);
|
||||||
foodStockInfluenceFloorParam = Config.Bind("Birthing Config", "Food Stock Influence Floor Param", 0f);
|
foodStockInfluenceFloorParam =
|
||||||
foodStockInfluenceCeilingParam = Config.Bind("Birthing Config", "Food Stock Influence Ceiling Param", 1f);
|
Config.Bind("Birthing Config", "Food Stock Influence Floor Param", 0f);
|
||||||
quartersRatioInfluenceFloorParam =
|
foodStockInfluenceCeilingParam = Config.Bind(
|
||||||
Config.Bind("Birthing Config", "Quarters Ratio Influence Floor Param", 0.6f);
|
"Birthing Config", "Food Stock Influence Ceiling Param", 1f);
|
||||||
quartersRatioInfluenceCeilingParam =
|
quartersRatioInfluenceFloorParam = Config.Bind(
|
||||||
Config.Bind("Birthing Config", "Quarters Ratio Influence Ceiling Param", 1.4f);
|
"Birthing Config", "Quarters Ratio Influence Floor Param", 0.6f);
|
||||||
childToAdultRatioInfluenceFloorParam =
|
quartersRatioInfluenceCeilingParam = Config.Bind(
|
||||||
Config.Bind("Birthing Config", "Child to Adult Ratio Influence Floor Param", 1f);
|
"Birthing Config", "Quarters Ratio Influence Ceiling Param", 1.4f);
|
||||||
childToAdultRatioInfluenceCeilingParam =
|
childToAdultRatioInfluenceFloorParam = Config.Bind(
|
||||||
Config.Bind("Birthing Config", "Child to Adult Ratio Influence Ceiling Param", 0f);
|
"Birthing Config", "Child to Adult Ratio Influence Floor Param", 1f);
|
||||||
|
childToAdultRatioInfluenceCeilingParam = Config.Bind(
|
||||||
|
"Birthing Config", "Child to Adult Ratio Influence Ceiling Param", 0f);
|
||||||
adultAge = Config.Bind("Birthing Config", "Adult Age", 12);
|
adultAge = Config.Bind("Birthing Config", "Adult Age", 12);
|
||||||
oldAge = Config.Bind("Birthing Config", "Old Age", 60);
|
oldAge = Config.Bind("Birthing Config", "Old Age", 60);
|
||||||
|
|
||||||
rotationTimestepMultiplier = Config.Bind("General", "Rotation Timestep Multiplier", 1f);
|
rotationTimestepMultiplier =
|
||||||
|
Config.Bind("General", "Rotation Timestep Multiplier", 1f);
|
||||||
sunsetHourOffset = Config.Bind("General", "Sunset Hour Offset", 0f);
|
sunsetHourOffset = Config.Bind("General", "Sunset Hour Offset", 0f);
|
||||||
sunriseHourOffset = Config.Bind("General", "Sunrise Hour Offset", 0f);
|
sunriseHourOffset = Config.Bind("General", "Sunrise Hour Offset", 0f);
|
||||||
|
|
||||||
productionProfitMultiplierDebug = Config.Bind("General", "Production Profit Multiplier Debug", false);
|
productionProfitMultiplierDebug =
|
||||||
productionProfitMultiplier =
|
Config.Bind("General", "Production Profit Multiplier Debug", false);
|
||||||
Config.Bind("General", "Production Profit Multiplier (Resource ID: multiplier)", "");
|
productionProfitMultiplier = Config.Bind(
|
||||||
|
"General", "Production Profit Multiplier (Resource ID: multiplier)",
|
||||||
|
"");
|
||||||
productionProfitMultiplierDict = new Dictionary<ResourceID, float>();
|
productionProfitMultiplierDict = new Dictionary<ResourceID, float>();
|
||||||
productionProfitMultiplier.SettingChanged += delegate { UpdateProductionProfitMultiplierDict(); };
|
productionProfitMultiplier.SettingChanged += delegate {
|
||||||
|
UpdateProductionProfitMultiplierDict();
|
||||||
|
};
|
||||||
UpdateProductionProfitMultiplierDict();
|
UpdateProductionProfitMultiplierDict();
|
||||||
|
|
||||||
towerEchoSelectionDebug = Config.Bind("General", "Tower Echo Selection Debug", false);
|
towerEchoSelectionDebug =
|
||||||
|
Config.Bind("General", "Tower Echo Selection Debug", false);
|
||||||
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);
|
buildingMaxVolumeDebug =
|
||||||
|
Config.Bind("General", "Building Max Volume Debug", false);
|
||||||
buildingMaxVolume = Config.Bind("General", "Building Max Volume", 50000f);
|
buildingMaxVolume = Config.Bind("General", "Building Max Volume", 50000f);
|
||||||
|
|
||||||
Logger.LogInfo("Cyka mod loaded");
|
Logger.LogInfo("Cyka mod loaded");
|
||||||
@@ -290,21 +323,27 @@ namespace InfectionFreeZone {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
[HarmonyPatch(typeof(GatherResourcesWork), "InstantiateResources", new Type[] { })]
|
[HarmonyPatch(typeof(GatherResourcesWork), "InstantiateResources",
|
||||||
|
new Type[] {})]
|
||||||
public static void PrefixGatheredResource(ref ScavengeWork __instance) {
|
public static void PrefixGatheredResource(ref ScavengeWork __instance) {
|
||||||
var trav = Traverse.Create(__instance);
|
var trav = Traverse.Create(__instance);
|
||||||
var resourcesToDropNew = new Dictionary<ResourceID, int>();
|
var resourcesToDropNew = new Dictionary<ResourceID, int>();
|
||||||
var resourcesToDrop = trav.Field<Dictionary<ResourceID, int>>("_resourcesToDrop");
|
var resourcesToDrop =
|
||||||
|
trav.Field<Dictionary<ResourceID, int>>("_resourcesToDrop");
|
||||||
if (Main.resourceGatheringMultiplierDebug.Value)
|
if (Main.resourceGatheringMultiplierDebug.Value)
|
||||||
Console.WriteLine($"Resources to drop: {resourcesToDrop}");
|
Console.WriteLine($"Resources to drop: {resourcesToDrop}");
|
||||||
if (resourcesToDrop.Value.Count > 0) {
|
if (resourcesToDrop.Value.Count > 0) {
|
||||||
foreach (KeyValuePair<ResourceID, int> resource in resourcesToDrop.Value) {
|
foreach (KeyValuePair<ResourceID, int> resource in resourcesToDrop
|
||||||
|
.Value) {
|
||||||
if (Main.resourceGatheringMultiplierDebug.Value)
|
if (Main.resourceGatheringMultiplierDebug.Value)
|
||||||
Console.WriteLine($"Resource {resource.Key} to drop: {resource.Value}");
|
Console.WriteLine(
|
||||||
var newResourceValue = (int)(resource.Value * Main.resourceScavengingMultiplier.Value);
|
$"Resource {resource.Key} to drop: {resource.Value}");
|
||||||
|
var newResourceValue =
|
||||||
|
(int)(resource.Value * Main.resourceScavengingMultiplier.Value);
|
||||||
resourcesToDropNew.Add(resource.Key, newResourceValue);
|
resourcesToDropNew.Add(resource.Key, newResourceValue);
|
||||||
if (Main.resourceGatheringMultiplierDebug.Value)
|
if (Main.resourceGatheringMultiplierDebug.Value)
|
||||||
Console.WriteLine($"Resource {resource.Key} to drop modified to: {newResourceValue}");
|
Console.WriteLine(
|
||||||
|
$"Resource {resource.Key} to drop modified to: {newResourceValue}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -314,7 +353,8 @@ namespace InfectionFreeZone {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
[HarmonyPatch(typeof(PlaceableObjectDraft), "GetCapacity", typeof(float), typeof(float))]
|
[HarmonyPatch(typeof(PlaceableObjectDraft), "GetCapacity", typeof(float),
|
||||||
|
typeof(float))]
|
||||||
public static void PostfixGetCapacity(ref int __result) {
|
public static void PostfixGetCapacity(ref int __result) {
|
||||||
if (Main.buildingStorageCapacityMultiplier.Value <= 0)
|
if (Main.buildingStorageCapacityMultiplier.Value <= 0)
|
||||||
return;
|
return;
|
||||||
@@ -341,7 +381,8 @@ namespace InfectionFreeZone {
|
|||||||
|
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
[HarmonyPatch(typeof(Building), "DeconstructionResources", MethodType.Getter)]
|
[HarmonyPatch(typeof(Building), "DeconstructionResources", MethodType.Getter)]
|
||||||
public static ResourceQuantity[] PostfixDeconstructionResources(ResourceQuantity[] __result) {
|
public static ResourceQuantity[] PostfixDeconstructionResources(
|
||||||
|
ResourceQuantity[] __result) {
|
||||||
if (Main.buildingDeconstructionResourcesMultiplier.Value <= 0)
|
if (Main.buildingDeconstructionResourcesMultiplier.Value <= 0)
|
||||||
return __result;
|
return __result;
|
||||||
|
|
||||||
@@ -352,12 +393,17 @@ namespace InfectionFreeZone {
|
|||||||
Console.WriteLine($"Resource quantity is {resourceQuantity}");
|
Console.WriteLine($"Resource quantity is {resourceQuantity}");
|
||||||
|
|
||||||
if (Main.buildingDeconstructionResourcesMultiplierDebug.Value)
|
if (Main.buildingDeconstructionResourcesMultiplierDebug.Value)
|
||||||
Console.WriteLine($"Resource quantity value is {resourceQuantity.value}");
|
Console.WriteLine(
|
||||||
modifiedResult[i] = new ResourceQuantity(resourceQuantity.resourceType,
|
$"Resource quantity value is {resourceQuantity.value}");
|
||||||
resourceQuantity.value * Main.buildingDeconstructionResourcesMultiplier.Value);
|
modifiedResult[i] = new ResourceQuantity(
|
||||||
// resourceQuantity.value *= Main.buildingDeconstructionResourcesMultiplier.Value;
|
resourceQuantity.resourceType,
|
||||||
|
resourceQuantity.value *
|
||||||
|
Main.buildingDeconstructionResourcesMultiplier.Value);
|
||||||
|
// resourceQuantity.value *=
|
||||||
|
// Main.buildingDeconstructionResourcesMultiplier.Value;
|
||||||
if (Main.buildingDeconstructionResourcesMultiplierDebug.Value)
|
if (Main.buildingDeconstructionResourcesMultiplierDebug.Value)
|
||||||
Console.WriteLine($"Resource quantity value modified to {modifiedResult[i].value}");
|
Console.WriteLine(
|
||||||
|
$"Resource quantity value modified to {modifiedResult[i].value}");
|
||||||
}
|
}
|
||||||
|
|
||||||
return modifiedResult;
|
return modifiedResult;
|
||||||
@@ -365,7 +411,8 @@ namespace InfectionFreeZone {
|
|||||||
|
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
[HarmonyPatch(typeof(BuildingDestruction), "Initialize")]
|
[HarmonyPatch(typeof(BuildingDestruction), "Initialize")]
|
||||||
public static void PrefixBuildingDeconstruction(ref BuildingDestruction __instance) {
|
public static void
|
||||||
|
PrefixBuildingDeconstruction(ref BuildingDestruction __instance) {
|
||||||
if (Main.deconstructionWorkersPer100m.Value <= 0)
|
if (Main.deconstructionWorkersPer100m.Value <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -376,7 +423,8 @@ namespace InfectionFreeZone {
|
|||||||
Console.WriteLine(
|
Console.WriteLine(
|
||||||
$"Building deconstruction workers per 100m is {configV.deconstructWorkersPer100m3OfBuilding}");
|
$"Building deconstruction workers per 100m is {configV.deconstructWorkersPer100m3OfBuilding}");
|
||||||
|
|
||||||
configV.deconstructWorkersPer100m3OfBuilding = Main.deconstructionWorkersPer100m.Value;
|
configV.deconstructWorkersPer100m3OfBuilding =
|
||||||
|
Main.deconstructionWorkersPer100m.Value;
|
||||||
config.Value = configV;
|
config.Value = configV;
|
||||||
if (Main.buildingDeconstructionResourcesMultiplierDebug.Value)
|
if (Main.buildingDeconstructionResourcesMultiplierDebug.Value)
|
||||||
Console.WriteLine(
|
Console.WriteLine(
|
||||||
@@ -385,8 +433,10 @@ namespace InfectionFreeZone {
|
|||||||
|
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
[HarmonyPatch(typeof(Movement), "CalculateSpeed")]
|
[HarmonyPatch(typeof(Movement), "CalculateSpeed")]
|
||||||
public static void PostfixCalculateSpeedHuman(Movement __instance, ref float __result) {
|
public static void PostfixCalculateSpeedHuman(Movement __instance,
|
||||||
// Humans are "Human(Clone)", infected are "inf_human(Clone)" and vehicles are "ve_<name>"
|
ref float __result) {
|
||||||
|
// Humans are "Human(Clone)", infected are "inf_human(Clone)" and vehicles
|
||||||
|
// are "ve_<name>"
|
||||||
var name = __instance.ToString();
|
var name = __instance.ToString();
|
||||||
if (name.StartsWith("Human"))
|
if (name.StartsWith("Human"))
|
||||||
__result *= Main.humanMovementSpeedMultiplier.Value;
|
__result *= Main.humanMovementSpeedMultiplier.Value;
|
||||||
@@ -395,18 +445,22 @@ namespace InfectionFreeZone {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
[HarmonyPatch(typeof(Vehicle), "Constructor",
|
[HarmonyPatch(typeof(Vehicle), "Constructor", typeof(GroupIconsPool),
|
||||||
typeof(GroupIconsPool), typeof(SignalBus), typeof(WeatherController))]
|
typeof(SignalBus), typeof(WeatherController))]
|
||||||
public static void PostfixVehicle(ref Vehicle __instance) {
|
public static void PostfixVehicle(ref Vehicle __instance) {
|
||||||
if (Main.vehicleTrunkCapacityMultiplier.Value <= 0)
|
if (Main.vehicleTrunkCapacityMultiplier.Value <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (Main.vehicleTrunkCapacityMultiplierDebug.Value)
|
if (Main.vehicleTrunkCapacityMultiplierDebug.Value)
|
||||||
Console.WriteLine($"Vehicle trunk capacity is {__instance.Trunk.Capacity}");
|
Console.WriteLine(
|
||||||
__instance.Trunk.SetCapacity((int)(__instance.Trunk.Capacity * Main.vehicleTrunkCapacityMultiplier.Value),
|
$"Vehicle trunk capacity is {__instance.Trunk.Capacity}");
|
||||||
|
__instance.Trunk.SetCapacity(
|
||||||
|
(int)(__instance.Trunk.Capacity *
|
||||||
|
Main.vehicleTrunkCapacityMultiplier.Value),
|
||||||
true);
|
true);
|
||||||
if (Main.vehicleTrunkCapacityMultiplierDebug.Value)
|
if (Main.vehicleTrunkCapacityMultiplierDebug.Value)
|
||||||
Console.WriteLine($"Vehicle trunk capacity modified to {__instance.Trunk.Capacity}");
|
Console.WriteLine(
|
||||||
|
$"Vehicle trunk capacity modified to {__instance.Trunk.Capacity}");
|
||||||
}
|
}
|
||||||
|
|
||||||
// GatherResourcesWork
|
// GatherResourcesWork
|
||||||
@@ -415,8 +469,10 @@ namespace InfectionFreeZone {
|
|||||||
// ProductionWork
|
// ProductionWork
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
[HarmonyPatch(typeof(DisassembleWork), MethodType.Constructor,
|
[HarmonyPatch(typeof(DisassembleWork), MethodType.Constructor,
|
||||||
typeof(Structure), typeof(float), typeof(int), typeof(ResourcesController), typeof(SignalBus))]
|
typeof(Structure), typeof(float), typeof(int),
|
||||||
public static void PrefixDisassembleWork(Structure structure, ref float timeToDeconstruct) {
|
typeof(ResourcesController), typeof(SignalBus))]
|
||||||
|
public static void PrefixDisassembleWork(Structure structure,
|
||||||
|
ref float timeToDeconstruct) {
|
||||||
if (Main.deconstructionTimeMultiplier.Value <= 0)
|
if (Main.deconstructionTimeMultiplier.Value <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -429,9 +485,10 @@ namespace InfectionFreeZone {
|
|||||||
|
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
[HarmonyPatch(typeof(ConstructableWork), MethodType.Constructor,
|
[HarmonyPatch(typeof(ConstructableWork), MethodType.Constructor,
|
||||||
typeof(Structure), typeof(Dictionary<ResourceID, int>), typeof(float), typeof(StockroomsController),
|
typeof(Structure), typeof(Dictionary<ResourceID, int>),
|
||||||
typeof(SignalBus))]
|
typeof(float), typeof(StockroomsController), typeof(SignalBus))]
|
||||||
public static void PrefixConstructWork(Structure structure, Dictionary<ResourceID, int> cost,
|
public static void PrefixConstructWork(Structure structure,
|
||||||
|
Dictionary<ResourceID, int> cost,
|
||||||
ref float timeToConstruct) {
|
ref float timeToConstruct) {
|
||||||
if (Main.deconstructionTimeMultiplier.Value <= 0)
|
if (Main.deconstructionTimeMultiplier.Value <= 0)
|
||||||
return;
|
return;
|
||||||
@@ -459,7 +516,8 @@ namespace InfectionFreeZone {
|
|||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
[HarmonyPatch(typeof(CitizensController), "IncreasePopulation")]
|
[HarmonyPatch(typeof(CitizensController), "IncreasePopulation")]
|
||||||
// Could not find a better way to do this
|
// Could not find a better way to do this
|
||||||
public static void PostfixCharactersConfig(ref CitizensController __instance) {
|
public static void
|
||||||
|
PostfixCharactersConfig(ref CitizensController __instance) {
|
||||||
if (Main.birthingConfigDebug.Value)
|
if (Main.birthingConfigDebug.Value)
|
||||||
Console.WriteLine($"Citizens controller IncreasePopulation");
|
Console.WriteLine($"Citizens controller IncreasePopulation");
|
||||||
var trav = Traverse.Create(__instance);
|
var trav = Traverse.Create(__instance);
|
||||||
@@ -475,36 +533,43 @@ namespace InfectionFreeZone {
|
|||||||
if (Main.birthingConfigDebug.Value)
|
if (Main.birthingConfigDebug.Value)
|
||||||
Console.WriteLine($"Old age is {charactersConfigV.oldAge}");
|
Console.WriteLine($"Old age is {charactersConfigV.oldAge}");
|
||||||
|
|
||||||
bornConfig.MaxCitizensInZoneToChildrenBorn = Main.maxCitizensInZoneToChildrenBorn.Value;
|
bornConfig.MaxCitizensInZoneToChildrenBorn =
|
||||||
|
Main.maxCitizensInZoneToChildrenBorn.Value;
|
||||||
if (Main.birthingConfigDebug.Value)
|
if (Main.birthingConfigDebug.Value)
|
||||||
Console.WriteLine(
|
Console.WriteLine(
|
||||||
$"Max citizens in zone to children born is {bornConfig.MaxCitizensInZoneToChildrenBorn}");
|
$"Max citizens in zone to children born is {bornConfig.MaxCitizensInZoneToChildrenBorn}");
|
||||||
|
|
||||||
bornConfig.MoraleInfluenceFloorParam = Main.moraleInfluenceFloorParam.Value;
|
bornConfig.MoraleInfluenceFloorParam = Main.moraleInfluenceFloorParam.Value;
|
||||||
if (Main.birthingConfigDebug.Value)
|
if (Main.birthingConfigDebug.Value)
|
||||||
Console.WriteLine($"Morale influence floor param is {bornConfig.MoraleInfluenceFloorParam}");
|
Console.WriteLine(
|
||||||
|
$"Morale influence floor param is {bornConfig.MoraleInfluenceFloorParam}");
|
||||||
|
|
||||||
bornConfig.MoraleInfluenceCeilingParam = Main.moraleInfluenceCeilingParam.Value;
|
bornConfig.MoraleInfluenceCeilingParam =
|
||||||
|
Main.moraleInfluenceCeilingParam.Value;
|
||||||
if (Main.birthingConfigDebug.Value)
|
if (Main.birthingConfigDebug.Value)
|
||||||
Console.WriteLine(
|
Console.WriteLine(
|
||||||
$"Morale influence ceiling param is {bornConfig.MoraleInfluenceCeilingParam}");
|
$"Morale influence ceiling param is {bornConfig.MoraleInfluenceCeilingParam}");
|
||||||
|
|
||||||
bornConfig.FoodStockInfluenceFloorParam = Main.foodStockInfluenceFloorParam.Value;
|
bornConfig.FoodStockInfluenceFloorParam =
|
||||||
|
Main.foodStockInfluenceFloorParam.Value;
|
||||||
if (Main.birthingConfigDebug.Value)
|
if (Main.birthingConfigDebug.Value)
|
||||||
Console.WriteLine(
|
Console.WriteLine(
|
||||||
$"Food stock influence floor param is {bornConfig.FoodStockInfluenceFloorParam}");
|
$"Food stock influence floor param is {bornConfig.FoodStockInfluenceFloorParam}");
|
||||||
|
|
||||||
bornConfig.FoodStockInfluenceCeilingParam = Main.foodStockInfluenceCeilingParam.Value;
|
bornConfig.FoodStockInfluenceCeilingParam =
|
||||||
|
Main.foodStockInfluenceCeilingParam.Value;
|
||||||
if (Main.birthingConfigDebug.Value)
|
if (Main.birthingConfigDebug.Value)
|
||||||
Console.WriteLine(
|
Console.WriteLine(
|
||||||
$"Food stock influence ceiling param is {bornConfig.FoodStockInfluenceCeilingParam}");
|
$"Food stock influence ceiling param is {bornConfig.FoodStockInfluenceCeilingParam}");
|
||||||
|
|
||||||
bornConfig.QuartersRatioInfluenceFloorParam = Main.quartersRatioInfluenceFloorParam.Value;
|
bornConfig.QuartersRatioInfluenceFloorParam =
|
||||||
|
Main.quartersRatioInfluenceFloorParam.Value;
|
||||||
if (Main.birthingConfigDebug.Value)
|
if (Main.birthingConfigDebug.Value)
|
||||||
Console.WriteLine(
|
Console.WriteLine(
|
||||||
$"Quarters ratio influence floor param is {bornConfig.QuartersRatioInfluenceFloorParam}");
|
$"Quarters ratio influence floor param is {bornConfig.QuartersRatioInfluenceFloorParam}");
|
||||||
|
|
||||||
bornConfig.QuartersRatioInfluenceCeilingParam = Main.quartersRatioInfluenceCeilingParam.Value;
|
bornConfig.QuartersRatioInfluenceCeilingParam =
|
||||||
|
Main.quartersRatioInfluenceCeilingParam.Value;
|
||||||
if (Main.birthingConfigDebug.Value)
|
if (Main.birthingConfigDebug.Value)
|
||||||
Console.WriteLine(
|
Console.WriteLine(
|
||||||
$"Quarters ratio influence ceiling param is {bornConfig.QuartersRatioInfluenceCeilingParam}");
|
$"Quarters ratio influence ceiling param is {bornConfig.QuartersRatioInfluenceCeilingParam}");
|
||||||
@@ -527,18 +592,24 @@ namespace InfectionFreeZone {
|
|||||||
|
|
||||||
[HarmonyTranspiler]
|
[HarmonyTranspiler]
|
||||||
[HarmonyPatch(typeof(PlaceObjectsInSingleLineCursor), "RotateRight")]
|
[HarmonyPatch(typeof(PlaceObjectsInSingleLineCursor), "RotateRight")]
|
||||||
public static IEnumerable<CodeInstruction> PostfixRotateRight(IEnumerable<CodeInstruction> instructions) {
|
public static IEnumerable<CodeInstruction>
|
||||||
|
PostfixRotateRight(IEnumerable<CodeInstruction> instructions) {
|
||||||
var codes = new List<CodeInstruction>(instructions);
|
var codes = new List<CodeInstruction>(instructions);
|
||||||
for (var i = 0; i < codes.Count; i++) {
|
for (var i = 0; i < codes.Count; i++) {
|
||||||
var code = codes[i];
|
var code = codes[i];
|
||||||
Console.WriteLine($"Opcode is {code.opcode}");
|
Console.WriteLine($"Opcode is {code.opcode}");
|
||||||
if (code.opcode == OpCodes.Ldc_R4 && Mathf.Approximately((float)code.operand, 100f)) {
|
if (code.opcode == OpCodes.Ldc_R4 &&
|
||||||
|
Mathf.Approximately((float)code.operand, 100f)) {
|
||||||
Console.WriteLine($"Operand is {code.operand}");
|
Console.WriteLine($"Operand is {code.operand}");
|
||||||
codes[i] = new CodeInstruction(OpCodes.Ldsfld,
|
codes[i] = new CodeInstruction(
|
||||||
|
OpCodes.Ldsfld,
|
||||||
AccessTools.Field(typeof(Main), "rotationTimestepMultiplier"));
|
AccessTools.Field(typeof(Main), "rotationTimestepMultiplier"));
|
||||||
codes.Insert(i + 1,
|
codes.Insert(i + 1, new CodeInstruction(
|
||||||
new CodeInstruction(OpCodes.Call,
|
OpCodes.Call,
|
||||||
AccessTools.PropertyGetter(typeof(Main).GetField("rotationTimestepMultiplier").FieldType,
|
AccessTools.PropertyGetter(
|
||||||
|
typeof(Main)
|
||||||
|
.GetField("rotationTimestepMultiplier")
|
||||||
|
.FieldType,
|
||||||
"Value")));
|
"Value")));
|
||||||
Console.WriteLine($"Operand modified to {codes[i].operand}");
|
Console.WriteLine($"Operand modified to {codes[i].operand}");
|
||||||
}
|
}
|
||||||
@@ -549,18 +620,24 @@ namespace InfectionFreeZone {
|
|||||||
|
|
||||||
[HarmonyTranspiler]
|
[HarmonyTranspiler]
|
||||||
[HarmonyPatch(typeof(PlaceObjectsInSingleLineCursor), "RotateLeft")]
|
[HarmonyPatch(typeof(PlaceObjectsInSingleLineCursor), "RotateLeft")]
|
||||||
public static IEnumerable<CodeInstruction> PostfixRotateLeft(IEnumerable<CodeInstruction> instructions) {
|
public static IEnumerable<CodeInstruction>
|
||||||
|
PostfixRotateLeft(IEnumerable<CodeInstruction> instructions) {
|
||||||
var codes = new List<CodeInstruction>(instructions);
|
var codes = new List<CodeInstruction>(instructions);
|
||||||
for (var i = 0; i < codes.Count; i++) {
|
for (var i = 0; i < codes.Count; i++) {
|
||||||
var code = codes[i];
|
var code = codes[i];
|
||||||
Console.WriteLine($"Opcode is {code.opcode}");
|
Console.WriteLine($"Opcode is {code.opcode}");
|
||||||
if (code.opcode == OpCodes.Ldc_R4 && Mathf.Approximately((float)code.operand, 100f)) {
|
if (code.opcode == OpCodes.Ldc_R4 &&
|
||||||
|
Mathf.Approximately((float)code.operand, 100f)) {
|
||||||
Console.WriteLine($"Operand is {code.operand}");
|
Console.WriteLine($"Operand is {code.operand}");
|
||||||
codes[i] = new CodeInstruction(OpCodes.Ldsfld,
|
codes[i] = new CodeInstruction(
|
||||||
|
OpCodes.Ldsfld,
|
||||||
AccessTools.Field(typeof(Main), "rotationTimestepMultiplier"));
|
AccessTools.Field(typeof(Main), "rotationTimestepMultiplier"));
|
||||||
codes.Insert(i + 1,
|
codes.Insert(i + 1, new CodeInstruction(
|
||||||
new CodeInstruction(OpCodes.Call,
|
OpCodes.Call,
|
||||||
AccessTools.PropertyGetter(typeof(Main).GetField("rotationTimestepMultiplier").FieldType,
|
AccessTools.PropertyGetter(
|
||||||
|
typeof(Main)
|
||||||
|
.GetField("rotationTimestepMultiplier")
|
||||||
|
.FieldType,
|
||||||
"Value")));
|
"Value")));
|
||||||
Console.WriteLine($"Operand modified to {codes[i].operand}");
|
Console.WriteLine($"Operand modified to {codes[i].operand}");
|
||||||
}
|
}
|
||||||
@@ -585,7 +662,8 @@ namespace InfectionFreeZone {
|
|||||||
|
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
[HarmonyPatch(typeof(ProductionWork), "ProduceResources")]
|
[HarmonyPatch(typeof(ProductionWork), "ProduceResources")]
|
||||||
public static void PrefixProduceResources(List<ProductionDataPart> productionDataParts) {
|
public static void
|
||||||
|
PrefixProduceResources(List<ProductionDataPart> productionDataParts) {
|
||||||
if (Main.productionProfitMultiplierDict.Count == 0)
|
if (Main.productionProfitMultiplierDict.Count == 0)
|
||||||
return;
|
return;
|
||||||
if (productionDataParts.Count == 0)
|
if (productionDataParts.Count == 0)
|
||||||
@@ -596,7 +674,8 @@ namespace InfectionFreeZone {
|
|||||||
if (Main.productionProfitMultiplierDebug.Value)
|
if (Main.productionProfitMultiplierDebug.Value)
|
||||||
Console.WriteLine(
|
Console.WriteLine(
|
||||||
$"Production data part is {productionDataPart.type} x {productionDataPart.amount}");
|
$"Production data part is {productionDataPart.type} x {productionDataPart.amount}");
|
||||||
if (Main.productionProfitMultiplierDict.TryGetValue(productionDataPart.type, out var setpoint)) {
|
if (Main.productionProfitMultiplierDict.TryGetValue(
|
||||||
|
productionDataPart.type, out var setpoint)) {
|
||||||
if (Main.productionProfitMultiplierDebug.Value)
|
if (Main.productionProfitMultiplierDebug.Value)
|
||||||
Console.WriteLine($"Production data part has setpoint {setpoint}");
|
Console.WriteLine($"Production data part has setpoint {setpoint}");
|
||||||
productionDataPart.amount = (int)setpoint;
|
productionDataPart.amount = (int)setpoint;
|
||||||
@@ -609,10 +688,12 @@ namespace InfectionFreeZone {
|
|||||||
|
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
[HarmonyPatch(typeof(StructureDefenceModule), "Awake")]
|
[HarmonyPatch(typeof(StructureDefenceModule), "Awake")]
|
||||||
public static void PostfixStructureDefenceModule(StructureDefenceModule __instance) {
|
public static void
|
||||||
|
PostfixStructureDefenceModule(StructureDefenceModule __instance) {
|
||||||
if (Main.towerEchoSelectionDebug.Value)
|
if (Main.towerEchoSelectionDebug.Value)
|
||||||
Console.WriteLine($"Structure defence module created");
|
Console.WriteLine($"Structure defence module created");
|
||||||
Main.towerEchoSelectionList.Add(new WeakReference<StructureDefenceModule>(__instance));
|
Main.towerEchoSelectionList.Add(
|
||||||
|
new WeakReference<StructureDefenceModule>(__instance));
|
||||||
}
|
}
|
||||||
|
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
@@ -634,7 +715,8 @@ namespace InfectionFreeZone {
|
|||||||
|
|
||||||
if (Main.towerEchoSelectionDebug.Value) {
|
if (Main.towerEchoSelectionDebug.Value) {
|
||||||
Console.WriteLine($"Selected weapon item is {selectedItem.name}");
|
Console.WriteLine($"Selected weapon item is {selectedItem.name}");
|
||||||
Console.WriteLine($"Echoing weapon to {Main.towerEchoSelectionList.Count} towers");
|
Console.WriteLine(
|
||||||
|
$"Echoing weapon to {Main.towerEchoSelectionList.Count} towers");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i = 0; i < Main.towerEchoSelectionList.Count; i++) {
|
for (var i = 0; i < Main.towerEchoSelectionList.Count; i++) {
|
||||||
@@ -654,11 +736,13 @@ namespace InfectionFreeZone {
|
|||||||
towerEchoSelectionT.SetFieldOfView(selectedItem.WeaponData);
|
towerEchoSelectionT.SetFieldOfView(selectedItem.WeaponData);
|
||||||
towerEchoSelectionT.SetupWeapon(selectedItem.WeaponData);
|
towerEchoSelectionT.SetupWeapon(selectedItem.WeaponData);
|
||||||
|
|
||||||
var selectedWeapon = towerEchoSelectionT.SelectedWeapon == null
|
var selectedWeapon =
|
||||||
|
towerEchoSelectionT.SelectedWeapon == null
|
||||||
? "null"
|
? "null"
|
||||||
: towerEchoSelectionT.SelectedWeapon.ToString();
|
: towerEchoSelectionT.SelectedWeapon.ToString();
|
||||||
if (Main.towerEchoSelectionDebug.Value)
|
if (Main.towerEchoSelectionDebug.Value)
|
||||||
Console.WriteLine($"Tower defence weapon modified to {selectedWeapon}");
|
Console.WriteLine(
|
||||||
|
$"Tower defence weapon modified to {selectedWeapon}");
|
||||||
}
|
}
|
||||||
} catch (NullReferenceException e) {
|
} catch (NullReferenceException e) {
|
||||||
Console.WriteLine($"Failed to set tower defence weapon: {e}");
|
Console.WriteLine($"Failed to set tower defence weapon: {e}");
|
||||||
@@ -669,8 +753,8 @@ namespace InfectionFreeZone {
|
|||||||
// TODO: Add toggle for this
|
// TODO: Add toggle for this
|
||||||
[HarmonyTranspiler]
|
[HarmonyTranspiler]
|
||||||
[HarmonyPatch(typeof(ValidatableStructure), "Awake")]
|
[HarmonyPatch(typeof(ValidatableStructure), "Awake")]
|
||||||
public static IEnumerable<CodeInstruction> PostfixValidatableStructure(
|
public static IEnumerable<CodeInstruction>
|
||||||
IEnumerable<CodeInstruction> instructions) {
|
PostfixValidatableStructure(IEnumerable<CodeInstruction> instructions) {
|
||||||
var codes = new List<CodeInstruction>(instructions);
|
var codes = new List<CodeInstruction>(instructions);
|
||||||
int start = 0;
|
int start = 0;
|
||||||
int start2 = 0;
|
int start2 = 0;
|
||||||
@@ -678,40 +762,52 @@ namespace InfectionFreeZone {
|
|||||||
int end2 = 0;
|
int end2 = 0;
|
||||||
for (var i = 0; i < codes.Count; i++) {
|
for (var i = 0; i < codes.Count; i++) {
|
||||||
if (codes[i].opcode == OpCodes.Ldc_I4_5) {
|
if (codes[i].opcode == OpCodes.Ldc_I4_5) {
|
||||||
Console.WriteLine($"Opcode is {codes[i].opcode} and operand is {codes[i].operand} at index {i}");
|
Console.WriteLine(
|
||||||
codes[i] = new CodeInstruction(OpCodes.Ldc_I4_2); // Array size after our deletion is 3 from 5
|
$"Opcode is {codes[i].opcode} and operand is {codes[i].operand} at index {i}");
|
||||||
|
codes[i] = new CodeInstruction(
|
||||||
|
OpCodes.Ldc_I4_2); // Array size after our deletion is 3 from 5
|
||||||
}
|
}
|
||||||
|
|
||||||
if (codes[i].opcode == OpCodes.Ldstr && codes[i].operand.ToString() == "Tower") {
|
if (codes[i].opcode == OpCodes.Ldstr &&
|
||||||
Console.WriteLine($"Opcode is {codes[i].opcode} and operand is {codes[i].operand} at index {i}");
|
codes[i].operand.ToString() == "Tower") {
|
||||||
|
Console.WriteLine(
|
||||||
|
$"Opcode is {codes[i].opcode} and operand is {codes[i].operand} at index {i}");
|
||||||
start2 = i - 2;
|
start2 = i - 2;
|
||||||
end2 = i + 2;
|
end2 = i + 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (codes[i].opcode == OpCodes.Ldstr && codes[i].operand.ToString() == "Farmland") {
|
if (codes[i].opcode == OpCodes.Ldstr &&
|
||||||
Console.WriteLine($"Opcode is {codes[i].opcode} and operand is {codes[i].operand} at index {i}");
|
codes[i].operand.ToString() == "Farmland") {
|
||||||
|
Console.WriteLine(
|
||||||
|
$"Opcode is {codes[i].opcode} and operand is {codes[i].operand} at index {i}");
|
||||||
Console.WriteLine(
|
Console.WriteLine(
|
||||||
$"Opcode is {codes[i - 1].opcode} and operand is {codes[i - 1].operand} at index {i - 1}");
|
$"Opcode is {codes[i - 1].opcode} and operand is {codes[i - 1].operand} at index {i - 1}");
|
||||||
codes[i - 1].opcode =
|
codes[i - 1].opcode =
|
||||||
OpCodes.Ldc_I4_1; // Because we deleted the previous element this one is now index 1 instead of 2
|
OpCodes.Ldc_I4_1; // Because we deleted the previous element this
|
||||||
|
// one is now index 1 instead of 2
|
||||||
}
|
}
|
||||||
|
|
||||||
if (codes[i].opcode == OpCodes.Ldstr && codes[i].operand.ToString() == "Wall") {
|
if (codes[i].opcode == OpCodes.Ldstr &&
|
||||||
Console.WriteLine($"Opcode is {codes[i].opcode} and operand is {codes[i].operand} at index {i}");
|
codes[i].operand.ToString() == "Wall") {
|
||||||
|
Console.WriteLine(
|
||||||
|
$"Opcode is {codes[i].opcode} and operand is {codes[i].operand} at index {i}");
|
||||||
start = i - 2;
|
start = i - 2;
|
||||||
end = i + 6;
|
end = i + 6;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.WriteLine($"Start is {start} with opcode {codes[start].opcode} and operand {codes[start].operand}");
|
Console.WriteLine(
|
||||||
Console.WriteLine($"End is {end} with opcode {codes[end].opcode} and operand {codes[end].operand}");
|
$"Start is {start} with opcode {codes[start].opcode} and operand {codes[start].operand}");
|
||||||
|
Console.WriteLine(
|
||||||
|
$"End is {end} with opcode {codes[end].opcode} and operand {codes[end].operand}");
|
||||||
codes.RemoveRange(start, end - start);
|
codes.RemoveRange(start, end - start);
|
||||||
Console.WriteLine($"Removed {end - start} instructions");
|
Console.WriteLine($"Removed {end - start} instructions");
|
||||||
|
|
||||||
Console.WriteLine(
|
Console.WriteLine(
|
||||||
$"Start2 is {start2} with opcode {codes[start2].opcode} and operand {codes[start2].operand}");
|
$"Start2 is {start2} with opcode {codes[start2].opcode} and operand {codes[start2].operand}");
|
||||||
Console.WriteLine($"End2 is {end2} with opcode {codes[end2].opcode} and operand {codes[end2].operand}");
|
Console.WriteLine(
|
||||||
|
$"End2 is {end2} with opcode {codes[end2].opcode} and operand {codes[end2].operand}");
|
||||||
codes.RemoveRange(start2, end2 - start2);
|
codes.RemoveRange(start2, end2 - start2);
|
||||||
Console.WriteLine($"Removed {end2 - start2} instructions");
|
Console.WriteLine($"Removed {end2 - start2} instructions");
|
||||||
|
|
||||||
@@ -722,14 +818,16 @@ 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,
|
public static void PostfixWallConstructor(Wall.Factory factory,
|
||||||
|
WorkersRadio workersRadio,
|
||||||
ref WallConfig wallConfig) {
|
ref WallConfig wallConfig) {
|
||||||
Console.WriteLine($"Wall config created");
|
Console.WriteLine($"Wall config created");
|
||||||
wallConfig.maxAngel = 2f;
|
wallConfig.maxAngel = 2f;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
[HarmonyPatch(typeof(AdaptController), MethodType.Constructor, typeof(AdaptConfig))]
|
[HarmonyPatch(typeof(AdaptController), MethodType.Constructor,
|
||||||
|
typeof(AdaptConfig))]
|
||||||
public static void PostfixAdaptConfig(ref AdaptConfig adaptConfig) {
|
public static void PostfixAdaptConfig(ref AdaptConfig adaptConfig) {
|
||||||
var trav = Traverse.Create(adaptConfig);
|
var trav = Traverse.Create(adaptConfig);
|
||||||
var buildingsMaxVolume = trav.Field<float>("buildingsMaxVolume");
|
var buildingsMaxVolume = trav.Field<float>("buildingsMaxVolume");
|
||||||
@@ -740,7 +838,8 @@ namespace InfectionFreeZone {
|
|||||||
buildingsMaxVolume.Value = Main.buildingMaxVolume.Value;
|
buildingsMaxVolume.Value = Main.buildingMaxVolume.Value;
|
||||||
|
|
||||||
if (Main.buildingMaxVolumeDebug.Value)
|
if (Main.buildingMaxVolumeDebug.Value)
|
||||||
Console.WriteLine($"Building max volume modified to {buildingsMaxVolume.Value}");
|
Console.WriteLine(
|
||||||
|
$"Building max volume modified to {buildingsMaxVolume.Value}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -18,7 +18,8 @@ using System.Runtime.InteropServices;
|
|||||||
// COM, set the ComVisible attribute to true on that type.
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
[assembly:ComVisible(false)]
|
[assembly:ComVisible(false)]
|
||||||
|
|
||||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
// The following GUID is for the ID of the typelib if this project is exposed to
|
||||||
|
// COM
|
||||||
[assembly:Guid("DA9D274E-486F-4F82-84FF-CD9388CB0B09")]
|
[assembly:Guid("DA9D274E-486F-4F82-84FF-CD9388CB0B09")]
|
||||||
|
|
||||||
// Version information for an assembly consists of the following four values:
|
// Version information for an assembly consists of the following four values:
|
||||||
@@ -28,8 +29,7 @@ using System.Runtime.InteropServices;
|
|||||||
// Build Number
|
// Build Number
|
||||||
// Revision
|
// Revision
|
||||||
//
|
//
|
||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision
|
||||||
// by using the '*' as shown below:
|
// Numbers by using the '*' as shown below: [assembly: AssemblyVersion("1.0.*")]
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
|
||||||
[assembly:AssemblyVersion("1.0.0.0")]
|
[assembly:AssemblyVersion("1.0.0.0")]
|
||||||
[assembly:AssemblyFileVersion("1.0.0.0")]
|
[assembly:AssemblyFileVersion("1.0.0.0")]
|
Reference in New Issue
Block a user