1
0
mirror of https://github.com/soarqin/DSP_Mods.git synced 2025-12-09 06:13:36 +08:00
This commit is contained in:
2024-05-22 20:07:21 +08:00
parent 1ebcb49536
commit c8a0651ae2
8 changed files with 200 additions and 50 deletions

View File

@@ -28,6 +28,10 @@ public class CheatEnabler : BaseUnityPlugin
"Belt signal generator"); "Belt signal generator");
FactoryPatch.BeltSignalNumberAltFormat = Config.Bind("Build", "BeltSignalNumberFormat", false, FactoryPatch.BeltSignalNumberAltFormat = Config.Bind("Build", "BeltSignalNumberFormat", false,
"Belt signal number format alternative format (AAAA=generation speed in minutes, B=proliferate points, C=stack count):\n AAAABC by default\n BCAAAA as alternative"); "Belt signal number format alternative format (AAAA=generation speed in minutes, B=proliferate points, C=stack count):\n AAAABC by default\n BCAAAA as alternative");
FactoryPatch.BeltSignalCountGenEnabled = Config.Bind("Build", "BeltSignalCountGenerations", true,
"Belt signal count generations as production in statistics");
FactoryPatch.BeltSignalCountRemEnabled = Config.Bind("Build", "BeltSignalCountRemovals", true,
"Belt signal count removals as comsumption in statistics");
FactoryPatch.BeltSignalCountRecipeEnabled = Config.Bind("Build", "BeltSignalCountRecipe", false, FactoryPatch.BeltSignalCountRecipeEnabled = Config.Bind("Build", "BeltSignalCountRecipe", false,
"Belt signal count all raws and intermediates in statistics"); "Belt signal count all raws and intermediates in statistics");
FactoryPatch.RemovePowerSpaceLimitEnabled = Config.Bind("Build", "RemovePowerDistanceLimit", false, FactoryPatch.RemovePowerSpaceLimitEnabled = Config.Bind("Build", "RemovePowerDistanceLimit", false,

View File

@@ -17,6 +17,8 @@ public static class FactoryPatch
public static ConfigEntry<bool> NoCollisionEnabled; public static ConfigEntry<bool> NoCollisionEnabled;
public static ConfigEntry<bool> BeltSignalGeneratorEnabled; public static ConfigEntry<bool> BeltSignalGeneratorEnabled;
public static ConfigEntry<bool> BeltSignalNumberAltFormat; public static ConfigEntry<bool> BeltSignalNumberAltFormat;
public static ConfigEntry<bool> BeltSignalCountGenEnabled;
public static ConfigEntry<bool> BeltSignalCountRemEnabled;
public static ConfigEntry<bool> BeltSignalCountRecipeEnabled; public static ConfigEntry<bool> BeltSignalCountRecipeEnabled;
public static ConfigEntry<bool> RemovePowerSpaceLimitEnabled; public static ConfigEntry<bool> RemovePowerSpaceLimitEnabled;
public static ConfigEntry<bool> BoostWindPowerEnabled; public static ConfigEntry<bool> BoostWindPowerEnabled;
@@ -837,7 +839,7 @@ public static class FactoryPatch
int itemId; int itemId;
if ((itemId = cargoPath.TryPickItem(belt.segIndex + belt.segPivotOffset - 5, 12, out var stack, out _)) > 0) if ((itemId = cargoPath.TryPickItem(belt.segIndex + belt.segPivotOffset - 5, 12, out var stack, out _)) > 0)
{ {
consumeRegister[itemId] += stack; if (BeltSignalCountRemEnabled.Value) consumeRegister[itemId] += stack;
} }
continue; continue;
@@ -894,7 +896,7 @@ public static class FactoryPatch
var inc = beltSignal.Inc; var inc = beltSignal.Inc;
if (!cargoPath.TryInsertItem(belt.segIndex + belt.segPivotOffset, signalId, stack, inc)) continue; if (!cargoPath.TryInsertItem(belt.segIndex + belt.segPivotOffset, signalId, stack, inc)) continue;
if (hasSpeedLimit) beltSignal.Progress -= 3600; if (hasSpeedLimit) beltSignal.Progress -= 3600;
productRegister[signalId] += stack; if (BeltSignalCountGenEnabled.Value) productRegister[signalId] += stack;
if (!countRecipe) continue; if (!countRecipe) continue;
var sources = beltSignal.Sources; var sources = beltSignal.Sources;
if (sources == null) continue; if (sources == null) continue;
@@ -1275,5 +1277,4 @@ public static class FactoryPatch
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
} }
} }

