More slower rotationing
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection.Emit;
|
||||
using BepInEx;
|
||||
using BepInEx.Configuration;
|
||||
using Controllers;
|
||||
@@ -12,6 +13,7 @@ using Gameplay.Buildings;
|
||||
using Gameplay.GameResources;
|
||||
using Gameplay.InGameResources;
|
||||
using Gameplay.Rebuilding;
|
||||
using Gameplay.Rebuilding.Walls;
|
||||
using Gameplay.Scavenge;
|
||||
using Gameplay.Units.Characters;
|
||||
using Gameplay.Units.Icons;
|
||||
@@ -21,6 +23,7 @@ using Gameplay.Vehicles;
|
||||
using HarmonyLib;
|
||||
using HarmonyLib.Tools;
|
||||
using MapEssentials.Temp;
|
||||
using UnityEngine;
|
||||
using Zenject;
|
||||
|
||||
// See:
|
||||
@@ -86,6 +89,8 @@ namespace InfectionFreeZone {
|
||||
public static ConfigEntry<float> childToAdultRatioInfluenceFloorParam;
|
||||
public static ConfigEntry<float> childToAdultRatioInfluenceCeilingParam;
|
||||
|
||||
public static ConfigEntry<float> rotationTimestepMultiplier;
|
||||
|
||||
public void Awake() {
|
||||
resourceMultiplierDebug = Config.Bind("General", "Resource Multiplier Debug", false);
|
||||
resourceMultiplier = Config.Bind("General", "Resource Multiplier", 1f);
|
||||
@@ -146,6 +151,8 @@ namespace InfectionFreeZone {
|
||||
childToAdultRatioInfluenceCeilingParam =
|
||||
Config.Bind("Birthing Config", "Child to Adult Ratio Influence Ceiling Param", 0f);
|
||||
|
||||
rotationTimestepMultiplier = Config.Bind("General", "Rotation Timestep Multiplier", 1f);
|
||||
|
||||
Logger.LogInfo("Cyka mod loaded");
|
||||
HarmonyFileLog.Enabled = true;
|
||||
Harmony harmony = new Harmony(pluginGuid);
|
||||
@@ -294,12 +301,14 @@ namespace InfectionFreeZone {
|
||||
var config = trav.Field<BuildingDestructionConfig>("_deconstructionConfig");
|
||||
var configV = config.Value;
|
||||
if (Main.buildingDeconstructionResourcesMultiplierDebug.Value)
|
||||
Console.WriteLine($"Building deconstruction workers per 100m is {configV.deconstructWorkersPer100m3OfBuilding}");
|
||||
Console.WriteLine(
|
||||
$"Building deconstruction workers per 100m is {configV.deconstructWorkersPer100m3OfBuilding}");
|
||||
|
||||
configV.deconstructWorkersPer100m3OfBuilding = Main.deconstructionWorkersPer100m.Value;
|
||||
config.Value = configV;
|
||||
if (Main.buildingDeconstructionResourcesMultiplierDebug.Value)
|
||||
Console.WriteLine($"Building deconstruction workers per 100m modified to {configV.deconstructWorkersPer100m3OfBuilding}");
|
||||
Console.WriteLine(
|
||||
$"Building deconstruction workers per 100m modified to {configV.deconstructWorkersPer100m3OfBuilding}");
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
@@ -440,5 +449,41 @@ namespace InfectionFreeZone {
|
||||
charactersConfigV.bornConfig = bornConfig;
|
||||
charactersConfig.Value = charactersConfigV;
|
||||
}
|
||||
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(PlaceableObject), "RotateRight")]
|
||||
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)) {
|
||||
Console.WriteLine($"Operand is {code.operand}");
|
||||
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, "Value")));
|
||||
Console.WriteLine($"Operand modified to {codes[i].operand}");
|
||||
}
|
||||
}
|
||||
|
||||
return codes.AsEnumerable();
|
||||
}
|
||||
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(PlaceableObject), "RotateLeft")]
|
||||
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)) {
|
||||
Console.WriteLine($"Operand is {code.operand}");
|
||||
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, "Value")));
|
||||
Console.WriteLine($"Operand modified to {codes[i].operand}");
|
||||
}
|
||||
}
|
||||
|
||||
return codes.AsEnumerable();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user