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

UXAssist and CheatEnabler new releases

This commit is contained in:
2024-08-30 19:14:34 +08:00
parent 287cfbbed4
commit 92445a452a
14 changed files with 408 additions and 263 deletions

View File

@@ -1,5 +1,10 @@
## Changlog
* 2.3.24
+ `Complete Dyson Sphere Shells instantly`: Fix a bug that may cause negative power in some cases
* 2.3.23
+ New feature: `Complete Dyson Sphere Shells instantly`
+ Fix a crash when config panel is opened before game is fully loaded
* 2.3.22
+ Fix `Pump Anywhere`
* 2.3.21
@@ -122,6 +127,11 @@
## 更新日志
* 2.3.24
+ `立即完成戴森壳建造`:修复了在某些情况下可能导致发电为负的问题
* 2.3.23
+ 新功能:`立即完成戴森壳建造`
+ 修复了在游戏完全加载前打开配置面板可能导致的崩溃问题
* 2.3.22
+ 修复了`平地抽水`
* 2.3.21

View File

@@ -86,6 +86,7 @@ public class CheatEnabler : BaseUnityPlugin
PlayerFunctions.Init();
PlayerPatch.Init();
DysonSpherePatch.Init();
DysonSphereFunctions.Init();
CombatPatch.Init();
}

View File

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

View File

@@ -0,0 +1,121 @@
using HarmonyLib;
using UXAssist.Common;
namespace CheatEnabler;
public static class DysonSphereFunctions
{
public static void Init()
{
I18N.Add("You are not in any system.", "You are not in any system.", "你不在任何星系中");
I18N.Add("There is no Dyson Sphere shell on \"{0}\".", "There is no Dyson Sphere shell on \"{0}\".", "“{0}”上没有可建造的戴森壳");
I18N.Add("This will complete all Dyson Sphere shells on \"{0}\" instantly. Are you sure?", "This will complete all Dyson Sphere shells on \"{0}\" instantly. Are you sure?", "这将立即完成“{0}”上的所有戴森壳。你确定吗?");
}
public static void CompleteShellsInstantly()
{
StarData star = null;
var dysonEditor = UIRoot.instance?.uiGame?.dysonEditor;
if (dysonEditor != null && dysonEditor.gameObject.activeSelf)
{
star = dysonEditor.selection.viewStar;
}
if (star == null)
{
star = GameMain.data?.localStar;
if (star == null)
{
UIMessageBox.Show("CheatEnabler".Translate(), "You are not in any system.".Translate(), "确定".Translate(), 3, null);
return;
}
}
var dysonSphere = GameMain.data?.dysonSpheres[star.index];
if (dysonSphere == null || dysonSphere.layerCount == 0)
{
UIMessageBox.Show("CheatEnabler".Translate(), string.Format("There is no Dyson Sphere shell on \"{0}\".".Translate(), star.displayName), "确定".Translate(), 3, null);
return;
}
UIMessageBox.Show("CheatEnabler".Translate(), string.Format("This will complete all Dyson Sphere shells on \"{0}\" instantly. Are you sure?".Translate(), star.displayName), "取消".Translate(), "确定".Translate(), 2, null, () =>
{
var totalNodeSpInfo = AccessTools.Field(typeof(DysonSphereLayer), "totalNodeSP");
var totalFrameSpInfo = AccessTools.Field(typeof(DysonSphereLayer), "totalFrameSP");
var totalCpInfo = AccessTools.Field(typeof(DysonSphereLayer), "totalCP");
var rocketCount = 0;
var solarSailCount = 0;
foreach (var dysonSphereLayer in dysonSphere.layersIdBased)
{
if (dysonSphereLayer == null) continue;
long totalNodeSp = 0;
long totalFrameSp = 0;
long totalCp = 0;
for (var i = dysonSphereLayer.frameCursor - 1; i >= 0; i--)
{
var dysonFrame = dysonSphereLayer.framePool[i];
if (dysonFrame == null || dysonFrame.id != i) continue;
totalFrameSp += dysonFrame.spMax;
var spMax = dysonFrame.spMax / 2;
if (dysonFrame.spA < spMax)
{
rocketCount += spMax - dysonFrame.spA;
dysonFrame.spA = spMax;
dysonSphere.UpdateProgress(dysonFrame);
}
if (dysonFrame.spB < spMax)
{
rocketCount += spMax - dysonFrame.spB;
dysonFrame.spB = spMax;
dysonSphere.UpdateProgress(dysonFrame);
}
}
for (var i = dysonSphereLayer.nodeCursor - 1; i >= 0; i--)
{
var dysonNode = dysonSphereLayer.nodePool[i];
if (dysonNode == null || dysonNode.id != i) continue;
dysonNode.spOrdered = 0;
dysonNode._spReq = 0;
totalNodeSp += dysonNode.spMax;
var diff = dysonNode.spMax - dysonNode.sp;
if (diff > 0)
{
rocketCount += diff;
dysonNode.sp = dysonNode.spMax;
dysonSphere.UpdateProgress(dysonNode);
}
dysonNode._cpReq = 0;
dysonNode.cpOrdered = 0;
foreach (var shell in dysonNode.shells)
{
var nodeIndex = shell.nodeIndexMap[dysonNode.id];
var cpMax = (shell.vertsqOffset[nodeIndex + 1] - shell.vertsqOffset[nodeIndex]) * shell.cpPerVertex;
totalCp += cpMax;
diff = cpMax - shell.nodecps[nodeIndex];
shell.nodecps[nodeIndex] = cpMax;
shell.nodecps[shell.nodecps.Length - 1] += diff;
solarSailCount += diff;
if (totalCpInfo != null)
{
shell.SetMaterialDynamicVars();
}
}
}
totalNodeSpInfo?.SetValue(dysonSphereLayer, totalNodeSp);
totalFrameSpInfo?.SetValue(dysonSphereLayer, totalFrameSp);
totalCpInfo?.SetValue(dysonSphereLayer, totalCp);
}
dysonSphere.CheckAutoNodes();
var productRegister = dysonSphere.productRegister;
if (productRegister != null)
{
lock (productRegister)
{
if (rocketCount > 0) productRegister[11902] += rocketCount;
if (solarSailCount > 0) productRegister[11903] += solarSailCount;
}
}
});
}
}

