1
0
mirror of https://github.com/soarqin/DSP_Mods.git synced 2025-12-08 21:33:28 +08:00

CheatEnabler: illegal dyson shell functions

This commit is contained in:
2025-06-04 18:10:49 +08:00
parent ba095d79f0
commit 2c4d1b8b0d
6 changed files with 1207 additions and 12 deletions

View File

@@ -6,6 +6,10 @@
* 2.3.31
+ New feature: `Unlock Dyson Sphere max orbit radius`
+ `Remove metadata consumption record in current game`: Fix implementation
+ Add 3 buttons for creating illegal Dyson Sphere Shells, you must enable `IllegalDysonShellFunctionsEnabled` of `DysonSphere` section in config to see them.
- `Generate an illegal dyson shell`
- `Keep max production shells and remove others`
- `Duplicate shells from that with highest production`
* 2.3.30
+ Fix a warning issue while `No condition build` or `No collision` is enabled.
+ Increase performance for `Finish build immediately` greatly on pasting large blueprints.
@@ -159,6 +163,10 @@
* 2.3.31
+ 新功能:`解锁戴森球最大轨道半径`
+ `移除当前存档的元数据消耗记录`:修复实现
+ 增加了3个用于制作仙术戴森壳的按钮你必须在设置文件里开启`DysonSphere`分类的`IllegalDysonShellFunctionsEnabled`才能看到它们
- `生成单层仙术戴森壳`
- `保留发电量最高的戴森壳并移除其他戴森壳`
- `从发电量最高的壳复制戴森壳`
* 2.3.30
+ 修复了启用`无条件建造``无碰撞`时的警告问题
+ 粘贴大规模蓝图时大幅提升`立即完成建造`的性能表现

View File

