mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2025-12-09 02:13:29 +08:00
CheatEnabler 2.3.16 and UXAssist 1.0.24
This commit is contained in:
@@ -44,6 +44,8 @@ public class CheatEnabler : BaseUnityPlugin
|
||||
"Boost fuel power");
|
||||
FactoryPatch.BoostGeothermalPowerEnabled = Config.Bind("Build", "BoostGeothermalPower", false,
|
||||
"Boost geothermal power");
|
||||
FactoryPatch.GreaterPowerUsageInLogisticsEnabled = Config.Bind("Build", "GreaterPowerUsageInLogistics", false,
|
||||
"Increase maximum power usage in Logistic Stations and Advanced Mining Machines");
|
||||
ResourcePatch.InfiniteResourceEnabled = Config.Bind("Planet", "AlwaysInfiniteResource", false,
|
||||
"always infinite natural resource");
|
||||
ResourcePatch.FastMiningEnabled = Config.Bind("Planet", "FastMining", false,
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<BepInExPluginGuid>org.soardev.cheatenabler</BepInExPluginGuid>
|
||||
<Description>DSP MOD - CheatEnabler</Description>
|
||||
<Version>2.3.15</Version>
|
||||
<Version>2.3.16</Version>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<PackageId>CheatEnabler</PackageId>
|
||||
|
||||
@@ -5,6 +5,7 @@ using BepInEx.Configuration;
|
||||
using CommonAPI.Systems;
|
||||
using HarmonyLib;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UXAssist.Common;
|
||||
|
||||
namespace CheatEnabler;
|
||||
@@ -25,6 +26,7 @@ public static class FactoryPatch
|
||||
public static ConfigEntry<bool> BoostSolarPowerEnabled;
|
||||
public static ConfigEntry<bool> BoostFuelPowerEnabled;
|
||||
public static ConfigEntry<bool> BoostGeothermalPowerEnabled;
|
||||
public static ConfigEntry<bool> GreaterPowerUsageInLogisticsEnabled;
|
||||
|
||||
private static Harmony _factoryPatch;
|
||||
private static PressKeyBind _noConditionKey;
|
||||
@@ -66,6 +68,7 @@ public static class FactoryPatch
|
||||
BoostSolarPowerEnabled.SettingChanged += (_, _) => BoostSolarPower.Enable(BoostSolarPowerEnabled.Value);
|
||||
BoostFuelPowerEnabled.SettingChanged += (_, _) => BoostFuelPower.Enable(BoostFuelPowerEnabled.Value);
|
||||
BoostGeothermalPowerEnabled.SettingChanged += (_, _) => BoostGeothermalPower.Enable(BoostGeothermalPowerEnabled.Value);
|
||||
GreaterPowerUsageInLogisticsEnabled.SettingChanged += (_, _) => GreaterPowerUsageInLogistics.Enable(GreaterPowerUsageInLogisticsEnabled.Value);
|
||||
ImmediateBuild.Enable(ImmediateEnabled.Value);
|
||||
ArchitectMode.Enable(ArchitectModeEnabled.Value);
|
||||
NoConditionBuild.Enable(NoConditionEnabled.Value);
|
||||
@@ -76,9 +79,26 @@ public static class FactoryPatch
|
||||
BoostSolarPower.Enable(BoostSolarPowerEnabled.Value);
|
||||
BoostFuelPower.Enable(BoostFuelPowerEnabled.Value);
|
||||
BoostGeothermalPower.Enable(BoostGeothermalPowerEnabled.Value);
|
||||
GreaterPowerUsageInLogistics.Enable(GreaterPowerUsageInLogisticsEnabled.Value);
|
||||
_factoryPatch = Harmony.CreateAndPatchAll(typeof(FactoryPatch));
|
||||
}
|
||||
|
||||
public static void Uninit()
|
||||
{
|
||||
_factoryPatch?.UnpatchSelf();
|
||||
_factoryPatch = null;
|
||||
ImmediateBuild.Enable(false);
|
||||
ArchitectMode.Enable(false);
|
||||
NoConditionBuild.Enable(false);
|
||||
BeltSignalGenerator.Enable(false);
|
||||
RemovePowerSpaceLimit.Enable(false);
|
||||
BoostWindPower.Enable(false);
|
||||
BoostSolarPower.Enable(false);
|
||||
BoostFuelPower.Enable(false);
|
||||
BoostGeothermalPower.Enable(false);
|
||||
GreaterPowerUsageInLogistics.Enable(false);
|
||||
}
|
||||
|
||||
public static void OnUpdate()
|
||||
{
|
||||
if (_noConditionKey.keyValue)
|
||||
@@ -99,21 +119,6 @@ public static class FactoryPatch
|
||||
}
|
||||
}
|
||||
|
||||
public static void Uninit()
|
||||
{
|
||||
_factoryPatch?.UnpatchSelf();
|
||||
_factoryPatch = null;
|
||||
ImmediateBuild.Enable(false);
|
||||
ArchitectMode.Enable(false);
|
||||
NoConditionBuild.Enable(false);
|
||||
BeltSignalGenerator.Enable(false);
|
||||
RemovePowerSpaceLimit.Enable(false);
|
||||
BoostWindPower.Enable(false);
|
||||
BoostSolarPower.Enable(false);
|
||||
BoostFuelPower.Enable(false);
|
||||
BoostGeothermalPower.Enable(false);
|
||||
}
|
||||
|
||||
private static void NoCollisionValueChanged()
|
||||
{
|
||||
var coll = ColliderPool.instance;
|
||||
@@ -1277,4 +1282,161 @@ public static class FactoryPatch
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
}
|
||||
|
||||
private static class GreaterPowerUsageInLogistics
|
||||
{
|
||||
private static Harmony _patch;
|
||||
|
||||
public static void Enable(bool enable)
|
||||
{
|
||||
if (enable)
|
||||
{
|
||||
_patch ??= Harmony.CreateAndPatchAll(typeof(GreaterPowerUsageInLogistics));
|
||||
return;
|
||||
}
|
||||
|
||||
_patch?.UnpatchSelf();
|
||||
_patch = null;
|
||||
}
|
||||
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(UIStationWindow), nameof(UIStationWindow._OnInit))]
|
||||
private static IEnumerable<CodeInstruction> UIStationWindow__OnInit_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||
{
|
||||
var matcher = new CodeMatcher(instructions, generator);
|
||||
matcher.Start().Insert(
|
||||
new CodeInstruction(OpCodes.Ldarg_0),
|
||||
Transpilers.EmitDelegate((UIStationWindow window) =>
|
||||
{
|
||||
window.maxMiningSpeedSlider.maxValue = 27f;
|
||||
})
|
||||
);
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(UIStationWindow), nameof(UIStationWindow.OnStationIdChange))]
|
||||
private static IEnumerable<CodeInstruction> UIStationWindow_OnStationIdChange_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||
{
|
||||
var matcher = new CodeMatcher(instructions, generator);
|
||||
matcher.MatchForward(false,
|
||||
new CodeMatch(OpCodes.Ldarg_0),
|
||||
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(UIStationWindow), nameof(UIStationWindow.maxChargePowerSlider))),
|
||||
new CodeMatch(ci => ci.IsLdloc()),
|
||||
new CodeMatch(ci => ci.opcode == OpCodes.Ldc_I4 && ci.OperandIs(0xC350)),
|
||||
new CodeMatch(OpCodes.Conv_I8)
|
||||
);
|
||||
var pos = matcher.Pos + 1;
|
||||
matcher.Advance(5).MatchForward(false,
|
||||
new CodeMatch(OpCodes.Conv_R4),
|
||||
new CodeMatch(OpCodes.Callvirt, AccessTools.PropertySetter(typeof(Slider), nameof(Slider.value)))
|
||||
);
|
||||
var pos2 = matcher.Pos + 2;
|
||||
matcher.Start().Advance(pos);
|
||||
var ldvar = matcher.InstructionAt(1).Clone();
|
||||
var locWorkEnergyPerTick = matcher.InstructionAt(-2).operand;
|
||||
matcher.RemoveInstructions(pos2 - pos).InsertAndAdvance(
|
||||
ldvar,
|
||||
new CodeInstruction(OpCodes.Ldloc_S, locWorkEnergyPerTick),
|
||||
Transpilers.EmitDelegate((UIStationWindow window, long maxWorkEnergy, long workEnergyPerTick) =>
|
||||
{
|
||||
var maxSliderValue = maxWorkEnergy / 50000L;
|
||||
window.maxChargePowerSlider.maxValue = maxSliderValue + 9;
|
||||
window.maxChargePowerSlider.minValue = maxWorkEnergy / 500000L;
|
||||
if (workEnergyPerTick <= maxWorkEnergy)
|
||||
window.maxChargePowerSlider.value = workEnergyPerTick / 50000L;
|
||||
else
|
||||
window.maxChargePowerSlider.value = maxSliderValue + (workEnergyPerTick - 1) / maxWorkEnergy + 1;
|
||||
})
|
||||
);
|
||||
|
||||
matcher.MatchForward(false,
|
||||
new CodeMatch(OpCodes.Ldarg_0),
|
||||
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(UIStationWindow), nameof(UIStationWindow.maxMiningSpeedSlider))),
|
||||
new CodeMatch(OpCodes.Ldarg_0),
|
||||
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(UIStationWindow), nameof(UIStationWindow.factorySystem))),
|
||||
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(FactorySystem), nameof(FactorySystem.minerPool))),
|
||||
new CodeMatch(ci => ci.IsLdloc()),
|
||||
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(StationComponent), nameof(StationComponent.minerId))),
|
||||
new CodeMatch(OpCodes.Ldelema, typeof(MinerComponent)),
|
||||
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(MinerComponent), nameof(MinerComponent.speed)))
|
||||
);
|
||||
pos = matcher.Pos + 9;
|
||||
matcher.Advance(5).MatchForward(false,
|
||||
new CodeMatch(OpCodes.Conv_R4),
|
||||
new CodeMatch(OpCodes.Callvirt, AccessTools.PropertySetter(typeof(Slider), nameof(Slider.value)))
|
||||
);
|
||||
pos2 = matcher.Pos;
|
||||
matcher.Start().Advance(pos).RemoveInstructions(pos2 - pos).Insert(
|
||||
Transpilers.EmitDelegate((int speed) =>
|
||||
{
|
||||
if (speed <= 30000)
|
||||
return (speed - 10000) / 1000;
|
||||
return (speed - 30000) / 10000 + 20;
|
||||
})
|
||||
);
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(UIStationWindow), nameof(UIStationWindow.OnMaxMiningSpeedChange))]
|
||||
private static IEnumerable<CodeInstruction> UIStationWindow_OnMaxMiningSpeedChange_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||
{
|
||||
var matcher = new CodeMatcher(instructions, generator);
|
||||
matcher.MatchForward(false,
|
||||
new CodeMatch(ci => ci.opcode == OpCodes.Ldc_I4 && ci.OperandIs(10000)),
|
||||
new CodeMatch(OpCodes.Ldarg_1)
|
||||
);
|
||||
var pos = matcher.Pos;
|
||||
matcher.MatchForward(false,
|
||||
new CodeMatch(OpCodes.Stloc_1)
|
||||
);
|
||||
var pos2 = matcher.Pos;
|
||||
matcher.Start().Advance(pos);
|
||||
var labels = matcher.Labels;
|
||||
matcher.RemoveInstructions(pos2 - pos);
|
||||
matcher.Insert(
|
||||
new CodeInstruction(OpCodes.Ldarg_1).WithLabels(labels),
|
||||
Transpilers.EmitDelegate((float value) =>
|
||||
{
|
||||
var intval = (int)(value + 0.5f);
|
||||
if (intval <= 20)
|
||||
return intval * 1000 + 10000;
|
||||
return (intval - 20) * 10000 + 30000;
|
||||
})
|
||||
);
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(UIStationWindow), nameof(UIStationWindow.OnMaxChargePowerSliderValueChange))]
|
||||
private static IEnumerable<CodeInstruction> UIStationWindow_OnMaxChargePowerSliderValueChange_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||
{
|
||||
var matcher = new CodeMatcher(instructions, generator);
|
||||
matcher.MatchForward(false,
|
||||
new CodeMatch(OpCodes.Ldarg_0),
|
||||
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(UIStationWindow), nameof(UIStationWindow.factory))),
|
||||
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(PlanetFactory), nameof(PlanetFactory.powerSystem))),
|
||||
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(PowerSystem), nameof(PowerSystem.consumerPool)))
|
||||
);
|
||||
var labels = matcher.Labels;
|
||||
matcher.Labels = null;
|
||||
matcher.Insert(
|
||||
new CodeInstruction(OpCodes.Ldarg_0).WithLabels(labels),
|
||||
new CodeInstruction(OpCodes.Ldarg_1),
|
||||
Transpilers.EmitDelegate((UIStationWindow window, float value) =>
|
||||
{
|
||||
float prevMax = window.workEnergyPrefab * 5L / 50000L;
|
||||
if (value <= prevMax)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
return prevMax * (value - prevMax + 1);
|
||||
}),
|
||||
new CodeInstruction(OpCodes.Starg_S, 1)
|
||||
);
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,9 @@
|
||||
+ Add 2 options to `Belt signal item generation`:
|
||||
- `Count generations as production in statistics`
|
||||
- `Count removals as consumption in statistics`
|
||||
+ New feature: `Increase maximum power usage in Logistic Stations and Advanced Mining Machines`
|
||||
- Logistic Stations: Increased max charging power to 3GW(ILS) and 600MW(PLS) (10x of original)
|
||||
- Advanced Mining Machines: Increased max mining speed to 1000%
|
||||
* 2.3.15
|
||||
+ New features:
|
||||
- `Instant teleport (like that in Sandbox mode)`
|
||||
@@ -38,7 +41,7 @@
|
||||
* 2.3.6
|
||||
+ Support for UXAssist's new function within `Finish build immediately`.
|
||||
+ Add a warning message when `Build without condition` is enabled.
|
||||
+ Fix a issue in `Finish build immediately` that some buildings are not finished immediately.
|
||||
+ Fix an issue in `Finish build immediately` that some buildings are not finished immediately.
|
||||
* 2.3.5
|
||||
+ Fix another crash in `Skip bullet period`.
|
||||
* 2.3.4
|
||||
@@ -121,6 +124,9 @@
|
||||
- Count removals as consumption in statistics
|
||||
- Count all raws and intermediates in statistics
|
||||
- Belt signal alt format
|
||||
+ Increase maximum power usage in Logistic Stations and Advanced Mining Machines
|
||||
- Logistic Stations: Increased max charging power to 3GW(ILS) and 600MW(PLS) (10x of original)
|
||||
- Advanced Mining Machines: Increased max mining speed to 1000%
|
||||
+ Remove space limit between wind turbines and solar panels
|
||||
+ Boost power generations for kinds of power generators
|
||||
+ Planet:
|
||||
@@ -153,6 +159,9 @@
|
||||
+ 为`传送带信号物品生成`添加了两个选项:
|
||||
- `统计信息里将生成计算为产物`
|
||||
- `统计信息里将移除计算为消耗`
|
||||
+ 新功能:`提升物流塔和大型采矿机的最大功耗`
|
||||
- 物流塔:将最大充电功率提高到3GW(星际物流塔)和600MW(行星物流塔)(原来的10倍)
|
||||
- 大型采矿机:将最大采矿速度提高到1000%
|
||||
* 2.3.15
|
||||
+ 新功能:
|
||||
- `快速传送(和沙盒模式一样)`
|
||||
@@ -266,6 +275,9 @@
|
||||
- 统计信息里将移除计算为消耗
|
||||
- 统计面板中计算所有原材料和中间产物
|
||||
- 传送带信号替换格式
|
||||
+ 提升物流塔和大型采矿机的最大功耗
|
||||
- 物流塔:将最大充电功率提高到3GW(星际物流塔)和600MW(行星物流塔)(原来的10倍)
|
||||
- 大型采矿机:将最大采矿速度提高到1000%
|
||||
+ 风力发电机和太阳能板无间距限制
|
||||
+ 提升各种发电设备发电量
|
||||
+ 行星:
|
||||
|
||||
@@ -45,6 +45,7 @@ public static class UIConfigWindow
|
||||
I18N.Add("Boost fuel power", "Boost fuel power(x50,000)", "提升燃料发电(x50,000)");
|
||||
I18N.Add("Boost fuel power 2", "(x20,000 for deuteron, x10,000 for antimatter)", "(氘核燃料棒x20,000,反物质燃料棒x10,000)");
|
||||
I18N.Add("Boost geothermal power", "Boost geothermal power(x50,000)", "提升地热发电(x50,000)");
|
||||
I18N.Add("Increase maximum power usage in Logistic Stations and Advanced Mining Machines", "Increase maximum power usage in Logistic Stations and Advanced Mining Machines", "提升物流塔和大型采矿机的最大功耗");
|
||||
I18N.Add("Infinite Natural Resources", "Infinite natural resources", "自然资源采集不消耗");
|
||||
I18N.Add("Fast Mining", "Fast mining", "高速采集");
|
||||
I18N.Add("Pump Anywhere", "Pump anywhere", "平地抽水");
|
||||
@@ -111,6 +112,8 @@ public static class UIConfigWindow
|
||||
x += 180f;
|
||||
y += 6f;
|
||||
var tip1 = MyWindow.AddTipsButton(x, y, tab2, "Belt signal alt format", "Belt signal alt format tips", "belt-signal-alt-format-tips");
|
||||
y += 30f;
|
||||
MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.GreaterPowerUsageInLogisticsEnabled, "Increase maximum power usage in Logistic Stations and Advanced Mining Machines");
|
||||
|
||||
FactoryPatch.BeltSignalGeneratorEnabled.SettingChanged += (_, _) =>
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "CheatEnabler",
|
||||
"version_number": "2.3.15",
|
||||
"version_number": "2.3.16",
|
||||
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/CheatEnabler",
|
||||
"description": "Add various cheat functions while disabling abnormal determinants / 添加一些作弊功能,同时屏蔽异常检测",
|
||||
"dependencies": [
|
||||
|
||||
@@ -7,9 +7,7 @@ using CommonAPI.Systems;
|
||||
using HarmonyLib;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
using UXAssist.Common;
|
||||
using OpCodes = System.Reflection.Emit.OpCodes;
|
||||
|
||||
namespace UXAssist;
|
||||
|
||||
@@ -29,7 +27,6 @@ public static class FactoryPatch
|
||||
public static ConfigEntry<bool> DoNotRenderEntitiesEnabled;
|
||||
public static ConfigEntry<bool> DragBuildPowerPolesEnabled;
|
||||
public static ConfigEntry<bool> AllowOverflowInLogisticsEnabled;
|
||||
public static ConfigEntry<bool> GreaterPowerUsageInLogisticsEnabled;
|
||||
private static PressKeyBind _doNotRenderEntitiesKey;
|
||||
|
||||
private static Harmony _factoryPatch;
|
||||
@@ -59,7 +56,7 @@ public static class FactoryPatch
|
||||
DoNotRenderEntitiesEnabled.SettingChanged += (_, _) => DoNotRenderEntities.Enable(DoNotRenderEntitiesEnabled.Value);
|
||||
DragBuildPowerPolesEnabled.SettingChanged += (_, _) => DragBuildPowerPoles.Enable(DragBuildPowerPolesEnabled.Value);
|
||||
AllowOverflowInLogisticsEnabled.SettingChanged += (_, _) => AllowOverflowInLogistics.Enable(AllowOverflowInLogisticsEnabled.Value);
|
||||
GreaterPowerUsageInLogisticsEnabled.SettingChanged += (_, _) => LogisticsCapacityTweaks.Enable(LogisticsCapacityTweaksEnabled.Value);
|
||||
LogisticsCapacityTweaksEnabled.SettingChanged += (_, _) => LogisticsCapacityTweaks.Enable(LogisticsCapacityTweaksEnabled.Value);
|
||||
UnlimitInteractive.Enable(UnlimitInteractiveEnabled.Value);
|
||||
RemoveSomeConditionBuild.Enable(RemoveSomeConditionEnabled.Value);
|
||||
NightLight.Enable(NightLightEnabled.Value);
|
||||
@@ -74,7 +71,7 @@ public static class FactoryPatch
|
||||
DoNotRenderEntities.Enable(DoNotRenderEntitiesEnabled.Value);
|
||||
DragBuildPowerPoles.Enable(DragBuildPowerPolesEnabled.Value);
|
||||
AllowOverflowInLogistics.Enable(AllowOverflowInLogisticsEnabled.Value);
|
||||
GreaterPowerUsageInLogistics.Enable(GreaterPowerUsageInLogisticsEnabled.Value);
|
||||
LogisticsCapacityTweaks.Enable(LogisticsCapacityTweaksEnabled.Value);
|
||||
|
||||
_factoryPatch ??= Harmony.CreateAndPatchAll(typeof(FactoryPatch));
|
||||
}
|
||||
@@ -95,7 +92,7 @@ public static class FactoryPatch
|
||||
DoNotRenderEntities.Enable(false);
|
||||
DragBuildPowerPoles.Enable(false);
|
||||
AllowOverflowInLogistics.Enable(false);
|
||||
GreaterPowerUsageInLogistics.Enable(false);
|
||||
LogisticsCapacityTweaks.Enable(false);
|
||||
|
||||
_factoryPatch?.UnpatchSelf();
|
||||
_factoryPatch = null;
|
||||
@@ -1828,91 +1825,4 @@ public static class FactoryPatch
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
}
|
||||
|
||||
private static class GreaterPowerUsageInLogistics
|
||||
{
|
||||
private static Harmony _patch;
|
||||
|
||||
public static void Enable(bool enable)
|
||||
{
|
||||
if (enable)
|
||||
{
|
||||
_patch ??= Harmony.CreateAndPatchAll(typeof(GreaterPowerUsageInLogistics));
|
||||
return;
|
||||
}
|
||||
|
||||
_patch?.UnpatchSelf();
|
||||
_patch = null;
|
||||
}
|
||||
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(UIStationWindow), nameof(UIStationWindow.OnStationIdChange))]
|
||||
private static IEnumerable<CodeInstruction> UIStationWindow_OnStationIdChange_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||
{
|
||||
var matcher = new CodeMatcher(instructions, generator);
|
||||
matcher.MatchForward(false,
|
||||
new CodeMatch(OpCodes.Ldarg_0),
|
||||
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(UIStationWindow), nameof(UIStationWindow.maxChargePowerSlider))),
|
||||
new CodeMatch(ci => ci.IsLdloc()),
|
||||
new CodeMatch(ci => ci.opcode == OpCodes.Ldc_I4 && ci.OperandIs(0xC350)),
|
||||
new CodeMatch(OpCodes.Conv_I8)
|
||||
);
|
||||
var pos = matcher.Pos + 1;
|
||||
matcher.Advance(5).MatchForward(false,
|
||||
new CodeMatch(OpCodes.Conv_R4),
|
||||
new CodeMatch(OpCodes.Callvirt, AccessTools.PropertySetter(typeof(Slider), nameof(Slider.value)))
|
||||
);
|
||||
var pos2 = matcher.Pos + 2;
|
||||
matcher.Start().Advance(pos);
|
||||
var ldvar = matcher.InstructionAt(1).Clone();
|
||||
var locWorkEnergyPerTick = matcher.InstructionAt(-2).operand;
|
||||
matcher.RemoveInstructions(pos2 - pos).Insert(
|
||||
ldvar,
|
||||
new CodeInstruction(OpCodes.Ldloc_S, locWorkEnergyPerTick),
|
||||
Transpilers.EmitDelegate((UIStationWindow window, long maxWorkEnergy, long workEnergyPerTick) =>
|
||||
{
|
||||
var maxSliderValue = maxWorkEnergy / 50000L;
|
||||
window.maxChargePowerSlider.maxValue = maxSliderValue + 9;
|
||||
window.maxChargePowerSlider.minValue = maxWorkEnergy / 500000L;
|
||||
if (workEnergyPerTick <= maxWorkEnergy)
|
||||
window.maxChargePowerSlider.value = workEnergyPerTick / 50000L;
|
||||
else
|
||||
{
|
||||
window.maxChargePowerSlider.value = (workEnergyPerTick - 1) / maxWorkEnergy + 1;
|
||||
}
|
||||
})
|
||||
);
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(UIStationWindow), nameof(UIStationWindow.OnMaxChargePowerSliderValueChange))]
|
||||
private static IEnumerable<CodeInstruction> UIStationWindow_OnMaxChargePowerSliderValueChange_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||
{
|
||||
var matcher = new CodeMatcher(instructions, generator);
|
||||
matcher.MatchForward(false,
|
||||
new CodeMatch(OpCodes.Ldarg_0),
|
||||
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(UIStationWindow), nameof(UIStationWindow.factory))),
|
||||
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(PlanetFactory), nameof(PlanetFactory.powerSystem))),
|
||||
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(PowerSystem), nameof(PowerSystem.consumerPool)))
|
||||
);
|
||||
var labels = matcher.Labels;
|
||||
matcher.Labels = null;
|
||||
matcher.Insert(
|
||||
new CodeInstruction(OpCodes.Ldarg_0).WithLabels(labels),
|
||||
new CodeInstruction(OpCodes.Ldarg_1),
|
||||
Transpilers.EmitDelegate((UIStationWindow window, float value) =>
|
||||
{
|
||||
float prevMax = window.workEnergyPrefab * 5L / 50000L;
|
||||
if (value <= prevMax)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
return prevMax * (value - prevMax + 1);
|
||||
}),
|
||||
new CodeInstruction(OpCodes.Starg_S, 1)
|
||||
);
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
}
|
||||
@@ -13,9 +13,6 @@
|
||||
- Allow overflow when trying to insert in-hand items
|
||||
- Allow `Enhanced control for logistic storage limits` to exceed tech capacity limits
|
||||
- Remove logistic strorage limit check on loading game
|
||||
+ New feature: `Increase maximum power usage in Logistic Stations and Advanced Mining Machines`
|
||||
- Logistic Stations: Increased max charging power to 3GW(ILS) and 600MW(PLS) (10x of original)
|
||||
- Advanced Mining Machines: Increased max mining speed to 1000%
|
||||
* 1.0.23
|
||||
+ New features:
|
||||
- `Do not render factory entities (except belts and sorters)`
|
||||
@@ -30,7 +27,7 @@
|
||||
+ Fix a bug that stepped rotation is not working in `Off-grid building and stepped rotation`, which is caused by latest game update
|
||||
+ Fix some issues in `Auto nativation` and `Auto-cruise`, now only boosts when core energy at least 10% and warps when core energy at least 50%
|
||||
* 1.0.20
|
||||
+ Fix a infinite-loop issue when `Quick build and dismantle stacking labs` and `No condition build` are both enabled
|
||||
+ Fix an infinite-loop issue when `Quick build and dismantle stacking labs` and `No condition build` are both enabled
|
||||
+ Fix a crash caused by `Re-initialize planet` in combat mode
|
||||
* 1.0.19
|
||||
+ New functions:
|
||||
@@ -145,13 +142,11 @@
|
||||
- Close this function to resume mining and pumping, usually when you have enough level on `Veins Utilization`
|
||||
- Do not render factory entities (except belts and sorters)
|
||||
- This also makes players click though factory entities but belts and sorters
|
||||
- Drag building power poles in maximum connection range
|
||||
- Allow overflow for Logistic Stations and Advanced Mining Machines
|
||||
- Allow overflow when trying to insert in-hand items
|
||||
- Allow `Enhanced control for logistic storage limits` to exceed tech capacity limits
|
||||
- Remove logistic strorage limit check on loading game
|
||||
- Increase maximum power usage in Logistic Stations and Advanced Mining Machines
|
||||
- Logistic Stations: Increased max charging power to 3GW(ILS) and 600MW(PLS) (10x of original)
|
||||
- Advanced Mining Machines: Increased max mining speed to 1000%
|
||||
- Re-intialize planet (without reseting veins)
|
||||
- Quick dismantle all buildings (without drops)
|
||||
- Quick build Orbital Collectors
|
||||
@@ -192,13 +187,11 @@
|
||||
+ `不渲染工厂建筑实体(除了传送带和分拣器)`的改动
|
||||
- 在配置面板中添加了一个快捷键来切换此功能
|
||||
- 现在也可以点击到分拣器了
|
||||
+ 新功能:`拖动建造电线杆时自动使用最大连接距离间隔`
|
||||
+ 新功能:`允许物流塔和大型采矿机物品溢出`
|
||||
- 当尝试塞入手中物品时允许溢出
|
||||
- 允许`物流塔存储数量限制控制改进`超过科技容量限制
|
||||
- 在加载游戏时移除物流塔容量限制检查
|
||||
+ 新功能:`提升物流塔和大型采矿机的最大功耗`
|
||||
- 物流塔:将最大充电功率提高到3GW(星际物流塔)和600MW(行星物流塔)(原来的10倍)
|
||||
- 大型采矿机:将最大采矿速度提高到1000%
|
||||
* 1.0.23
|
||||
+ 新功能:
|
||||
- `不渲染工厂建筑实体(除了传送带和分拣器)`
|
||||
@@ -329,13 +322,11 @@
|
||||
- 关闭此功能以恢复开采,一般是当你在`矿物利用`上有足够的等级时。
|
||||
- 不渲染工厂建筑实体(除了传送带和分拣器)
|
||||
- 这也使玩家可以点穿工厂实体直接点到传送带和分拣器
|
||||
- 拖动建造电线杆时自动使用最大连接距离间隔
|
||||
- 允许物流塔和大型采矿机物品溢出
|
||||
- 当尝试塞入手中物品时允许溢出
|
||||
- 允许`物流塔存储数量限制控制改进`超过科技容量限制
|
||||
- 在加载游戏时移除物流塔容量限制检查
|
||||
- 提升物流塔和大型采矿机的最大功耗
|
||||
- 物流塔:将最大充电功率提高到3GW(星际物流塔)和600MW(行星物流塔)(原来的10倍)
|
||||
- 大型采矿机:将最大采矿速度提高到1000%
|
||||
- 初始化本行星(不重置矿脉)
|
||||
- 快速拆除所有建筑(不掉落)
|
||||
- 快速建造轨道采集器
|
||||
|
||||
@@ -45,7 +45,6 @@ public static class UIConfigWindow
|
||||
I18N.Add("Do not render factory entities", "Do not render factory entities (except belts and sorters)", "不渲染工厂建筑实体(除了传送带和分拣器)");
|
||||
I18N.Add("Drag building power poles in maximum connection range", "Drag building power poles in maximum connection range", "拖动建造电线杆时自动使用最大连接距离间隔");
|
||||
I18N.Add("Allow overflow for Logistic Stations and Advanced Mining Machines", "Allow overflow for Logistic Stations and Advanced Mining Machines", "允许物流站和大型采矿机物品溢出");
|
||||
I18N.Add("Increase maximum power usage in Logistic Stations and Advanced Mining Machines", "Increase maximum power usage in Logistic Stations and Advanced Mining Machines", "提升物流塔和大型采矿机的最大功耗");
|
||||
I18N.Add("Auto navigation on sailings", "Auto navigation on sailings", "宇宙航行时自动导航");
|
||||
I18N.Add("Enable auto-cruise", "Enable auto-cruise", "启用自动巡航");
|
||||
I18N.Add("Auto boost", "Auto boost", "自动加速");
|
||||
@@ -126,8 +125,6 @@ public static class UIConfigWindow
|
||||
y += 36f;
|
||||
MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.AllowOverflowInLogisticsEnabled, "Allow overflow for Logistic Stations and Advanced Mining Machines");
|
||||
y += 36f;
|
||||
MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.GreaterPowerUsageInLogisticsEnabled, "Increase maximum power usage in Logistic Stations and Advanced Mining Machines");
|
||||
y += 36f;
|
||||
MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.DoNotRenderEntitiesEnabled, "Do not render factory entities");
|
||||
x = 400f;
|
||||
y = 10f;
|
||||
|
||||
@@ -80,8 +80,6 @@ public class UXAssist : BaseUnityPlugin
|
||||
"Drag building power poles in maximum connection range");
|
||||
FactoryPatch.AllowOverflowInLogisticsEnabled = Config.Bind("Factory", "AllowOverflowInLogistics", false,
|
||||
"Allow overflow in logistic stations");
|
||||
FactoryPatch.GreaterPowerUsageInLogisticsEnabled = Config.Bind("Factory", "GreaterPowerUsageInLogistics", false,
|
||||
"Increase maximum power usage in Logistic Stations and Advanced Mining Machines");
|
||||
PlanetFunctions.OrbitalCollectorMaxBuildCount = Config.Bind("Factory", "OCMaxBuildCount", 0, "Maximum Orbital Collectors to build once, set to 0 to build as many as possible");
|
||||
PlayerPatch.EnhancedMechaForgeCountControlEnabled = Config.Bind("Player", "EnhancedMechaForgeCountControl", false,
|
||||
"Enhanced count control for hand-make, increases maximum of count to 1000, and you can hold Ctrl/Shift/Alt to change the count rapidly");
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<BepInExPluginGuid>org.soardev.uxassist</BepInExPluginGuid>
|
||||
<Description>DSP MOD - UXAssist</Description>
|
||||
<Version>1.0.23</Version>
|
||||
<Version>1.0.24</Version>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<PackageId>UXAssist</PackageId>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "UXAssist",
|
||||
"version_number": "1.0.23",
|
||||
"version_number": "1.0.24",
|
||||
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/UXAssist",
|
||||
"description": "Some functions and patches for better user experience / 一些提升用户体验的功能和补丁",
|
||||
"dependencies": [
|
||||
|
||||
Reference in New Issue
Block a user