View File

@@ -43,6 +43,7 @@
+ Skip absorption period
+ Quick absorb
+ Eject anyway
+ Complete Dyson Sphere Shells instantly
+ Mecha/Combat:
+ Mecha and Drones/Fleets invicible
+ Buildings invicible
@@ -100,6 +101,7 @@
+ 跳过吸收阶段
+ 快速吸收
+ 全球弹射
+ 立即完成戴森壳建造
+ 战斗:
+ 机甲和战斗无人机无敌
+ 建筑无敌

View File

@@ -61,6 +61,7 @@ public static class UIConfigWindow
I18N.Add("Eject anyway", "Eject anyway", "全球弹射");
I18N.Add("Overclock Ejectors", "Overclock Ejectors (10x)", "高速弹射器(10倍射速)");
I18N.Add("Overclock Silos", "Overclock Silos (10x)", "高速发射井(10倍射速)");
I18N.Add("Complete Dyson Sphere shells instantly", "Complete Dyson Sphere shells instantly", "立即完成戴森壳建造");
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", "机甲和战斗无人机无敌");
@@ -204,6 +205,9 @@ public static class UIConfigWindow
wnd.AddCheckBox(x, y, tab4, DysonSpherePatch.OverclockEjectorEnabled, "Overclock Ejectors");
y += 36f;
wnd.AddCheckBox(x, y, tab4, DysonSpherePatch.OverclockSiloEnabled, "Overclock Silos");
x = 300f;
y = 10f;
wnd.AddButton(x, y, 300f, tab4, "Complete Dyson Sphere shells instantly", 16, "button-complete-dyson-sphere-shells-instantly", DysonSphereFunctions.CompleteShellsInstantly);
var tab5 = wnd.AddTab(_windowTrans, "Mecha/Combat");
x = 0f;

View File

@@ -1,6 +1,6 @@
{
"name": "CheatEnabler",
"version_number": "2.3.22",
"version_number": "2.3.24",
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/CheatEnabler",
"description": "Add various cheat functions while disabling abnormal determinants / 添加一些作弊功能,同时屏蔽异常检测",
"dependencies": [