1
0
mirror of https://github.com/soarqin/DSP_Mods.git synced 2026-02-05 04:22:21 +08:00

UXAssist and CheatEnabler release

This commit is contained in:
2024-05-07 00:24:46 +08:00
parent a359f789e7
commit 7cdaa5df20
16 changed files with 429 additions and 85 deletions

View File

@@ -48,6 +48,8 @@ public class CheatEnabler : BaseUnityPlugin
"Can pump water anywhere (while water type is not None)"); "Can pump water anywhere (while water type is not None)");
PlanetPatch.TerraformAnywayEnabled = Config.Bind("Planet", "TerraformAnyway", false, PlanetPatch.TerraformAnywayEnabled = Config.Bind("Planet", "TerraformAnyway", false,
"Can do terraform without enough soil piless"); "Can do terraform without enough soil piless");
PlayerPatch.InstantTeleportEnabled = Config.Bind("Player", "InstantTeleport", false,
"Enable instant teleport (like that in Sandbox mode)");
DysonSpherePatch.SkipBulletEnabled = Config.Bind("DysonSphere", "SkipBullet", false, DysonSpherePatch.SkipBulletEnabled = Config.Bind("DysonSphere", "SkipBullet", false,
"Skip bullet"); "Skip bullet");
DysonSpherePatch.SkipAbsorbEnabled = Config.Bind("DysonSphere", "SkipAbsorb", false, DysonSpherePatch.SkipAbsorbEnabled = Config.Bind("DysonSphere", "SkipAbsorb", false,
@@ -60,7 +62,11 @@ public class CheatEnabler : BaseUnityPlugin
"Overclock ejector"); "Overclock ejector");
DysonSpherePatch.OverclockSiloEnabled = Config.Bind("DysonSphere", "OverclockSilo", false, DysonSpherePatch.OverclockSiloEnabled = Config.Bind("DysonSphere", "OverclockSilo", false,
"Overclock silo"); "Overclock silo");
CombatPatch.MechaInvincibleEnabled = Config.Bind("Battle", "MechaInvincible", false,
"Mecha and Drones/Fleets invincible");
CombatPatch.BuildingsInvincibleEnabled = Config.Bind("Battle", "BuildingsInvincible", false,
"Buildings invincible");
UIConfigWindow.Init(); UIConfigWindow.Init();
DevShortcuts.Init(); DevShortcuts.Init();
@@ -69,12 +75,16 @@ public class CheatEnabler : BaseUnityPlugin
FactoryPatch.Init(); FactoryPatch.Init();
ResourcePatch.Init(); ResourcePatch.Init();
PlanetPatch.Init(); PlanetPatch.Init();
PlayerPatch.Init();
DysonSpherePatch.Init(); DysonSpherePatch.Init();
CombatPatch.Init();
} }
private void OnDestroy() private void OnDestroy()
{ {
CombatPatch.Uninit();
DysonSpherePatch.Uninit(); DysonSpherePatch.Uninit();
PlayerPatch.Uninit();
PlanetPatch.Uninit(); PlanetPatch.Uninit();
ResourcePatch.Uninit(); ResourcePatch.Uninit();
FactoryPatch.Uninit(); FactoryPatch.Uninit();

View File

@@ -5,7 +5,7 @@
<TargetFramework>net472</TargetFramework> <TargetFramework>net472</TargetFramework>
<BepInExPluginGuid>org.soardev.cheatenabler</BepInExPluginGuid> <BepInExPluginGuid>org.soardev.cheatenabler</BepInExPluginGuid>
<Description>DSP MOD - CheatEnabler</Description> <Description>DSP MOD - CheatEnabler</Description>
<Version>2.3.14</Version> <Version>2.3.15</Version>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
<PackageId>CheatEnabler</PackageId> <PackageId>CheatEnabler</PackageId>

113
CheatEnabler/CombatPatch.cs Normal file
View File

@@ -0,0 +1,113 @@
using System.Collections.Generic;
using System.Reflection;
using System.Reflection.Emit;
using BepInEx.Configuration;
using HarmonyLib;
namespace CheatEnabler;
public static class CombatPatch
{
public static ConfigEntry<bool> MechaInvincibleEnabled;
public static ConfigEntry<bool> BuildingsInvincibleEnabled;
public static void Init()
{
MechaInvincibleEnabled.SettingChanged += (_, _) => MechaInvincible.Enable(MechaInvincibleEnabled.Value);
BuildingsInvincibleEnabled.SettingChanged += (_, _) => BuildingsInvincible.Enable(BuildingsInvincibleEnabled.Value);
MechaInvincible.Enable(MechaInvincibleEnabled.Value);
BuildingsInvincible.Enable(BuildingsInvincibleEnabled.Value);
}
public static void Uninit()
{
BuildingsInvincible.Enable(false);
MechaInvincible.Enable(false);
}
private static class MechaInvincible
{
private static Harmony _patch;
public static void Enable(bool on)
{
if (on)
{
_patch ??= Harmony.CreateAndPatchAll(typeof(MechaInvincible));
}
else
{
_patch?.UnpatchSelf();
_patch = null;
}
}
[HarmonyTranspiler]
[HarmonyPatch(typeof(Player), nameof(Player.invincible), MethodType.Getter)]
private static IEnumerable<CodeInstruction> Player_get_invincible_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
{
var matcher = new CodeMatcher(instructions, generator);
matcher.Start().RemoveInstructions(matcher.Length).Insert(
new CodeInstruction(OpCodes.Ldc_I4_1),
new CodeInstruction(OpCodes.Ret)
);
return matcher.InstructionEnumeration();
}
[HarmonyTranspiler]
[HarmonyPatch(typeof(SkillSystem), nameof(SkillSystem.DamageGroundObjectByLocalCaster))]
[HarmonyPatch(typeof(SkillSystem), nameof(SkillSystem.DamageGroundObjectByRemoteCaster))]
[HarmonyPatch(typeof(SkillSystem), nameof(SkillSystem.DamageObject))]
private static IEnumerable<CodeInstruction> SkillSystem_DamageObject_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator, MethodBase __originalMethod)
{
var matcher = new CodeMatcher(instructions, generator);
matcher.MatchForward(false,
new CodeMatch(ci => ci.IsLdarg()),
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(SkillTargetLocal), nameof(SkillTargetLocal.type))),
new CodeMatch(OpCodes.Ldc_I4_6),
new CodeMatch(ci => ci.opcode == OpCodes.Bne_Un || ci.opcode == OpCodes.Bne_Un_S)
);
matcher.Repeat(m => m.Advance(4).InsertAndAdvance(
new CodeInstruction(OpCodes.Ldc_I4_0),
new CodeInstruction(OpCodes.Starg_S, __originalMethod.Name == "DamageObject" ? 1 : 2)
));
return matcher.InstructionEnumeration();
}
}
private static class BuildingsInvincible
{
private static Harmony _patch;
public static void Enable(bool on)
{
if (on)
{
_patch ??= Harmony.CreateAndPatchAll(typeof(BuildingsInvincible));
}
else
{
_patch?.UnpatchSelf();
_patch = null;
}
}
[HarmonyTranspiler]
[HarmonyPatch(typeof(SkillSystem), nameof(SkillSystem.DamageGroundObjectByLocalCaster))]
[HarmonyPatch(typeof(SkillSystem), nameof(SkillSystem.DamageGroundObjectByRemoteCaster))]
private static IEnumerable<CodeInstruction> SkillSystem_DamageObject_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
{
var matcher = new CodeMatcher(instructions, generator);
matcher.MatchForward(false,
new CodeMatch(ci => ci.IsLdarg()),
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(SkillTargetLocal), nameof(SkillTargetLocal.type))),
new CodeMatch(ci => ci.opcode == OpCodes.Brtrue || ci.opcode == OpCodes.Brtrue_S),
new CodeMatch(OpCodes.Ldarg_1)
).Advance(3).Insert(
new CodeInstruction(OpCodes.Ldc_I4_0),
new CodeInstruction(OpCodes.Starg_S, 2)
);
return matcher.InstructionEnumeration();
}
}
}

