10 Commits

37 changed files with 1735 additions and 972 deletions

View File

@@ -43,11 +43,12 @@ using Zenject;
// System.Single Gameplay.Units.Movements.Movement::CalculateSpeed()
// GameConfig looks interesting
// 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 {
[BepInPlugin(pluginGuid, pluginName, pluginVersion)]
public class Main : BaseUnityPlugin {
[BepInPlugin(pluginGuid, pluginName, pluginVersion)]
public class Main : BaseUnityPlugin {
private const string pluginGuid = "InfectionFreeDave";
private const string pluginName = "InfectionFreeDave";
private const string pluginVersion = "1.0.0";
@@ -70,7 +71,8 @@ namespace InfectionFreeZone {
public static ConfigEntry<bool> buildingQuartersCapacityMultiplierDebug;
public static ConfigEntry<float> buildingQuartersCapacityMultiplier;
public static ConfigEntry<bool> buildingDeconstructionResourcesMultiplierDebug;
public static ConfigEntry<bool>
buildingDeconstructionResourcesMultiplierDebug;
public static ConfigEntry<float> buildingDeconstructionResourcesMultiplier;
public static ConfigEntry<float> humanMovementSpeedMultiplier;
@@ -102,7 +104,8 @@ namespace InfectionFreeZone {
public static ConfigEntry<int> adultAge;
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> sunriseHourOffset;
@@ -112,92 +115,122 @@ namespace InfectionFreeZone {
public static ConfigEntry<bool> towerEchoSelectionDebug;
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() {
resourceMultiplierDebug = Config.Bind("General", "Resource Multiplier Debug", false);
resourceMultiplierDebug =
Config.Bind("General", "Resource Multiplier Debug", false);
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);
resourceGatheringMultiplierDebug = Config.Bind("General", "Resource Gathering Multiplier Debug", false);
resourceGatheringMultiplier = Config.Bind("General", "Resource Gathering Multiplier", 1f);
resourceGatheringMultiplierDebug =
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);
resourceScavengingMultiplier = Config.Bind("General", "Resource Scavenging Multiplier", 1f);
resourceScavengingMultiplierDebug =
Config.Bind("General", "Resource Scavenging Multiplier Debug", false);
resourceScavengingMultiplier =
Config.Bind("General", "Resource Scavenging Multiplier", 1f);
buildingStorageCapacityMultiplierDebug =
Config.Bind("General", "Building Storage Capacity Multiplier Debug", false);
buildingStorageCapacityMultiplier = Config.Bind("General", "Building Storage Capacity Multiplier", 1f);
buildingStorageCapacityMultiplierDebug = Config.Bind(
"General", "Building Storage Capacity Multiplier Debug", false);
buildingStorageCapacityMultiplier =
Config.Bind("General", "Building Storage Capacity Multiplier", 1f);
buildingQuartersCapacityMultiplierDebug =
Config.Bind("General", "Building Quarters Capacity Multiplier Debug", false);
buildingQuartersCapacityMultiplier = Config.Bind("General", "Building Quarters Capacity Multiplier", 1f);
buildingQuartersCapacityMultiplierDebug = Config.Bind(
"General", "Building Quarters Capacity Multiplier Debug", false);
buildingQuartersCapacityMultiplier =
Config.Bind("General", "Building Quarters Capacity Multiplier", 1f);
buildingDeconstructionResourcesMultiplierDebug = Config.Bind("General",
"Building Deconstruction Resources Multiplier Debug", false);
buildingDeconstructionResourcesMultiplier =
Config.Bind("General", "Building Deconstruction Resources Multiplier", 1f);
deconstructionWorkersPer100m =
Config.Bind("General", "Building Deconstruction Workers Per 100m", 0.0045f);
buildingDeconstructionResourcesMultiplierDebug = Config.Bind(
"General", "Building Deconstruction Resources Multiplier Debug", false);
buildingDeconstructionResourcesMultiplier = Config.Bind(
"General", "Building Deconstruction Resources Multiplier", 1f);
deconstructionWorkersPer100m = Config.Bind(
"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);
vehicleMovementSpeedMultiplier = Config.Bind("General", "Vehicle Movement Speed Multiplier", 1f);
vehicleTrunkCapacityMultiplierDebug = Config.Bind(
"General", "Vehicle Trunk Capacity Multiplier Debug", false);
vehicleTrunkCapacityMultiplier =
Config.Bind("General", "Vehicle Trunk Capacity Multiplier", 1f);
vehicleTrunkCapacityMultiplierDebug =
Config.Bind("General", "Vehicle Trunk Capacity Multiplier Debug", false);
vehicleTrunkCapacityMultiplier = Config.Bind("General", "Vehicle Trunk Capacity Multiplier", 1f);
deconstructionTimeMultiplierDebug =
Config.Bind("General", "Deconstruction Time Multiplier Debug", false);
deconstructionTimeMultiplier =
Config.Bind("General", "Deconstruction Time Multiplier", 1f);
deconstructionTimeMultiplierDebug = Config.Bind("General", "Deconstruction Time Multiplier Debug", false);
deconstructionTimeMultiplier = Config.Bind("General", "Deconstruction Time Multiplier", 1f);
constructionTimeMultiplierDebug =
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);
constructionTimeMultiplier = Config.Bind("General", "Construction Time Multiplier", 1f);
productionTimeMultiplierDebug =
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);
productionTimeMultiplier = Config.Bind("General", "Production Time Multiplier", 1f);
birthingConfigDebug = Config.Bind("Birthing Config", "Birthing Config Debug", false);
maxCitizensInZoneToChildrenBorn =
Config.Bind("Birthing Config", "Max Citizens in Zone to Children Born", 600);
moraleInfluenceFloorParam = Config.Bind("Birthing Config", "Morale Influence Floor Param", 0.3f);
moraleInfluenceCeilingParam = Config.Bind("Birthing Config", "Morale Influence Ceiling Param", 2f);
foodStockInfluenceFloorParam = Config.Bind("Birthing Config", "Food Stock Influence Floor Param", 0f);
foodStockInfluenceCeilingParam = Config.Bind("Birthing Config", "Food Stock Influence Ceiling Param", 1f);
quartersRatioInfluenceFloorParam =
Config.Bind("Birthing Config", "Quarters Ratio Influence Floor Param", 0.6f);
quartersRatioInfluenceCeilingParam =
Config.Bind("Birthing Config", "Quarters Ratio Influence Ceiling Param", 1.4f);
childToAdultRatioInfluenceFloorParam =
Config.Bind("Birthing Config", "Child to Adult Ratio Influence Floor Param", 1f);
childToAdultRatioInfluenceCeilingParam =
Config.Bind("Birthing Config", "Child to Adult Ratio Influence Ceiling Param", 0f);
birthingConfigDebug =
Config.Bind("Birthing Config", "Birthing Config Debug", false);
maxCitizensInZoneToChildrenBorn = Config.Bind(
"Birthing Config", "Max Citizens in Zone to Children Born", 600);
moraleInfluenceFloorParam =
Config.Bind("Birthing Config", "Morale Influence Floor Param", 0.3f);
moraleInfluenceCeilingParam =
Config.Bind("Birthing Config", "Morale Influence Ceiling Param", 2f);
foodStockInfluenceFloorParam =
Config.Bind("Birthing Config", "Food Stock Influence Floor Param", 0f);
foodStockInfluenceCeilingParam = Config.Bind(
"Birthing Config", "Food Stock Influence Ceiling Param", 1f);
quartersRatioInfluenceFloorParam = Config.Bind(
"Birthing Config", "Quarters Ratio Influence Floor Param", 0.6f);
quartersRatioInfluenceCeilingParam = Config.Bind(
"Birthing Config", "Quarters Ratio Influence Ceiling Param", 1.4f);
childToAdultRatioInfluenceFloorParam = Config.Bind(
"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);
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);
sunriseHourOffset = Config.Bind("General", "Sunrise Hour Offset", 0f);
productionProfitMultiplierDebug = Config.Bind("General", "Production Profit Multiplier Debug", false);
productionProfitMultiplier =
Config.Bind("General", "Production Profit Multiplier (Resource ID: multiplier)", "");
productionProfitMultiplierDebug =
Config.Bind("General", "Production Profit Multiplier Debug", false);
productionProfitMultiplier = Config.Bind(
"General", "Production Profit Multiplier (Resource ID: multiplier)",
"");
productionProfitMultiplierDict = new Dictionary<ResourceID, float>();
productionProfitMultiplier.SettingChanged += delegate { UpdateProductionProfitMultiplierDict(); };
productionProfitMultiplier.SettingChanged += delegate {
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);
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);
Logger.LogInfo("Cyka mod loaded");
@@ -235,10 +268,10 @@ namespace InfectionFreeZone {
Console.WriteLine($"Added {resourceID} with multiplier {multiplier}");
}
}
}
}
[HarmonyPatch]
public class Patches {
[HarmonyPatch]
public class Patches {
[HarmonyPrefix]
[HarmonyPatch(typeof(GameCustomize), "LoadResourcesSettings")]
public static void PostfixResourceMultiplier(ref float multiplier) {
@@ -290,21 +323,27 @@ namespace InfectionFreeZone {
}
[HarmonyPrefix]
[HarmonyPatch(typeof(GatherResourcesWork), "InstantiateResources", new Type[] { })]
[HarmonyPatch(typeof(GatherResourcesWork), "InstantiateResources",
new Type[] {})]
public static void PrefixGatheredResource(ref ScavengeWork __instance) {
var trav = Traverse.Create(__instance);
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)
Console.WriteLine($"Resources to drop: {resourcesToDrop}");
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)
Console.WriteLine($"Resource {resource.Key} to drop: {resource.Value}");
var newResourceValue = (int)(resource.Value * Main.resourceScavengingMultiplier.Value);
Console.WriteLine(
$"Resource {resource.Key} to drop: {resource.Value}");
var newResourceValue =
(int)(resource.Value * Main.resourceScavengingMultiplier.Value);
resourcesToDropNew.Add(resource.Key, newResourceValue);
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]
[HarmonyPatch(typeof(PlaceableObjectDraft), "GetCapacity", typeof(float), typeof(float))]
[HarmonyPatch(typeof(PlaceableObjectDraft), "GetCapacity", typeof(float),
typeof(float))]
public static void PostfixGetCapacity(ref int __result) {
if (Main.buildingStorageCapacityMultiplier.Value <= 0)
return;
@@ -341,7 +381,8 @@ namespace InfectionFreeZone {
[HarmonyPostfix]
[HarmonyPatch(typeof(Building), "DeconstructionResources", MethodType.Getter)]
public static ResourceQuantity[] PostfixDeconstructionResources(ResourceQuantity[] __result) {
public static ResourceQuantity[] PostfixDeconstructionResources(
ResourceQuantity[] __result) {
if (Main.buildingDeconstructionResourcesMultiplier.Value <= 0)
return __result;
@@ -352,12 +393,17 @@ namespace InfectionFreeZone {
Console.WriteLine($"Resource quantity is {resourceQuantity}");
if (Main.buildingDeconstructionResourcesMultiplierDebug.Value)
Console.WriteLine($"Resource quantity value is {resourceQuantity.value}");
modifiedResult[i] = new ResourceQuantity(resourceQuantity.resourceType,
resourceQuantity.value * Main.buildingDeconstructionResourcesMultiplier.Value);
// resourceQuantity.value *= Main.buildingDeconstructionResourcesMultiplier.Value;
Console.WriteLine(
$"Resource quantity value is {resourceQuantity.value}");
modifiedResult[i] = new ResourceQuantity(
resourceQuantity.resourceType,
resourceQuantity.value *
Main.buildingDeconstructionResourcesMultiplier.Value);
// resourceQuantity.value *=
// Main.buildingDeconstructionResourcesMultiplier.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;
@@ -365,7 +411,8 @@ namespace InfectionFreeZone {
[HarmonyPrefix]
[HarmonyPatch(typeof(BuildingDestruction), "Initialize")]
public static void PrefixBuildingDeconstruction(ref BuildingDestruction __instance) {
public static void
PrefixBuildingDeconstruction(ref BuildingDestruction __instance) {
if (Main.deconstructionWorkersPer100m.Value <= 0)
return;
@@ -376,7 +423,8 @@ namespace InfectionFreeZone {
Console.WriteLine(
$"Building deconstruction workers per 100m is {configV.deconstructWorkersPer100m3OfBuilding}");
configV.deconstructWorkersPer100m3OfBuilding = Main.deconstructionWorkersPer100m.Value;
configV.deconstructWorkersPer100m3OfBuilding =
Main.deconstructionWorkersPer100m.Value;
config.Value = configV;
if (Main.buildingDeconstructionResourcesMultiplierDebug.Value)
Console.WriteLine(
@@ -385,8 +433,10 @@ namespace InfectionFreeZone {
[HarmonyPostfix]
[HarmonyPatch(typeof(Movement), "CalculateSpeed")]
public static void PostfixCalculateSpeedHuman(Movement __instance, ref float __result) {
// Humans are "Human(Clone)", infected are "inf_human(Clone)" and vehicles are "ve_<name>"
public static void PostfixCalculateSpeedHuman(Movement __instance,
ref float __result) {
// Humans are "Human(Clone)", infected are "inf_human(Clone)" and vehicles
// are "ve_<name>"
var name = __instance.ToString();
if (name.StartsWith("Human"))
__result *= Main.humanMovementSpeedMultiplier.Value;
@@ -395,18 +445,22 @@ namespace InfectionFreeZone {
}
[HarmonyPostfix]
[HarmonyPatch(typeof(Vehicle), "Constructor",
typeof(GroupIconsPool), typeof(SignalBus), typeof(WeatherController))]
[HarmonyPatch(typeof(Vehicle), "Constructor", typeof(GroupIconsPool),
typeof(SignalBus), typeof(WeatherController))]
public static void PostfixVehicle(ref Vehicle __instance) {
if (Main.vehicleTrunkCapacityMultiplier.Value <= 0)
return;
if (Main.vehicleTrunkCapacityMultiplierDebug.Value)
Console.WriteLine($"Vehicle trunk capacity is {__instance.Trunk.Capacity}");
__instance.Trunk.SetCapacity((int)(__instance.Trunk.Capacity * Main.vehicleTrunkCapacityMultiplier.Value),
Console.WriteLine(
$"Vehicle trunk capacity is {__instance.Trunk.Capacity}");
__instance.Trunk.SetCapacity(
(int)(__instance.Trunk.Capacity *
Main.vehicleTrunkCapacityMultiplier.Value),
true);
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
@@ -415,8 +469,10 @@ namespace InfectionFreeZone {
// ProductionWork
[HarmonyPrefix]
[HarmonyPatch(typeof(DisassembleWork), MethodType.Constructor,
typeof(Structure), typeof(float), typeof(int), typeof(ResourcesController), typeof(SignalBus))]
public static void PrefixDisassembleWork(Structure structure, ref float timeToDeconstruct) {
typeof(Structure), typeof(float), typeof(int),
typeof(ResourcesController), typeof(SignalBus))]
public static void PrefixDisassembleWork(Structure structure,
ref float timeToDeconstruct) {
if (Main.deconstructionTimeMultiplier.Value <= 0)
return;
@@ -429,9 +485,10 @@ namespace InfectionFreeZone {
[HarmonyPrefix]
[HarmonyPatch(typeof(ConstructableWork), MethodType.Constructor,
typeof(Structure), typeof(Dictionary<ResourceID, int>), typeof(float), typeof(StockroomsController),
typeof(SignalBus))]
public static void PrefixConstructWork(Structure structure, Dictionary<ResourceID, int> cost,
typeof(Structure), typeof(Dictionary<ResourceID, int>),
typeof(float), typeof(StockroomsController), typeof(SignalBus))]
public static void PrefixConstructWork(Structure structure,
Dictionary<ResourceID, int> cost,
ref float timeToConstruct) {
if (Main.deconstructionTimeMultiplier.Value <= 0)
return;
@@ -459,7 +516,8 @@ namespace InfectionFreeZone {
[HarmonyPrefix]
[HarmonyPatch(typeof(CitizensController), "IncreasePopulation")]
// 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)
Console.WriteLine($"Citizens controller IncreasePopulation");
var trav = Traverse.Create(__instance);
@@ -475,36 +533,43 @@ namespace InfectionFreeZone {
if (Main.birthingConfigDebug.Value)
Console.WriteLine($"Old age is {charactersConfigV.oldAge}");
bornConfig.MaxCitizensInZoneToChildrenBorn = Main.maxCitizensInZoneToChildrenBorn.Value;
bornConfig.MaxCitizensInZoneToChildrenBorn =
Main.maxCitizensInZoneToChildrenBorn.Value;
if (Main.birthingConfigDebug.Value)
Console.WriteLine(
$"Max citizens in zone to children born is {bornConfig.MaxCitizensInZoneToChildrenBorn}");
bornConfig.MoraleInfluenceFloorParam = Main.moraleInfluenceFloorParam.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)
Console.WriteLine(
$"Morale influence ceiling param is {bornConfig.MoraleInfluenceCeilingParam}");
bornConfig.FoodStockInfluenceFloorParam = Main.foodStockInfluenceFloorParam.Value;
bornConfig.FoodStockInfluenceFloorParam =
Main.foodStockInfluenceFloorParam.Value;
if (Main.birthingConfigDebug.Value)
Console.WriteLine(
$"Food stock influence floor param is {bornConfig.FoodStockInfluenceFloorParam}");
bornConfig.FoodStockInfluenceCeilingParam = Main.foodStockInfluenceCeilingParam.Value;
bornConfig.FoodStockInfluenceCeilingParam =
Main.foodStockInfluenceCeilingParam.Value;
if (Main.birthingConfigDebug.Value)
Console.WriteLine(
$"Food stock influence ceiling param is {bornConfig.FoodStockInfluenceCeilingParam}");
bornConfig.QuartersRatioInfluenceFloorParam = Main.quartersRatioInfluenceFloorParam.Value;
bornConfig.QuartersRatioInfluenceFloorParam =
Main.quartersRatioInfluenceFloorParam.Value;
if (Main.birthingConfigDebug.Value)
Console.WriteLine(
$"Quarters ratio influence floor param is {bornConfig.QuartersRatioInfluenceFloorParam}");
bornConfig.QuartersRatioInfluenceCeilingParam = Main.quartersRatioInfluenceCeilingParam.Value;
bornConfig.QuartersRatioInfluenceCeilingParam =
Main.quartersRatioInfluenceCeilingParam.Value;
if (Main.birthingConfigDebug.Value)
Console.WriteLine(
$"Quarters ratio influence ceiling param is {bornConfig.QuartersRatioInfluenceCeilingParam}");
@@ -527,18 +592,24 @@ namespace InfectionFreeZone {
[HarmonyTranspiler]
[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);
for (var i = 0; i < codes.Count; i++) {
var code = codes[i];
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}");
codes[i] = new CodeInstruction(OpCodes.Ldsfld,
codes[i] = new CodeInstruction(
OpCodes.Ldsfld,
AccessTools.Field(typeof(Main), "rotationTimestepMultiplier"));
codes.Insert(i + 1,
new CodeInstruction(OpCodes.Call,
AccessTools.PropertyGetter(typeof(Main).GetField("rotationTimestepMultiplier").FieldType,
codes.Insert(i + 1, new CodeInstruction(
OpCodes.Call,
AccessTools.PropertyGetter(
typeof(Main)
.GetField("rotationTimestepMultiplier")
.FieldType,
"Value")));
Console.WriteLine($"Operand modified to {codes[i].operand}");
}
@@ -549,18 +620,24 @@ namespace InfectionFreeZone {
[HarmonyTranspiler]
[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);
for (var i = 0; i < codes.Count; i++) {
var code = codes[i];
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}");
codes[i] = new CodeInstruction(OpCodes.Ldsfld,
codes[i] = new CodeInstruction(
OpCodes.Ldsfld,
AccessTools.Field(typeof(Main), "rotationTimestepMultiplier"));
codes.Insert(i + 1,
new CodeInstruction(OpCodes.Call,
AccessTools.PropertyGetter(typeof(Main).GetField("rotationTimestepMultiplier").FieldType,
codes.Insert(i + 1, new CodeInstruction(
OpCodes.Call,
AccessTools.PropertyGetter(
typeof(Main)
.GetField("rotationTimestepMultiplier")
.FieldType,
"Value")));
Console.WriteLine($"Operand modified to {codes[i].operand}");
}
@@ -585,7 +662,8 @@ namespace InfectionFreeZone {
[HarmonyPrefix]
[HarmonyPatch(typeof(ProductionWork), "ProduceResources")]
public static void PrefixProduceResources(List<ProductionDataPart> productionDataParts) {
public static void
PrefixProduceResources(List<ProductionDataPart> productionDataParts) {
if (Main.productionProfitMultiplierDict.Count == 0)
return;
if (productionDataParts.Count == 0)
@@ -596,7 +674,8 @@ namespace InfectionFreeZone {
if (Main.productionProfitMultiplierDebug.Value)
Console.WriteLine(
$"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)
Console.WriteLine($"Production data part has setpoint {setpoint}");
productionDataPart.amount = (int)setpoint;
@@ -609,10 +688,12 @@ namespace InfectionFreeZone {
[HarmonyPostfix]
[HarmonyPatch(typeof(StructureDefenceModule), "Awake")]
public static void PostfixStructureDefenceModule(StructureDefenceModule __instance) {
public static void
PostfixStructureDefenceModule(StructureDefenceModule __instance) {
if (Main.towerEchoSelectionDebug.Value)
Console.WriteLine($"Structure defence module created");
Main.towerEchoSelectionList.Add(new WeakReference<StructureDefenceModule>(__instance));
Main.towerEchoSelectionList.Add(
new WeakReference<StructureDefenceModule>(__instance));
}
[HarmonyPrefix]
@@ -634,7 +715,8 @@ namespace InfectionFreeZone {
if (Main.towerEchoSelectionDebug.Value) {
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++) {
@@ -654,11 +736,13 @@ namespace InfectionFreeZone {
towerEchoSelectionT.SetFieldOfView(selectedItem.WeaponData);
towerEchoSelectionT.SetupWeapon(selectedItem.WeaponData);
var selectedWeapon = towerEchoSelectionT.SelectedWeapon == null
var selectedWeapon =
towerEchoSelectionT.SelectedWeapon == null
? "null"
: towerEchoSelectionT.SelectedWeapon.ToString();
if (Main.towerEchoSelectionDebug.Value)
Console.WriteLine($"Tower defence weapon modified to {selectedWeapon}");
Console.WriteLine(
$"Tower defence weapon modified to {selectedWeapon}");
}
} catch (NullReferenceException e) {
Console.WriteLine($"Failed to set tower defence weapon: {e}");
@@ -669,8 +753,8 @@ namespace InfectionFreeZone {
// TODO: Add toggle for this
[HarmonyTranspiler]
[HarmonyPatch(typeof(ValidatableStructure), "Awake")]
public static IEnumerable<CodeInstruction> PostfixValidatableStructure(
IEnumerable<CodeInstruction> instructions) {
public static IEnumerable<CodeInstruction>
PostfixValidatableStructure(IEnumerable<CodeInstruction> instructions) {
var codes = new List<CodeInstruction>(instructions);
int start = 0;
int start2 = 0;
@@ -678,40 +762,52 @@ namespace InfectionFreeZone {
int end2 = 0;
for (var i = 0; i < codes.Count; i++) {
if (codes[i].opcode == OpCodes.Ldc_I4_5) {
Console.WriteLine($"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
Console.WriteLine(
$"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") {
Console.WriteLine($"Opcode is {codes[i].opcode} and operand is {codes[i].operand} at index {i}");
if (codes[i].opcode == OpCodes.Ldstr &&
codes[i].operand.ToString() == "Tower") {
Console.WriteLine(
$"Opcode is {codes[i].opcode} and operand is {codes[i].operand} at index {i}");
start2 = i - 2;
end2 = i + 2;
}
if (codes[i].opcode == OpCodes.Ldstr && codes[i].operand.ToString() == "Farmland") {
Console.WriteLine($"Opcode is {codes[i].opcode} and operand is {codes[i].operand} at index {i}");
if (codes[i].opcode == OpCodes.Ldstr &&
codes[i].operand.ToString() == "Farmland") {
Console.WriteLine(
$"Opcode is {codes[i].opcode} and operand is {codes[i].operand} at index {i}");
Console.WriteLine(
$"Opcode is {codes[i - 1].opcode} and operand is {codes[i - 1].operand} at index {i - 1}");
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") {
Console.WriteLine($"Opcode is {codes[i].opcode} and operand is {codes[i].operand} at index {i}");
if (codes[i].opcode == OpCodes.Ldstr &&
codes[i].operand.ToString() == "Wall") {
Console.WriteLine(
$"Opcode is {codes[i].opcode} and operand is {codes[i].operand} at index {i}");
start = i - 2;
end = i + 6;
break;
}
}
Console.WriteLine($"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}");
Console.WriteLine(
$"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);
Console.WriteLine($"Removed {end - start} instructions");
Console.WriteLine(
$"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);
Console.WriteLine($"Removed {end2 - start2} instructions");
@@ -722,14 +818,16 @@ namespace InfectionFreeZone {
[HarmonyPrefix]
[HarmonyPatch(typeof(WallConstructor), MethodType.Constructor,
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) {
Console.WriteLine($"Wall config created");
wallConfig.maxAngel = 2f;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(AdaptController), MethodType.Constructor, typeof(AdaptConfig))]
[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");
@@ -740,7 +838,8 @@ namespace InfectionFreeZone {
buildingsMaxVolume.Value = Main.buildingMaxVolume.Value;
if (Main.buildingMaxVolumeDebug.Value)
Console.WriteLine($"Building max volume modified to {buildingsMaxVolume.Value}");
}
Console.WriteLine(
$"Building max volume modified to {buildingsMaxVolume.Value}");
}
}
}

View File

@@ -4,22 +4,23 @@ using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("InfectionFreeZone")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("InfectionFreeZone")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly:AssemblyTitle("InfectionFreeZone")]
[assembly:AssemblyDescription("")]
[assembly:AssemblyConfiguration("")]
[assembly:AssemblyCompany("")]
[assembly:AssemblyProduct("InfectionFreeZone")]
[assembly:AssemblyCopyright("Copyright © 2023")]
[assembly:AssemblyTrademark("")]
[assembly:AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// 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
[assembly: Guid("DA9D274E-486F-4F82-84FF-CD9388CB0B09")]
// The following GUID is for the ID of the typelib if this project is exposed to
// COM
[assembly:Guid("DA9D274E-486F-4F82-84FF-CD9388CB0B09")]
// Version information for an assembly consists of the following four values:
//
@@ -28,8 +29,7 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
// You can specify all the values or you can default the Build and Revision
// Numbers by using the '*' as shown below: [assembly: AssemblyVersion("1.0.*")]
[assembly:AssemblyVersion("1.0.0.0")]
[assembly:AssemblyFileVersion("1.0.0.0")]

View File

@@ -8,13 +8,17 @@ using HarmonyLib.Tools;
// TODO: Maybe make props faster, thrusters work fine
namespace TerraTech {
[BepInPlugin(pluginGuid, pluginName, pluginVersion)]
[BepInPlugin(PluginGuid, PluginName, PluginVersion)]
public class Main : BaseUnityPlugin {
private const string pluginGuid = "CykaMod";
private const string pluginName = "CykaMod";
private const string pluginVersion = "1.0.0";
private const string PluginGuid = "CykaMod";
private const string PluginName = "CykaMod";
private const string PluginVersion = "1.0.0";
public static ConfigEntry<bool> debug;
public static ConfigEntry<bool> debugBuyAll;
public static ConfigEntry<bool> debugMultiBuy;
public static ConfigEntry<int> multiBuyAmount;
public static ConfigEntry<float> xpMultiplier;
public static ConfigEntry<float> moneyMultiplier;
public static ConfigEntry<float> heartbeatIntervalMultiplier;
@@ -25,6 +29,11 @@ namespace TerraTech {
public void Awake() {
debug = Config.Bind("General", "Debug", false);
debugBuyAll = Config.Bind("General", "Debug Buy All", false);
debugMultiBuy = Config.Bind("General", "Debug Multi Buy", false);
multiBuyAmount =
Config.Bind("General", "Multi Buy Amount", 10,
new ConfigDescription("Multi Buy Amount", new AcceptableValueRange<int>(1, 10000)));
float min = 0.01f;
float max = 32f;
@@ -43,6 +52,7 @@ namespace TerraTech {
ModuleWeaponManager.Setup(Config);
ModuleHeartManager.Setup(Config);
ModuleFuelTankManager.Setup(Config);
TankManager.Setup(Config);
xpMultiplier =
Config.Bind("General", "XP Multiplier", 1f,
@@ -72,7 +82,7 @@ namespace TerraTech {
Logger.LogInfo("Cyka mod loaded");
HarmonyFileLog.Enabled = true;
Harmony harmony = new Harmony(pluginGuid);
Harmony harmony = new Harmony(PluginGuid);
harmony.PatchAll();
var originalMethods = harmony.GetPatchedMethods();
Logger.LogInfo("Patched " + originalMethods.Count() + " methods");

View File

@@ -14,7 +14,7 @@ namespace TerraTech {
return tank.ControllableByLocalPlayer;
}
public static Func<object, bool> IsObjectPlayerTank = obj => {
public static Func<object, bool> isObjectPlayerTank = obj => {
if (obj == null)
return false;
try {

View File

@@ -6,14 +6,14 @@ using HarmonyLib;
namespace TerraTech {
[HarmonyPatch]
public class ModuleBoosterManager {
private static readonly MultipliedObjectManager<FanJet> fanManager =
private static readonly MultipliedObjectManager<FanJet> FanManager =
new MultipliedObjectManager<FanJet>(ConfigureFanThruster);
private static readonly MultipliedObjectManager<BoosterJet> jetManager =
private static readonly MultipliedObjectManager<BoosterJet> JetManager =
new MultipliedObjectManager<BoosterJet>(ConfigureJetThruster);
public static ConfigEntry<bool> playerOnly;
public static ConfigEntry<float> fanThrustMultiplier;
public static ConfigEntry<float> jetThrustMultiplier;
private static ConfigEntry<bool> playerOnly;
private static ConfigEntry<float> fanThrustMultiplier;
private static ConfigEntry<float> jetThrustMultiplier;
public static void Setup(ConfigFile config) {
float min = 0.01f;
@@ -44,34 +44,41 @@ namespace TerraTech {
private static readonly Func<object, bool> ShouldApply = obj => {
if (!playerOnly.Value)
return true;
return CykUtil.IsObjectPlayerTank(obj);
return CykUtil.isObjectPlayerTank(obj);
};
[HarmonyPrefix]
[HarmonyPatch(typeof(ModuleBooster), "OnAttached")]
static void PostfixCreate(ModuleBooster __instance) {
public static void PostfixCreate(ModuleBooster __instance) {
var trav = Traverse.Create(__instance);
var fans = trav.Field("fans").GetValue<List<FanJet>>();
var jets = trav.Field("jets").GetValue<List<BoosterJet>>();
foreach (var fan in fans) fanManager.OnObjectAttached(fan);
foreach (var jet in jets) jetManager.OnObjectAttached(jet);
foreach (var fan in fans) FanManager.OnObjectAttached(fan);
foreach (var jet in jets) JetManager.OnObjectAttached(jet);
}
[HarmonyPrefix]
[HarmonyPatch(typeof(ModuleBooster), "OnDetaching")]
static void PostfixDestroy(ModuleBooster __instance) {
public static void PostfixDestroy(ModuleBooster __instance) {
var trav = Traverse.Create(__instance);
var fans = trav.Field("fans").GetValue<List<FanJet>>();
var jets = trav.Field("jets").GetValue<List<BoosterJet>>();
foreach (var fan in fans) fanManager.OnObjectDetached(fan);
foreach (var jet in jets) jetManager.OnObjectDetached(jet);
foreach (var fan in fans) FanManager.OnObjectDetached(fan);
foreach (var jet in jets) JetManager.OnObjectDetached(jet);
}
public static void DoPatch() {
fanManager.ApplyAll();
jetManager.ApplyAll();
private static void DoPatch() {
FanManager.ApplyAll();
JetManager.ApplyAll();
}
public static readonly Func<Module, bool> Register = obj => {
if (Main.debug.Value)
Console.WriteLine("Registering ModuleBooster: {0}", obj);
PostfixCreate(obj as ModuleBooster);
return true;
};
}
}

View File

@@ -5,12 +5,12 @@ using HarmonyLib;
namespace TerraTech {
[HarmonyPatch]
public class ModuleEnergyManager {
private static readonly MultipliedObjectManager<ModuleEnergy> manager =
private static readonly MultipliedObjectManager<ModuleEnergy> Manager =
new MultipliedObjectManager<ModuleEnergy>(ConfigureModuleEnergy);
public static ConfigEntry<bool> playerOnly;
public static ConfigEntry<float> outputMultiplier;
public static ConfigEntry<float> powerUpDelayMultiplier;
private static ConfigEntry<bool> playerOnly;
private static ConfigEntry<float> outputMultiplier;
private static ConfigEntry<float> powerUpDelayMultiplier;
public static void Setup(ConfigFile config) {
float min = 0.01f;
@@ -43,18 +43,25 @@ namespace TerraTech {
[HarmonyPrefix]
[HarmonyPatch(typeof(ModuleEnergy), "OnAnchorStatusChanged")]
static void PostfixCreate(ModuleEnergy __instance) {
manager.OnObjectAttached(__instance);
public static void PostfixCreate(ModuleEnergy __instance) {
Manager.OnObjectAttached(__instance);
}
[HarmonyPrefix]
[HarmonyPatch(typeof(ModuleEnergy), "OnDetaching")]
static void PostfixDestroy(ModuleEnergy __instance) {
manager.OnObjectDetached(__instance);
public static void PostfixDestroy(ModuleEnergy __instance) {
Manager.OnObjectDetached(__instance);
}
public static void DoPatch() {
manager.ApplyAll();
private static void DoPatch() {
Manager.ApplyAll();
}
public static readonly Func<Module, bool> Register = obj => {
if (Main.debug.Value)
Console.WriteLine("Registering ModuleEnergy: {0}", obj);
PostfixCreate(obj as ModuleEnergy);
return true;
};
}
}

View File

@@ -5,11 +5,11 @@ using HarmonyLib;
namespace TerraTech {
[HarmonyPatch]
public class ModuleEnergyStoreManager {
private static readonly MultipliedObjectManager<ModuleEnergyStore> manager =
private static readonly MultipliedObjectManager<ModuleEnergyStore> Manager =
new MultipliedObjectManager<ModuleEnergyStore>(ConfigureModuleEnergyStore);
public static ConfigEntry<bool> playerOnly;
public static ConfigEntry<float> capacityMultiplier;
private static ConfigEntry<bool> playerOnly;
private static ConfigEntry<float> capacityMultiplier;
public static void Setup(ConfigFile config) {
float min = 0.01f;
@@ -36,18 +36,25 @@ namespace TerraTech {
[HarmonyPrefix]
[HarmonyPatch(typeof(ModuleEnergyStore), "OnAttached")]
static void PostfixCreate(ModuleEnergyStore __instance) {
manager.OnObjectAttached(__instance);
public static void PostfixCreate(ModuleEnergyStore __instance) {
Manager.OnObjectAttached(__instance);
}
[HarmonyPrefix]
[HarmonyPatch(typeof(ModuleEnergyStore), "OnDetaching")]
static void PostfixDestroy(ModuleEnergyStore __instance) {
manager.OnObjectDetached(__instance);
public static void PostfixDestroy(ModuleEnergyStore __instance) {
Manager.OnObjectDetached(__instance);
}
public static void DoPatch() {
manager.ApplyAll();
private static void DoPatch() {
Manager.ApplyAll();
}
public static readonly Func<Module, bool> Register = obj => {
if (Main.debug.Value)
Console.WriteLine("Registering ModuleEnergyStore: {0}", obj);
PostfixCreate(obj as ModuleEnergyStore);
return true;
};
}
}

View File

@@ -1,17 +1,16 @@
using System;
using System.Collections.Generic;
using BepInEx.Configuration;
using HarmonyLib;
namespace TerraTech {
[HarmonyPatch]
public class ModuleFuelTankManager {
private static readonly MultipliedObjectManager<ModuleFuelTank> manager =
private static readonly MultipliedObjectManager<ModuleFuelTank> Manager =
new MultipliedObjectManager<ModuleFuelTank>(ConfigureFuelTank);
public static ConfigEntry<bool> playerOnly;
public static ConfigEntry<float> fuelCapacityMultiplier;
public static ConfigEntry<float> fuelRefillMultiplier;
private static ConfigEntry<bool> playerOnly;
private static ConfigEntry<float> fuelCapacityMultiplier;
private static ConfigEntry<float> fuelRefillMultiplier;
public static void Setup(ConfigFile config) {
float min = 0.01f;
@@ -39,23 +38,30 @@ namespace TerraTech {
private static readonly Func<object, bool> ShouldApply = obj => {
if (!playerOnly.Value)
return true;
return CykUtil.IsObjectPlayerTank(obj);
return CykUtil.isObjectPlayerTank(obj);
};
[HarmonyPrefix]
[HarmonyPatch(typeof(ModuleFuelTank), "OnAttached")]
static void PostfixCreate(ModuleFuelTank __instance) {
manager.OnObjectAttached(__instance);
public static void PostfixCreate(ModuleFuelTank __instance) {
Manager.OnObjectAttached(__instance);
}
[HarmonyPrefix]
[HarmonyPatch(typeof(ModuleFuelTank), "OnDetaching")]
static void PostfixDestroy(ModuleFuelTank __instance) {
manager.OnObjectDetached(__instance);
public static void PostfixDestroy(ModuleFuelTank __instance) {
Manager.OnObjectDetached(__instance);
}
public static void DoPatch() {
manager.ApplyAll();
private static void DoPatch() {
Manager.ApplyAll();
}
public static readonly Func<Module, bool> Register = obj => {
if (Main.debug.Value)
Console.WriteLine("Registering ModuleFuelTank: {0}", obj);
PostfixCreate(obj as ModuleFuelTank);
return true;
};
}
}

View File

@@ -5,11 +5,11 @@ using HarmonyLib;
namespace TerraTech {
[HarmonyPatch]
public class ModuleGyroManager {
private static readonly MultipliedObjectManager<ModuleGyro> manager =
private static readonly MultipliedObjectManager<ModuleGyro> Manager =
new MultipliedObjectManager<ModuleGyro>(ConfigureModuleGyro);
public static ConfigEntry<bool> playerOnly;
public static ConfigEntry<float> activeSpeedMultiplier;
private static ConfigEntry<bool> playerOnly;
private static ConfigEntry<float> activeSpeedMultiplier;
public static void Setup(ConfigFile config) {
float min = 0.01f;
@@ -36,18 +36,25 @@ namespace TerraTech {
[HarmonyPrefix]
[HarmonyPatch(typeof(ModuleGyro), "OnAttached")]
static void PostfixCreate(ModuleGyro __instance) {
manager.OnObjectAttached(__instance);
public static void PostfixCreate(ModuleGyro __instance) {
Manager.OnObjectAttached(__instance);
}
[HarmonyPrefix]
[HarmonyPatch(typeof(ModuleGyro), "OnDetaching")]
static void PostfixDestroy(ModuleGyro __instance) {
manager.OnObjectDetached(__instance);
public static void PostfixDestroy(ModuleGyro __instance) {
Manager.OnObjectDetached(__instance);
}
public static void DoPatch() {
manager.ApplyAll();
private static void DoPatch() {
Manager.ApplyAll();
}
public static readonly Func<Module, bool> Register = obj => {
if (Main.debug.Value)
Console.WriteLine("Registering ModuleGyro: {0}", obj);
PostfixCreate(obj as ModuleGyro);
return true;
};
}
}

View File

@@ -1,18 +1,17 @@
using System;
using System.Collections.Generic;
using BepInEx.Configuration;
using HarmonyLib;
namespace TerraTech {
[HarmonyPatch]
public class ModuleHeartManager {
private static readonly MultipliedObjectManager<ModuleHeart> manager =
private static readonly MultipliedObjectManager<ModuleHeart> Manager =
new MultipliedObjectManager<ModuleHeart>(ConfigureHeart);
public static ConfigEntry<bool> playerOnly;
public static ConfigEntry<float> eventHorizonRadiusMultiplier;
public static ConfigEntry<float> setupTimeMultiplier;
public static ConfigEntry<float> startShrinkingRadiusMultiplier;
private static ConfigEntry<bool> playerOnly;
private static ConfigEntry<float> eventHorizonRadiusMultiplier;
private static ConfigEntry<float> setupTimeMultiplier;
private static ConfigEntry<float> startShrinkingRadiusMultiplier;
public static void Setup(ConfigFile config) {
float min = 0.01f;
@@ -48,23 +47,30 @@ namespace TerraTech {
private static readonly Func<object, bool> ShouldApply = obj => {
if (!playerOnly.Value)
return true;
return CykUtil.IsObjectPlayerTank(obj);
return CykUtil.isObjectPlayerTank(obj);
};
[HarmonyPrefix]
[HarmonyPatch(typeof(ModuleHeart), "OnAttached")]
static void PostfixCreate(ModuleHeart __instance) {
manager.OnObjectAttached(__instance);
public static void PostfixCreate(ModuleHeart __instance) {
Manager.OnObjectAttached(__instance);
}
[HarmonyPrefix]
[HarmonyPatch(typeof(ModuleHeart), "OnDetaching")]
static void PostfixDestroy(ModuleHeart __instance) {
manager.OnObjectDetached(__instance);
public static void PostfixDestroy(ModuleHeart __instance) {
Manager.OnObjectDetached(__instance);
}
public static void DoPatch() {
manager.ApplyAll();
private static void DoPatch() {
Manager.ApplyAll();
}
public static readonly Func<Module, bool> Register = obj => {
if (Main.debug.Value)
Console.WriteLine("Registering ModuleHeart: {0}", obj);
PostfixCreate(obj as ModuleHeart);
return true;
};
}
}

View File

@@ -5,25 +5,25 @@ using HarmonyLib;
namespace TerraTech {
[HarmonyPatch]
public class ModuleItemHolderManager {
private static readonly MultipliedObjectManager<ModuleItemHolder> beamManager =
private static readonly MultipliedObjectManager<ModuleItemHolder> BeamManager =
new MultipliedObjectManager<ModuleItemHolder>(ConfigureBeam);
private static readonly MultipliedObjectManager<ModuleItemHolderBeam> beamHolderManager =
private static readonly MultipliedObjectManager<ModuleItemHolderBeam> BeamHolderManager =
new MultipliedObjectManager<ModuleItemHolderBeam>(ConfigureBeamHolder);
private static readonly MultipliedObjectManager<ModuleItemPickup> beamPickupManager =
private static readonly MultipliedObjectManager<ModuleItemPickup> BeamPickupManager =
new MultipliedObjectManager<ModuleItemPickup>(ConfigureBeamPickup);
private static readonly MultipliedObjectManager<ModuleItemHolderMagnet> magnetHolderManager =
private static readonly MultipliedObjectManager<ModuleItemHolderMagnet> MagnetHolderManager =
new MultipliedObjectManager<ModuleItemHolderMagnet>(ConfigureMagnetHolder);
private static readonly MultipliedObjectManager<ModuleItemPickup> magnetPickupManager =
private static readonly MultipliedObjectManager<ModuleItemPickup> MagnetPickupManager =
new MultipliedObjectManager<ModuleItemPickup>(ConfigureMagnetPickup);
public static ConfigEntry<bool> playerOnly;
public static ConfigEntry<float> capacityPerStackMultiplier;
public static ConfigEntry<float> beamStrengthMultiplier;
public static ConfigEntry<float> beamHeightIncrementScaleMultiplier;
public static ConfigEntry<float> beamPickupRangeMultiplier;
public static ConfigEntry<float> magnetStrengthMultiplier;
public static ConfigEntry<float> magnetPickupRangeMultiplier;
private static ConfigEntry<bool> playerOnly;
private static ConfigEntry<float> capacityPerStackMultiplier;
private static ConfigEntry<float> beamStrengthMultiplier;
private static ConfigEntry<float> beamHeightIncrementScaleMultiplier;
private static ConfigEntry<float> beamPickupRangeMultiplier;
private static ConfigEntry<float> magnetStrengthMultiplier;
private static ConfigEntry<float> magnetPickupRangeMultiplier;
public static void Setup(ConfigFile config) {
float min = 0.01f;
@@ -96,62 +96,69 @@ namespace TerraTech {
[HarmonyPrefix]
[HarmonyPatch(typeof(ModuleItemHolder), "OnAttached")]
static void PostfixCreate(ModuleItemHolder __instance) {
beamManager.OnObjectAttached(__instance);
public static void PostfixCreate(ModuleItemHolder __instance) {
BeamManager.OnObjectAttached(__instance);
}
[HarmonyPrefix]
[HarmonyPatch(typeof(ModuleItemHolder), "OnDetaching")]
static void PostfixDestroy(ModuleItemHolder __instance) {
beamManager.OnObjectDetached(__instance);
public static void PostfixDestroy(ModuleItemHolder __instance) {
BeamManager.OnObjectDetached(__instance);
}
[HarmonyPrefix]
[HarmonyPatch(typeof(ModuleItemHolderBeam), "OnAttached")]
static void PostfixCreate(ModuleItemHolderBeam __instance) {
public static void PostfixCreate(ModuleItemHolderBeam __instance) {
var trav = Traverse.Create(__instance);
var pickup = trav.Field("m_Pickup").GetValue<ModuleItemPickup>();
beamHolderManager.OnObjectAttached(__instance);
beamPickupManager.OnObjectAttached(pickup);
BeamHolderManager.OnObjectAttached(__instance);
BeamPickupManager.OnObjectAttached(pickup);
}
[HarmonyPrefix]
[HarmonyPatch(typeof(ModuleItemHolderBeam), "OnDetaching")]
static void PostfixDestroy(ModuleItemHolderBeam __instance) {
public static void PostfixDestroy(ModuleItemHolderBeam __instance) {
var trav = Traverse.Create(__instance);
var pickup = trav.Field("m_Pickup").GetValue<ModuleItemPickup>();
beamHolderManager.OnObjectDetached(__instance);
beamPickupManager.OnObjectDetached(pickup);
BeamHolderManager.OnObjectDetached(__instance);
BeamPickupManager.OnObjectDetached(pickup);
}
[HarmonyPrefix]
[HarmonyPatch(typeof(ModuleItemHolderMagnet), "OnAttached")]
static void PostfixCreate(ModuleItemHolderMagnet __instance) {
public static void PostfixCreate(ModuleItemHolderMagnet __instance) {
var trav = Traverse.Create(__instance);
var pickup = trav.Field("m_Pickup").GetValue<ModuleItemPickup>();
magnetHolderManager.OnObjectAttached(__instance);
magnetPickupManager.OnObjectAttached(pickup);
MagnetHolderManager.OnObjectAttached(__instance);
MagnetPickupManager.OnObjectAttached(pickup);
}
[HarmonyPrefix]
[HarmonyPatch(typeof(ModuleItemHolderMagnet), "OnDetaching")]
static void PostfixDestroy(ModuleItemHolderMagnet __instance) {
public static void PostfixDestroy(ModuleItemHolderMagnet __instance) {
var trav = Traverse.Create(__instance);
var pickup = trav.Field("m_Pickup").GetValue<ModuleItemPickup>();
magnetHolderManager.OnObjectDetached(__instance);
magnetPickupManager.OnObjectDetached(pickup);
MagnetHolderManager.OnObjectDetached(__instance);
MagnetPickupManager.OnObjectDetached(pickup);
}
public static void DoPatch() {
beamManager.ApplyAll();
beamHolderManager.ApplyAll();
beamPickupManager.ApplyAll();
magnetHolderManager.ApplyAll();
magnetPickupManager.ApplyAll();
private static void DoPatch() {
BeamManager.ApplyAll();
BeamHolderManager.ApplyAll();
BeamPickupManager.ApplyAll();
MagnetHolderManager.ApplyAll();
MagnetPickupManager.ApplyAll();
}
public static readonly Func<Module, bool> Register = obj => {
if (Main.debug.Value)
Console.WriteLine("Registering ModuleItemHolder: {0}", obj);
PostfixCreate(obj as ModuleItemHolder);
return true;
};
}
}

View File

@@ -5,13 +5,13 @@ using HarmonyLib;
namespace TerraTech {
[HarmonyPatch]
public class ModuleItemProducerManager {
private static readonly MultipliedObjectManager<ModuleItemProducer> manager =
private static readonly MultipliedObjectManager<ModuleItemProducer> Manager =
new MultipliedObjectManager<ModuleItemProducer>(ConfigureModuleItemProducer);
public static ConfigEntry<bool> playerOnly;
public static ConfigEntry<float> resourceGroundRadiusMultiplier;
public static ConfigEntry<float> minDispenseIntervalMultiplier;
public static ConfigEntry<float> secPerItemProducedMultiplier;
private static ConfigEntry<bool> playerOnly;
private static ConfigEntry<float> resourceGroundRadiusMultiplier;
private static ConfigEntry<float> minDispenseIntervalMultiplier;
private static ConfigEntry<float> secPerItemProducedMultiplier;
public static void Setup(ConfigFile config) {
float min = 0.01f;
@@ -53,18 +53,25 @@ namespace TerraTech {
[HarmonyPrefix]
[HarmonyPatch(typeof(ModuleItemProducer), "GetClosestResourceReservoirInRange")]
static void PostfixCreate(ModuleItemProducer __instance) {
manager.OnObjectAttached(__instance);
public static void PostfixCreate(ModuleItemProducer __instance) {
Manager.OnObjectAttached(__instance);
}
[HarmonyPrefix]
[HarmonyPatch(typeof(ModuleItemProducer), "OnDetaching")]
static void PostfixDestroy(ModuleItemProducer __instance) {
manager.OnObjectDetached(__instance);
public static void PostfixDestroy(ModuleItemProducer __instance) {
Manager.OnObjectDetached(__instance);
}
public static void DoPatch() {
manager.ApplyAll();
private static void DoPatch() {
Manager.ApplyAll();
}
public static readonly Func<Module, bool> Register = obj => {
if (Main.debug.Value)
Console.WriteLine("Registering ModuleItemProducer: {0}", obj);
PostfixCreate(obj as ModuleItemProducer);
return true;
};
}
}

View File

@@ -5,17 +5,17 @@ using HarmonyLib;
namespace TerraTech {
[HarmonyPatch]
public class ModuleRemoteChargerManager {
private static readonly MultipliedObjectManager<ModuleRemoteCharger> manager =
private static readonly MultipliedObjectManager<ModuleRemoteCharger> Manager =
new MultipliedObjectManager<ModuleRemoteCharger>(ConfigureModuleRemoteCharger);
public static ConfigEntry<bool> playerOnly;
public static ConfigEntry<float> arcFiringIntervalMultiplier;
public static ConfigEntry<float> chargingRadiusMultiplier;
public static ConfigEntry<float> powerTransferPerArcMultiplier;
private static ConfigEntry<bool> playerOnly;
private static ConfigEntry<float> arcFiringIntervalMultiplier;
private static ConfigEntry<float> chargingRadiusMultiplier;
private static ConfigEntry<float> powerTransferPerArcMultiplier;
public static void Setup(ConfigFile config) {
float min = 0.01f;
float max = 32f;
const float min = 0.01f;
const float max = 32f;
playerOnly = config.Bind("Remote Charger", "Player Only", false, new ConfigDescription("Player Only"));
playerOnly.SettingChanged += (sender, args) => DoPatch();
@@ -53,18 +53,25 @@ namespace TerraTech {
[HarmonyPrefix]
[HarmonyPatch(typeof(ModuleRemoteCharger), "OnAttached")]
static void PostfixCreate(ModuleRemoteCharger __instance) {
manager.OnObjectAttached(__instance);
public static void PostfixCreate(ModuleRemoteCharger __instance) {
Manager.OnObjectAttached(__instance);
}
[HarmonyPrefix]
[HarmonyPatch(typeof(ModuleRemoteCharger), "OnDetaching")]
static void PostfixDestroy(ModuleRemoteCharger __instance) {
manager.OnObjectDetached(__instance);
public static void PostfixDestroy(ModuleRemoteCharger __instance) {
Manager.OnObjectDetached(__instance);
}
public static void DoPatch() {
manager.ApplyAll();
private static void DoPatch() {
Manager.ApplyAll();
}
public static readonly Func<Module, bool> Register = obj => {
if (Main.debug.Value)
Console.WriteLine("Registering ModuleRemoteCharger: {0}", obj);
PostfixCreate(obj as ModuleRemoteCharger);
return true;
};
}
}

View File

@@ -5,18 +5,18 @@ using HarmonyLib;
namespace TerraTech {
[HarmonyPatch]
public class ModuleShieldGeneratorManager {
private static readonly MultipliedObjectManager<ModuleShieldGenerator> manager =
private static readonly MultipliedObjectManager<ModuleShieldGenerator> Manager =
new MultipliedObjectManager<ModuleShieldGenerator>(ConfigureShieldGenerator);
public static ConfigEntry<bool> playerOnly;
public static ConfigEntry<float> radiusMultiplier;
public static ConfigEntry<float> radiusMultiplierHealing;
public static ConfigEntry<float> heartbeatIntervalMultiplier;
public static ConfigEntry<float> powerUpDelayMultiplier;
private static ConfigEntry<bool> playerOnly;
private static ConfigEntry<float> radiusMultiplier;
private static ConfigEntry<float> radiusMultiplierHealing;
private static ConfigEntry<float> heartbeatIntervalMultiplier;
private static ConfigEntry<float> powerUpDelayMultiplier;
public static void Setup(ConfigFile config) {
float min = 0.01f;
float max = 32f;
const float min = 0.01f;
const float max = 32f;
playerOnly = config.Bind("Shield", "Player Only", false, new ConfigDescription("Player Only"));
playerOnly.SettingChanged += (sender, args) => DoPatch();
@@ -46,10 +46,10 @@ namespace TerraTech {
obj.AddField(new FieldConfiguration<float, float>("m_HealingHeartbeatInterval", heartbeatIntervalMultiplier,
ShouldApply));
obj.AddField(new FieldConfiguration<float, float>("m_Radius", radiusMultiplier, instance => {
if (!ShouldApply(instance))
obj.AddField(new FieldConfiguration<float, float>("m_Radius", radiusMultiplier, __instance => {
if (!ShouldApply(__instance))
return radiusMultiplier;
var shield = (ModuleShieldGenerator)instance;
var shield = (ModuleShieldGenerator)__instance;
return shield.m_Healing ? radiusMultiplierHealing : radiusMultiplier;
}));
@@ -64,18 +64,25 @@ namespace TerraTech {
[HarmonyPrefix]
[HarmonyPatch(typeof(ModuleShieldGenerator), "OnAttached")]
static void PostfixCreate(ModuleShieldGenerator __instance) {
manager.OnObjectAttached(__instance);
public static void PostfixCreate(ModuleShieldGenerator __instance) {
Manager.OnObjectAttached(__instance);
}
[HarmonyPrefix]
[HarmonyPatch(typeof(ModuleShieldGenerator), "OnDetaching")]
static void PostfixDestroy(ModuleShieldGenerator __instance) {
manager.OnObjectDetached(__instance);
public static void PostfixDestroy(ModuleShieldGenerator __instance) {
Manager.OnObjectDetached(__instance);
}
public static void DoPatch() {
manager.ApplyAll();
private static void DoPatch() {
Manager.ApplyAll();
}
public static readonly Func<Module, bool> Register = obj => {
if (Main.debug.Value)
Console.WriteLine("Registering ModuleShieldGenerator: {0}", obj);
PostfixCreate(obj as ModuleShieldGenerator);
return true;
};
}
}

View File

@@ -5,23 +5,23 @@ using HarmonyLib;
namespace TerraTech {
[HarmonyPatch]
public class ModuleWeaponGunManager {
private static readonly MultipliedObjectManager<ModuleWeaponGun> manager =
private static readonly MultipliedObjectManager<ModuleWeaponGun> Manager =
new MultipliedObjectManager<ModuleWeaponGun>(ConfigureManager);
private static readonly MultipliedObjectManager<FireData> fireDataManager =
private static readonly MultipliedObjectManager<FireData> FireDataManager =
new MultipliedObjectManager<FireData>(ConfigureFireData);
public static ConfigEntry<bool> playerOnly;
public static ConfigEntry<float> kickbackStrengthMultiplier;
public static ConfigEntry<float> muzzleVelocityMultiplier;
public static ConfigEntry<float> burstCooldownMultiplier;
public static ConfigEntry<float> burstShotCountMultiplier;
public static ConfigEntry<float> shotCooldownMultiplier;
public static ConfigEntry<bool> seekingRoundsAll;
public static ConfigEntry<bool> resetBurstOnInterruptAll;
private static ConfigEntry<bool> playerOnly;
private static ConfigEntry<float> kickbackStrengthMultiplier;
private static ConfigEntry<float> muzzleVelocityMultiplier;
private static ConfigEntry<float> burstCooldownMultiplier;
private static ConfigEntry<float> burstShotCountMultiplier;
private static ConfigEntry<float> shotCooldownMultiplier;
private static ConfigEntry<bool> seekingRoundsAll;
private static ConfigEntry<bool> resetBurstOnInterruptAll;
public static void Setup(ConfigFile config) {
float min = 0.01f;
float max = 32f;
const float min = 0.01f;
const float max = 32f;
playerOnly = config.Bind("WeaponGun", "Player Only", false, new ConfigDescription("Player Only"));
playerOnly.SettingChanged += (sender, args) => DoPatch();
@@ -84,31 +84,38 @@ namespace TerraTech {
[HarmonyPrefix]
[HarmonyPatch(typeof(ModuleWeaponGun), "OnAttached")]
static void PostfixCreate(ModuleWeaponGun __instance) {
manager.OnObjectAttached(__instance);
public static void PostfixCreate(ModuleWeaponGun __instance) {
Manager.OnObjectAttached(__instance);
if (playerOnly.Value && !CykUtil.IsPlayerTank(__instance))
return;
var trav = Traverse.Create(__instance);
var firingData = trav.Field("m_FiringData");
fireDataManager.OnObjectAttached(firingData.GetValue<FireData>());
FireDataManager.OnObjectAttached(firingData.GetValue<FireData>());
}
[HarmonyPrefix]
[HarmonyPatch(typeof(ModuleWeaponGun), "OnDetaching")]
static void PostfixDestroy(ModuleWeaponGun __instance) {
manager.OnObjectAttached(__instance);
public static void PostfixDestroy(ModuleWeaponGun __instance) {
Manager.OnObjectAttached(__instance);
var trav = Traverse.Create(__instance);
if (playerOnly.Value && !CykUtil.IsPlayerTank(__instance))
return;
var firingData = trav.Field("m_FiringData");
fireDataManager.OnObjectDetached(firingData.GetValue<FireData>());
FireDataManager.OnObjectDetached(firingData.GetValue<FireData>());
}
public static void DoPatch() {
fireDataManager.ApplyAll();
manager.ApplyAll();
private static void DoPatch() {
FireDataManager.ApplyAll();
Manager.ApplyAll();
}
public static readonly Func<Module, bool> Register = obj => {
if (Main.debug.Value)
Console.WriteLine("Registering ModuleWeaponGun: {0}", obj);
PostfixCreate(obj as ModuleWeaponGun);
return true;
};
}
}

View File

@@ -5,15 +5,15 @@ using HarmonyLib;
namespace TerraTech {
[HarmonyPatch]
public class ModuleWeaponManager {
private static readonly MultipliedObjectManager<ModuleWeapon> manager =
private static readonly MultipliedObjectManager<ModuleWeapon> Manager =
new MultipliedObjectManager<ModuleWeapon>(ConfigureManager);
public static ConfigEntry<bool> playerOnly;
public static ConfigEntry<float> rotateSpeedMultiplier;
private static ConfigEntry<bool> playerOnly;
private static ConfigEntry<float> rotateSpeedMultiplier;
public static void Setup(ConfigFile config) {
float min = 0.01f;
float max = 32f;
const float min = 0.01f;
const float max = 32f;
playerOnly = config.Bind("ModuleWeapon", "Player Only", false, new ConfigDescription("Player Only"));
playerOnly.SettingChanged += (sender, args) => DoPatch();
@@ -36,18 +36,25 @@ namespace TerraTech {
[HarmonyPrefix]
[HarmonyPatch(typeof(ModuleWeapon), "OnAttached")]
static void PostfixCreate(ModuleWeapon __instance) {
manager.OnObjectAttached(__instance);
public static void PostfixCreate(ModuleWeapon __instance) {
Manager.OnObjectAttached(__instance);
}
[HarmonyPrefix]
[HarmonyPatch(typeof(ModuleWeapon), "OnDetaching")]
static void PostfixDestroy(ModuleWeapon __instance) {
manager.OnObjectDetached(__instance);
public static void PostfixDestroy(ModuleWeapon __instance) {
Manager.OnObjectDetached(__instance);
}
public static void DoPatch() {
manager.ApplyAll();
private static void DoPatch() {
Manager.ApplyAll();
}
public static readonly Func<Module, bool> Register = obj => {
if (Main.debug.Value)
Console.WriteLine("Registering ModuleWeapon: {0}", obj);
PostfixCreate(obj as ModuleWeapon);
return true;
};
}
}

View File

@@ -5,16 +5,16 @@ using HarmonyLib;
namespace TerraTech {
[HarmonyPatch]
public class ModuleWheelsManager {
private static readonly MultipliedObjectManager<ManWheels.TorqueParams> torqueParamsManager =
private static readonly MultipliedObjectManager<ManWheels.TorqueParams> TorqueParamsManager =
new MultipliedObjectManager<ManWheels.TorqueParams>(ConfigureTorqueParams);
public static ConfigEntry<bool> playerOnly;
public static ConfigEntry<float> torqueRpmMultiplier;
public static ConfigEntry<float> torqueMultiplier;
private static ConfigEntry<bool> playerOnly;
private static ConfigEntry<float> torqueRpmMultiplier;
private static ConfigEntry<float> torqueMultiplier;
public static void Setup(ConfigFile config) {
float min = 0.01f;
float max = 32f;
const float min = 0.01f;
const float max = 32f;
playerOnly = config.Bind("TorqueParams", "Player Only", false, new ConfigDescription("Player Only"));
playerOnly.SettingChanged += (sender, args) => DoPatch();
@@ -43,22 +43,29 @@ namespace TerraTech {
[HarmonyPrefix]
[HarmonyPatch(typeof(ModuleWheels), "OnAttached")]
static void PostfixCreate(ModuleWheels __instance) {
public static void PostfixCreate(ModuleWheels __instance) {
var trav = Traverse.Create(__instance);
var torqueParams = trav.Field("torqueParams");
torqueParamsManager.OnObjectAttached(torqueParams.GetValue<ManWheels.TorqueParams>());
TorqueParamsManager.OnObjectAttached(torqueParams.GetValue<ManWheels.TorqueParams>());
}
[HarmonyPrefix]
[HarmonyPatch(typeof(ModuleWheels), "OnDetaching")]
static void PostfixDestroy(ModuleWheels __instance) {
public static void PostfixDestroy(ModuleWheels __instance) {
var trav = Traverse.Create(__instance);
var torqueParams = trav.Field("torqueParams");
torqueParamsManager.OnObjectDetached(torqueParams.GetValue<ManWheels.TorqueParams>());
TorqueParamsManager.OnObjectDetached(torqueParams.GetValue<ManWheels.TorqueParams>());
}
public static void DoPatch() {
torqueParamsManager.ApplyAll();
private static void DoPatch() {
TorqueParamsManager.ApplyAll();
}
public static readonly Func<Module, bool> Register = obj => {
if (Main.debug.Value)
Console.WriteLine("Registering ModuleWheels: {0}", obj);
PostfixCreate(obj as ModuleWheels);
return true;
};
}
}

View File

@@ -5,17 +5,17 @@ using HarmonyLib;
namespace TerraTech {
[HarmonyPatch]
public class ModuleWingManager {
private static readonly MultipliedObjectManager<ModuleWing.Aerofoil> manager =
private static readonly MultipliedObjectManager<ModuleWing.Aerofoil> Manager =
new MultipliedObjectManager<ModuleWing.Aerofoil>(ConfigureAerofoil);
public static ConfigEntry<bool> playerOnly;
public static ConfigEntry<float> angleRangeMultiplier;
public static ConfigEntry<float> turnSpeedMultiplier;
public static ConfigEntry<float> liftStrengthMultiplier;
private static ConfigEntry<bool> playerOnly;
private static ConfigEntry<float> angleRangeMultiplier;
private static ConfigEntry<float> turnSpeedMultiplier;
private static ConfigEntry<float> liftStrengthMultiplier;
public static void Setup(ConfigFile config) {
float min = 0.01f;
float max = 32f;
const float min = 0.01f;
const float max = 32f;
playerOnly = config.Bind("Aerofoil", "Player Only", false, new ConfigDescription("Player Only"));
playerOnly.SettingChanged += (sender, args) => DoPatch();
@@ -52,28 +52,32 @@ namespace TerraTech {
[HarmonyPrefix]
[HarmonyPatch(typeof(ModuleWing), "OnAttached")]
static void PostfixCreate(ModuleWing __instance) {
public static void PostfixCreate(ModuleWing __instance) {
if (playerOnly.Value && !CykUtil.IsPlayerTank(__instance))
return;
for (int i = 0; i < __instance.m_Aerofoils.Length; i++) {
var aerofoil = __instance.m_Aerofoils[i];
manager.OnObjectAttached(aerofoil);
Manager.OnObjectAttached(aerofoil);
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(ModuleWing), "OnDetaching")]
static void PostfixDestroy(ModuleWing __instance) {
public static void PostfixDestroy(ModuleWing __instance) {
if (playerOnly.Value && !CykUtil.IsPlayerTank(__instance))
return;
for (int i = 0; i < __instance.m_Aerofoils.Length; i++) {
var aerofoil = __instance.m_Aerofoils[i];
manager.OnObjectDetached(aerofoil);
}
foreach (var aerofoil in __instance.m_Aerofoils) Manager.OnObjectDetached(aerofoil);
}
public static void DoPatch() {
manager.ApplyAll();
private static void DoPatch() {
Manager.ApplyAll();
}
public static readonly Func<Module, bool> Register = obj => {
if (Main.debug.Value)
Console.WriteLine("Registering ModuleWing: {0}", obj);
PostfixCreate(obj as ModuleWing);
return true;
};
}
}

View File

@@ -0,0 +1,71 @@
using System;
using System.Reflection;
using HarmonyLib;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
namespace TerraTech {
[HarmonyPatch]
public class MultiBuy {
public static UIShopBlockSelect panel;
public static Traverse panelTraverse;
[HarmonyPostfix]
[HarmonyPatch(typeof(UIShopBlockSelect), "OnSpawn")]
public static void PostfixCreate(UIShopBlockSelect __instance) {
panel = __instance;
if (Main.debugBuyAll.Value)
Console.WriteLine("UISnapshotPanel.OnPool: {0}", __instance);
panelTraverse = Traverse.Create(__instance);
var placeButton = panelTraverse.Field("m_PurchaseBlockButton").GetValue<Button>();
placeButton.gameObject.AddComponent<MultiBuyRightClickHandler>();
}
}
class MultiBuyRightClickHandler : MonoBehaviour, IPointerClickHandler {
// private void Awake() {
// }
public void OnPointerClick(PointerEventData eventData) {
if (Main.debugBuyAll.Value)
Console.WriteLine("MultiBuyRightClickHandler.OnPointerClick: {0} {1}", gameObject.name,
eventData.button);
try {
if (eventData.button == PointerEventData.InputButton.Right) {
UIBlockSelectGrid grid = MultiBuy.panelTraverse.Field("m_Grid").GetValue<UIBlockSelectGrid>();
BlockTypes blockTypes;
bool ok = grid.TryGetSelection(out blockTypes);
if (!ok) {
if (Main.debugBuyAll.Value)
Console.WriteLine(
"MultiBuyRightClickHandler.OnPointerClick: Failed to get block selection from grid");
return;
}
uint shopBlockPoolID = MultiBuy.panelTraverse.Field("m_ShopBlockPoolID").GetValue<uint>();
MethodInfo canPurchaseMethod =
AccessTools.Method(typeof(UIShopBlockSelect), "CanPurchaseBlock", new[] { typeof(BlockTypes) });
Func<BlockTypes, bool> canPurchase = (Func<BlockTypes, bool>)Delegate.CreateDelegate(
typeof(Func<BlockTypes, bool>), MultiBuy.panel, canPurchaseMethod);
for (int i = 0; i < Main.multiBuyAmount.Value; i++) {
if (!canPurchase.Invoke(blockTypes)) {
if (Main.debugBuyAll.Value)
Console.WriteLine("MultiBuyRightClickHandler.OnPointerClick: Can purchase no more {0}",
blockTypes);
return;
}
Singleton.Manager<ManPurchases>.inst.RequestPurchaseBlock(shopBlockPoolID, blockTypes, 1);
if (Main.debugBuyAll.Value)
Console.WriteLine("MultiBuyRightClickHandler.OnPointerClick: Purchased {0} block",
blockTypes);
}
}
} catch (Exception e) {
if (Main.debugBuyAll.Value)
Console.WriteLine("MultiBuyRightClickHandler.OnPointerClick: Exception occurred: {0}", e);
}
}
}
}

View File

@@ -71,18 +71,18 @@ namespace TerraTech {
_applyCondition = applyCondition;
}
public ConfigEntry<TMul> GetMultiplier(object instance) {
public ConfigEntry<TMul> GetMultiplier(object __instance) {
if (_conditionalMultiplier == null) {
return _defaultMultiplier;
}
return _conditionalMultiplier(instance);
return _conditionalMultiplier(__instance);
}
public bool ShouldApply(object instance) {
public bool ShouldApply(object __instance) {
if (_applyCondition == null) {
return true;
}
return _applyCondition(instance);
return _applyCondition(__instance);
}
}
@@ -247,18 +247,18 @@ namespace TerraTech {
_applyCondition = applyCondition;
}
public ConfigEntry<bool> GetValue(object instance) {
public ConfigEntry<bool> GetValue(object __instance) {
if (_conditionalValue == null) {
return _value;
}
return _conditionalValue(instance);
return _conditionalValue(__instance);
}
public bool ShouldApply(object instance) {
public bool ShouldApply(object __instance) {
if (_applyCondition == null) {
return true;
}
return _applyCondition(instance);
return _applyCondition(__instance);
}
}
@@ -353,9 +353,9 @@ namespace TerraTech {
private readonly Traverse _objectTraverse;
private readonly Dictionary<string, IFieldModifier> _fields;
public MultipliedObject(T instance) {
_instance = instance;
_objectTraverse = Traverse.Create(instance);
public MultipliedObject(T __instance) {
_instance = __instance;
_objectTraverse = Traverse.Create(__instance);
_fields = new Dictionary<string, IFieldModifier>();
}
@@ -413,68 +413,68 @@ namespace TerraTech {
_managedObjects = new Dictionary<T, MultipliedObject<T>>();
}
private void SafeRemove(T instance) {
if (instance == null)
private void SafeRemove(T __instance) {
if (__instance == null)
return;
try {
_managedObjects.Remove(instance);
_managedObjects.Remove(__instance);
} catch (Exception e) {
Console.WriteLine("Error removing instance from _managedObjects: {0}", e);
Console.WriteLine("Error removing __instance from _managedObjects: {0}", e);
}
}
public void OnObjectAttached(T instance) {
public void OnObjectAttached(T __instance) {
if (Main.debug.Value)
Console.WriteLine("{0}.OnAttached", typeof(T).Name);
if (instance == null) {
Console.WriteLine("Attempted to attach null instance");
if (__instance == null) {
Console.WriteLine("Attempted to attach null __instance");
return;
}
try {
if (_managedObjects.ContainsKey(instance)) {
if (_managedObjects.ContainsKey(__instance)) {
if (Main.debug.Value)
Console.WriteLine("{0} already managed, skipping", typeof(T).Name);
return;
}
var multipliedObject = new MultipliedObject<T>(instance);
var multipliedObject = new MultipliedObject<T>(__instance);
_configureObject(multipliedObject);
multipliedObject.CaptureFrom();
_managedObjects.Add(instance, multipliedObject);
_managedObjects.Add(__instance, multipliedObject);
multipliedObject.LogValues("Patching");
ApplyTo(instance);
ApplyTo(__instance);
multipliedObject.LogValues("Patched");
} catch (Exception e) {
Console.WriteLine("Error in OnObjectAttached: {0}", e);
}
}
public void OnObjectDetached(T instance) {
public void OnObjectDetached(T __instance) {
if (Main.debug.Value)
Console.WriteLine("{0}.OnDetaching", typeof(T).Name);
if (instance == null) {
Console.WriteLine("Attempted to detach null instance");
if (__instance == null) {
Console.WriteLine("Attempted to detach null __instance");
return;
}
try {
MultipliedObject<T> multipliedObject;
if (_managedObjects.TryGetValue(instance, out multipliedObject)) {
if (_managedObjects.TryGetValue(__instance, out multipliedObject)) {
if (Main.debug.Value)
multipliedObject.LogValues("Restoring");
try {
RestoreTo(instance);
RestoreTo(__instance);
multipliedObject.LogValues("Restored");
} catch (Exception e) {
Console.WriteLine("Error restoring values: {0}", e);
}
SafeRemove(instance);
SafeRemove(__instance);
}
} catch (Exception e) {
Console.WriteLine("Error in OnObjectDetached: {0}", e);
@@ -488,40 +488,40 @@ namespace TerraTech {
// Make a copy of the keys to avoid modification during enumeration
var instances = _managedObjects.Keys.ToList();
foreach (var instance in instances) {
foreach (var __instance in instances) {
try {
RestoreTo(instance, fieldNames);
ApplyTo(instance, fieldNames);
RestoreTo(__instance, fieldNames);
ApplyTo(__instance, fieldNames);
} catch (Exception e) {
Console.WriteLine("Error applying to instance: {0}", e);
Console.WriteLine("Error applying to __instance: {0}", e);
}
}
}
public void ApplyTo(T instance, IEnumerable<string> fieldNames = null) {
public void ApplyTo(T __instance, IEnumerable<string> fieldNames = null) {
if (Main.debug.Value)
Console.WriteLine("Applying {0}", typeof(T).Name);
if (instance == null)
if (__instance == null)
return;
try {
MultipliedObject<T> obj;
if (_managedObjects.TryGetValue(instance, out obj))
if (_managedObjects.TryGetValue(__instance, out obj))
obj.ApplyTo(fieldNames);
} catch (Exception e) {
Console.WriteLine("Error in ApplyTo: {0}", e);
}
}
public void RestoreTo(T instance, IEnumerable<string> fieldNames = null) {
public void RestoreTo(T __instance, IEnumerable<string> fieldNames = null) {
if (Main.debug.Value)
Console.WriteLine("Restoring {0}", typeof(T).Name);
if (instance == null)
if (__instance == null)
return;
try {
MultipliedObject<T> obj;
if (_managedObjects.TryGetValue(instance, out obj))
if (_managedObjects.TryGetValue(__instance, out obj))
obj.RestoreTo(fieldNames);
} catch (Exception e) {
Console.WriteLine("Error in RestoreTo: {0}", e);

View File

@@ -5,7 +5,7 @@ namespace TerraTech {
public class Patches {
[HarmonyPrefix]
[HarmonyPatch(typeof(ManLicenses), "AddXP")]
static void XPMulti(FactionSubTypes corporation, ref int xp, bool showUI = true) {
static void XpMulti(FactionSubTypes corporation, ref int xp, bool showUI = true) {
xp = (int)(xp * Main.xpMultiplier.Value);
}

View File

@@ -5,7 +5,7 @@ namespace TerraTech {
public class SeekingProjectileManager {
[HarmonyPatch(typeof(SeekingProjectile), "OnSpawn")]
class Patch {
static void Postfix(SeekingProjectile __instance) {
public static void Postfix(SeekingProjectile __instance) {
if (Main.debug.Value)
Console.WriteLine("SeekingProjectile created");

View File

@@ -4,7 +4,7 @@ using HarmonyLib;
namespace TerraTech {
[HarmonyPatch]
public class TankBeamManager {
private static readonly MultipliedObjectManager<TankBeam> manager =
private static readonly MultipliedObjectManager<TankBeam> Manager =
new MultipliedObjectManager<TankBeam>(ConfigureBeam);
public static ConfigEntry<float> hoverClearanceMultiplier;
@@ -39,15 +39,15 @@ namespace TerraTech {
[HarmonyPrefix]
[HarmonyPatch(typeof(TankBeam), "EnableBeam")]
static void PostfixCreate(TankBeam __instance, ref bool enable) {
public static void PostfixCreate(TankBeam __instance, ref bool enable) {
if (enable)
manager.OnObjectAttached(__instance);
Manager.OnObjectAttached(__instance);
else
manager.OnObjectDetached(__instance);
Manager.OnObjectDetached(__instance);
}
public static void DoPatch() {
manager.ApplyAll();
Manager.ApplyAll();
}
}
}

View File

@@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using BepInEx.Configuration;
using HarmonyLib;
using UnityEngine;
namespace TerraTech {
[HarmonyPatch]
public class TankManager {
public static ConfigEntry<bool> recheck;
public static Dictionary<Type, Func<Module, bool>> moduleManagerMapper =
new Dictionary<Type, Func<Module, bool>>();
public static void Setup(ConfigFile config) {
recheck = config.Bind("Tank", "Recheck", false, new ConfigDescription("Recheck"));
moduleManagerMapper.Add(typeof(ModuleBooster), ModuleBoosterManager.Register);
moduleManagerMapper.Add(typeof(ModuleEnergy), ModuleEnergyManager.Register);
moduleManagerMapper.Add(typeof(ModuleEnergyStore), ModuleEnergyStoreManager.Register);
moduleManagerMapper.Add(typeof(ModuleFuelTank), ModuleFuelTankManager.Register);
moduleManagerMapper.Add(typeof(ModuleGyro), ModuleGyroManager.Register);
moduleManagerMapper.Add(typeof(ModuleHeart), ModuleHeartManager.Register);
moduleManagerMapper.Add(typeof(ModuleItemHolder), ModuleItemHolderManager.Register);
moduleManagerMapper.Add(typeof(ModuleItemProducer), ModuleItemProducerManager.Register);
moduleManagerMapper.Add(typeof(ModuleRemoteCharger), ModuleRemoteChargerManager.Register);
moduleManagerMapper.Add(typeof(ModuleShieldGenerator), ModuleShieldGeneratorManager.Register);
moduleManagerMapper.Add(typeof(ModuleWeaponGun), ModuleWeaponGunManager.Register);
moduleManagerMapper.Add(typeof(ModuleWeapon), ModuleWeaponManager.Register);
moduleManagerMapper.Add(typeof(ModuleWheels), ModuleWheelsManager.Register);
moduleManagerMapper.Add(typeof(ModuleWing), ModuleWingManager.Register);
}
[HarmonyPrefix]
[HarmonyPatch(typeof(Tank), "NotifyAnchor")]
public static void PostfixCreate(Tank __instance, ModuleAnchor anchor, bool anchored) {
if (Main.debug.Value)
Console.WriteLine("TankManager.NotifyAnchor: {0}", __instance);
if (!__instance.ControllableByLocalPlayer)
return;
if (!recheck.Value)
return;
foreach (Transform child in __instance.transform) {
GameObject childObj = child.gameObject;
Component[] components = childObj.GetComponents<Component>();
foreach (Component component in components) {
Func<Module, bool> manager;
if (moduleManagerMapper.TryGetValue(component.GetType(), out manager))
manager(component as Module);
}
}
}
}
}

View File

@@ -59,6 +59,9 @@
<Compile Include="ModuleHeartManager.cs" />
<Compile Include="ModuleFuelTankManager.cs" />
<Compile Include="ProjectilePatch.cs" />
<Compile Include="TankManager.cs" />
<Compile Include="UISnapshotPanelBuyAll.cs" />
<Compile Include="MultiBuy.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="0Harmony">
@@ -73,6 +76,9 @@
<Reference Include="UnityEngine.CoreModule">
<HintPath>$(GAME_MANAGED)/UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UI">
<HintPath>$(GAME_MANAGED)/UnityEngine.UI.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.Networking">
<HintPath>$(GAME_MANAGED)/UnityEngine.Networking.dll</HintPath>
</Reference>

View File

@@ -0,0 +1,181 @@
using System;
using System.Collections.Generic;
using HarmonyLib;
using Snapshots;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
namespace TerraTech {
[HarmonyPatch]
public class UISnapshotPanelBuyAll {
public static UISnapshotPanel panel;
public static Traverse panelTraverse;
public static SnapshotLiveData selectedData;
[HarmonyPostfix]
[HarmonyPatch(typeof(UISnapshotPanel), "OnPool")]
public static void PostfixCreate(UISnapshotPanel __instance) {
if (Main.debugBuyAll.Value)
Console.WriteLine("UISnapshotPanel.OnPool: {0}", __instance);
panel = __instance;
panelTraverse = Traverse.Create(__instance);
var placeButton = panelTraverse.Field("m_PlaceButton").GetValue<Button>();
placeButton.gameObject.AddComponent<RightClickHandler>();
var swapButton = panelTraverse.Field("m_SwapButton").GetValue<Button>();
swapButton.gameObject.AddComponent<RightClickHandlerSwap>();
}
[HarmonyPostfix]
[HarmonyPatch(typeof(UISnapshotPanel), "OnSelectedChanged")]
public static void PostfixCreate(UISnapshotPanel __instance, ref SnapshotLiveData selectedData) {
if (Main.debugBuyAll.Value)
Console.WriteLine("UISnapshotPanel.OnSelectedChanged: {0}", __instance);
UISnapshotPanelBuyAll.selectedData = selectedData;
}
}
public abstract class BaseRightClickHandler : MonoBehaviour, IPointerClickHandler {
protected static Traverse m_TechAvailLookupTraverse;
protected static Dictionary<Snapshot, TechDataAvailValidation> m_TechAvailLookup;
protected virtual void Awake() {
var trav = Traverse.Create(Singleton.Manager<ManSnapshots>.inst);
m_TechAvailLookupTraverse = trav.Field("m_TechAvailLookup");
m_TechAvailLookup = m_TechAvailLookupTraverse.GetValue<Dictionary<Snapshot, TechDataAvailValidation>>();
}
protected Dictionary<BlockTypes, int> CalculateMissingBlocks(
Dictionary<BlockTypes, TechDataAvailValidation.BlockTypeAvailability> blockAvailability, bool isSpawning) {
Dictionary<BlockTypes, int> missing = new Dictionary<BlockTypes, int>();
foreach (var kvp in blockAvailability) {
int numMissing;
if (isSpawning)
numMissing = kvp.Value.numRequired - kvp.Value.numInInventory;
else
numMissing = kvp.Value.numRequired - kvp.Value.numInInventory - kvp.Value.numOnPlayerTech;
}
if (missing.Count == 0)
foreach (var kvp in blockAvailability) missing.Add(kvp.Key, kvp.Value.numRequired);
return missing;
}
protected int CalculateTotalCost(Dictionary<BlockTypes, int> missingBlocks) {
int totalCost = 0;
RecipeManager recipeManager = Singleton.Manager<RecipeManager>.inst;
foreach (var kvp in missingBlocks) {
int cost = recipeManager.GetBlockBuyPrice(kvp.Key) * kvp.Value;
totalCost += cost;
if (Main.debugBuyAll.Value)
Console.WriteLine("{0} of {1} would cost {2}, total now {3}", kvp.Value, kvp.Key, cost, totalCost);
}
return totalCost;
}
protected bool TryPurchaseBlocks(Dictionary<BlockTypes, int> missingBlocks, int totalCost) {
ManPlayer player = Singleton.Manager<ManPlayer>.inst;
if (player.GetCurrentMoney() < totalCost) {
if (Main.debugBuyAll.Value)
Console.WriteLine("Not enough money, have {0} but need {1}, nothing to do",
player.GetCurrentMoney(), totalCost);
return false;
}
player.PayMoney(totalCost);
foreach (var kvp in missingBlocks) {
if (Main.debugBuyAll.Value)
Console.WriteLine("Buying {0} of {1}", kvp.Value, kvp.Key);
player.PlayerInventory.HostAddItem(kvp.Key, kvp.Value);
}
return true;
}
protected bool ProcessPurchase(
Dictionary<BlockTypes, TechDataAvailValidation.BlockTypeAvailability> blockAvailability, bool isSpawning) {
try {
if (blockAvailability == null) {
if (Main.debugBuyAll.Value)
Console.WriteLine("Block availability is null (wtf?), nothing to do");
return false;
}
var missingBlocks = CalculateMissingBlocks(blockAvailability, isSpawning);
int totalCost = CalculateTotalCost(missingBlocks);
if (totalCost > 0) {
if (Main.debugBuyAll.Value)
Console.WriteLine("Total cost: {0}", totalCost);
return TryPurchaseBlocks(missingBlocks, totalCost);
}
if (Main.debugBuyAll.Value)
Console.WriteLine("No blocks missing or no cost calculated");
return false;
} catch (Exception e) {
if (Main.debugBuyAll.Value)
Console.WriteLine("Error during purchase processing: {0}", e);
return false;
}
}
protected Dictionary<BlockTypes, TechDataAvailValidation.BlockTypeAvailability> GetCurrentBlockAvailability() {
SnapshotLiveData selectedSnapshotData = UISnapshotPanelBuyAll.selectedData;
Snapshot selectedSnapshot = selectedSnapshotData.m_Snapshot;
if (selectedSnapshot == null) {
if (Main.debugBuyAll.Value)
Console.WriteLine("Selected snapshot is null wtf??: {0}", gameObject.name);
return null;
}
TechDataAvailValidation techDataAvail;
if (!m_TechAvailLookup.TryGetValue(selectedSnapshot, out techDataAvail)) {
if (Main.debugBuyAll.Value)
Console.WriteLine("Failed to find TechDataAvailValidation for snapshot: {0}", selectedSnapshot);
return null;
}
var trav = Traverse.Create(techDataAvail);
var mBlockAvailabilityField = trav.Field("m_BlockAvailability");
var mBlockAvailability =
mBlockAvailabilityField
.GetValue<Dictionary<BlockTypes, TechDataAvailValidation.BlockTypeAvailability>>();
return mBlockAvailability;
}
public abstract void OnPointerClick(PointerEventData eventData);
}
public class RightClickHandler : BaseRightClickHandler {
public override void OnPointerClick(PointerEventData eventData) {
if (Main.debugBuyAll.Value)
Console.WriteLine("UISnapshotPanel.OnPointerClick: {0} {1}", gameObject.name, eventData.button);
try {
if (eventData.button == PointerEventData.InputButton.Right)
ProcessPurchase(GetCurrentBlockAvailability(), true);
} catch (Exception e) {
if (Main.debugBuyAll.Value)
Console.WriteLine("Shit exploded fml: {0}", e);
}
}
}
public class RightClickHandlerSwap : BaseRightClickHandler {
public override void OnPointerClick(PointerEventData eventData) {
if (Main.debugBuyAll.Value)
Console.WriteLine("UISnapshotPanel.OnPointerClick: {0} {1}", gameObject.name, eventData.button);
try {
if (eventData.button == PointerEventData.InputButton.Right)
ProcessPurchase(GetCurrentBlockAvailability(), false);
} catch (Exception e) {
if (Main.debugBuyAll.Value)
Console.WriteLine("Shit exploded fml: {0}", e);
}
}
}
}

View File

@@ -0,0 +1,14 @@
static void Postfix(UIItemSelectGrid __instance) {
try {
StringBuilder sb = new StringBuilder();
sb.AppendLine("--------------------");
sb.AppendLine("void UIItemSelectGrid::Repopulate()");
sb.Append("- __instance: ").AppendLine(__instance.ToString());
foreach (var item in __instance.m_FilteredItemList) {
sb.Append("- item: ").AppendLine(item.ToString());
}
UnityExplorer.ExplorerCore.Log(sb.ToString());
} catch (System.Exception ex) {
UnityExplorer.ExplorerCore.LogWarning($"Exception in patch of void UIItemSelectGrid::Repopulate():\n{ex}");
}
}

View File

@@ -0,0 +1,3 @@
BasedOnStyle: Google
IndentWidth: 4
ColumnLimit: 120

View File

@@ -0,0 +1,18 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CRiderProjects_005CBepinex_005CProjects_005CTerraTech_005Clibs_005C0Harmony_002Edll/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CRiderProjects_005CBepinex_005CProjects_005CTerraTech_005Clibs_005CAssembly_002DCSharp_002Edll/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CRiderProjects_005CBepinex_005CProjects_005CTerraTech_005Clibs_005CBepInEx_002Edll/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CRiderProjects_005CBepinex_005CProjects_005CTerraTech_005Clibs_005CConfigurationManager_002Edll/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CRiderProjects_005CBepinex_005CProjects_005CTerraTech_005Clibs_005CUnityEngine_002ECoreModule_002Edll/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CRiderProjects_005CBepinex_005CProjects_005CTerraTech_005Clibs_005CUnityEngine_002Edll/@EntryIndexedValue">True</s:Boolean>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ABaseUnityPlugin_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F9185a461e2a54cd99ed3b83eace57b3d1f200_003F59_003Fb886ba39_003FBaseUnityPlugin_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AFunc_00602_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F105da1159ec9496ab9310694c7b11dd2532bb0_003F8e_003Fd9fe1d1e_003FFunc_00602_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AInt32_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F105da1159ec9496ab9310694c7b11dd2532bb0_003F2f_003Fc4c87fac_003FInt32_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AModuleEnergy_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F88c9fc29ca6844c7a78a6d5386efc5cfbd1c00_003F6a_003Ff8d470ed_003FModuleEnergy_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ARecipeManager_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F88c9fc29ca6844c7a78a6d5386efc5cfbd1c00_003Fec_003F11004097_003FRecipeManager_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ATraverse_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F474744d65d8e460fa08cd5fd82b5d65f32000_003F24_003F10e7e9ab_003FTraverse_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/Environment/AssemblyExplorer/XmlDocument/@EntryValue">&lt;AssemblyExplorer /&gt;</s:String>
<s:String x:Key="/Default/Environment/Hierarchy/Build/BuildTool/CustomBuildToolPath/@EntryValue">C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe</s:String>
<s:Int64 x:Key="/Default/Environment/Hierarchy/Build/BuildTool/MsbuildVersion/@EntryValue">262144</s:Int64>
</wpf:ResourceDictionary>

View File

@@ -0,0 +1,16 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Zompiercer", "Zompiercer\Zompiercer.csproj", "{EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,17 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CRiderProjects_005CBepinex_005CProjects_005CTerraTech_005Clibs_005C0Harmony_002Edll/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CRiderProjects_005CBepinex_005CProjects_005CTerraTech_005Clibs_005CAssembly_002DCSharp_002Edll/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CRiderProjects_005CBepinex_005CProjects_005CTerraTech_005Clibs_005CBepInEx_002Edll/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CRiderProjects_005CBepinex_005CProjects_005CTerraTech_005Clibs_005CConfigurationManager_002Edll/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CRiderProjects_005CBepinex_005CProjects_005CTerraTech_005Clibs_005CUnityEngine_002ECoreModule_002Edll/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CRiderProjects_005CBepinex_005CProjects_005CTerraTech_005Clibs_005CUnityEngine_002Edll/@EntryIndexedValue">True</s:Boolean>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ABaseUnityPlugin_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F9185a461e2a54cd99ed3b83eace57b3d1f200_003F59_003Fb886ba39_003FBaseUnityPlugin_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AFunc_00602_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F105da1159ec9496ab9310694c7b11dd2532bb0_003F8e_003Fd9fe1d1e_003FFunc_00602_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AInt32_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F105da1159ec9496ab9310694c7b11dd2532bb0_003F2f_003Fc4c87fac_003FInt32_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AModuleEnergy_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F88c9fc29ca6844c7a78a6d5386efc5cfbd1c00_003F6a_003Ff8d470ed_003FModuleEnergy_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ARecipeManager_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F88c9fc29ca6844c7a78a6d5386efc5cfbd1c00_003Fec_003F11004097_003FRecipeManager_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ATraverse_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F474744d65d8e460fa08cd5fd82b5d65f32000_003F24_003F10e7e9ab_003FTraverse_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/Environment/AssemblyExplorer/XmlDocument/@EntryValue">&lt;AssemblyExplorer /&gt;</s:String>
<s:String x:Key="/Default/Environment/Hierarchy/Build/BuildTool/CustomBuildToolPath/@EntryValue">C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe</s:String>
<s:Int64 x:Key="/Default/Environment/Hierarchy/Build/BuildTool/MsbuildVersion/@EntryValue">262144</s:Int64>
</wpf:ResourceDictionary>

View File

@@ -0,0 +1,32 @@
using System.Linq;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using HarmonyLib.Tools;
// TODO: Make shield and repair bigger
// TODO: Maybe make props faster, thrusters work fine
namespace Zompiercer {
[BepInPlugin(PluginGuid, PluginName, PluginVersion)]
public class Main : BaseUnityPlugin {
private const string PluginGuid = "CykPiercer";
private const string PluginName = "CykaPiercer";
private const string PluginVersion = "1.0.0";
public static ConfigEntry<bool> debug;
public static ConfigEntry<float> weightMultiplier;
public void Awake() {
debug = Config.Bind("General", "Debug", false);
weightMultiplier = Config.Bind("General", "Weight Multiplier", 1.0f, "Multiplier for the weight of the tank");
Logger.LogInfo("Cyka mod loaded");
HarmonyFileLog.Enabled = true;
Harmony harmony = new Harmony(PluginGuid);
harmony.PatchAll();
var originalMethods = harmony.GetPatchedMethods();
Logger.LogInfo("Patched " + originalMethods.Count() + " methods");
}
}
}

View File

@@ -0,0 +1,35 @@
using System;
using HarmonyLib;
namespace Zompiercer {
[HarmonyPatch]
public class Patches {
[HarmonyPostfix]
[HarmonyPatch(typeof(InventoryItem), "GetWeight")]
static void GetWeight(ref float __result) {
if (Main.debug.Value)
Console.WriteLine("GetWeight: " + __result);
__result = __result * Main.weightMultiplier.Value;
}
[HarmonyPostfix]
[HarmonyPatch(typeof(InventoryItem), "GetWeightOfOneItem")]
static void GetWeightOfOneItem(ref float __result) {
if (Main.debug.Value)
Console.WriteLine("GetWeightOfOneItem: " + __result);
__result = __result * Main.weightMultiplier.Value;
}
//[HarmonyPrefix]
//[HarmonyPatch(typeof(ManPlayer), "AddMoney")]
//static void MoneyMulti(ref int amount) {
// amount = (int)(amount * Main.moneyMultiplier.Value);
//}
//[HarmonyPrefix]
//[HarmonyPatch(typeof(TechHolders), "SetHeartbeatInterval")]
//static void HeartbeatMulti(ref float interval) {
// interval *= Main.heartbeatIntervalMultiplier.Value;
//}
}
}

View File

@@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly:AssemblyTitle("Zompiercer")]
[assembly:AssemblyDescription("")]
[assembly:AssemblyConfiguration("")]
[assembly:AssemblyCompany("")]
[assembly:AssemblyProduct("Zompiercer")]
[assembly:AssemblyCopyright("Copyright © 2023")]
[assembly:AssemblyTrademark("")]
[assembly:AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly:ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly:Guid("EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly:AssemblyVersion("1.0.0.0")]
[assembly:AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props"
Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<GAME_DIR>C:/Games/Zompiercer.Build.16292544</GAME_DIR>
<GAME_MANAGED>$(GAME_DIR)/Zompiercer_Data/Managed</GAME_MANAGED>
<GAME_BEPINEX>$(GAME_DIR)/BepInEx</GAME_BEPINEX>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Zompiercer</RootNamespace>
<AssemblyName>Zompiercer</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Compile Include="Class1.cs" />
<Compile Include="Patches.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="0Harmony">
<HintPath>$(GAME_BEPINEX)/core/0Harmony.dll</HintPath>
</Reference>
<Reference Include="BepInEx">
<HintPath>$(GAME_BEPINEX)/core/BepInEx.dll</HintPath>
</Reference>
<Reference Include="UnityEngine">
<HintPath>$(GAME_MANAGED)/UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>$(GAME_MANAGED)/UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UI">
<HintPath>$(GAME_MANAGED)/UnityEngine.UI.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.Networking">
<HintPath>$(GAME_MANAGED)/UnityEngine.Networking.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>$(GAME_MANAGED)/Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="ConfigurationManager">
<HintPath>$(GAME_BEPINEX)/plugins/ConfigurationManager.dll</HintPath>
</Reference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1 @@
clang-format -i TerraTech/*.cs

View File

@@ -0,0 +1,2 @@
- source: Zompiercer/obj/Release/Zompiercer.dll
target: C:/Games/Zompiercer.Build.16292544/BepInEx/plugins/Zompiercer.dll