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

donet format

This commit is contained in:
2025-09-21 15:38:03 +08:00
parent 5f37b8b6d6
commit a25f74443d
32 changed files with 170 additions and 155 deletions

View File

@@ -25,7 +25,7 @@ public static class DysonSphereFunctions
private static readonly double factor2 = RawToDouble(rawNum2);
private static readonly double factor3 = RawToDouble(rawNum3);
private static readonly PrecalculatedTriangle[] PrecalculatedTriangles = [
new PrecalculatedTriangle() { MaxOrbitRadius = 6869, PosA = new Vector3() { x = RawToFloat(0x00000000U), y = RawToFloat(0x00000000U), z = RawToFloat(0x45D66000U)}, PosB = new Vector3() { x = RawToFloat(0x2C88BEC4U), y = RawToFloat(0x00000000U), z = RawToFloat(0xC5D66000U)}, PosC = new Vector3() { x = RawToFloat(0xC5D66000U), y = RawToFloat(0x00000000U), z = RawToFloat(0xABB1589BU)} },
new PrecalculatedTriangle() { MaxOrbitRadius = 6869, PosA = new Vector3() { x = RawToFloat(0x00000000U), y = RawToFloat(0x00000000U), z = RawToFloat(0x45D66000U)}, PosB = new Vector3() { x = RawToFloat(0x2C88BEC4U), y = RawToFloat(0x00000000U), z = RawToFloat(0xC5D66000U)}, PosC = new Vector3() { x = RawToFloat(0xC5D66000U), y = RawToFloat(0x00000000U), z = RawToFloat(0xABB1589BU)} },
new PrecalculatedTriangle() { MaxOrbitRadius = 13573, PosA = new Vector3() { x = RawToFloat(0x46540800U), y = RawToFloat(0x00000000U), z = RawToFloat(0x2C87400AU)}, PosB = new Vector3() { x = RawToFloat(0x4652DEA6U), y = RawToFloat(0x00000000U), z = RawToFloat(0xC4B14E71U)}, PosC = new Vector3() { x = RawToFloat(0xC6540800U), y = RawToFloat(0x00000000U), z = RawToFloat(0xAC2F683EU)} },
new PrecalculatedTriangle() { MaxOrbitRadius = 21257, PosA = new Vector3() { x = RawToFloat(0x46A60400U), y = RawToFloat(0x00000000U), z = RawToFloat(0x2CD3CBAAU)}, PosB = new Vector3() { x = RawToFloat(0xC6070C9DU), y = RawToFloat(0x00000000U), z = RawToFloat(0xC697A9AEU)}, PosC = new Vector3() { x = RawToFloat(0xC6A60400U), y = RawToFloat(0x00000000U), z = RawToFloat(0xAC8956FFU)} },
new PrecalculatedTriangle() { MaxOrbitRadius = 29718, PosA = new Vector3() { x = RawToFloat(0x469B4FBEU), y = RawToFloat(0x00000000U), z = RawToFloat(0x46AC7DAAU)}, PosB = new Vector3() { x = RawToFloat(0x46E81C00U), y = RawToFloat(0x00000000U), z = RawToFloat(0x2D140EBCU)}, PosC = new Vector3() { x = RawToFloat(0xC6E81C00U), y = RawToFloat(0x00000000U), z = RawToFloat(0xACC0046AU)} },
@@ -323,10 +323,10 @@ public static class DysonSphereFunctions
num += num2;
}
var radius = Math.Round(polygon[0].magnitude * 10.0) / 10.0;
for (int j = 0; j < polygon.Length; j++)
{
polygon[j] = polygon[j].normalized * radius;
}
for (int j = 0; j < polygon.Length; j++)
{
polygon[j] = polygon[j].normalized * radius;
}
var center = (sum / num).normalized * radius;
float num3 = 0f;
for (int k = 0; k < 3; k++)
@@ -459,10 +459,10 @@ public static class DysonSphereFunctions
num += num2;
}
shell.radius = Math.Round(shell.polygon[0].magnitude * 10.0) / 10.0;
for (int j = 0; j < shell.polygon.Count; j++)
{
shell.polygon[j] = shell.polygon[j].normalized * shell.radius;
}
for (int j = 0; j < shell.polygon.Count; j++)
{
shell.polygon[j] = shell.polygon[j].normalized * shell.radius;
}
var normalized = (sum / num).normalized;
shell.center = normalized * shell.radius;
float num3 = 0f;
@@ -1191,19 +1191,25 @@ public static class DysonSphereFunctions
for (int i = 1; i <= 10; i++)
{
var layer = dysonSphere.layersIdBased[i];
if (layer != null) {
if (layer != null)
{
continue;
}
var radius = dysonSphere.maxOrbitRadius;
for (; radius > 4000; radius -= 10) {
if (dysonSphere.CheckLayerRadius(radius) == 0) {
for (; radius > 4000; radius -= 10)
{
if (dysonSphere.CheckLayerRadius(radius) == 0)
{
break;
}
}
PrecalculatedTriangle triangle;
try {
try
{
triangle = PrecalculatedTriangles.First(t => t.MaxOrbitRadius > radius);
} catch (InvalidOperationException) {
}
catch (InvalidOperationException)
{
UIMessageBox.Show("CheatEnabler".Translate(), string.Format("No precalculated triangle found for radius {0}.".Translate(), radius), "确定".Translate(), UIMessageBox.ERROR, null);
return;
}
@@ -1389,7 +1395,8 @@ public static class DysonSphereFunctions
{
var lastGridScale = 0;
var radiusList = new List<int>();
for (var r = 4000; r <= 250000; r++) {
for (var r = 4000; r <= 250000; r++)
{
var gridScale = (int)(Math.Pow(r / 4000.0, 0.75) + 0.5);
gridScale = (gridScale < 1) ? 1 : gridScale;
if (gridScale == lastGridScale) continue;

View File

@@ -30,7 +30,7 @@ public static class CombatPatch
MechaInvincible.Enable(false);
}
private class MechaInvincible: PatchImpl<MechaInvincible>
private class MechaInvincible : PatchImpl<MechaInvincible>
{
[HarmonyTranspiler]
[HarmonyPatch(typeof(Player), nameof(Player.invincible), MethodType.Getter)]
@@ -65,7 +65,7 @@ public static class CombatPatch
}
}
private class BuildingsInvincible: PatchImpl<BuildingsInvincible>
private class BuildingsInvincible : PatchImpl<BuildingsInvincible>
{
[HarmonyTranspiler]
[HarmonyPatch(typeof(SkillSystem), nameof(SkillSystem.DamageGroundObjectByLocalCaster))]

View File

@@ -187,7 +187,7 @@ public static class GamePatch
}
}
public class UnlockTech: PatchImpl<UnlockTech>
public class UnlockTech : PatchImpl<UnlockTech>
{
private static void UnlockTechRecursive(GameHistoryData history, [NotNull] TechProto techProto, int maxLevel = 10000)
{

View File

@@ -29,7 +29,7 @@ public static class PlanetPatch
TerraformAnyway.Enable(false);
}
private class WaterPumperPatch: PatchImpl<WaterPumperPatch>
private class WaterPumperPatch : PatchImpl<WaterPumperPatch>
{
[HarmonyTranspiler]
[HarmonyPatch(typeof(BuildTool_BlueprintPaste), nameof(BuildTool_BlueprintPaste.CheckBuildConditions))]
@@ -51,7 +51,7 @@ public static class PlanetPatch
}
}
private class TerraformAnyway: PatchImpl<TerraformAnyway>
private class TerraformAnyway : PatchImpl<TerraformAnyway>
{
[HarmonyTranspiler]
[HarmonyPatch(typeof(BuildTool_Reform), nameof(BuildTool_Reform.ReformAction))]

View File

@@ -33,7 +33,7 @@ public static class PlayerPatch
WarpWithoutSpaceWarpers.Enable(false);
}
private class InstantHandCraft: PatchImpl<InstantHandCraft>
private class InstantHandCraft : PatchImpl<InstantHandCraft>
{
[HarmonyPostfix]
[HarmonyPatch(typeof(ForgeTask), MethodType.Constructor, typeof(int), typeof(int))]
@@ -43,7 +43,7 @@ public static class PlayerPatch
}
}
private class InstantTeleport: PatchImpl<InstantTeleport>
private class InstantTeleport : PatchImpl<InstantTeleport>
{
[HarmonyTranspiler]
[HarmonyPatch(typeof(UIGlobemap), nameof(UIGlobemap._OnUpdate))]
@@ -66,7 +66,7 @@ public static class PlayerPatch
}
}
private class WarpWithoutSpaceWarpers: PatchImpl<WarpWithoutSpaceWarpers>
private class WarpWithoutSpaceWarpers : PatchImpl<WarpWithoutSpaceWarpers>
{
[HarmonyPrefix]
[HarmonyPatch(typeof(Mecha), nameof(Mecha.HasWarper))]
@@ -75,7 +75,7 @@ public static class PlayerPatch
__result = true;
return false;
}
[HarmonyPostfix]
[HarmonyPatch(typeof(Mecha), nameof(Mecha.UseWarper))]
private static void Mecha_UseWarper_Postfix(ref bool __result)

View File

@@ -29,7 +29,7 @@ public static class ResourcePatch
FastMining.Enable(false);
}
private class InfiniteResource: PatchImpl<InfiniteResource>
private class InfiniteResource : PatchImpl<InfiniteResource>
{
[HarmonyTranspiler]
[HarmonyPatch(typeof(FactorySystem), nameof(FactorySystem.GameTick), typeof(long), typeof(bool))]
@@ -59,7 +59,7 @@ public static class ResourcePatch
}
}
private class FastMining: PatchImpl<FastMining>
private class FastMining : PatchImpl<FastMining>
{
[HarmonyTranspiler]
[HarmonyPatch(typeof(FactorySystem), "GameTick", typeof(long), typeof(bool))]

View File

@@ -304,17 +304,20 @@ public static class UIConfigWindow
{
y += 72f;
var originalY = y;
var btn1 = wnd.AddButton(x, y, 300f, tab4, "Generate illegal dyson shell", 16, "button-generate-illegal-dyson-shells", () => {
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.CreateIllegalDysonShellWithMaxOutput(); });
});
y += 36f;
var btn2 = wnd.AddButton(x, y, 300f, tab4, "Keep max production shells and remove others", 16, "button-keep-max-production-shells", () => {
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", () => {
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(); });
});
@@ -322,7 +325,8 @@ public static class UIConfigWindow
var slider1 = wnd.AddSlider(x + 20f, y, tab4, DysonSphereFunctions.ShellsCountForFunctions, new ShellsCountMapper());
y = originalY;
var btn4 = wnd.AddButton(x, y, 300f, tab4, "Generate illegal dyson shell quickly", 16, "button-generate-illegal-dyson-shells-quickly", () => {
var btn4 = wnd.AddButton(x, y, 300f, tab4, "Generate illegal dyson shell quickly", 16, "button-generate-illegal-dyson-shells-quickly", () =>
{
UIMessageBox.Show("Generate illegal dyson shell".Translate(), "WARNING: This operation can be very slow, continue?".Translate(), "取消".Translate(), "确定".Translate(), UIMessageBox.WARNING, null,
() => { DysonSphereFunctions.CreateIllegalDysonShellQuickly(DysonSphereFunctions.ShellsCountForFunctions.Value); });
});