Add terratech mods
This commit is contained in:
@@ -35,6 +35,9 @@ namespace TerraTech {
|
||||
public static ConfigEntry<float> seekingProjectileVisionConeAngleMultiplier;
|
||||
public static ConfigEntry<float> seekingProjectileVisionRangeMultiplier;
|
||||
public static ConfigEntry<float> seekingProjectileTurningSpeedMultiplier;
|
||||
public static ConfigEntry<float> wirelessChargingRadiusMultiplier;
|
||||
public static ConfigEntry<float> wirelessChargingPowerPerArcMultiplier;
|
||||
public static ConfigEntry<float> wirelessChargingArcFiringIntervalMultiplier;
|
||||
|
||||
public void Awake() {
|
||||
xpMultiplier = Config.Bind("General", "XP Multiplier", 1f, new ConfigDescription("XP Multiplier", new AcceptableValueRange<float>(1f, 32f)));
|
||||
@@ -64,6 +67,13 @@ namespace TerraTech {
|
||||
new ConfigDescription("Beam Strength Multiplier", new AcceptableValueRange<float>(1f, 16f)));
|
||||
beamRadiusMultiplier = Config.Bind("Attractors", "Beam Radius Multiplier", 1f,
|
||||
new ConfigDescription("Beam Radius Multiplier", new AcceptableValueRange<float>(1f, 16f)));
|
||||
|
||||
wirelessChargingRadiusMultiplier = Config.Bind("Power", "Wireless Charger Radius Multiplier", 1f,
|
||||
new ConfigDescription("Wireless Charger Radius Multiplier", new AcceptableValueRange<float>(0.2f, 16f)));
|
||||
wirelessChargingArcFiringIntervalMultiplier = Config.Bind("Power", "Wireless Charger Arc Firing Interval", 1f,
|
||||
new ConfigDescription("Wireless Charger Arc Firing Interval", new AcceptableValueRange<float>(0.02f, 16f)));
|
||||
wirelessChargingPowerPerArcMultiplier = Config.Bind("Power", "Wireless Charger Power Per Arc", 1f,
|
||||
new ConfigDescription("Wireless Charger Power Per Arc", new AcceptableValueRange<float>(0.2f, 16f)));
|
||||
|
||||
fuelTankRefillMultiplier = Config.Bind("Propulsion", "Fuel Tank Refill Rate Multiplier", 1f,
|
||||
new ConfigDescription("Fuel Tank Refill Rate Multiplier", new AcceptableValueRange<float>(1f, 32f)));
|
||||
@@ -96,6 +106,9 @@ namespace TerraTech {
|
||||
jetThrustMultiplier.SettingChanged += (sender, args) => ThrusterPropertiesManager.DoPatch();
|
||||
minerGroundArea.SettingChanged += (sender, args) => MinerPropertiesManager.DoPatch();
|
||||
minerMiningSpeed.SettingChanged += (sender, args) => MinerPropertiesManager.DoPatch();
|
||||
wirelessChargingPowerPerArcMultiplier.SettingChanged += (sender, args) => WirelessChargerPropertiesManager.DoPatch();
|
||||
wirelessChargingArcFiringIntervalMultiplier.SettingChanged += (sender, args) => WirelessChargerPropertiesManager.DoPatch();
|
||||
wirelessChargingRadiusMultiplier.SettingChanged += (sender, args) => WirelessChargerPropertiesManager.DoPatch();
|
||||
|
||||
Logger.LogInfo("Cyka mod loaded");
|
||||
HarmonyFileLog.Enabled = true;
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
using HarmonyLib;
|
||||
|
||||
namespace TerraTech {
|
||||
[HarmonyPatch]
|
||||
public class Patches {
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(ManLicenses), "AddXP")]
|
||||
static void XPMulti(FactionSubTypes corporation, ref int xp, bool showUI = true) {
|
||||
xp = (int)(xp * Main.xpMultiplier.Value);
|
||||
}
|
||||
[HarmonyPatch]
|
||||
public class Patches {
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(ManLicenses), "AddXP")]
|
||||
static void XPMulti(FactionSubTypes corporation, ref int xp, bool showUI = true) {
|
||||
xp = (int)(xp * Main.xpMultiplier.Value);
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(ManPlayer), "AddMoney")]
|
||||
static void MoneyMulti(ref int amount) {
|
||||
amount = (int)(amount * Main.moneyMultiplier.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;
|
||||
}
|
||||
}
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(TechHolders), "SetHeartbeatInterval")]
|
||||
static void HeartbeatMulti(ref float interval) {
|
||||
interval *= Main.heartbeatIntervalMultiplier.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -45,6 +45,7 @@
|
||||
<Compile Include="ThrusterPropertiesManager.cs" />
|
||||
<Compile Include="WeaponPropertiesManager.cs" />
|
||||
<Compile Include="WheelPropertiesManager.cs" />
|
||||
<Compile Include="WirelessChargerPropertiesManager.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="0Harmony">
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
using System.Collections.Generic;
|
||||
using HarmonyLib;
|
||||
|
||||
// TODO: Fix this, no workey
|
||||
namespace TerraTech {
|
||||
[HarmonyPatch]
|
||||
public class WirelessChargerPropertiesManager {
|
||||
private static Dictionary<ModuleRemoteCharger, float> radius = new Dictionary<ModuleRemoteCharger, float>();
|
||||
private static Dictionary<ModuleRemoteCharger, float> transferPerArc = new Dictionary<ModuleRemoteCharger, float>();
|
||||
private static Dictionary<ModuleRemoteCharger, float> arcFiringInterval = new Dictionary<ModuleRemoteCharger, float>();
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(ModuleRemoteCharger), "OnAttached")]
|
||||
static void PostfixCreate(ModuleRemoteCharger __instance) {
|
||||
// Console.WriteLine("ModuleRemoteCharger.OnAttached");
|
||||
if (!radius.ContainsKey(__instance)) {
|
||||
radius.Add(__instance, __instance.m_ChargingRadius);
|
||||
transferPerArc.Add(__instance, __instance.m_PowerTransferPerArc);
|
||||
arcFiringInterval.Add(__instance, __instance.m_ArcFiringInterval);
|
||||
// Console.WriteLine("Patching {0}; m_RefillRate: {1}; m_Capacity: {2}", __instance.name, __instance.m_RefillRate, __instance.m_Capacity);
|
||||
DoPatchSingle(__instance);
|
||||
// Console.WriteLine("Patched {0}; m_RefillRate: {1}; m_Capacity: {2}", __instance.name, __instance.m_RefillRate, __instance.m_Capacity);
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(ModuleRemoteCharger), "OnDetaching")]
|
||||
static void PostfixDestroy(ModuleRemoteCharger __instance) {
|
||||
// Console.WriteLine("ModuleRemoteCharger.OnAttached");
|
||||
// Console.WriteLine("Restoring {0}; m_RefillRate: {1}; m_Capacity: {2}", __instance.name, __instance.m_RefillRate, __instance.m_Capacity);
|
||||
DoRestoreSingle(__instance);
|
||||
// Console.WriteLine("Restored {0}; m_RefillRate: {1}; m_Capacity: {2}", __instance.name, __instance.m_RefillRate, __instance.m_Capacity);
|
||||
radius.Remove(__instance);
|
||||
transferPerArc.Remove(__instance);
|
||||
arcFiringInterval.Remove(__instance);
|
||||
}
|
||||
|
||||
public static void DoPatch() {
|
||||
// Console.WriteLine("Modifying {0} ModuleRemoteCharger", radius.Count);
|
||||
foreach (KeyValuePair<ModuleRemoteCharger, float> keyValuePair in radius) {
|
||||
DoRestoreSingle(keyValuePair.Key);
|
||||
DoPatchSingle(keyValuePair.Key);
|
||||
}
|
||||
}
|
||||
|
||||
static void DoPatchSingle(ModuleRemoteCharger moduleRemoteCharger) {
|
||||
moduleRemoteCharger.m_ChargingRadius = radius[moduleRemoteCharger] * Main.wirelessChargingRadiusMultiplier.Value;
|
||||
moduleRemoteCharger.m_PowerTransferPerArc = radius[moduleRemoteCharger] * Main.wirelessChargingPowerPerArcMultiplier.Value;
|
||||
moduleRemoteCharger.m_ArcFiringInterval = radius[moduleRemoteCharger] * Main.wirelessChargingArcFiringIntervalMultiplier.Value;
|
||||
}
|
||||
|
||||
static void DoRestoreSingle(ModuleRemoteCharger moduleRemoteCharger) {
|
||||
if (radius.ContainsKey(moduleRemoteCharger)) {
|
||||
moduleRemoteCharger.m_ChargingRadius = radius[moduleRemoteCharger];
|
||||
moduleRemoteCharger.m_PowerTransferPerArc = radius[moduleRemoteCharger];
|
||||
moduleRemoteCharger.m_ArcFiringInterval = radius[moduleRemoteCharger];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -9,3 +9,4 @@ C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\obj\De
|
||||
C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\obj\Debug\TerraTech.dll
|
||||
C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\obj\Debug\TerraTech.pdb
|
||||
C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\bin\Debug\ConfigurationManager.dll
|
||||
C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\obj\Debug\TerraTech.csprojResolveAssemblyReference.cache
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user