View File

@@ -390,6 +390,7 @@ public static class FactoryPatch
} }
[HarmonyTranspiler, HarmonyPriority(Priority.Last)] [HarmonyTranspiler, HarmonyPriority(Priority.Last)]
[HarmonyPatch(typeof(BuildTool_BlueprintPaste), nameof(BuildTool_BlueprintPaste.CheckBuildConditions))]
[HarmonyPatch(typeof(BuildTool_Click), nameof(BuildTool_Click.CheckBuildConditions))] [HarmonyPatch(typeof(BuildTool_Click), nameof(BuildTool_Click.CheckBuildConditions))]
private static IEnumerable<CodeInstruction> BuildTool_Click_CheckBuildConditions_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> BuildTool_Click_CheckBuildConditions_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
{ {

View File

@@ -42,8 +42,8 @@ public static class PlanetPatch
} }
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(BuildTool_BlueprintPaste), "CheckBuildConditions")] [HarmonyPatch(typeof(BuildTool_BlueprintPaste), nameof(BuildTool_BlueprintPaste.CheckBuildConditions))]
[HarmonyPatch(typeof(BuildTool_Click), "CheckBuildConditions")] [HarmonyPatch(typeof(BuildTool_Click), nameof(BuildTool_Click.CheckBuildConditions))]
private static IEnumerable<CodeInstruction> BuildTool_CheckBuildConditions_Transpiler( private static IEnumerable<CodeInstruction> BuildTool_CheckBuildConditions_Transpiler(
IEnumerable<CodeInstruction> instructions, ILGenerator generator) IEnumerable<CodeInstruction> instructions, ILGenerator generator)
{ {

View File

@@ -0,0 +1,60 @@
using System.Collections.Generic;
using System.Reflection.Emit;
using BepInEx.Configuration;
using HarmonyLib;
namespace CheatEnabler;
public static class PlayerPatch
{
public static ConfigEntry<bool> InstantTeleportEnabled;
public static void Init()
{
InstantTeleportEnabled.SettingChanged += (_, _) => InstantTeleport.Enable(InstantTeleportEnabled.Value);
InstantTeleport.Enable(InstantTeleportEnabled.Value);
}
public static void Uninit()
{
InstantTeleport.Enable(false);
}
private static class InstantTeleport
{
private static Harmony _patch;
public static void Enable(bool on)
{
if (on)
{
_patch ??= Harmony.CreateAndPatchAll(typeof(InstantTeleport));
}
else
{
_patch?.UnpatchSelf();
_patch = null;
}
}
[HarmonyTranspiler]
[HarmonyPatch(typeof(UIGlobemap), nameof(UIGlobemap._OnUpdate))]
[HarmonyPatch(typeof(UIStarmap), nameof(UIStarmap.DoRightClickFastTravel))]
[HarmonyPatch(typeof(UIStarmap), nameof(UIStarmap.OnFastTravelButtonClick))]
[HarmonyPatch(typeof(UIStarmap), nameof(UIStarmap.OnScreenClick))]
[HarmonyPatch(typeof(UIStarmap), nameof(UIStarmap.SandboxRightClickFastTravelLogic))]
[HarmonyPatch(typeof(UIStarmap), nameof(UIStarmap.StartFastTravelToPlanet))]
[HarmonyPatch(typeof(UIStarmap), nameof(UIStarmap.StartFastTravelToUPosition))]
[HarmonyPatch(typeof(UIStarmap), nameof(UIStarmap.UpdateCursorView))]
[HarmonyPatch(typeof(UIStarmap), nameof(UIStarmap._OnUpdate))]
private static IEnumerable<CodeInstruction> UIGlobemap__OnUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
{
var matcher = new CodeMatcher(instructions, generator);
matcher.MatchForward(false,
new CodeMatch(OpCodes.Call, AccessTools.PropertyGetter(typeof(GameMain), nameof(GameMain.sandboxToolsEnabled)))
);
matcher.Repeat(cm => cm.SetAndAdvance(OpCodes.Ldc_I4_1, null));
return matcher.InstructionEnumeration();
}
}
}

View File

@@ -4,6 +4,11 @@
#### 添加一些作弊功能,同时屏蔽异常检测 #### 添加一些作弊功能,同时屏蔽异常检测
## Changlog ## Changlog
* 2.3.15
+ New features:
- `Instant teleport (like that in Sandbox mode)`
- `Mecha and Drones/Fleets invicible`
- `Buildings invicible`
* 2.3.14 * 2.3.14
+ Remove default shortcut key for `No condition build` and `No collision`, to avoid misoperation. You can still set them in system settings window manually if needed. + Remove default shortcut key for `No condition build` and `No collision`, to avoid misoperation. You can still set them in system settings window manually if needed.
+ Fix translation issue. + Fix translation issue.
@@ -117,11 +122,15 @@
+ Fast Mining + Fast Mining
+ Pump Anywhere + Pump Anywhere
+ Terraform without enought soil piles + Terraform without enought soil piles
+ Instant teleport (like that in Sandbox mode)
+ Dyson Sphere: + Dyson Sphere:
+ Skip bullet period + Skip bullet period
+ Skip absorption period + Skip absorption period
+ Quick absorb + Quick absorb
+ Eject anyway + Eject anyway
+ Combat:
+ Mecha and Drones/Fleets invicible
+ Buildings invicible
## Notes ## Notes
* Please upgrade `BepInEx` 5.4.21 or later if using with [BlueprintTweaks](https://dsp.thunderstore.io/package/kremnev8/BlueprintTweaks/) to avoid possible conflicts. * Please upgrade `BepInEx` 5.4.21 or later if using with [BlueprintTweaks](https://dsp.thunderstore.io/package/kremnev8/BlueprintTweaks/) to avoid possible conflicts.
@@ -134,6 +143,11 @@
* [Multifunction_mod](https://github.com/blacksnipebiu/Multifunction_mod): Some cheat functions * [Multifunction_mod](https://github.com/blacksnipebiu/Multifunction_mod): Some cheat functions
## 更新日志 ## 更新日志
* 2.3.15
+ 新功能:
- `快速传送(和沙盒模式一样)`
- `机甲和战斗无人机无敌`
- `建筑无敌`
* 2.3.14 * 2.3.14
+ 移除了`无条件建造``无碰撞`的默认快捷键,以避免误操作。如有需要请手动在系统选项窗口中设置。 + 移除了`无条件建造``无碰撞`的默认快捷键,以避免误操作。如有需要请手动在系统选项窗口中设置。
+ 修复了翻译问题。 + 修复了翻译问题。
@@ -247,11 +261,15 @@
+ 高速采集 + 高速采集
+ 平地抽水 + 平地抽水
+ 沙土不够时依然可以整改地形 + 沙土不够时依然可以整改地形
+ 快速传送(和沙盒模式一样)
+ 戴森球: + 戴森球:
+ 跳过子弹阶段 + 跳过子弹阶段
+ 跳过吸收阶段 + 跳过吸收阶段
+ 快速吸收 + 快速吸收
+ 全球弹射 + 全球弹射
+ 战斗:
+ 机甲和战斗无人机无敌
+ 建筑无敌
## 注意事项 ## 注意事项
* 如果和[BlueprintTweaks](https://dsp.thunderstore.io/package/kremnev8/BlueprintTweaks/)一起使用,请升级`BepInEx`到5.4.21或更高版本,以避免可能的冲突 * 如果和[BlueprintTweaks](https://dsp.thunderstore.io/package/kremnev8/BlueprintTweaks/)一起使用,请升级`BepInEx`到5.4.21或更高版本,以避免可能的冲突

View File

@@ -53,6 +53,9 @@ public static class UIConfigWindow
I18N.Add("Overclock Ejectors", "Overclock Ejectors (10x)", "高速弹射器(10倍射速)"); I18N.Add("Overclock Ejectors", "Overclock Ejectors (10x)", "高速弹射器(10倍射速)");
I18N.Add("Overclock Silos", "Overclock Silos (10x)", "高速发射井(10倍射速)"); I18N.Add("Overclock Silos", "Overclock Silos (10x)", "高速发射井(10倍射速)");
I18N.Add("Terraform without enough soil piles", "Terraform without enough soil piles", "沙土不够时依然可以整改地形"); I18N.Add("Terraform without enough soil piles", "Terraform without enough soil piles", "沙土不够时依然可以整改地形");
I18N.Add("Instant teleport (like that in Sandbox mode)", "Instant teleport (like that in Sandbox mode)", "快速传送(和沙盒模式一样)");
I18N.Add("Mecha and Drones/Fleets invicible", "Mecha and Drones/Fleets invicible", "机甲和战斗无人机无敌");
I18N.Add("Buildings invicible", "Buildings invincible", "建筑无敌");
I18N.Apply(); I18N.Apply();
MyConfigWindow.OnUICreated += CreateUI; MyConfigWindow.OnUICreated += CreateUI;
MyConfigWindow.OnUpdateUI += UpdateUI; MyConfigWindow.OnUpdateUI += UpdateUI;
@@ -134,6 +137,8 @@ public static class UIConfigWindow
MyCheckBox.CreateCheckBox(x, y, tab3, PlanetPatch.WaterPumpAnywhereEnabled, "Pump Anywhere"); MyCheckBox.CreateCheckBox(x, y, tab3, PlanetPatch.WaterPumpAnywhereEnabled, "Pump Anywhere");
y += 36f; y += 36f;
MyCheckBox.CreateCheckBox(x, y, tab3, PlanetPatch.TerraformAnywayEnabled, "Terraform without enough soil piles"); MyCheckBox.CreateCheckBox(x, y, tab3, PlanetPatch.TerraformAnywayEnabled, "Terraform without enough soil piles");
y += 36f;
MyCheckBox.CreateCheckBox(x, y, tab3, PlayerPatch.InstantTeleportEnabled, "Instant teleport (like that in Sandbox mode)");
x = 400f; x = 400f;
y = 10f; y = 10f;
wnd.AddButton(x, y, 200f, tab3, "矿物掩埋标题", 16, "button-bury-all", () => { PlanetFunctions.BuryAllVeins(true); }); wnd.AddButton(x, y, 200f, tab3, "矿物掩埋标题", 16, "button-bury-all", () => { PlanetFunctions.BuryAllVeins(true); });
@@ -171,6 +176,13 @@ public static class UIConfigWindow
MyCheckBox.CreateCheckBox(x, y, tab4, DysonSpherePatch.OverclockEjectorEnabled, "Overclock Ejectors"); MyCheckBox.CreateCheckBox(x, y, tab4, DysonSpherePatch.OverclockEjectorEnabled, "Overclock Ejectors");
y += 36f; y += 36f;
MyCheckBox.CreateCheckBox(x, y, tab4, DysonSpherePatch.OverclockSiloEnabled, "Overclock Silos"); MyCheckBox.CreateCheckBox(x, y, tab4, DysonSpherePatch.OverclockSiloEnabled, "Overclock Silos");
var tab5 = wnd.AddTab(_windowTrans, "Combat");
x = 0f;
y = 10f;
MyCheckBox.CreateCheckBox(x, y, tab5, CombatPatch.MechaInvincibleEnabled, "Mecha and Drones/Fleets invicible");
y += 36f;
MyCheckBox.CreateCheckBox(x, y, tab5, CombatPatch.BuildingsInvincibleEnabled, "Buildings invicible");
return; return;
void OnBeltSignalChanged() void OnBeltSignalChanged()

View File

@@ -1,10 +1,10 @@
{ {
"name": "CheatEnabler", "name": "CheatEnabler",
"version_number": "2.3.14", "version_number": "2.3.15",
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/CheatEnabler", "website_url": "https://github.com/soarqin/DSP_Mods/tree/master/CheatEnabler",
"description": "Add various cheat functions while disabling abnormal determinants / 添加一些作弊功能,同时屏蔽异常检测", "description": "Add various cheat functions while disabling abnormal determinants / 添加一些作弊功能,同时屏蔽异常检测",
"dependencies": [ "dependencies": [
"xiaoye97-BepInEx-5.4.17", "xiaoye97-BepInEx-5.4.17",
"soarqin-UXAssist-1.0.15" "soarqin-UXAssist-1.0.23"
] ]
} }

View File

@@ -21,6 +21,7 @@ public static class FactoryPatch
public static ConfigEntry<bool> TreatStackingAsSingleEnabled; public static ConfigEntry<bool> TreatStackingAsSingleEnabled;
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;
private static Harmony _factoryPatch; private static Harmony _factoryPatch;
@@ -37,6 +38,7 @@ public static class FactoryPatch
TreatStackingAsSingleEnabled.SettingChanged += (_, _) => TreatStackingAsSingle.Enable(TreatStackingAsSingleEnabled.Value); TreatStackingAsSingleEnabled.SettingChanged += (_, _) => TreatStackingAsSingle.Enable(TreatStackingAsSingleEnabled.Value);
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);
UnlimitInteractive.Enable(UnlimitInteractiveEnabled.Value); UnlimitInteractive.Enable(UnlimitInteractiveEnabled.Value);
RemoveSomeConditionBuild.Enable(RemoveSomeConditionEnabled.Value); RemoveSomeConditionBuild.Enable(RemoveSomeConditionEnabled.Value);
NightLight.Enable(NightLightEnabled.Value); NightLight.Enable(NightLightEnabled.Value);
@@ -48,6 +50,7 @@ public static class FactoryPatch
TreatStackingAsSingle.Enable(TreatStackingAsSingleEnabled.Value); TreatStackingAsSingle.Enable(TreatStackingAsSingleEnabled.Value);
QuickBuildAndDismantleLab.Enable(QuickBuildAndDismantleLabsEnabled.Value); QuickBuildAndDismantleLab.Enable(QuickBuildAndDismantleLabsEnabled.Value);
ProtectVeinsFromExhaustion.Enable(ProtectVeinsFromExhaustionEnabled.Value); ProtectVeinsFromExhaustion.Enable(ProtectVeinsFromExhaustionEnabled.Value);
DoNotRenderEntities.Enable(DoNotRenderEntitiesEnabled.Value);
_factoryPatch ??= Harmony.CreateAndPatchAll(typeof(FactoryPatch)); _factoryPatch ??= Harmony.CreateAndPatchAll(typeof(FactoryPatch));
} }
@@ -65,6 +68,7 @@ public static class FactoryPatch
TreatStackingAsSingle.Enable(false); TreatStackingAsSingle.Enable(false);
QuickBuildAndDismantleLab.Enable(false); QuickBuildAndDismantleLab.Enable(false);
ProtectVeinsFromExhaustion.Enable(false); ProtectVeinsFromExhaustion.Enable(false);
DoNotRenderEntities.Enable(false);
_factoryPatch?.UnpatchSelf(); _factoryPatch?.UnpatchSelf();
_factoryPatch = null; _factoryPatch = null;
@@ -739,7 +743,8 @@ public static class FactoryPatch
var jmp0 = generator.DefineLabel(); var jmp0 = generator.DefineLabel();
var jmp1 = generator.DefineLabel(); var jmp1 = generator.DefineLabel();
matcher.InsertAndAdvance( matcher.InsertAndAdvance(
new CodeInstruction(OpCodes.Call, AccessTools.PropertyGetter(typeof(VFInput), nameof(VFInput._ignoreGrid))), new CodeInstruction(OpCodes.Call, AccessTools.PropertyGetter(typeof(VFInput), nameof(VFInput._switchModelStyle))),
new CodeInstruction(OpCodes.Ldfld, AccessTools.Field(typeof(VFInput.InputValue), nameof(VFInput.InputValue.pressing))),
new CodeInstruction(OpCodes.Brfalse, jmp0), new CodeInstruction(OpCodes.Brfalse, jmp0),
new CodeInstruction(OpCodes.Ldarg_0), new CodeInstruction(OpCodes.Ldarg_0),
new CodeInstruction(OpCodes.Ldarg_0), new CodeInstruction(OpCodes.Ldarg_0),
@@ -1462,4 +1467,62 @@ public static class FactoryPatch
return false; return false;
} }
} }
private static class DoNotRenderEntities
{
private static Harmony _patch;
public static void Enable(bool enable)
{
if (enable)
{
_patch ??= Harmony.CreateAndPatchAll(typeof(DoNotRenderEntities));
return;
}
_patch?.UnpatchSelf();
_patch = null;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(ObjectRenderer), nameof(ObjectRenderer.Render))]
[HarmonyPatch(typeof(DynamicRenderer), nameof(DynamicRenderer.Render))]
private static bool ObjectRenderer_Render_Prefix(GPUInstancingManager __instance)
{
return false;
}
[HarmonyPostfix]
[HarmonyPatch(typeof(GPUInstancingManager), nameof(GPUInstancingManager.Render))]
private static void FactoryModel_DrawInstancedBatches_Postfix(GPUInstancingManager __instance)
{
__instance.renderEntity = true;
}
[HarmonyTranspiler]
[HarmonyPatch(typeof(RaycastLogic), nameof(RaycastLogic.GameTick))]
private static IEnumerable<CodeInstruction> RaycastLogic_GameTick_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
{
var matcher = new CodeMatcher(instructions, generator);
matcher.MatchForward(false,
new CodeMatch(OpCodes.Ldc_I4_0),
new CodeMatch(OpCodes.Brtrue));
var branch1 = (Label)matcher.Advance(1).Operand;
matcher.Start().MatchForward(false,
new CodeMatch(OpCodes.Call),
new CodeMatch(ci => ci.IsStloc()),
new CodeMatch(OpCodes.Call),
new CodeMatch(ci => ci.IsStloc()),
new CodeMatch(OpCodes.Call),
new CodeMatch(ci => ci.IsStloc()),
new CodeMatch(ci => ci.IsLdloc()),
new CodeMatch(ci => ci.Branches(out _)),
new CodeMatch(OpCodes.Ldarg_0)
).Advance(8).Insert(
new CodeInstruction(OpCodes.Ldloc_S, 45),
new CodeInstruction(OpCodes.Brfalse, branch1)
);
return matcher.InstructionEnumeration();
}
}
} }