@@ -87,6 +87,10 @@ public class CheatEnabler : BaseUnityPlugin
"Unlock Dyson Sphere max orbit radius");
DysonSpherePatch.UnlockMaxOrbitRadiusValue = Config.Bind("DysonSphere", "MaxOrbitRadiusValue", 10_000_000f,
"Unlocked Dyson Sphere max orbit radius value");
Functions.DysonSphereFunctions.IllegalDysonShellFunctionsEnabled = Config.Bind("DysonSphere", "IllegalDysonShellFunctions", false,
"Enable illegal dyson shell functions");
Functions.DysonSphereFunctions.ShellsCountForFunctions = Config.Bind("DysonSphere", "ShellsCountForFunctions", 2048,
"Shells count for various functions");
CombatPatch.MechaInvincibleEnabled = Config.Bind("Battle", "MechaInvincible", false,
"Mecha and Drones/Fleets invincible");
CombatPatch.BuildingsInvincibleEnabled = Config.Bind("Battle", "BuildingsInvincible", false,

File diff suppressed because it is too large Load Diff

View File

@@ -106,7 +106,7 @@ public static class PlayerFunctions
if (itemCnt.All(cnt => cnt == 0))
{
UIMessageBox.Show("Remove all metadata consumption records".Translate(), "NoMetadataConsumptionRecord".Translate(), "OK".Translate(), 0);
UIMessageBox.Show("Remove all metadata consumption records".Translate(), "NoMetadataConsumptionRecord".Translate(), "OK".Translate(), UIMessageBox.INFO);
return;
}
var msg = "ClearAllMetadataConsumptionDetails".Translate();
@@ -117,7 +117,7 @@ public static class PlayerFunctions
msg += $"\n {LDB.items.Select(i + 6001).propertyName} x{itemCnt[i]}";
}
}
UIMessageBox.Show("Remove all metadata consumption records".Translate(), msg, "取消".Translate(), "确定".Translate(), 2, null, () =>
UIMessageBox.Show("Remove all metadata consumption records".Translate(), msg, "取消".Translate(), "确定".Translate(), UIMessageBox.QUESTION, null, () =>
{
foreach (var data in propertySystem.propertyDatas)
{
@@ -143,7 +143,7 @@ public static class PlayerFunctions
var clusterPropertyData = propertySystem.propertyDatas.FirstOrDefault(cpd => cpd.seedKey == seedKey);
if (clusterPropertyData == null)
{
UIMessageBox.Show("Remove metadata consumption record in current game".Translate(), "NoMetadataConsumptionRecord".Translate(), "OK".Translate(), 0);
UIMessageBox.Show("Remove metadata consumption record in current game".Translate(), "NoMetadataConsumptionRecord".Translate(), "OK".Translate(), UIMessageBox.INFO);
return;
}
var currentGamePropertyData = GameMain.data.history.propertyData;
@@ -154,7 +154,7 @@ public static class PlayerFunctions
if (itemCnt.All(cnt => cnt == 0))
{
UIMessageBox.Show("Remove metadata consumption record in current game".Translate(), "NoMetadataConsumptionRecord".Translate(), "OK".Translate(), 0);
UIMessageBox.Show("Remove metadata consumption record in current game".Translate(), "NoMetadataConsumptionRecord".Translate(), "OK".Translate(), UIMessageBox.INFO);
return;
}
var msg = "ClearCurrentMetadataConsumptionDetails".Translate();
@@ -165,7 +165,7 @@ public static class PlayerFunctions
msg += $"\n {LDB.items.Select(i + 6001).propertyName} x{itemCnt[i]}";
}
}
UIMessageBox.Show("Remove metadata consumption record in current game".Translate(), msg, "取消".Translate(), "确定".Translate(), 2, null, () =>
UIMessageBox.Show("Remove metadata consumption record in current game".Translate(), msg, "取消".Translate(), "确定".Translate(), UIMessageBox.QUESTION, null, () =>
{
for (var i = 0; i < clusterPropertyData.totalConsumption.Count; i++)
{

View File

@@ -47,7 +47,12 @@
+ Skip absorption period
+ Quick absorb
+ Eject anyway
+ Unlock Dyson Sphere max orbit radius
+ Complete Dyson Sphere Shells instantly
+ Buttons for creating illegal Dyson Sphere Shells, you must enable `IllegalDysonShellFunctionsEnabled` of `DysonSphere` section in config to see them.
- Generate an illegal dyson shell
- Keep max production shells and remove others
- Duplicate shells from that with highest production
+ Mecha/Combat:
+ Mecha and Drones/Fleets invicible
+ Buildings invicible
@@ -114,7 +119,12 @@
+ 跳过吸收阶段
+ 快速吸收
+ 全球弹射
+ 解锁戴森球最大轨道半径
+ 立即完成戴森壳建造
+ 用于制作仙术戴森壳的按钮,你必须在设置文件里开启`DysonSphere`分类的`IllegalDysonShellFunctionsEnabled`才能看到它们
- 生成单层仙术戴森壳
- 保留发电量最高的戴森壳并移除其他戴森壳
- 从发电量最高的壳复制戴森壳
+ 机甲/战斗:
+ 机甲和战斗无人机无敌
+ 建筑无敌

View File

@@ -68,6 +68,11 @@ public static class UIConfigWindow
I18N.Add("Overclock Silos", "Overclock Silos (10x)", "高速发射井(10倍射速)");
I18N.Add("Unlock Dyson Sphere max orbit radius", "Unlock Dyson Sphere max orbit radius", "解锁戴森球最大轨道半径");
I18N.Add("Complete Dyson Sphere shells instantly", "Complete Dyson Sphere shells instantly", "立即完成戴森壳建造");
I18N.Add("Generate illegal dyson shell", "Generate an illegal dyson shell (Put/Paste nodes first)", "生成单层仙术戴森壳(请先设置/粘贴节点)");
I18N.Add("Keep max production shells and remove others", "Keep max production shells and remove others", "保留发电量最高的戴森壳并移除其他戴森壳");
I18N.Add("Duplicate shells from that with highest production", "Duplicate shells from that with highest production", "从发电量最高的壳复制戴森壳");
I18N.Add("WARNING: This operation can be very slow, continue?", "WARNING: This operation can be very slow, continue?", "警告:此操作可能非常慢,继续吗?");
I18N.Add("WARNING: This operation is DANGEROUS, continue?", "WARNING: This operation is DANGEROUS, continue?", "警告:此操作非常危险,继续吗?");
I18N.Add("Terraform without enough soil piles", "Terraform without enough soil piles", "沙土不够时依然可以整改地形");
I18N.Add("Instant hand-craft", "Instant hand-craft", "快速手动制造");
I18N.Add("Instant teleport (like that in Sandbox mode)", "Instant teleport (like that in Sandbox mode)", "快速传送(和沙盒模式一样)");
@@ -101,6 +106,37 @@ public static class UIConfigWindow
}
}
class ShellsCountMapper : MyWindow.RangeValueMapper<int>
{
public ShellsCountMapper() : base(1, 139)
{
}
public override int ValueToIndex(int value)
{
return value switch
{
< 4 => value,
< 64 => value / 4 + 3,
< 256 => value / 16 + 15,
< 4096 => value / 64 + 27,
_ => value / 256 + 75,
};
}
public override int IndexToValue(int index)
{
return index switch
{
< 4 => index,
< 19 => (index - 3) * 4,
< 31 => (index - 15) * 16,
< 91 => (index - 27) * 64,
_ => (index - 75) * 256,
};
}
}
private static void CreateUI(MyConfigWindow wnd, RectTransform trans)
{
_windowTrans = trans;
@@ -166,7 +202,6 @@ public static class UIConfigWindow
FactoryPatch.BeltSignalGeneratorEnabled.SettingChanged += OnBeltSignalChanged;
wnd.OnFree += () => { FactoryPatch.BeltSignalGeneratorEnabled.SettingChanged -= OnBeltSignalChanged; };
OnBeltSignalChanged(null, null);
void OnBeltSignalChanged(object o, EventArgs e)
{
var on = FactoryPatch.BeltSignalGeneratorEnabled.Value;
@@ -260,12 +295,40 @@ public static class UIConfigWindow
{
slider.slider.enabled = DysonSpherePatch.UnlockMaxOrbitRadiusEnabled.Value;
}
;
}
x = 300f;
y = 10f;
wnd.AddButton(x, y, 300f, tab4, "Complete Dyson Sphere shells instantly", 16, "button-complete-dyson-sphere-shells-instantly", DysonSphereFunctions.CompleteShellsInstantly);
{
y += 72f;
var btn1 = wnd.AddButton(x, y, 300f, tab4, "Generate illegal dyson shell", 16, "button-generate-illegal-dyson-shells", () => {
UIMessageBox.Show("Generate illegal dyson shell".Translate(), "WARNING: This operation can be very slow, continue?".Translate(), "取消".Translate(), "确定".Translate(), UIMessageBox.WARNING, null,
() => { DysonSphereFunctions.CreatePossibleFramesAndShells(); });
});
y += 36f;
var btn2 = wnd.AddButton(x, y, 300f, tab4, "Keep max production shells and remove others", 16, "button-keep-max-production-shells", () => {
UIMessageBox.Show("Keep max production shells and remove others".Translate(), "WARNING: This operation is DANGEROUS, continue?".Translate(), "取消".Translate(), "确定".Translate(), UIMessageBox.WARNING, null,
() => { DysonSphereFunctions.KeepMaxProductionShells(); });
});
y += 36f;
var btn3 = wnd.AddButton(x, y, 300f, tab4, "Duplicate shells from that with highest production", 16, "button-duplicate-shells-from-the-highest-production", () => {
UIMessageBox.Show("Duplicate shells from that with highest production".Translate(), "WARNING: This operation can be very slow, continue?".Translate(), "取消".Translate(), "确定".Translate(), UIMessageBox.WARNING, null,
() => { DysonSphereFunctions.DuplicateShellsWithHighestProduction(); });
});
y += 30f;
var slider1 = wnd.AddSlider(x + 20f, y, tab4, DysonSphereFunctions.ShellsCountForFunctions, new ShellsCountMapper());
Functions.DysonSphereFunctions.IllegalDysonShellFunctionsEnabled.SettingChanged += onIllegalDysonShellFunctionsChanged;
wnd.OnFree += () => { Functions.DysonSphereFunctions.IllegalDysonShellFunctionsEnabled.SettingChanged -= onIllegalDysonShellFunctionsChanged; };
onIllegalDysonShellFunctionsChanged(null, null);
void onIllegalDysonShellFunctionsChanged(object o, EventArgs e)
{
var enabled = Functions.DysonSphereFunctions.IllegalDysonShellFunctionsEnabled.Value;
btn1.gameObject.SetActive(enabled);
btn2.gameObject.SetActive(enabled);
btn3.gameObject.SetActive(enabled);
slider1.gameObject.SetActive(enabled);
}
}
var tab5 = wnd.AddTab(_windowTrans, "Mecha/Combat");
x = 0f;