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

use original game's consts

This commit is contained in:
2025-06-03 18:55:38 +08:00
parent 4ba1512205
commit cb3975ae1a
3 changed files with 21 additions and 21 deletions

View File

@@ -76,7 +76,7 @@ public static class DysonSphereFunctions
dysonNode.spOrdered = 0; dysonNode.spOrdered = 0;
dysonNode._spReq = 0; dysonNode._spReq = 0;
totalNodeSp += dysonNode.spMax; totalNodeSp += dysonNode.spMax;
var diff = dysonNode.spMax - dysonNode.sp; var diff = dysonNode.spMax - dysonNode.sp;
if (diff > 0) if (diff > 0)
{ {
rocketCount += diff; rocketCount += diff;
@@ -115,21 +115,21 @@ public static class DysonSphereFunctions
var count = rocketCount; var count = rocketCount;
while (count > 0x40000000L) while (count > 0x40000000L)
{ {
productRegister[11902] += 0x40000000; productRegister[ProductionStatistics.DYSON_STRUCTURE_ID] += 0x40000000;
count -= 0x40000000; count -= 0x40000000;
} }
if (count > 0L) productRegister[11902] += (int)count; if (count > 0L) productRegister[ProductionStatistics.DYSON_STRUCTURE_ID] += (int)count;
count = solarSailCount; count = solarSailCount;
while (count > 0x40000000L) while (count > 0x40000000L)
{ {
productRegister[11901] += 0x40000000; productRegister[ProductionStatistics.SOLAR_SAIL_ID] += 0x40000000;
productRegister[11903] += 0x40000000; productRegister[ProductionStatistics.DYSON_CELL_ID] += 0x40000000;
count -= 0x40000000; count -= 0x40000000;
} }
if (count > 0L) if (count > 0L)
{ {
productRegister[11901] += (int)count; productRegister[ProductionStatistics.SOLAR_SAIL_ID] += (int)count;
productRegister[11903] += (int)count; productRegister[ProductionStatistics.DYSON_CELL_ID] += (int)count;
} }
} }
} }
@@ -141,10 +141,10 @@ public static class DysonSphereFunctions
var count = solarSailCount; var count = solarSailCount;
while (count > 0x40000000L) while (count > 0x40000000L)
{ {
consumeRegister[11901] += 0x40000000; consumeRegister[ProductionStatistics.SOLAR_SAIL_ID] += 0x40000000;
count -= 0x40000000; count -= 0x40000000;
} }
if (count > 0L) consumeRegister[11901] += (int)count; if (count > 0L) consumeRegister[ProductionStatistics.SOLAR_SAIL_ID] += (int)count;
} }
} }
}); });

View File

@@ -326,9 +326,9 @@ public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
if (node.ConstructCp() == null) break; if (node.ConstructCp() == null) break;
if (idx == 0) if (idx == 0)
{ {
sphereProductRegister[11901] += len; sphereProductRegister[ProductionStatistics.SOLAR_SAIL_ID] += len;
sphereConsumeRegister[11901] += len; sphereConsumeRegister[ProductionStatistics.SOLAR_SAIL_ID] += len;
sphereProductRegister[11903] += len; sphereProductRegister[ProductionStatistics.DYSON_CELL_ID] += len;
return; return;
} }
idx--; idx--;
@@ -339,9 +339,9 @@ public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
var absorbCnt = len - 1 - idx; var absorbCnt = len - 1 - idx;
if (absorbCnt > 0) if (absorbCnt > 0)
{ {
sphereProductRegister[11901] += absorbCnt; sphereProductRegister[ProductionStatistics.SOLAR_SAIL_ID] += absorbCnt;
sphereConsumeRegister[11901] += absorbCnt; sphereConsumeRegister[ProductionStatistics.SOLAR_SAIL_ID] += absorbCnt;
sphereProductRegister[11903] += absorbCnt; sphereProductRegister[ProductionStatistics.DYSON_CELL_ID] += absorbCnt;
} }
} }
for (; idx >= 0; idx--) for (; idx >= 0; idx--)
@@ -374,7 +374,7 @@ public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
).Advance(1).RemoveInstructions(matcher.Length - matcher.Pos).Insert( ).Advance(1).RemoveInstructions(matcher.Length - matcher.Pos).Insert(
// if (node.ConstructCp() != null) // if (node.ConstructCp() != null)
// { // {
// this.dysonSphere.productRegister[11903]++; // this.dysonSphere.productRegister[ProductionStatistics.DYSON_CELL_ID]++;
// } // }
new CodeInstruction(OpCodes.Ldarg_1), new CodeInstruction(OpCodes.Ldarg_1),
new CodeInstruction(OpCodes.Callvirt, AccessTools.Method(typeof(DysonNode), nameof(DysonNode.ConstructCp))), new CodeInstruction(OpCodes.Callvirt, AccessTools.Method(typeof(DysonNode), nameof(DysonNode.ConstructCp))),
@@ -382,7 +382,7 @@ public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
new CodeInstruction(OpCodes.Ldarg_0), new CodeInstruction(OpCodes.Ldarg_0),
new CodeInstruction(OpCodes.Ldfld, AccessTools.Field(typeof(DysonSwarm), nameof(DysonSwarm.dysonSphere))), new CodeInstruction(OpCodes.Ldfld, AccessTools.Field(typeof(DysonSwarm), nameof(DysonSwarm.dysonSphere))),
new CodeInstruction(OpCodes.Call, AccessTools.PropertyGetter(typeof(DysonSphere), nameof(DysonSphere.productRegister))), new CodeInstruction(OpCodes.Call, AccessTools.PropertyGetter(typeof(DysonSphere), nameof(DysonSphere.productRegister))),
new CodeInstruction(OpCodes.Ldc_I4, 11903), new CodeInstruction(OpCodes.Ldc_I4, ProductionStatistics.DYSON_CELL_ID),
new CodeInstruction(OpCodes.Ldelema, typeof(int)), new CodeInstruction(OpCodes.Ldelema, typeof(int)),
new CodeInstruction(OpCodes.Dup), new CodeInstruction(OpCodes.Dup),
new CodeInstruction(OpCodes.Ldind_I4), new CodeInstruction(OpCodes.Ldind_I4),

View File

@@ -173,7 +173,7 @@ public class DysonSpherePatch: PatchImpl<DysonSpherePatch>
{ {
lock (productRegister) lock (productRegister)
{ {
productRegister[11902] += todoCount - count; productRegister[ProductionStatistics.DYSON_STRUCTURE_ID] += todoCount - count;
} }
} }
} }
@@ -213,8 +213,8 @@ public class DysonSpherePatch: PatchImpl<DysonSpherePatch>
{ {
lock (productRegister) lock (productRegister)
{ {
productRegister[11901] += solarSailCount; productRegister[ProductionStatistics.SOLAR_SAIL_ID] += solarSailCount;
productRegister[11903] += solarSailCount; productRegister[ProductionStatistics.DYSON_CELL_ID] += solarSailCount;
} }
} }
var consumeRegister = __instance.consumeRegister; var consumeRegister = __instance.consumeRegister;
@@ -222,7 +222,7 @@ public class DysonSpherePatch: PatchImpl<DysonSpherePatch>
{ {
lock (consumeRegister) lock (consumeRegister)
{ {
consumeRegister[11901] += solarSailCount; consumeRegister[ProductionStatistics.SOLAR_SAIL_ID] += solarSailCount;
} }
} }
} }