View File

@@ -14,6 +14,7 @@ public static class PlayerPatch
public static ConfigEntry<bool> HideTipsForSandsChangesEnabled; public static ConfigEntry<bool> HideTipsForSandsChangesEnabled;
public static ConfigEntry<bool> AutoNavigationEnabled; public static ConfigEntry<bool> AutoNavigationEnabled;
public static ConfigEntry<bool> AutoCruiseEnabled; public static ConfigEntry<bool> AutoCruiseEnabled;
public static ConfigEntry<bool> AutoBoostEnabled;
public static ConfigEntry<double> DistanceToWarp; public static ConfigEntry<double> DistanceToWarp;
private static PressKeyBind _autoDriveKey; private static PressKeyBind _autoDriveKey;
@@ -237,13 +238,14 @@ public static class PlayerPatch
} }
return; return;
} }
var autoCruise = AutoCruiseEnabled.Value;
if (GameMain.instance.timei % 6 == 0 || _direction == Vector3.zero) if (GameMain.instance.timei % 6 == 0 || _direction == Vector3.zero)
{ {
_direction = astroVec.normalized; _direction = astroVec.normalized;
/* Check nearest astroes, try to bypass them */ /* Check nearest astroes, try to bypass them */
var localStar = GameMain.localStar; var localStar = GameMain.localStar;
_canUseWarper = AutoCruiseEnabled.Value && !player.warping && player.mecha.warpStorage.GetItemCount(1210) > 0; _canUseWarper = autoCruise && !player.warping && player.mecha.warpStorage.GetItemCount(1210) > 0;
if (localStar != null) if (localStar != null)
{ {
var nearestRange = (playerPos - localStar.uPosition).sqrMagnitude; var nearestRange = (playerPos - localStar.uPosition).sqrMagnitude;
@@ -304,7 +306,7 @@ public static class PlayerPatch
if (player.warping) if (player.warping)
{ {
_speedUp = false; _speedUp = false;
if (AutoCruiseEnabled.Value) if (autoCruise)
{ {
/* Speed down if too close */ /* Speed down if too close */
var actionSail = controller.actionSail; var actionSail = controller.actionSail;
@@ -327,7 +329,7 @@ public static class PlayerPatch
{ {
var mecha = player.mecha; var mecha = player.mecha;
var energyRatio = mecha.coreEnergy / mecha.coreEnergyCap; var energyRatio = mecha.coreEnergy / mecha.coreEnergyCap;
if (_canUseWarper && GameMain.localPlanet == null && distance > GalaxyData.AU * DistanceToWarp.Value && energyRatio >= 0.5 && player.mecha.UseWarper()) if (_canUseWarper && GameMain.localPlanet == null && distance > GalaxyData.AU * DistanceToWarp.Value && energyRatio >= 0.8 && player.mecha.UseWarper())
{ {
player.warpCommand = true; player.warpCommand = true;
VFAudio.Create("warp-begin", player.transform, Vector3.zero, true); VFAudio.Create("warp-begin", player.transform, Vector3.zero, true);
@@ -335,7 +337,7 @@ public static class PlayerPatch
else else
{ {
/* Speed up if needed */ /* Speed up if needed */
_speedUp = speed + 0.2f < player.mecha.maxSailSpeed && energyRatio >= 0.1; _speedUp = autoCruise && AutoBoostEnabled.Value && speed + 0.2f < player.mecha.maxSailSpeed && energyRatio >= 0.1;
} }
} }

View File

@@ -4,11 +4,19 @@
#### 一些提升用户体验的功能和补丁 #### 一些提升用户体验的功能和补丁
## Changlog ## Changlog
* 1.0.23
+ New features:
- `Do not render factory entities (except belts and sorters)`
- This also makes players click though factory entities but belts
- `Open Dark Fog Communicator` anywhere
+ Belts can be built off-grid now, by pressing the shortcut key for `Switch Splitter model`(`Tab` by default)
+ Add a suboption `Auto boost` to `Auto-cruise`
+ `Auto-cruise` does warp when core energy at least 80% now
* 1.0.22 * 1.0.22
+ Fix a crash issue caused by `Quick build and dismantle stacking labs` + Fix a crash issue caused by `Quick build and dismantle stacking labs`
* 1.0.21 * 1.0.21
+ Fix a bug that stepped rotation is not working in `Off-grid building and stepped rotation`, which is caused by latest game update + 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 speeds up when core energy at least 10% and warps when core energy at least 50% + 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 * 1.0.20
+ Fix a infinite-loop issue when `Quick build and dismantle stacking labs` and `No condition build` are both enabled + Fix a 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 + Fix a crash caused by `Re-initialize planet` in combat mode
@@ -109,15 +117,30 @@
- Remember window position and size on last exit - Remember window position and size on last exit
- Convert Peace-Mode saves to Combat-Mode on loading - Convert Peace-Mode saves to Combat-Mode on loading
+ Planet/Factory + Planet/Factory
- Unlimited interactive range
- Sunlight at night - Sunlight at night
- Remove some build conditions - Remove some build conditions
- Remove build count and range limit - Remove build count and range limit
- Larger area for upgrade and dismantle(30x30 at max) - Larger area for upgrade and dismantle(30x30 at max)
- Larger area for terraform(30x30 at max) - Larger area for terraform(30x30 at max)
- Enable player actions in globe view
- Treat stack items as single in monitor components - Treat stack items as single in monitor components
- Enhanced control for logistic storage limits
- Logistic storage limits are not scaled on upgrading `Logistics Carrier Capacity`, if they are not set to maximum capacity.
- You can use arrow keys to adjust logistic storage limits gracefully.
- Quick build and dismantle stacking labs
- Protect veins from exhaustion
- 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.
- 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`
- Do not render factory entities (except belts and sorters)
- This also makes players click though factory entities but belts
- Re-intialize planet (without reseting veins)
- Quick dismantle all buildings (without drops)
- Quick build Orbital Collectors
+ Player/Mecha
- Unlimited interactive range
- Enable player actions in globe view
- Hide tips for soil piles changes - Hide tips for soil piles changes
- Enhanced count control for hand-make
- Auto navigation on sailings - Auto navigation on sailings
- It keeps Icarus on course to the target planet - It keeps Icarus on course to the target planet
- It will try to bypass any obstacles(planets, stars or dark-fog hives) on the way - It will try to bypass any obstacles(planets, stars or dark-fog hives) on the way
@@ -125,23 +148,13 @@
- Auto-cruise will start when you select a planet as target - Auto-cruise will start when you select a planet as target
- It will use warper to fly to the target planet if the planet is too far away, the range can be configured. - It will use warper to fly to the target planet if the planet is too far away, the range can be configured.
- It will speed down when approaching the target planet, to avoid overshooting - It will speed down when approaching the target planet, to avoid overshooting
- Enhanced control for logistic storage limits
- Logistic storage limits are not scaled on upgrading `Logistics Carrier Capacity`, if they are not set to maximum capacity.
- You can use arrow keys to adjust logistic storage limits gracefully.
- Enhanced count control for hand-make
- Quick build and dismantle stacking labs
- Protect veins from exhaustion
- 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.
- 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`
- Re-intialize planet (without reseting veins)
- Quick dismantle all buildings (without drops)
- Quick build Orbital Collectors
+ Dyson Sphere + Dyson Sphere
- Stop ejectors when available nodes are all filled up - Stop ejectors when available nodes are all filled up
- Construct only nodes but frames - Construct only nodes but frames
- Re-initialize Dyson Spheres - Re-initialize Dyson Spheres
- Quick dismantle Dyson Shells - Quick dismantle Dyson Shells
+ Combat
- Open Dark Fog Communicator anywhere
## Notes ## Notes
* Please upgrade `BepInEx` 5.4.21 or later if using with [BlueprintTweaks](https://dsp.thunderstore.io/package/kremnev8/BlueprintTweaks/) to avoid possible conflicts. * Please upgrade `BepInEx` 5.4.21 or later if using with [BlueprintTweaks](https://dsp.thunderstore.io/package/kremnev8/BlueprintTweaks/) to avoid possible conflicts.
@@ -156,6 +169,14 @@
* [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.23
+ 新功能:
- `不渲染工厂建筑实体(除了传送带和分拣器)`
- 这使得玩家可以点穿工厂实体直接点到传送带
- 在任意位置`打开黑雾通讯器`
+ 传送带现在可以脱离网格建造了,通过按住`切换分流器样式`的快捷键(默认`Tab`)
+ 为`自动巡航`添加一个子选项`自动加速`
+ `自动巡航`现在在核心能量至少80%时才加速
* 1.0.22 * 1.0.22
+ 修复了`快速建造和拆除堆叠研究站`导致的崩溃问题 + 修复了`快速建造和拆除堆叠研究站`导致的崩溃问题
* 1.0.21 * 1.0.21
@@ -168,7 +189,7 @@
+ 新功能: + 新功能:
- `快速建造和拆除堆叠研究站` - `快速建造和拆除堆叠研究站`
- `保护矿脉不会耗尽` - `保护矿脉不会耗尽`
- 默认矿脉数量保护100采油速保护1.0/s你可以在配置文件中自行设置。 - 默认矿脉数量保护于剩余100采油速保护于速度1.0/s你可以在配置文件中自行设置。
- 当达到保护值时,矿脉和油井将不再被开采。 - 当达到保护值时,矿脉和油井将不再被开采。
- 关闭此功能以恢复开采,一般是当你在`矿物利用`上有足够的等级时。 - 关闭此功能以恢复开采,一般是当你在`矿物利用`上有足够的等级时。
+ 移除了`自动巡航`的默认快捷键,以避免误操作。如有需要请手动在系统选项窗口中设置。 + 移除了`自动巡航`的默认快捷键,以避免误操作。如有需要请手动在系统选项窗口中设置。
@@ -263,15 +284,29 @@
- 将元数据提取的最大数量增加到20000(原来为2000) - 将元数据提取的最大数量增加到20000(原来为2000)
- 将玩家指令队列的容量增加到128(原来为16) - 将玩家指令队列的容量增加到128(原来为16)
+ 行星/工厂 + 行星/工厂
- 无限交互距离
- 夜间日光灯 - 夜间日光灯
- 移除部分不影响游戏逻辑的建造条件 - 移除部分不影响游戏逻辑的建造条件
- 移除建造数量和范围限制
- 范围升级和拆除的最大区域扩大(最大30x30) - 范围升级和拆除的最大区域扩大(最大30x30)
- 范围铺设地基的最大区域扩大(最大30x30) - 范围铺设地基的最大区域扩大(最大30x30)
- 在行星视图中允许玩家操作
- 在流速计中将堆叠物品视为单个物品 - 在流速计中将堆叠物品视为单个物品
- 物流塔存储数量限制控制改进
- 当升级`运输机舱扩容`时,不会对各种物流塔的存储限制按比例提升,除非设置为最大允许容量。
- 你可以使用方向键微调物流塔存储限制
- 快速建造和拆除堆叠研究站
- 保护矿脉不会耗尽
- 默认矿脉数量保护在100采油速保护在1.0/s你可以在配置文件中自行设置。
- 当达到保护值时,矿脉和油井将不再被开采。
- 关闭此功能以恢复开采,一般是当你在`矿物利用`上有足够的等级时。
- 不渲染工厂建筑实体(除了传送带和分拣器)
- 初始化本行星(不重置矿脉)
- 快速拆除所有建筑(不掉落)
- 快速建造轨道采集器
+ 玩家/机甲
- 无限交互距离
- 移除建造数量和范围限制
- 在行星视图中允许玩家操作
- 隐藏沙土数量变动的提示 - 隐藏沙土数量变动的提示
- 手动制造物品的数量控制改进
- 航行时自动导航 - 航行时自动导航
- 它会保持伊卡洛斯飞向目标星球 - 它会保持伊卡洛斯飞向目标星球
- 它会尝试绕过途中的任何障碍物(行星、恒星或黑雾巢穴) - 它会尝试绕过途中的任何障碍物(行星、恒星或黑雾巢穴)
@@ -279,23 +314,13 @@
- 当你选择目标星球后,自动巡航就会开始 - 当你选择目标星球后,自动巡航就会开始
- 如果目标星球距离过远会自动使用曲速(超过5AU),你可以在面板上更改这个值。 - 如果目标星球距离过远会自动使用曲速(超过5AU),你可以在面板上更改这个值。
- 它会在接近目标星球时减速,以避免发生越过目标的情况 - 它会在接近目标星球时减速,以避免发生越过目标的情况
- 物流塔存储数量限制控制改进
- 当升级`运输机舱扩容`时,不会对各种物流塔的存储限制按比例提升,除非设置为最大允许容量。
- 你可以使用方向键微调物流塔存储限制
- 手动制造物品的数量控制改进
- 快速建造和拆除堆叠研究站
- 保护矿脉不会耗尽
- 默认矿脉数量保护在100采油速保护在1.0/s你可以在配置文件中自行设置。
- 当达到保护值时,矿脉和油井将不再被开采。
- 关闭此功能以恢复开采,一般是当你在`矿物利用`上有足够的等级时。
- 初始化本行星(不重置矿脉)
- 快速拆除所有建筑(不掉落)
- 快速建造轨道采集器
+ 戴森球 + 戴森球
- 可用节点全部造完时停止弹射 - 可用节点全部造完时停止弹射
- 只建造节点不建造框架 - 只建造节点不建造框架
- 初始化戴森球 - 初始化戴森球
- 快速拆除戴森壳 - 快速拆除戴森壳
+ 战斗
- 在任意位置打开黑雾通讯器
## 注意事项 ## 注意事项
* 如果和[BlueprintTweaks](https://dsp.thunderstore.io/package/kremnev8/BlueprintTweaks/)一起使用,请升级`BepInEx`到5.4.21或更高版本,以避免可能的冲突。 * 如果和[BlueprintTweaks](https://dsp.thunderstore.io/package/kremnev8/BlueprintTweaks/)一起使用,请升级`BepInEx`到5.4.21或更高版本,以避免可能的冲突。

View File

@@ -16,7 +16,9 @@ public static class UIConfigWindow
I18N.Add("UXAssist", "UXAssist", "UX助手"); I18N.Add("UXAssist", "UXAssist", "UX助手");
I18N.Add("General", "General", "常规"); I18N.Add("General", "General", "常规");
I18N.Add("Planet/Factory", "Planet/Factory", "行星/工厂"); I18N.Add("Planet/Factory", "Planet/Factory", "行星/工厂");
I18N.Add("Player/Mecha", "Player/Mecha", "玩家/机甲");
I18N.Add("Dyson Sphere", "Dyson Sphere", "戴森球"); I18N.Add("Dyson Sphere", "Dyson Sphere", "戴森球");
I18N.Add("Combat", "Combat", "战斗");
I18N.Add("Enable game window resize", "Enable game window resize (maximum box and thick frame)", "可调整游戏窗口大小(可最大化和拖动边框)"); I18N.Add("Enable game window resize", "Enable game window resize (maximum box and thick frame)", "可调整游戏窗口大小(可最大化和拖动边框)");
I18N.Add("Remeber window position and size on last exit", "Remeber window position and size on last exit", "记住上次退出时的窗口位置和大小"); I18N.Add("Remeber window position and size on last exit", "Remeber window position and size on last exit", "记住上次退出时的窗口位置和大小");
/* /*
@@ -39,8 +41,11 @@ public static class UIConfigWindow
I18N.Add("Enhanced count control for hand-make tips", "Maximum count is increased to 1000.\nHold Ctrl/Shift/Alt to change the count rapidly.", "最大数量提升至1000\n按住Ctrl/Shift/Alt可快速改变数量"); I18N.Add("Enhanced count control for hand-make tips", "Maximum count is increased to 1000.\nHold Ctrl/Shift/Alt to change the count rapidly.", "最大数量提升至1000\n按住Ctrl/Shift/Alt可快速改变数量");
I18N.Add("Quick build and dismantle stacking labs", "Quick build and dismantle stacking labs(hold shift)", "快速建造和拆除堆叠研究站(按住shift)"); I18N.Add("Quick build and dismantle stacking labs", "Quick build and dismantle stacking labs(hold shift)", "快速建造和拆除堆叠研究站(按住shift)");
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("Do not render factory entities", "Do not render factory entities (except belts and sorters)", "不渲染工厂建筑实体(除了传送带和分拣器)");
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("Distance to use warp", "Distance to use warp (AU)", "使用曲速的距离(AU)"); I18N.Add("Distance to use warp", "Distance to use warp (AU)", "使用曲速的距离(AU)");
I18N.Add("Treat stack items as single in monitor components", "Treat stack items as single in monitor components", "在流速计中将堆叠物品视为单个物品"); I18N.Add("Treat stack items as single in monitor components", "Treat stack items as single in monitor components", "在流速计中将堆叠物品视为单个物品");
I18N.Add("Initialize This Planet", "Initialize this planet", "初始化本行星"); I18N.Add("Initialize This Planet", "Initialize this planet", "初始化本行星");
@@ -57,6 +62,7 @@ public static class UIConfigWindow
I18N.Add("Click to dismantle selected layer", "Click to dismantle selected layer", "点击拆除对应的戴森壳"); I18N.Add("Click to dismantle selected layer", "Click to dismantle selected layer", "点击拆除对应的戴森壳");
I18N.Add("Dismantle selected layer", "Dismantle selected layer", "拆除选中的戴森壳"); I18N.Add("Dismantle selected layer", "Dismantle selected layer", "拆除选中的戴森壳");
I18N.Add("Dismantle selected layer Confirm", "This operation will dismantle selected layer, are you sure?", "此操作将会拆除选中的戴森壳,确定吗?"); I18N.Add("Dismantle selected layer Confirm", "This operation will dismantle selected layer, are you sure?", "此操作将会拆除选中的戴森壳,确定吗?");
I18N.Add("Open Dark Fog Communicator", "Open Dark Fog Communicator", "打开黑雾通讯器");
I18N.Apply(); I18N.Apply();
MyConfigWindow.OnUICreated += CreateUI; MyConfigWindow.OnUICreated += CreateUI;
MyConfigWindow.OnUpdateUI += UpdateUI; MyConfigWindow.OnUpdateUI += UpdateUI;
@@ -85,8 +91,6 @@ public static class UIConfigWindow
var tab2 = wnd.AddTab(trans, "Planet/Factory"); var tab2 = wnd.AddTab(trans, "Planet/Factory");
x = 0f; x = 0f;
y = 10f; y = 10f;
MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.UnlimitInteractiveEnabled, "Unlimited interactive range");
y += 36f;
MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.RemoveSomeConditionEnabled, "Remove some build conditions"); MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.RemoveSomeConditionEnabled, "Remove some build conditions");
y += 36f; y += 36f;
MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.RemoveBuildRangeLimitEnabled, "Remove build range limit"); MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.RemoveBuildRangeLimitEnabled, "Remove build range limit");
@@ -101,45 +105,21 @@ public static class UIConfigWindow
y += 36f; y += 36f;
MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.TreatStackingAsSingleEnabled, "Treat stack items as single in monitor components"); MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.TreatStackingAsSingleEnabled, "Treat stack items as single in monitor components");
y += 36f; y += 36f;
MyCheckBox.CreateCheckBox(x, y, tab2, PlanetPatch.PlayerActionsInGlobeViewEnabled, "Enable player actions in globe view");
y += 36f;
MyCheckBox.CreateCheckBox(x, y, tab2, PlayerPatch.HideTipsForSandsChangesEnabled, "Hide tips for soil piles changes");
y += 36f;
MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.LogisticsCapacityTweaksEnabled, "Enhance control for logistic storage limits"); MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.LogisticsCapacityTweaksEnabled, "Enhance control for logistic storage limits");
x = 270f; x = 270f;
y += 6f; y += 6f;
MyWindow.AddTipsButton(x, y, tab2, "Enhance control for logistic storage limits", "Enhance control for logistic storage limits tips", "enhanced-logistic-limit-tips"); MyWindow.AddTipsButton(x, y, tab2, "Enhance control for logistic storage limits", "Enhance control for logistic storage limits tips", "enhanced-logistic-limit-tips");
x = 0f; x = 0f;
y += 30f; y += 30f;
MyCheckBox.CreateCheckBox(x, y, tab2, PlayerPatch.EnhancedMechaForgeCountControlEnabled, "Enhanced count control for hand-make");
x = 270f;
y += 6f;
MyWindow.AddTipsButton(x, y, tab2, "Enhanced count control for hand-make", "Enhanced count control for hand-make tips", "enhanced-count-control-tips");
x = 0f;
y += 30f;
MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.QuickBuildAndDismantleLabsEnabled, "Quick build and dismantle stacking labs"); MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.QuickBuildAndDismantleLabsEnabled, "Quick build and dismantle stacking labs");
y += 36f; y += 36f;
MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.ProtectVeinsFromExhaustionEnabled, "Protect veins from exhaustion"); MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.ProtectVeinsFromExhaustionEnabled, "Protect veins from exhaustion");
x = 350f; x = 270f;
y -= 108f; y += 6f;
MyCheckBox.CreateCheckBox(x, y, tab2, PlayerPatch.AutoNavigationEnabled, "Auto navigation on sailings"); MyWindow.AddTipsButton(x, y, tab2, "Protect veins from exhaustion", "Protect veins from exhaustion tips", "protect-veins-tips");
x += 20f; x = 0f;
y += 36f; y += 30f;
MyCheckBox.CreateCheckBox(x, y, tab2, PlayerPatch.AutoCruiseEnabled, "Enable auto-cruise", 14); MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.DoNotRenderEntitiesEnabled, "Do not render factory entities");
x -= 20f;
y += 36f;
MyWindow.AddText(x, y, tab2, "Distance to use warp", 15, "text-distance-to-warp");
y += 24f;
var distanceToWarp = MySlider.CreateSlider(x, y, tab2, (float)Math.Round(PlayerPatch.DistanceToWarp.Value * 2.0), 1f, 40f, "0.0", 200f);
if (PlanetFunctions.OrbitalCollectorMaxBuildCount.Value == 0)
{
distanceToWarp.SetLabelText(PlayerPatch.DistanceToWarp.Value.ToString("0.0"));
}
distanceToWarp.OnValueChanged += () =>
{
PlayerPatch.DistanceToWarp.Value = Math.Round(distanceToWarp.Value) * 0.5;
distanceToWarp.SetLabelText(PlayerPatch.DistanceToWarp.Value.ToString("0.0"));
};
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", () =>
@@ -175,27 +155,63 @@ public static class UIConfigWindow
} }
}; };
var tab3 = wnd.AddTab(trans, "Dyson Sphere"); var tab3 = wnd.AddTab(trans, "Player/Mecha");
x = 0f; x = 0f;
y = 10f; y = 10f;
MyCheckBox.CreateCheckBox(x, y, tab3, DysonSpherePatch.StopEjectOnNodeCompleteEnabled, "Stop ejectors when available nodes are all filled up"); MyCheckBox.CreateCheckBox(x, y, tab3, FactoryPatch.UnlimitInteractiveEnabled, "Unlimited interactive range");
y += 36f; y += 36f;
MyCheckBox.CreateCheckBox(x, y, tab3, DysonSpherePatch.OnlyConstructNodesEnabled, "Construct only nodes but frames"); MyCheckBox.CreateCheckBox(x, y, tab3, PlanetPatch.PlayerActionsInGlobeViewEnabled, "Enable player actions in globe view");
y += 36f;
MyCheckBox.CreateCheckBox(x, y, tab3, PlayerPatch.HideTipsForSandsChangesEnabled, "Hide tips for soil piles changes");
y += 36f;
MyCheckBox.CreateCheckBox(x, y, tab3, PlayerPatch.EnhancedMechaForgeCountControlEnabled, "Enhanced count control for hand-make");
x = 270f;
y += 6f;
MyWindow.AddTipsButton(x, y, tab3, "Enhanced count control for hand-make", "Enhanced count control for hand-make tips", "enhanced-count-control-tips");
x = 0f;
y += 30f;
MyCheckBox.CreateCheckBox(x, y, tab3, PlayerPatch.AutoNavigationEnabled, "Auto navigation on sailings");
x = 20f;
y += 36f;
MyCheckBox.CreateCheckBox(x, y, tab3, PlayerPatch.AutoCruiseEnabled, "Enable auto-cruise", 14);
x = 10f;
y += 32f;
MyCheckBox.CreateCheckBox(x, y, tab3, PlayerPatch.AutoBoostEnabled, "Auto boost", 15);
y += 32f;
MyWindow.AddText(x, y, tab3, "Distance to use warp", 15, "text-distance-to-warp");
y += 24f;
var distanceToWarp = MySlider.CreateSlider(x, y, tab3, (float)Math.Round(PlayerPatch.DistanceToWarp.Value * 2.0), 1f, 40f, "0.0", 200f);
if (PlanetFunctions.OrbitalCollectorMaxBuildCount.Value == 0)
{
distanceToWarp.SetLabelText(PlayerPatch.DistanceToWarp.Value.ToString("0.0"));
}
distanceToWarp.OnValueChanged += () =>
{
PlayerPatch.DistanceToWarp.Value = Math.Round(distanceToWarp.Value) * 0.5;
distanceToWarp.SetLabelText(PlayerPatch.DistanceToWarp.Value.ToString("0.0"));
};
var tab4 = wnd.AddTab(trans, "Dyson Sphere");
x = 0f;
y = 10f;
MyCheckBox.CreateCheckBox(x, y, tab4, DysonSpherePatch.StopEjectOnNodeCompleteEnabled, "Stop ejectors when available nodes are all filled up");
y += 36f;
MyCheckBox.CreateCheckBox(x, y, tab4, DysonSpherePatch.OnlyConstructNodesEnabled, "Construct only nodes but frames");
x = 400f; x = 400f;
y = 10f; y = 10f;
wnd.AddButton(x, y, tab3, "Initialize Dyson Sphere", 16, "init-dyson-sphere", () => wnd.AddButton(x, y, tab4, "Initialize Dyson Sphere", 16, "init-dyson-sphere", () =>
UIMessageBox.Show("Initialize Dyson Sphere".Translate(), "Initialize Dyson Sphere Confirm".Translate(), "取消".Translate(), "确定".Translate(), 2, null, () => UIMessageBox.Show("Initialize Dyson Sphere".Translate(), "Initialize Dyson Sphere Confirm".Translate(), "取消".Translate(), "确定".Translate(), 2, null, () =>
{ {
DysonSpherePatch.InitCurrentDysonSphere(-1); DysonSpherePatch.InitCurrentDysonSphere(-1);
}) })
); );
y += 36f; y += 36f;
MyWindow.AddText(x, y, tab3, "Click to dismantle selected layer", 16, "text-dismantle-layer"); MyWindow.AddText(x, y, tab4, "Click to dismantle selected layer", 16, "text-dismantle-layer");
y += 26f; y += 26f;
for (var i = 0; i < 10; i++) for (var i = 0; i < 10; i++)
{ {
var id = i + 1; var id = i + 1;
var btn = wnd.AddFlatButton(x, y, tab3, id.ToString(), 12, "dismantle-layer-" + id, () => var btn = wnd.AddFlatButton(x, y, tab4, id.ToString(), 12, "dismantle-layer-" + id, () =>
UIMessageBox.Show("Dismantle selected layer".Translate(), "Dismantle selected layer Confirm".Translate(), "取消".Translate(), "确定".Translate(), 2, null, () => UIMessageBox.Show("Dismantle selected layer".Translate(), "Dismantle selected layer Confirm".Translate(), "取消".Translate(), "确定".Translate(), 2, null, () =>
{ {
DysonSpherePatch.InitCurrentDysonSphere(id); DysonSpherePatch.InitCurrentDysonSphere(id);
@@ -213,7 +229,19 @@ public static class UIConfigWindow
x += 40f; x += 40f;
} }
} }
_dysonTab = tab3; _dysonTab = tab4;
var tab5 = wnd.AddTab(_windowTrans, "Combat");
x = 10;
y = 10;
wnd.AddButton(x, y, tab5, "Open Dark Fog Communicator", 16, "button-open-df-communicator", () =>
{
if (!(GameMain.data?.gameDesc.isCombatMode ?? false)) return;
var uiGame = UIRoot.instance.uiGame;
uiGame.ShutPlayerInventory();
uiGame.CloseEnemyBriefInfo();
uiGame.OpenCommunicatorWindow(5);
});
} }
private static void UpdateUI() private static void UpdateUI()

View File

@@ -74,15 +74,19 @@ public class UXAssist : BaseUnityPlugin
"Protect veins from exhaustion"); "Protect veins from exhaustion");
FactoryPatch.ProtectVeinsFromExhaustion.KeepVeinAmount = Config.Bind("Factory", "KeepVeinAmount", 100, new ConfigDescription("Keep veins amount (0 to disable)", new AcceptableValueRange<int>(0, 1000))).Value; FactoryPatch.ProtectVeinsFromExhaustion.KeepVeinAmount = Config.Bind("Factory", "KeepVeinAmount", 100, new ConfigDescription("Keep veins amount (0 to disable)", new AcceptableValueRange<int>(0, 1000))).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.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,
"Do not render factory entities");
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,
"Enhanced count control for hand-make, increases maximum of count to 1000, and you can hold Ctrl/Shift/Alt to change the count rapidly");
PlayerPatch.HideTipsForSandsChangesEnabled = Config.Bind("Player", "HideTipsForGettingSands", false, PlayerPatch.HideTipsForSandsChangesEnabled = Config.Bind("Player", "HideTipsForGettingSands", false,
"Hide tips for getting soil piles"); "Hide tips for getting soil piles");
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");
PlayerPatch.AutoNavigationEnabled = Config.Bind("Player", "AutoNavigation", false, PlayerPatch.AutoNavigationEnabled = Config.Bind("Player", "AutoNavigation", false,
"Auto navigation"); "Auto navigation");
PlayerPatch.AutoCruiseEnabled = Config.Bind("Player", "AutoCruise", false, PlayerPatch.AutoCruiseEnabled = Config.Bind("Player", "AutoCruise", false,
"Auto-cruise enabled"); "Auto-cruise enabled");
PlayerPatch.AutoBoostEnabled = Config.Bind("Player", "AutoBoost", false,
"Auto boost speed with auto-cruise enabled");
PlayerPatch.DistanceToWarp = Config.Bind("Player", "DistanceToWarp", 5.0, "Distance to warp (in AU)"); PlayerPatch.DistanceToWarp = Config.Bind("Player", "DistanceToWarp", 5.0, "Distance to warp (in AU)");
DysonSpherePatch.StopEjectOnNodeCompleteEnabled = Config.Bind("DysonSphere", "StopEjectOnNodeComplete", false, DysonSpherePatch.StopEjectOnNodeCompleteEnabled = Config.Bind("DysonSphere", "StopEjectOnNodeComplete", false,
"Stop ejectors when available nodes are all filled up"); "Stop ejectors when available nodes are all filled up");
@@ -401,4 +405,12 @@ public class UXAssist : BaseUnityPlugin
); );
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
// Ignore UIDFCommunicatorWindow.Determine()
[HarmonyPrefix]
[HarmonyPatch(typeof(UIDFCommunicatorWindow), nameof(UIDFCommunicatorWindow.Determine))]
private static bool UIDFCommunicatorWindow_Determine_Prefix()
{
return false;
}
} }

View File

@@ -4,7 +4,7 @@
<TargetFramework>net472</TargetFramework> <TargetFramework>net472</TargetFramework>
<BepInExPluginGuid>org.soardev.uxassist</BepInExPluginGuid> <BepInExPluginGuid>org.soardev.uxassist</BepInExPluginGuid>
<Description>DSP MOD - UXAssist</Description> <Description>DSP MOD - UXAssist</Description>
<Version>1.0.22</Version> <Version>1.0.23</Version>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
<PackageId>UXAssist</PackageId> <PackageId>UXAssist</PackageId>

View File

@@ -1,6 +1,6 @@
{ {
"name": "UXAssist", "name": "UXAssist",
"version_number": "1.0.22", "version_number": "1.0.23",
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/UXAssist", "website_url": "https://github.com/soarqin/DSP_Mods/tree/master/UXAssist",
"description": "Some functions and patches for better user experience / 一些提升用户体验的功能和补丁", "description": "Some functions and patches for better user experience / 一些提升用户体验的功能和补丁",
"dependencies": [ "dependencies": [