View File

@@ -4,6 +4,10 @@
#### 添加一些作弊功能,同时屏蔽异常检测 #### 添加一些作弊功能,同时屏蔽异常检测
## Changlog ## Changlog
* 2.3.16
+ Add 2 options to `Belt signal item generation`:
- `Count generations as production in statistics`
- `Count removals as consumption in statistics`
* 2.3.15 * 2.3.15
+ New features: + New features:
- `Instant teleport (like that in Sandbox mode)` - `Instant teleport (like that in Sandbox mode)`
@@ -15,10 +19,10 @@
* 2.3.13 * 2.3.13
+ Fix a bug that shortcuts are not working and have display issue on settings window. + Fix a bug that shortcuts are not working and have display issue on settings window.
* 2.3.12 * 2.3.12
+ Add a shortcut to toggle `No collision`(Alt+W by default), you can modify the shortcut on system settings window. + Add a shortcut to toggle `No collision`, you can modify the shortcut on system settings window.
+ Add realtime tips when toggling `No condition build` and `No collision` with shortcuts. + Add realtime tips when toggling `No condition build` and `No collision` with shortcuts.
* 2.3.11 * 2.3.11
+ Add a shortcut to toggle `No condition build`(Alt+Q by default), you can modify the shortcut on system settings window. This depends on [UXAssist](https://dsp.thunderstore.io/package/soarqin/UXAssist) 1.0.15 or later. + Add a shortcut to toggle `No condition build`, you can modify the shortcut on system settings window. This depends on [UXAssist](https://dsp.thunderstore.io/package/soarqin/UXAssist) 1.0.15 or later.
* 2.3.10 * 2.3.10
+ Fix following functions not working in new game updates: + Fix following functions not working in new game updates:
- `Pump Anywhere` - `Pump Anywhere`
@@ -113,6 +117,8 @@
+ Build without condition + Build without condition
+ No collision + No collision
+ Belt signal item generation + Belt signal item generation
- Count generations as production in statistics
- Count removals as consumption in statistics
- Count all raws and intermediates in statistics - Count all raws and intermediates in statistics
- Belt signal alt format - Belt signal alt format
+ Remove space limit between wind turbines and solar panels + Remove space limit between wind turbines and solar panels
@@ -143,6 +149,10 @@
* [Multifunction_mod](https://github.com/blacksnipebiu/Multifunction_mod): Some cheat functions * [Multifunction_mod](https://github.com/blacksnipebiu/Multifunction_mod): Some cheat functions
## 更新日志 ## 更新日志
* 2.3.16
+ 为`传送带信号物品生成`添加了两个选项:
- `统计信息里将生成计算为产物`
- `统计信息里将移除计算为消耗`
* 2.3.15 * 2.3.15
+ 新功能: + 新功能:
- `快速传送(和沙盒模式一样)` - `快速传送(和沙盒模式一样)`
@@ -252,6 +262,8 @@
+ 无条件建造 + 无条件建造
+ 无碰撞 + 无碰撞
+ 传送带信号物品生成 + 传送带信号物品生成
- 统计信息里将生成计算为产物
- 统计信息里将移除计算为消耗
- 统计面板中计算所有原材料和中间产物 - 统计面板中计算所有原材料和中间产物
- 传送带信号替换格式 - 传送带信号替换格式
+ 风力发电机和太阳能板无间距限制 + 风力发电机和太阳能板无间距限制

View File

@@ -36,6 +36,8 @@ public static class UIConfigWindow
I18N.Add("Belt signal alt format tips", I18N.Add("Belt signal alt format tips",
"Belt signal number format alternative format:\n AAAABC by default\n BCAAAA as alternative\nAAAA=generation speed in minutes, B=proliferate points, C=stack count", "Belt signal number format alternative format:\n AAAABC by default\n BCAAAA as alternative\nAAAA=generation speed in minutes, B=proliferate points, C=stack count",
"传送带信号物品生成数量格式:\n 默认为AAAABC\n 勾选替换为BCAAAA\nAAAA=生成速度B=增产点数C=堆叠数量"); "传送带信号物品生成数量格式:\n 默认为AAAABC\n 勾选替换为BCAAAA\nAAAA=生成速度B=增产点数C=堆叠数量");
I18N.Add("Count generations as production in statistics", "Count generations as production in statistics", "统计信息里将生成计算为产物");
I18N.Add("Count removals as consumption in statistics", "Count removals as consumption in statistics", "统计信息里将移除计算为消耗");
I18N.Add("Count all raws and intermediates in statistics","Count all raw materials in statistics", "统计信息里计算所有原料和中间产物"); I18N.Add("Count all raws and intermediates in statistics","Count all raw materials in statistics", "统计信息里计算所有原料和中间产物");
I18N.Add("Remove power space limit", "Remove space limit for winds and geothermals", "移除风力发电和地热发电的间距限制"); I18N.Add("Remove power space limit", "Remove space limit for winds and geothermals", "移除风力发电和地热发电的间距限制");
I18N.Add("Boost wind power", "Boost wind power(x100,000)", "提升风力发电(x100,000)"); I18N.Add("Boost wind power", "Boost wind power(x100,000)", "提升风力发电(x100,000)");
@@ -97,11 +99,15 @@ public static class UIConfigWindow
MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.NoCollisionEnabled, "No collision"); MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.NoCollisionEnabled, "No collision");
y += 36f; y += 36f;
MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.BeltSignalGeneratorEnabled, "Belt signal generator"); MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.BeltSignalGeneratorEnabled, "Belt signal generator");
y += 26f;
x += 26f; x += 26f;
var cb = MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.BeltSignalCountRecipeEnabled, "Count all raws and intermediates in statistics", 13);
y += 26f; y += 26f;
var cb2 = MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.BeltSignalNumberAltFormat, "Belt signal alt format", 13); var cb1 = MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.BeltSignalCountGenEnabled, "Count generations as production in statistics", 13);
y += 26f;
var cb2 = MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.BeltSignalCountRemEnabled, "Count removals as consumption in statistics", 13);
y += 26f;
var cb3 = MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.BeltSignalCountRecipeEnabled, "Count all raws and intermediates in statistics", 13);
y += 26f;
var cb4 = MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.BeltSignalNumberAltFormat, "Belt signal alt format", 13);
x += 180f; x += 180f;
y += 6f; y += 6f;
var tip1 = MyWindow.AddTipsButton(x, y, tab2, "Belt signal alt format", "Belt signal alt format tips", "belt-signal-alt-format-tips"); var tip1 = MyWindow.AddTipsButton(x, y, tab2, "Belt signal alt format", "Belt signal alt format tips", "belt-signal-alt-format-tips");
@@ -188,8 +194,10 @@ public static class UIConfigWindow
void OnBeltSignalChanged() void OnBeltSignalChanged()
{ {
var on = FactoryPatch.BeltSignalGeneratorEnabled.Value; var on = FactoryPatch.BeltSignalGeneratorEnabled.Value;
cb.gameObject.SetActive(on); cb1.gameObject.SetActive(on);
cb2.gameObject.SetActive(on); cb2.gameObject.SetActive(on);
cb3.gameObject.SetActive(on);
cb4.gameObject.SetActive(on);
tip1.gameObject.SetActive(on); tip1.gameObject.SetActive(on);
} }
} }

