mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2026-02-04 22:22:26 +08:00
WIP
This commit is contained in:
@@ -27,6 +27,7 @@ public static class FactoryPatch
|
|||||||
public static ConfigEntry<bool> DoNotRenderEntitiesEnabled;
|
public static ConfigEntry<bool> DoNotRenderEntitiesEnabled;
|
||||||
public static ConfigEntry<bool> DragBuildPowerPolesEnabled;
|
public static ConfigEntry<bool> DragBuildPowerPolesEnabled;
|
||||||
public static ConfigEntry<bool> AllowOverflowInLogisticsEnabled;
|
public static ConfigEntry<bool> AllowOverflowInLogisticsEnabled;
|
||||||
|
public static ConfigEntry<bool> GreaterPowerUsageInLogisticsEnabled;
|
||||||
private static PressKeyBind _doNotRenderEntitiesKey;
|
private static PressKeyBind _doNotRenderEntitiesKey;
|
||||||
|
|
||||||
private static Harmony _factoryPatch;
|
private static Harmony _factoryPatch;
|
||||||
@@ -56,6 +57,7 @@ public static class FactoryPatch
|
|||||||
DoNotRenderEntitiesEnabled.SettingChanged += (_, _) => DoNotRenderEntities.Enable(DoNotRenderEntitiesEnabled.Value);
|
DoNotRenderEntitiesEnabled.SettingChanged += (_, _) => DoNotRenderEntities.Enable(DoNotRenderEntitiesEnabled.Value);
|
||||||
DragBuildPowerPolesEnabled.SettingChanged += (_, _) => DragBuildPowerPoles.Enable(DragBuildPowerPolesEnabled.Value);
|
DragBuildPowerPolesEnabled.SettingChanged += (_, _) => DragBuildPowerPoles.Enable(DragBuildPowerPolesEnabled.Value);
|
||||||
AllowOverflowInLogisticsEnabled.SettingChanged += (_, _) => AllowOverflowInLogistics.Enable(AllowOverflowInLogisticsEnabled.Value);
|
AllowOverflowInLogisticsEnabled.SettingChanged += (_, _) => AllowOverflowInLogistics.Enable(AllowOverflowInLogisticsEnabled.Value);
|
||||||
|
GreaterPowerUsageInLogisticsEnabled.SettingChanged += (_, _) => LogisticsCapacityTweaks.Enable(LogisticsCapacityTweaksEnabled.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);
|
||||||
@@ -70,6 +72,7 @@ public static class FactoryPatch
|
|||||||
DoNotRenderEntities.Enable(DoNotRenderEntitiesEnabled.Value);
|
DoNotRenderEntities.Enable(DoNotRenderEntitiesEnabled.Value);
|
||||||
DragBuildPowerPoles.Enable(DragBuildPowerPolesEnabled.Value);
|
DragBuildPowerPoles.Enable(DragBuildPowerPolesEnabled.Value);
|
||||||
AllowOverflowInLogistics.Enable(AllowOverflowInLogisticsEnabled.Value);
|
AllowOverflowInLogistics.Enable(AllowOverflowInLogisticsEnabled.Value);
|
||||||
|
GreaterPowerUsageInLogistics.Enable(GreaterPowerUsageInLogisticsEnabled.Value);
|
||||||
|
|
||||||
_factoryPatch ??= Harmony.CreateAndPatchAll(typeof(FactoryPatch));
|
_factoryPatch ??= Harmony.CreateAndPatchAll(typeof(FactoryPatch));
|
||||||
}
|
}
|
||||||
@@ -90,6 +93,7 @@ public static class FactoryPatch
|
|||||||
DoNotRenderEntities.Enable(false);
|
DoNotRenderEntities.Enable(false);
|
||||||
DragBuildPowerPoles.Enable(false);
|
DragBuildPowerPoles.Enable(false);
|
||||||
AllowOverflowInLogistics.Enable(false);
|
AllowOverflowInLogistics.Enable(false);
|
||||||
|
GreaterPowerUsageInLogistics.Enable(false);
|
||||||
|
|
||||||
_factoryPatch?.UnpatchSelf();
|
_factoryPatch?.UnpatchSelf();
|
||||||
_factoryPatch = null;
|
_factoryPatch = null;
|
||||||
@@ -884,47 +888,50 @@ public static class FactoryPatch
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void OnUpdate()
|
public static void UpdateInput()
|
||||||
{
|
{
|
||||||
if (_lastKey != KeyCode.None && Input.GetKeyUp(_lastKey))
|
if (_lastKey != KeyCode.None && Input.GetKeyUp(_lastKey))
|
||||||
{
|
{
|
||||||
_lastKey = KeyCode.None;
|
_lastKey = KeyCode.None;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!VFInput.noModifier) return;
|
if (VFInput.shift) return;
|
||||||
|
var ctrl = VFInput.control;
|
||||||
|
var alt = VFInput.alt;
|
||||||
|
if (ctrl && alt) return;
|
||||||
int delta;
|
int delta;
|
||||||
if (UpdateKeyPressed(KeyCode.LeftArrow))
|
if (UpdateKeyPressed(KeyCode.LeftArrow))
|
||||||
{
|
{
|
||||||
if (VFInput.control)
|
if (ctrl)
|
||||||
delta = -100000;
|
delta = -100000;
|
||||||
else if (VFInput.alt)
|
else if (alt)
|
||||||
delta = -1000;
|
delta = -1000;
|
||||||
else
|
else
|
||||||
delta = -10;
|
delta = -10;
|
||||||
}
|
}
|
||||||
else if (UpdateKeyPressed(KeyCode.RightArrow))
|
else if (UpdateKeyPressed(KeyCode.RightArrow))
|
||||||
{
|
{
|
||||||
if (VFInput.control)
|
if (ctrl)
|
||||||
delta = 100000;
|
delta = 100000;
|
||||||
else if (VFInput.alt)
|
else if (alt)
|
||||||
delta = 1000;
|
delta = 1000;
|
||||||
else
|
else
|
||||||
delta = 10;
|
delta = 10;
|
||||||
}
|
}
|
||||||
else if (UpdateKeyPressed(KeyCode.DownArrow))
|
else if (UpdateKeyPressed(KeyCode.DownArrow))
|
||||||
{
|
{
|
||||||
if (VFInput.control)
|
if (ctrl)
|
||||||
delta = -1000000;
|
delta = -1000000;
|
||||||
else if (VFInput.alt)
|
else if (alt)
|
||||||
delta = -10000;
|
delta = -10000;
|
||||||
else
|
else
|
||||||
delta = -100;
|
delta = -100;
|
||||||
}
|
}
|
||||||
else if (UpdateKeyPressed(KeyCode.UpArrow))
|
else if (UpdateKeyPressed(KeyCode.UpArrow))
|
||||||
{
|
{
|
||||||
if (VFInput.control)
|
if (ctrl)
|
||||||
delta = 1000000;
|
delta = 1000000;
|
||||||
else if (VFInput.alt)
|
else if (alt)
|
||||||
delta = 10000;
|
delta = 10000;
|
||||||
else
|
else
|
||||||
delta = 100;
|
delta = 100;
|
||||||
@@ -953,7 +960,7 @@ public static class FactoryPatch
|
|||||||
int itemCountMax;
|
int itemCountMax;
|
||||||
if (AllowOverflowInLogisticsEnabled.Value)
|
if (AllowOverflowInLogisticsEnabled.Value)
|
||||||
{
|
{
|
||||||
itemCountMax = 1000000000;
|
itemCountMax = 90000000;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1795,5 +1802,44 @@ public static class FactoryPatch
|
|||||||
);
|
);
|
||||||
return matcher.InstructionEnumeration();
|
return matcher.InstructionEnumeration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remove storage limit check
|
||||||
|
[HarmonyTranspiler]
|
||||||
|
[HarmonyPatch(typeof(PlanetTransport), nameof(PlanetTransport.SetStationStorage))]
|
||||||
|
private static IEnumerable<CodeInstruction> PlanetTransport_SetStationStorage_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||||
|
{
|
||||||
|
var matcher = new CodeMatcher(instructions, generator);
|
||||||
|
matcher.MatchForward(false,
|
||||||
|
new CodeMatch(ci => ci.IsLdarg()),
|
||||||
|
new CodeMatch(ci => ci.IsLdloc()),
|
||||||
|
new CodeMatch(ci => ci.IsLdloc()),
|
||||||
|
new CodeMatch(OpCodes.Add),
|
||||||
|
new CodeMatch(ci => ci.Branches(out _)),
|
||||||
|
new CodeMatch(ci => ci.IsLdloc()),
|
||||||
|
new CodeMatch(ci => ci.IsLdloc()),
|
||||||
|
new CodeMatch(OpCodes.Add),
|
||||||
|
new CodeMatch(ci => ci.IsStarg())
|
||||||
|
);
|
||||||
|
var labels = matcher.Labels;
|
||||||
|
matcher.RemoveInstructions(9).Labels.AddRange(labels);
|
||||||
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -45,6 +45,7 @@ public static class UIConfigWindow
|
|||||||
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("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("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("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", "自动加速");
|
||||||
@@ -121,11 +122,13 @@ public static class UIConfigWindow
|
|||||||
MyWindow.AddTipsButton(x, y, tab2, "Protect veins from exhaustion", "Protect veins from exhaustion tips", "protect-veins-tips");
|
MyWindow.AddTipsButton(x, y, tab2, "Protect veins from exhaustion", "Protect veins from exhaustion tips", "protect-veins-tips");
|
||||||
x = 0f;
|
x = 0f;
|
||||||
y += 30f;
|
y += 30f;
|
||||||
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");
|
MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.DragBuildPowerPolesEnabled, "Drag building power poles in maximum connection range");
|
||||||
y += 36f;
|
y += 36f;
|
||||||
MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.AllowOverflowInLogisticsEnabled, "Allow overflow for Logistic Stations and Advanced Mining Machines");
|
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;
|
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", () =>
|
||||||
|
|||||||
@@ -80,6 +80,8 @@ public class UXAssist : BaseUnityPlugin
|
|||||||
"Drag building power poles in maximum connection range");
|
"Drag building power poles in maximum connection range");
|
||||||
FactoryPatch.AllowOverflowInLogisticsEnabled = Config.Bind("Factory", "AllowOverflowInLogistics", false,
|
FactoryPatch.AllowOverflowInLogisticsEnabled = Config.Bind("Factory", "AllowOverflowInLogistics", false,
|
||||||
"Allow overflow in logistic stations");
|
"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");
|
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");
|
||||||
@@ -134,7 +136,7 @@ public class UXAssist : BaseUnityPlugin
|
|||||||
if (VFInput.inputing) return;
|
if (VFInput.inputing) return;
|
||||||
if (VFInput.onGUI)
|
if (VFInput.onGUI)
|
||||||
{
|
{
|
||||||
FactoryPatch.LogisticsCapacityTweaks.OnUpdate();
|
FactoryPatch.LogisticsCapacityTweaks.UpdateInput();
|
||||||
}
|
}
|
||||||
if (_toggleKey.keyValue)
|
if (_toggleKey.keyValue)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user