mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2026-11-19 17:05:20 +08:00
fix(uxassist): name item ID constants after their items
The game-constant centralization attached wrong names to many item IDs, such as Steel for Titanium Alloy (1107) and HydrogenFuelRod for the Electromagnetic Matrix (6001). Every remaining usage relies on the IDs, which match the items in the belt-signal proliferation tips, the matrix metadata types, and the Dark Fog buy-out definitions. Rename the constants after their actual items and current Dark Fog item names, and remove the mislabeled constants that only the retired proliferator source table used. Item groups and compiled values are unchanged.
This commit is contained in:
1 parent
3ca7b62ec6
commit
ca884fe6af
4 files changed
+80
-84
No files matched your search
@@ -81,10 +81,10 @@ public static class PlayerFunctions
|
||||
var propertySystem = DSPGame.propertySystem;
|
||||
if (propertySystem == null) return;
|
||||
PurgePropertySystem(propertySystem);
|
||||
var itemCnt = new int[ItemIds.Metaverse - ItemIds.HydrogenFuelRod + 1];
|
||||
foreach (var cons in propertySystem.propertyDatas.SelectMany(data => data.totalConsumption.Where(cons => cons.id is >= ItemIds.HydrogenFuelRod and <= ItemIds.Metaverse)))
|
||||
var itemCnt = new int[ItemIds.UniverseMatrix - ItemIds.ElectromagneticMatrix + 1];
|
||||
foreach (var cons in propertySystem.propertyDatas.SelectMany(data => data.totalConsumption.Where(cons => cons.id is >= ItemIds.ElectromagneticMatrix and <= ItemIds.UniverseMatrix)))
|
||||
{
|
||||
itemCnt[cons.id - ItemIds.HydrogenFuelRod] += cons.count;
|
||||
itemCnt[cons.id - ItemIds.ElectromagneticMatrix] += cons.count;
|
||||
}
|
||||
|
||||
if (itemCnt.All(cnt => cnt == 0))
|
||||
@@ -97,7 +97,7 @@ public static class PlayerFunctions
|
||||
{
|
||||
if (itemCnt[i] > 0)
|
||||
{
|
||||
msg += $"\n {LDB.items.Select(i + ItemIds.HydrogenFuelRod).propertyName} x{itemCnt[i]}";
|
||||
msg += $"\n {LDB.items.Select(i + ItemIds.ElectromagneticMatrix).propertyName} x{itemCnt[i]}";
|
||||
}
|
||||
}
|
||||
UIMessageBox.Show(Localization.RemoveAllMetadataConsumptionRecords.Translate(), msg, Localization.Cancel.Translate(), Localization.OK.Translate(), UIMessageBox.QUESTION, null, () =>
|
||||
@@ -121,7 +121,7 @@ public static class PlayerFunctions
|
||||
var propertySystem = DSPGame.propertySystem;
|
||||
if (propertySystem == null) return;
|
||||
PurgePropertySystem(propertySystem);
|
||||
var itemCnt = new int[ItemIds.Metaverse - ItemIds.HydrogenFuelRod + 1];
|
||||
var itemCnt = new int[ItemIds.UniverseMatrix - ItemIds.ElectromagneticMatrix + 1];
|
||||
var seedKey = DSPGame.GameDesc.seedKey64;
|
||||
var clusterPropertyData = propertySystem.propertyDatas.FirstOrDefault(cpd => cpd.seedKey == seedKey);
|
||||
if (clusterPropertyData == null)
|
||||
@@ -130,9 +130,9 @@ public static class PlayerFunctions
|
||||
return;
|
||||
}
|
||||
var currentGamePropertyData = GameMain.data.history.propertyData;
|
||||
foreach (var cons in currentGamePropertyData.totalConsumption.Where(cons => cons.id is >= ItemIds.HydrogenFuelRod and <= ItemIds.Metaverse))
|
||||
foreach (var cons in currentGamePropertyData.totalConsumption.Where(cons => cons.id is >= ItemIds.ElectromagneticMatrix and <= ItemIds.UniverseMatrix))
|
||||
{
|
||||
itemCnt[cons.id - ItemIds.HydrogenFuelRod] += cons.count;
|
||||
itemCnt[cons.id - ItemIds.ElectromagneticMatrix] += cons.count;
|
||||
}
|
||||
|
||||
if (itemCnt.All(cnt => cnt == 0))
|
||||
@@ -145,7 +145,7 @@ public static class PlayerFunctions
|
||||
{
|
||||
if (itemCnt[i] > 0)
|
||||
{
|
||||
msg += $"\n {LDB.items.Select(i + ItemIds.HydrogenFuelRod).propertyName} x{itemCnt[i]}";
|
||||
msg += $"\n {LDB.items.Select(i + ItemIds.ElectromagneticMatrix).propertyName} x{itemCnt[i]}";
|
||||
}
|
||||
}
|
||||
UIMessageBox.Show(Localization.RemoveMetadataConsumptionRecordInCurrentGame.Translate(), msg, Localization.Cancel.Translate(), Localization.OK.Translate(), UIMessageBox.QUESTION, null, () =>
|
||||
@@ -154,8 +154,8 @@ public static class PlayerFunctions
|
||||
{
|
||||
if (clusterPropertyData.totalConsumption[i].count == 0) continue;
|
||||
var id = clusterPropertyData.totalConsumption[i].id;
|
||||
if (id < ItemIds.HydrogenFuelRod || id > ItemIds.Metaverse) continue;
|
||||
var currentGameCount = itemCnt[id - ItemIds.HydrogenFuelRod];
|
||||
if (id < ItemIds.ElectromagneticMatrix || id > ItemIds.UniverseMatrix) continue;
|
||||
var currentGameCount = itemCnt[id - ItemIds.ElectromagneticMatrix];
|
||||
if (currentGameCount == 0) continue;
|
||||
var totalCount = clusterPropertyData.totalConsumption[i].count;
|
||||
clusterPropertyData.totalConsumption[i] = new IDCNT(id, totalCount > currentGameCount ? totalCount - currentGameCount : 0);
|
||||
|
||||
@@ -13,49 +13,44 @@ public static class ItemIds
|
||||
public const int SulfuricAcid = 1116;
|
||||
public const int Hydrogen = 1120;
|
||||
public const int Deuterium = 1121;
|
||||
public const int Photon = 1208;
|
||||
public const int CriticalPhoton = 1208;
|
||||
|
||||
/* Materials used by recipes */
|
||||
public const int OrganicCrystal = 1015;
|
||||
public const int FireIce = 1012;
|
||||
public const int CriticalPhoton = 1124;
|
||||
public const int CircuitBoard = 1112; // used in proliferator mk.III recipe
|
||||
public const int Steel = 1107;
|
||||
public const int TitaniumGlass = 1111;
|
||||
public const int GravitonLens = 1125;
|
||||
/* Materials and components */
|
||||
public const int TitaniumAlloy = 1107;
|
||||
public const int Prism = 1111;
|
||||
public const int FrameMaterial = 1125;
|
||||
public const int CasimirCrystal = 1126;
|
||||
public const int MagneticCoil = 1202;
|
||||
public const int ElectricMotor = 1203;
|
||||
public const int ElectromagneticTurbine = 1204;
|
||||
public const int SuperMagneticRing = 1205;
|
||||
public const int GravitonLens = 1209;
|
||||
public const int CircuitBoard = 1301;
|
||||
public const int QuantumChip = 1305;
|
||||
public const int PlasmaExciter = 1401;
|
||||
public const int ParticleBroadband = 1402;
|
||||
public const int AnnihilationConstraintSphere = 1403;
|
||||
public const int Thruster = 1405;
|
||||
public const int ReinforcedThruster = 1406;
|
||||
|
||||
/* Proliferators */
|
||||
public const int ProliferatorMkI = 1141;
|
||||
public const int ProliferatorMkII = 1142;
|
||||
public const int ProliferatorMkIII = 1143;
|
||||
|
||||
/* Logistics carriers */
|
||||
/* Logistics */
|
||||
public const int SpaceWarper = 1210;
|
||||
public const int LogisticsDrone = 5001;
|
||||
public const int LogisticsVessel = 5002;
|
||||
public const int LogisticsBot = 5003;
|
||||
public const int SpaceWarper = 1126;
|
||||
|
||||
/* Matrices */
|
||||
public const int ElectromagneticMatrix = 1202;
|
||||
public const int EnergyMatrix = 1203;
|
||||
public const int StructureMatrix = 1204;
|
||||
public const int InformationMatrix = 1205;
|
||||
public const int UniverseMatrix = 1209;
|
||||
public const int Antimatter = 1210;
|
||||
|
||||
/* Components */
|
||||
public const int PlasmaExciter = 1301;
|
||||
public const int ParticleBroadband = 1305;
|
||||
public const int Processor = 1401;
|
||||
public const int QuantumChip = 1402;
|
||||
public const int MicrocrystallineComponent = 1403;
|
||||
public const int PlaneFilter = 1405;
|
||||
public const int ParticleContainer = 1406;
|
||||
|
||||
/* Dyson sphere materials */
|
||||
public const int SolarSail = 1502;
|
||||
public const int FrameMaterial = 1503;
|
||||
public const int DysonSphereComponent = 1802;
|
||||
public const int DysonSphereComponent = 1502;
|
||||
public const int SmallCarrierRocket = 1503;
|
||||
|
||||
/* Fuel rods */
|
||||
public const int DeuteronFuelRod = 1802;
|
||||
public const int StrangeAnnihilationFuelRod = 1804;
|
||||
|
||||
/* Power nodes */
|
||||
public const int TeslaTower = 2201;
|
||||
@@ -67,49 +62,49 @@ public static class ItemIds
|
||||
public const int MiningMachine = 2301;
|
||||
|
||||
/* Dark Fog items (combat expansion) */
|
||||
public const int DarkFogMemoryUnit = 5201;
|
||||
public const int DarkFogMatrix = 5201;
|
||||
public const int DarkFogSiliconNeuron = 5202;
|
||||
public const int DarkFogMatterReassembler = 5203;
|
||||
public const int DarkFogMatterRecombinator = 5203;
|
||||
public const int DarkFogNegentropySingularity = 5204;
|
||||
public const int DarkFogVirtualParticle = 5205;
|
||||
public const int DarkFogEnergyFragment = 5206;
|
||||
public const int DarkFogCoreElement = 5205;
|
||||
public const int DarkFogEnergyShard = 5206;
|
||||
|
||||
/* Fuel and advanced items */
|
||||
public const int HydrogenFuelRod = 6001;
|
||||
public const int DeuteronFuelRod = 6002;
|
||||
public const int AntimatterFuelRod = 6003;
|
||||
public const int StrangeAnnihilationFuelRod = 1804;
|
||||
public const int StrangeMatter = 6004;
|
||||
public const int Foundation = 6005;
|
||||
public const int Metaverse = 6006; // also called property/meta-data item
|
||||
/* Matrices. Metadata types use the same IDs; the Universe Matrix's metadata is Metaverse. */
|
||||
public const int ElectromagneticMatrix = 6001;
|
||||
public const int EnergyMatrix = 6002;
|
||||
public const int StructureMatrix = 6003;
|
||||
public const int InformationMatrix = 6004;
|
||||
public const int GravityMatrix = 6005;
|
||||
public const int UniverseMatrix = 6006;
|
||||
|
||||
/* Item groups used by belt signal recipe calculations. */
|
||||
public static readonly int[] ExtraOreItemIds =
|
||||
[
|
||||
Water, SulfuricAcid, Hydrogen, Deuterium, Photon,
|
||||
DarkFogMemoryUnit, DarkFogSiliconNeuron, DarkFogMatterReassembler,
|
||||
DarkFogNegentropySingularity, DarkFogVirtualParticle, DarkFogEnergyFragment
|
||||
Water, SulfuricAcid, Hydrogen, Deuterium, CriticalPhoton,
|
||||
DarkFogMatrix, DarkFogSiliconNeuron, DarkFogMatterRecombinator,
|
||||
DarkFogNegentropySingularity, DarkFogCoreElement, DarkFogEnergyShard
|
||||
];
|
||||
|
||||
// Listed in the same order as the belt signal option tips.
|
||||
public static readonly HashSet<int> ExtraProliferationItemIds =
|
||||
[
|
||||
Steel, TitaniumGlass, GravitonLens, ProliferatorMkII, ProliferatorMkIII,
|
||||
ElectromagneticMatrix, EnergyMatrix, StructureMatrix, InformationMatrix,
|
||||
UniverseMatrix, Antimatter, PlasmaExciter, ParticleBroadband,
|
||||
Processor, QuantumChip, MicrocrystallineComponent, PlaneFilter, ParticleContainer,
|
||||
SolarSail, FrameMaterial, DysonSphereComponent,
|
||||
HydrogenFuelRod, AntimatterFuelRod, StrangeMatter, Foundation, Metaverse
|
||||
TitaniumAlloy, Prism, FrameMaterial, ProliferatorMkII, ProliferatorMkIII,
|
||||
MagneticCoil, ElectricMotor, ElectromagneticTurbine, SuperMagneticRing,
|
||||
CircuitBoard, Thruster, ReinforcedThruster, PlasmaExciter, ParticleBroadband,
|
||||
GravitonLens, QuantumChip, AnnihilationConstraintSphere, DeuteronFuelRod, SpaceWarper,
|
||||
DysonSphereComponent, SmallCarrierRocket, ElectromagneticMatrix, StructureMatrix,
|
||||
InformationMatrix, GravityMatrix, UniverseMatrix
|
||||
];
|
||||
|
||||
public static readonly HashSet<int> NoProliferationItemIds =
|
||||
[
|
||||
SpaceWarper, DeuteronFuelRod
|
||||
CasimirCrystal, EnergyMatrix
|
||||
];
|
||||
|
||||
/* Dark Fog materials used by production calculations. */
|
||||
public static readonly int[] DarkFogItemIds =
|
||||
[
|
||||
DarkFogMemoryUnit, DarkFogSiliconNeuron, DarkFogMatterReassembler,
|
||||
DarkFogNegentropySingularity, DarkFogVirtualParticle, DarkFogEnergyFragment
|
||||
DarkFogMatrix, DarkFogSiliconNeuron, DarkFogMatterRecombinator,
|
||||
DarkFogNegentropySingularity, DarkFogCoreElement, DarkFogEnergyShard
|
||||
];
|
||||
}
|
||||
@@ -63,12 +63,12 @@ internal static class BeltSignalPatch
|
||||
// A belt selects one material, so its equivalent single-material rate is 30.
|
||||
private static readonly (int ItemId, int ExchangeRate, string NameKey, string IconPath)[] DarkFogBuyOutDefinitions =
|
||||
[
|
||||
(ItemIds.DarkFogMemoryUnit, 20, I18NKeys.MemoryUnit, "assets/signal/dark-fog-matrix.png"),
|
||||
(ItemIds.DarkFogEnergyFragment, 60, I18NKeys.EnergyFragment, "assets/signal/energy-shard.png"),
|
||||
(ItemIds.DarkFogMatrix, 20, I18NKeys.MemoryUnit, "assets/signal/dark-fog-matrix.png"),
|
||||
(ItemIds.DarkFogEnergyShard, 60, I18NKeys.EnergyFragment, "assets/signal/energy-shard.png"),
|
||||
(ItemIds.DarkFogSiliconNeuron, 30, I18NKeys.SiliconNeuron, "assets/signal/silicon-based-neuron.png"),
|
||||
(ItemIds.DarkFogNegentropySingularity, 30, I18NKeys.NegentropySingularity, "assets/signal/negentropy-singularity.png"),
|
||||
(ItemIds.DarkFogMatterReassembler, 30, I18NKeys.MatterReassembler, "assets/signal/matter-recombinator.png"),
|
||||
(ItemIds.DarkFogVirtualParticle, 10, I18NKeys.VirtualParticle, "assets/signal/core-element.png")
|
||||
(ItemIds.DarkFogMatterRecombinator, 30, I18NKeys.MatterReassembler, "assets/signal/matter-recombinator.png"),
|
||||
(ItemIds.DarkFogCoreElement, 10, I18NKeys.VirtualParticle, "assets/signal/core-element.png")
|
||||
];
|
||||
public static readonly int[] DarkFogItemsInVoid = [0, 0, 0, 0, 0, 0];
|
||||
private static Dictionary<int, uint>[] _signalBelts = new Dictionary<int, uint>[64];
|
||||
@@ -327,13 +327,14 @@ internal static class BeltSignalPatch
|
||||
var consume = (byte)Math.Min(DarkFogItemsInVoid[itemIdx], 4);
|
||||
if (consume < 4)
|
||||
{
|
||||
var metaverseLong = propertySystem.GetItemAvaliableProperty(_clusterSeedKey, ItemIds.Metaverse);
|
||||
// Metaverse is the metadata of the Universe Matrix.
|
||||
var metaverseLong = propertySystem.GetItemAvaliableProperty(_clusterSeedKey, ItemIds.UniverseMatrix);
|
||||
if (metaverseLong > 0L)
|
||||
{
|
||||
var metaverse = metaverseLong > 10 ? 10 : (int)metaverseLong;
|
||||
propertySystem.AddItemConsumption(_clusterSeedKey, ItemIds.Metaverse, metaverse);
|
||||
propertySystem.AddItemConsumption(_clusterSeedKey, ItemIds.UniverseMatrix, metaverse);
|
||||
var mainPlayer = GameMain.mainPlayer;
|
||||
GameMain.history.AddPropertyItemConsumption(ItemIds.Metaverse, metaverse, true);
|
||||
GameMain.history.AddPropertyItemConsumption(ItemIds.UniverseMatrix, metaverse, true);
|
||||
var count = definition.ExchangeRate * metaverse;
|
||||
DarkFogItemsInVoid[itemIdx] += count;
|
||||
consume = (byte)Math.Min(DarkFogItemsInVoid[itemIdx], 4);
|
||||
|
||||
@@ -1037,35 +1037,35 @@ internal static class Program
|
||||
{
|
||||
new ProductionItem(ItemIds.Water, 0, true, false, 0, 0),
|
||||
new ProductionItem(ItemIds.ProliferatorMkIII, 201, false, false, 4, 75),
|
||||
new ProductionItem(ItemIds.Steel, 202, false, false, 0, 0),
|
||||
new ProductionItem(ItemIds.SpaceWarper, 203, false, false, 0, 0),
|
||||
new ProductionItem(ItemIds.TitaniumGlass, 204, false, false, 0, 0)
|
||||
new ProductionItem(ItemIds.TitaniumAlloy, 202, false, false, 0, 0),
|
||||
new ProductionItem(ItemIds.CasimirCrystal, 203, false, false, 0, 0),
|
||||
new ProductionItem(ItemIds.Prism, 204, false, false, 0, 0)
|
||||
};
|
||||
var recipes = new[]
|
||||
{
|
||||
Recipe(201, new[] { (ItemIds.Water, 1.0) },
|
||||
new[] { (ItemIds.ProliferatorMkIII, 1.0) }),
|
||||
Recipe(202, new[] { (ItemIds.Water, 1.0) }, new[] { (ItemIds.Steel, 1.0) }),
|
||||
Recipe(203, new[] { (ItemIds.Water, 1.0) }, new[] { (ItemIds.SpaceWarper, 1.0) }),
|
||||
Recipe(204, new[] { (ItemIds.Water, 1.0) }, new[] { (ItemIds.TitaniumGlass, 1.0) },
|
||||
Recipe(202, new[] { (ItemIds.Water, 1.0) }, new[] { (ItemIds.TitaniumAlloy, 1.0) }),
|
||||
Recipe(203, new[] { (ItemIds.Water, 1.0) }, new[] { (ItemIds.CasimirCrystal, 1.0) }),
|
||||
Recipe(204, new[] { (ItemIds.Water, 1.0) }, new[] { (ItemIds.Prism, 1.0) },
|
||||
productive: false)
|
||||
};
|
||||
var catalog = new ProductionCatalog(items, recipes, Array.Empty<ProductionBuilding>(),
|
||||
new[] { 0.0, 0.25, 0.5, 0.75, 1.0 },
|
||||
new[] { 0.0, 0.125, 0.2, 0.225, 0.25 },
|
||||
new[] { 1.0, 1.3, 1.7, 2.1, 2.5 });
|
||||
var request = BeltSignalSourcePreset.Create(catalog, ItemIds.Steel, true, true);
|
||||
var request = BeltSignalSourcePreset.Create(catalog, ItemIds.TitaniumAlloy, true, true);
|
||||
Check(request.ExternalMaterials.SetEquals(new[] { ItemIds.Water }),
|
||||
"only known natural belt source IDs become external materials");
|
||||
Equal(ItemIds.ProliferatorMkIII, request.ProliferatorItemId,
|
||||
"belt policy uses the available proliferator item");
|
||||
Check(request.SelfSprayProliferator && request.SprayDeliveredItems.Contains(ItemIds.Steel),
|
||||
Check(request.SelfSprayProliferator && request.SprayDeliveredItems.Contains(ItemIds.TitaniumAlloy),
|
||||
"self-spray and delivered-item spraying are request settings");
|
||||
Check(request.ProliferationModeByItem[ItemIds.Steel] == ProliferationMode.ExtraProducts,
|
||||
Check(request.ProliferationModeByItem[ItemIds.TitaniumAlloy] == ProliferationMode.ExtraProducts,
|
||||
"productive legacy extra-products choice maps to a native mode");
|
||||
Check(request.ProliferationModeByItem[ItemIds.SpaceWarper] == ProliferationMode.None,
|
||||
Check(request.ProliferationModeByItem[ItemIds.CasimirCrystal] == ProliferationMode.None,
|
||||
"legacy disabled item keeps its no-proliferation preset");
|
||||
Check(request.ProliferationModeByItem[ItemIds.TitaniumGlass] == ProliferationMode.Speedup,
|
||||
Check(request.ProliferationModeByItem[ItemIds.Prism] == ProliferationMode.Speedup,
|
||||
"unsupported extra-products choice falls back to native speedup");
|
||||
var report = new ProductionPlanner(catalog).Calculate(request);
|
||||
Check(report.MaterialComplete, "belt preset resolves the proliferator's recipe and raw materials");
|
||||
@@ -1084,7 +1084,7 @@ internal static class Program
|
||||
Array.Empty<ProductionBuilding>(), new[] { 0.0, 0.25, 0.5, 0.75, 1.0 },
|
||||
new[] { 0.0, 0.125, 0.2, 0.225, 0.25 },
|
||||
new[] { 1.0, 1.3, 1.7, 2.1, 2.5 });
|
||||
var updated = BeltSignalSourcePreset.Create(updatedCatalog, ItemIds.Steel, true, false);
|
||||
var updated = BeltSignalSourcePreset.Create(updatedCatalog, ItemIds.TitaniumAlloy, true, false);
|
||||
Equal(9999, updated.ProliferatorItemId, "updated game data selects a valid proliferator instead of a stale ID");
|
||||
|
||||
var alternativeCatalog = new ProductionCatalog(new[]
|
||||
|
||||
Reference in new issue
Block a user