View File

@@ -3,9 +3,11 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection.Emit; using System.Reflection.Emit;
using BepInEx.Configuration; using BepInEx.Configuration;
using CommonAPI.Systems;
using HarmonyLib; using HarmonyLib;
using UnityEngine; using UnityEngine;
using UnityEngine.EventSystems; using UnityEngine.EventSystems;
using UXAssist.Common;
namespace UXAssist; namespace UXAssist;
@@ -23,11 +25,23 @@ public static class FactoryPatch
public static ConfigEntry<bool> QuickBuildAndDismantleLabsEnabled; public static ConfigEntry<bool> QuickBuildAndDismantleLabsEnabled;
public static ConfigEntry<bool> ProtectVeinsFromExhaustionEnabled; public static ConfigEntry<bool> ProtectVeinsFromExhaustionEnabled;
public static ConfigEntry<bool> DoNotRenderEntitiesEnabled; public static ConfigEntry<bool> DoNotRenderEntitiesEnabled;
public static ConfigEntry<bool> DragBuildPowerPolesEnabled;
public static ConfigEntry<bool> AllowOverflowInLogisticsEnabled;
private static PressKeyBind _doNotRenderEntitiesKey;
private static Harmony _factoryPatch; private static Harmony _factoryPatch;
public static void Init() public static void Init()
{ {
_doNotRenderEntitiesKey = KeyBindings.RegisterKeyBinding(new BuiltinKey
{
key = new CombineKey(0, 0, ECombineKeyAction.OnceClick, true),
conflictGroup = KeyBindConflict.MOVEMENT | KeyBindConflict.FLYING | KeyBindConflict.SAILING | KeyBindConflict.BUILD_MODE_1 | KeyBindConflict.KEYBOARD_KEYBIND,
name = "ToggleDoNotRenderEntities",
canOverride = true
}
);
I18N.Add("KEYToggleDoNotRenderEntities", "Toggle Do Not Render Factory Entities", "切换不渲染工厂建筑实体");
UnlimitInteractiveEnabled.SettingChanged += (_, _) => UnlimitInteractive.Enable(UnlimitInteractiveEnabled.Value); UnlimitInteractiveEnabled.SettingChanged += (_, _) => UnlimitInteractive.Enable(UnlimitInteractiveEnabled.Value);
RemoveSomeConditionEnabled.SettingChanged += (_, _) => RemoveSomeConditionBuild.Enable(RemoveSomeConditionEnabled.Value); RemoveSomeConditionEnabled.SettingChanged += (_, _) => RemoveSomeConditionBuild.Enable(RemoveSomeConditionEnabled.Value);
NightLightEnabled.SettingChanged += (_, _) => NightLight.Enable(NightLightEnabled.Value); NightLightEnabled.SettingChanged += (_, _) => NightLight.Enable(NightLightEnabled.Value);
@@ -40,6 +54,8 @@ public static class FactoryPatch
QuickBuildAndDismantleLabsEnabled.SettingChanged += (_, _) => QuickBuildAndDismantleLab.Enable(QuickBuildAndDismantleLabsEnabled.Value); QuickBuildAndDismantleLabsEnabled.SettingChanged += (_, _) => QuickBuildAndDismantleLab.Enable(QuickBuildAndDismantleLabsEnabled.Value);
ProtectVeinsFromExhaustionEnabled.SettingChanged += (_, _) => ProtectVeinsFromExhaustion.Enable(ProtectVeinsFromExhaustionEnabled.Value); ProtectVeinsFromExhaustionEnabled.SettingChanged += (_, _) => ProtectVeinsFromExhaustion.Enable(ProtectVeinsFromExhaustionEnabled.Value);
DoNotRenderEntitiesEnabled.SettingChanged += (_, _) => DoNotRenderEntities.Enable(DoNotRenderEntitiesEnabled.Value); DoNotRenderEntitiesEnabled.SettingChanged += (_, _) => DoNotRenderEntities.Enable(DoNotRenderEntitiesEnabled.Value);
DragBuildPowerPolesEnabled.SettingChanged += (_, _) => DragBuildPowerPoles.Enable(DragBuildPowerPolesEnabled.Value);
AllowOverflowInLogisticsEnabled.SettingChanged += (_, _) => AllowOverflowInLogistics.Enable(AllowOverflowInLogisticsEnabled.Value);
UnlimitInteractive.Enable(UnlimitInteractiveEnabled.Value); UnlimitInteractive.Enable(UnlimitInteractiveEnabled.Value);
RemoveSomeConditionBuild.Enable(RemoveSomeConditionEnabled.Value); RemoveSomeConditionBuild.Enable(RemoveSomeConditionEnabled.Value);
NightLight.Enable(NightLightEnabled.Value); NightLight.Enable(NightLightEnabled.Value);
@@ -52,7 +68,8 @@ public static class FactoryPatch
QuickBuildAndDismantleLab.Enable(QuickBuildAndDismantleLabsEnabled.Value); QuickBuildAndDismantleLab.Enable(QuickBuildAndDismantleLabsEnabled.Value);
ProtectVeinsFromExhaustion.Enable(ProtectVeinsFromExhaustionEnabled.Value); ProtectVeinsFromExhaustion.Enable(ProtectVeinsFromExhaustionEnabled.Value);
DoNotRenderEntities.Enable(DoNotRenderEntitiesEnabled.Value); DoNotRenderEntities.Enable(DoNotRenderEntitiesEnabled.Value);
DragBuildPowerPoles.Enable(true); DragBuildPowerPoles.Enable(DragBuildPowerPolesEnabled.Value);
AllowOverflowInLogistics.Enable(AllowOverflowInLogisticsEnabled.Value);
_factoryPatch ??= Harmony.CreateAndPatchAll(typeof(FactoryPatch)); _factoryPatch ??= Harmony.CreateAndPatchAll(typeof(FactoryPatch));
} }
@@ -72,11 +89,18 @@ public static class FactoryPatch
ProtectVeinsFromExhaustion.Enable(false); ProtectVeinsFromExhaustion.Enable(false);
DoNotRenderEntities.Enable(false); DoNotRenderEntities.Enable(false);
DragBuildPowerPoles.Enable(false); DragBuildPowerPoles.Enable(false);
AllowOverflowInLogistics.Enable(false);
_factoryPatch?.UnpatchSelf(); _factoryPatch?.UnpatchSelf();
_factoryPatch = null; _factoryPatch = null;
} }
public static void OnUpdate()
{
if (_doNotRenderEntitiesKey.keyValue)
DoNotRenderEntitiesEnabled.Value = !DoNotRenderEntitiesEnabled.Value;
}
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(ConnGizmoGraph), MethodType.Constructor)] [HarmonyPatch(typeof(ConnGizmoGraph), MethodType.Constructor)]
private static IEnumerable<CodeInstruction> ConnGizmoGraph_Constructor_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> ConnGizmoGraph_Constructor_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -871,19 +895,39 @@ public static class FactoryPatch
int delta; int delta;
if (UpdateKeyPressed(KeyCode.LeftArrow)) if (UpdateKeyPressed(KeyCode.LeftArrow))
{ {
delta = -10; if (VFInput.control)
delta = -100000;
else if (VFInput.alt)
delta = -1000;
else
delta = -10;
} }
else if (UpdateKeyPressed(KeyCode.RightArrow)) else if (UpdateKeyPressed(KeyCode.RightArrow))
{ {
delta = 10; if (VFInput.control)
delta = 100000;
else if (VFInput.alt)
delta = 1000;
else
delta = 10;
} }
else if (UpdateKeyPressed(KeyCode.DownArrow)) else if (UpdateKeyPressed(KeyCode.DownArrow))
{ {
delta = -100; if (VFInput.control)
delta = -1000000;
else if (VFInput.alt)
delta = -10000;
else
delta = -100;
} }
else if (UpdateKeyPressed(KeyCode.UpArrow)) else if (UpdateKeyPressed(KeyCode.UpArrow))
{ {
delta = 100; if (VFInput.control)
delta = 1000000;
else if (VFInput.alt)
delta = 10000;
else
delta = 100;
} }
else else
{ {
@@ -906,20 +950,26 @@ public static class FactoryPatch
} }
else else
{ {
var modelProto = LDB.models.Select(stationStorage.stationWindow.factory.entityPool[station.entityId].modelIndex); int itemCountMax;
var itemCountMax = 0; if (AllowOverflowInLogisticsEnabled.Value)
if (modelProto != null)
{ {
itemCountMax = modelProto.prefabDesc.stationMaxItemCount; itemCountMax = 1000000000;
}
else
{
var modelProto = LDB.models.Select(stationStorage.stationWindow.factory.entityPool[station.entityId].modelIndex);
itemCountMax = 0;
if (modelProto != null)
{
itemCountMax = modelProto.prefabDesc.stationMaxItemCount;
}
itemCountMax += station.isStellar ? GameMain.history.remoteStationExtraStorage : GameMain.history.localStationExtraStorage;
} }
itemCountMax += station.isStellar ? GameMain.history.remoteStationExtraStorage : GameMain.history.localStationExtraStorage;
if (newMax > itemCountMax) if (newMax > itemCountMax)
{ {
newMax = itemCountMax; newMax = itemCountMax;
} }
} }
storage.max = newMax; storage.max = newMax;
_skipNextEvent = oldMax / 100 != newMax / 100; _skipNextEvent = oldMax / 100 != newMax / 100;
break; break;
@@ -1490,11 +1540,18 @@ public static class FactoryPatch
[HarmonyPrefix] [HarmonyPrefix]
[HarmonyPatch(typeof(ObjectRenderer), nameof(ObjectRenderer.Render))] [HarmonyPatch(typeof(ObjectRenderer), nameof(ObjectRenderer.Render))]
[HarmonyPatch(typeof(DynamicRenderer), nameof(DynamicRenderer.Render))] [HarmonyPatch(typeof(DynamicRenderer), nameof(DynamicRenderer.Render))]
private static bool ObjectRenderer_Render_Prefix(GPUInstancingManager __instance) private static bool ObjectRenderer_Render_Prefix()
{ {
return false; return false;
} }
[HarmonyPrefix]
[HarmonyPatch(typeof(LabRenderer), nameof(LabRenderer.Render))]
private static bool LabRenderer_Render_Prefix()
{
return false;
}
[HarmonyPostfix] [HarmonyPostfix]
[HarmonyPatch(typeof(GPUInstancingManager), nameof(GPUInstancingManager.Render))] [HarmonyPatch(typeof(GPUInstancingManager), nameof(GPUInstancingManager.Render))]
private static void FactoryModel_DrawInstancedBatches_Postfix(GPUInstancingManager __instance) private static void FactoryModel_DrawInstancedBatches_Postfix(GPUInstancingManager __instance)
@@ -1523,6 +1580,8 @@ public static class FactoryPatch
new CodeMatch(OpCodes.Ldarg_0) new CodeMatch(OpCodes.Ldarg_0)
).Advance(8).Insert( ).Advance(8).Insert(
new CodeInstruction(OpCodes.Ldloc_S, 45), new CodeInstruction(OpCodes.Ldloc_S, 45),
new CodeInstruction(OpCodes.Ldloc_S, 47),
new CodeInstruction(OpCodes.Or),
new CodeInstruction(OpCodes.Brfalse, branch1) new CodeInstruction(OpCodes.Brfalse, branch1)
); );
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
@@ -1694,4 +1753,47 @@ public static class FactoryPatch
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
} }
private static class AllowOverflowInLogistics
{
private static Harmony _patch;
public static void Enable(bool enable)
{
if (enable)
{
_patch ??= Harmony.CreateAndPatchAll(typeof(AllowOverflowInLogistics));
return;
}
_patch?.UnpatchSelf();
_patch = null;
}
// Do not check for overflow when try to send hand items into storages
[HarmonyTranspiler]
[HarmonyPatch(typeof(UIStationStorage), nameof(UIStationStorage.OnItemIconMouseDown))]
private static IEnumerable<CodeInstruction> UIStationStorage_OnItemIconMouseDown_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
{
var matcher = new CodeMatcher(instructions, generator);
matcher.MatchForward(false,
new CodeMatch(OpCodes.Call, AccessTools.PropertyGetter(typeof(LDB), nameof(LDB.items))),
new CodeMatch(OpCodes.Ldarg_0)
);
var pos = matcher.Pos;
matcher.MatchForward(false,
new CodeMatch(OpCodes.Ldloc_S),
new CodeMatch(OpCodes.Stloc_S)
);
var inst = matcher.InstructionAt(1).Clone();
var pos2 = matcher.Pos + 2;
matcher.Start().Advance(pos).RemoveInstructions(pos2 - pos)
.Insert(
new CodeInstruction(OpCodes.Ldloc_1),
new CodeInstruction(OpCodes.Callvirt, AccessTools.PropertyGetter(typeof(Player), nameof(Player.inhandItemCount))),
inst
);
return matcher.InstructionEnumeration();
}
}
} }

