1
0
mirror of https://github.com/soarqin/DSP_Mods.git synced 2025-12-08 22:13:30 +08:00

CheatEnabler 2.3.16 and UXAssist 1.0.24

This commit is contained in:
2024-05-24 17:18:34 +08:00
parent 3db7fa5194
commit b1f27a2633
12 changed files with 206 additions and 131 deletions

View File

@@ -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();
}
}

View File

@@ -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%
- 初始化本行星(不重置矿脉)
- 快速拆除所有建筑(不掉落)
- 快速建造轨道采集器

View File

@@ -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;

View File

@@ -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");

View File

@@ -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>

View File

@@ -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": [