View File

@@ -4,6 +4,18 @@
#### 一些提升用户体验的功能和补丁 #### 一些提升用户体验的功能和补丁
## Changlog ## Changlog
* 1.0.24
+ Changes to `Do not render factory entities (except belts and sorters)`
- Add shortcut key in config panel to toggle this function
- Can click on both belts and sorters now
+ New feature: `Drag building power poles in maximum connection range`
+ New feature: `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
+ 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 * 1.0.23
+ New features: + New features:
- `Do not render factory entities (except belts and sorters)` - `Do not render factory entities (except belts and sorters)`
@@ -132,7 +144,14 @@
- When reach the protection value, veins/oils steeps will not be mined/extracted any longer. - When reach the protection value, veins/oils steeps will not be mined/extracted any longer.
- Close this function to resume mining and pumping, usually when you have enough level on `Veins Utilization` - 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) - Do not render factory entities (except belts and sorters)
- This also makes players click though factory entities but belts - This also makes players click though factory entities but belts and sorters
- 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) - Re-intialize planet (without reseting veins)
- Quick dismantle all buildings (without drops) - Quick dismantle all buildings (without drops)
- Quick build Orbital Collectors - Quick build Orbital Collectors
@@ -169,6 +188,17 @@
* [CruiseAssist](https://dsp.thunderstore.io/package/tanu/CruiseAssist/) and its extension [AutoPilot](https://dsp.thunderstore.io/package/tanu/AutoPilot/): `Auto navigation on sailings` and `Auto-cruise` implementations * [CruiseAssist](https://dsp.thunderstore.io/package/tanu/CruiseAssist/) and its extension [AutoPilot](https://dsp.thunderstore.io/package/tanu/AutoPilot/): `Auto navigation on sailings` and `Auto-cruise` implementations
## 更新日志 ## 更新日志
* 1.0.24
+ `不渲染工厂建筑实体(除了传送带和分拣器)`的改动
- 在配置面板中添加了一个快捷键来切换此功能
- 现在也可以点击到分拣器了
+ 新功能:`允许物流塔和大型采矿机物品溢出`
- 当尝试塞入手中物品时允许溢出
- 允许`物流塔存储数量限制控制改进`超过科技容量限制
- 在加载游戏时移除物流塔容量限制检查
+ 新功能:`提升物流塔和大型采矿机的最大功耗`
- 物流塔将最大充电功率提高到3GW(星际物流塔)和600MW(行星物流塔)原来的10倍
- 大型采矿机将最大采矿速度提高到1000%
* 1.0.23 * 1.0.23
+ 新功能: + 新功能:
- `不渲染工厂建筑实体(除了传送带和分拣器)` - `不渲染工厂建筑实体(除了传送带和分拣器)`
@@ -298,6 +328,14 @@
- 当达到保护值时,矿脉和油井将不再被开采。 - 当达到保护值时,矿脉和油井将不再被开采。
- 关闭此功能以恢复开采,一般是当你在`矿物利用`上有足够的等级时。 - 关闭此功能以恢复开采,一般是当你在`矿物利用`上有足够的等级时。
- 不渲染工厂建筑实体(除了传送带和分拣器) - 不渲染工厂建筑实体(除了传送带和分拣器)
- 这也使玩家可以点穿工厂实体直接点到传送带和分拣器
- 允许物流塔和大型采矿机物品溢出
- 当尝试塞入手中物品时允许溢出
- 允许`物流塔存储数量限制控制改进`超过科技容量限制
- 在加载游戏时移除物流塔容量限制检查
- 提升物流塔和大型采矿机的最大功耗
- 物流塔将最大充电功率提高到3GW(星际物流塔)和600MW(行星物流塔)原来的10倍
- 大型采矿机将最大采矿速度提高到1000%
- 初始化本行星(不重置矿脉) - 初始化本行星(不重置矿脉)
- 快速拆除所有建筑(不掉落) - 快速拆除所有建筑(不掉落)
- 快速建造轨道采集器 - 快速建造轨道采集器

View File

@@ -43,6 +43,8 @@ public static class UIConfigWindow
I18N.Add("Protect veins from exhaustion", "Protect veins from exhaustion", "保护矿脉不会耗尽"); I18N.Add("Protect veins from exhaustion", "Protect veins from exhaustion", "保护矿脉不会耗尽");
I18N.Add("Protect veins from exhaustion tips", "By default, the vein amount is protected at 100, and oil speed is protected at 1.0/s, you can set them yourself in config file.\nWhen reach the protection value, veins/oils steeps will not be mined/extracted any longer.\nClose this function to resume mining and pumping, usually when you have enough level on `Veins Utilization`", "默认矿脉数量保护于剩余100采油速保护于速度1.0/s你可以在配置文件中自行设置。\n当达到保护值时矿脉和油井将不再被开采。\n关闭此功能以恢复开采一般是当你在`矿物利用`上有足够的等级时。\n"); I18N.Add("Protect veins from exhaustion tips", "By default, the vein amount is protected at 100, and oil speed is protected at 1.0/s, you can set them yourself in config file.\nWhen reach the protection value, veins/oils steeps will not be mined/extracted any longer.\nClose this function to resume mining and pumping, usually when you have enough level on `Veins Utilization`", "默认矿脉数量保护于剩余100采油速保护于速度1.0/s你可以在配置文件中自行设置。\n当达到保护值时矿脉和油井将不再被开采。\n关闭此功能以恢复开采一般是当你在`矿物利用`上有足够的等级时。\n");
I18N.Add("Do not render factory entities", "Do not render factory entities (except belts and sorters)", "不渲染工厂建筑实体(除了传送带和分拣器)"); 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("Auto navigation on sailings", "Auto navigation on sailings", "宇宙航行时自动导航"); I18N.Add("Auto navigation on sailings", "Auto navigation on sailings", "宇宙航行时自动导航");
I18N.Add("Enable auto-cruise", "Enable auto-cruise", "启用自动巡航"); I18N.Add("Enable auto-cruise", "Enable auto-cruise", "启用自动巡航");
I18N.Add("Auto boost", "Auto boost", "自动加速"); I18N.Add("Auto boost", "Auto boost", "自动加速");
@@ -120,6 +122,10 @@ public static class UIConfigWindow
x = 0f; x = 0f;
y += 30f; y += 30f;
MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.DoNotRenderEntitiesEnabled, "Do not render factory entities"); MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.DoNotRenderEntitiesEnabled, "Do not render factory entities");
y += 36f;
MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.DragBuildPowerPolesEnabled, "Drag building power poles in maximum connection range");
y += 36f;
MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.AllowOverflowInLogisticsEnabled, "Allow overflow for Logistic Stations and Advanced Mining Machines");
x = 400f; x = 400f;
y = 10f; y = 10f;
wnd.AddButton(x, y, tab2, "Initialize This Planet", 16, "button-init-planet", () => wnd.AddButton(x, y, tab2, "Initialize This Planet", 16, "button-init-planet", () =>

View File

@@ -76,6 +76,10 @@ public class UXAssist : BaseUnityPlugin
FactoryPatch.ProtectVeinsFromExhaustion.KeepOilSpeed = Config.Bind("Factory", "KeepOilSpeed", 1.0f, new ConfigDescription("Keep minimal oil speed (< 0.1 to disable)", new AcceptableValueRange<float>(0.0f, 1.0f))).Value; FactoryPatch.ProtectVeinsFromExhaustion.KeepOilSpeed = Config.Bind("Factory", "KeepOilSpeed", 1.0f, new ConfigDescription("Keep minimal oil speed (< 0.1 to disable)", new AcceptableValueRange<float>(0.0f, 1.0f))).Value;
FactoryPatch.DoNotRenderEntitiesEnabled = Config.Bind("Factory", "DoNotRenderEntities", false, FactoryPatch.DoNotRenderEntitiesEnabled = Config.Bind("Factory", "DoNotRenderEntities", false,
"Do not render factory entities"); "Do not render factory entities");
FactoryPatch.DragBuildPowerPolesEnabled = Config.Bind("Factory", "DragBuildPowerPoles", false,
"Drag building power poles in maximum connection range");
FactoryPatch.AllowOverflowInLogisticsEnabled = Config.Bind("Factory", "AllowOverflowInLogistics", false,
"Allow overflow in logistic stations");
PlanetFunctions.OrbitalCollectorMaxBuildCount = Config.Bind("Factory", "OCMaxBuildCount", 0, "Maximum Orbital Collectors to build once, set to 0 to build as many as possible"); 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, 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"); "Enhanced count control for hand-make, increases maximum of count to 1000, and you can hold Ctrl/Shift/Alt to change the count rapidly");
@@ -136,6 +140,7 @@ public class UXAssist : BaseUnityPlugin
{ {
ToggleConfigWindow(); ToggleConfigWindow();
} }
FactoryPatch.OnUpdate();
PlayerPatch.OnUpdate(); PlayerPatch.OnUpdate();
} }
@@ -413,30 +418,4 @@ public class UXAssist : BaseUnityPlugin
{ {
return false; return false;
} }
// Do not check for overflow when try to send hand items into storages
[HarmonyTranspiler]
[HarmonyPatch(typeof(UIStationStorage), nameof(UIStationStorage.OnItemIconMouseDown))]
private static IEnumerable<CodeInstruction> UIStationStorage_OnItemIconMouseDown_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
{
var matcher = new CodeMatcher(instructions, generator);
matcher.MatchForward(false,
new CodeMatch(OpCodes.Call, AccessTools.PropertyGetter(typeof(LDB), nameof(LDB.items))),
new CodeMatch(OpCodes.Ldarg_0)
);
var pos = matcher.Pos;
matcher.MatchForward(false,
new CodeMatch(OpCodes.Ldloc_S),
new CodeMatch(OpCodes.Stloc_S)
);
var inst = matcher.InstructionAt(1).Clone();
var pos2 = matcher.Pos + 2;
matcher.Start().Advance(pos).RemoveInstructions(pos2 - pos)
.Insert(
new CodeInstruction(OpCodes.Ldloc_1),
new CodeInstruction(OpCodes.Callvirt, AccessTools.PropertyGetter(typeof(Player), nameof(Player.inhandItemCount))),
inst
);
return matcher.InstructionEnumeration();
}
} }