mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2026-08-05 17:40:24 +08:00
refactor: centralize game constants
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
namespace UXAssist.Common.GameConstants;
|
||||
|
||||
/// <summary>
|
||||
/// Geometric and pool constants used by Dyson Sphere helper functions.
|
||||
/// </summary>
|
||||
public static class DysonSphereConstants
|
||||
{
|
||||
/* Angle conversion. */
|
||||
public const float RadiansToDegrees = 57.2957802f;
|
||||
|
||||
/* Default capacity for newly reset Dyson sphere layer pools. */
|
||||
public const int DefaultLayerPoolCapacity = 64;
|
||||
|
||||
/* Maximum allowed vertices for a custom Dyson shell. */
|
||||
public const int MaxShellVertices = 32767;
|
||||
|
||||
/* Minimum vertex count used as a quality guard in quick shell creation. */
|
||||
public const int MinShellVertexThreshold = 32000;
|
||||
|
||||
/* Maximum orbit radius supported by precalculated shell triangles (m). */
|
||||
public const int MaxOrbitRadius = 250000;
|
||||
|
||||
/* Minimum radius considered when searching for a free layer radius. */
|
||||
public const int MinOrbitRadiusSearch = 4000;
|
||||
|
||||
/* Layer radius decrement step when looking for a free slot. */
|
||||
public const int OrbitRadiusSearchStep = 10;
|
||||
|
||||
/* Base grid size used for shell vertex tessellation. */
|
||||
public const float GridSizeBase = 80f;
|
||||
|
||||
/* Base radius used to derive shell grid scale (gridScale ~ (radius / base)^0.75). */
|
||||
public const double GridScaleBaseRadius = 4000.0;
|
||||
|
||||
/* Cell point cost per vertex (cpPerVertex = gridScale^2 * 2). */
|
||||
public const int CpPerVertexFactor = 2;
|
||||
|
||||
/* Number of candidate node positions around the orbit for max-output shell search. */
|
||||
public const int MaxShellSearchNodeCount = 60;
|
||||
|
||||
/* Maximum triangle combinations evaluated in brute-force shell search. */
|
||||
public const int MaxShellSearchCombinations = 60 * 59 * 58;
|
||||
|
||||
/* Seed multiplier for shell randomization. */
|
||||
public const int ShellRandSeedMultiplier = 10000;
|
||||
|
||||
/* int.MaxValue, used as a total-cp ceiling before forcing new nodes. */
|
||||
public const int TotalCpMaxCeiling = int.MaxValue;
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace UXAssist.Common.GameConstants;
|
||||
|
||||
/// <summary>
|
||||
/// Hard-coded item IDs used across factory and logistics patches.
|
||||
/// </summary>
|
||||
public static class ItemIds
|
||||
{
|
||||
/* Ores and basic resources */
|
||||
public const int Water = 1000;
|
||||
public const int Coal = 1006;
|
||||
public const int SulfuricAcid = 1116;
|
||||
public const int Hydrogen = 1120;
|
||||
public const int Deuterium = 1121;
|
||||
public const int Photon = 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;
|
||||
|
||||
/* Proliferators */
|
||||
public const int ProliferatorMkI = 1141;
|
||||
public const int ProliferatorMkII = 1142;
|
||||
public const int ProliferatorMkIII = 1143;
|
||||
|
||||
/* Logistics carriers */
|
||||
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;
|
||||
|
||||
/* Power generators */
|
||||
public const int WindTurbine = 2203;
|
||||
|
||||
/* Dark Fog items (combat expansion) */
|
||||
public const int DarkFogMemoryUnit = 5201;
|
||||
public const int DarkFogEnergyFragment = 5202;
|
||||
public const int DarkFogSiliconNeuron = 5203;
|
||||
public const int DarkFogNegentropySingularity = 5204;
|
||||
public const int DarkFogMatterReassembler = 5205;
|
||||
public const int DarkFogVirtualParticle = 5206;
|
||||
|
||||
/* Fuel and advanced items */
|
||||
public const int HydrogenFuelRod = 6001;
|
||||
public const int DeuteronFuelRod = 6002;
|
||||
public const int AntimatterFuelRod = 6003;
|
||||
public const int StrangeMatter = 6004;
|
||||
public const int Foundation = 6005;
|
||||
public const int Metaverse = 6006; // also called property/meta-data item
|
||||
|
||||
/* Item groups used by belt signal recipe calculations. */
|
||||
public static readonly int[] ExtraOreItemIds =
|
||||
[
|
||||
Water, SulfuricAcid, Hydrogen, Deuterium, Photon,
|
||||
DarkFogMemoryUnit, DarkFogEnergyFragment, DarkFogSiliconNeuron,
|
||||
DarkFogNegentropySingularity, DarkFogMatterReassembler, DarkFogVirtualParticle
|
||||
];
|
||||
|
||||
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
|
||||
];
|
||||
|
||||
public static readonly HashSet<int> NoProliferationItemIds =
|
||||
[
|
||||
SpaceWarper, DeuteronFuelRod
|
||||
];
|
||||
|
||||
/// <summary>
|
||||
/// All source items used to create 25 proliferators mk.III (not self-sprayed).
|
||||
/// </summary>
|
||||
public static readonly List<(int ItemId, float Count)> ProliferatorSources =
|
||||
[
|
||||
(OrganicCrystal, 60f),
|
||||
(CriticalPhoton, 20f),
|
||||
(Coal, 64f),
|
||||
(FireIce, 16f),
|
||||
(CircuitBoard, 32f),
|
||||
(ProliferatorMkI, 64f),
|
||||
(ProliferatorMkII, 40f),
|
||||
(ProliferatorMkIII, 25f)
|
||||
];
|
||||
|
||||
/* Aliases used by UXAssist belt signal buy-out logic. */
|
||||
public static readonly int[] DarkFogItemIds =
|
||||
[
|
||||
DarkFogMemoryUnit, DarkFogVirtualParticle, DarkFogEnergyFragment,
|
||||
DarkFogNegentropySingularity, DarkFogSiliconNeuron, DarkFogMatterReassembler
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
namespace UXAssist.Common.GameConstants;
|
||||
|
||||
/// <summary>
|
||||
/// Constants used by logistics capacity and station UI patches.
|
||||
/// </summary>
|
||||
public static class LogisticsConstants
|
||||
{
|
||||
/* Default base storage capacity used by the real-time logistics panel. */
|
||||
public const int DefaultLocalStorageMax = 5000;
|
||||
public const int DefaultRemoteStorageMax = 10000;
|
||||
|
||||
/* Maximum storage when overflow-in-logistics is enabled. */
|
||||
public const int OverflowStorageMax = 90000000;
|
||||
|
||||
/* Station storage slot limits. */
|
||||
public const int DefaultStorageSlotCount = 5;
|
||||
|
||||
/* Key-repeat timing for keyboard-based max adjustment (in game ticks). */
|
||||
public const long KeyRepeatInitialDelay = 30;
|
||||
public const long KeyRepeatInterval = 4;
|
||||
|
||||
/* Keyboard adjustment deltas for storage max values. */
|
||||
public const int SmallAdjustment = 10;
|
||||
public const int MediumAdjustment = 100;
|
||||
public const int LargeAdjustment = 1000;
|
||||
public const int HugeAdjustment = 10000;
|
||||
public const int MassiveAdjustment = 100000;
|
||||
public const int GargantuanAdjustment = 1000000;
|
||||
|
||||
/* Rounding divisors used when scaling storage on tech unlock. */
|
||||
public const int LocalStorageRounding = 50;
|
||||
public const int RemoteStorageRounding = 100;
|
||||
|
||||
/* Charge power slider scaling factors. */
|
||||
public const long ChargePowerSliderScale = 50000L;
|
||||
public const long ChargePowerSliderMinScale = 500000L;
|
||||
|
||||
/* Mining speed slider ranges. */
|
||||
public const int MinMiningSpeedBase = 10000;
|
||||
public const int MaxMiningSpeedBase = 30000;
|
||||
public const int MiningSpeedFineStep = 1000;
|
||||
public const int MiningSpeedCoarseStep = 10000;
|
||||
public const float MiningSpeedSliderMaxDefault = 20f;
|
||||
public const float MiningSpeedSliderMaxExtended = 27f;
|
||||
|
||||
/* Dispenser / battle base charge power multiplier. */
|
||||
public const double DispenserChargePowerMultiplier = 5000.0;
|
||||
|
||||
/* Real-time logistics panel UI dimensions. */
|
||||
public const float StorageSliderWidth = 70f;
|
||||
public const float StorageSliderHeight = 5f;
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace UXAssist.Common.GameConstants;
|
||||
|
||||
/// <summary>
|
||||
/// Hard-coded technology IDs used across tech patches.
|
||||
/// </summary>
|
||||
public static class TechIds
|
||||
{
|
||||
/// <summary>
|
||||
/// Base game tech for "Sorter Cargo Stacking" upgrades.
|
||||
/// </summary>
|
||||
public const int SorterCargoStacking = 3608;
|
||||
|
||||
/* Custom sorter cargo stacking techs used by UXAssist (repositioned clones). */
|
||||
public const int SorterCargoStackingCustomStart = 3301;
|
||||
public const int SorterCargoStackingCustomEnd = 3306;
|
||||
|
||||
/* Combat-related tech ranges disabled in peace mode. */
|
||||
public static readonly HashSet<int> CombatTechs = CreateCombatTechs();
|
||||
|
||||
private static HashSet<int> CreateCombatTechs()
|
||||
{
|
||||
(int Start, int End)[] ranges =
|
||||
[
|
||||
// Explosive Unit, Crystal Explosive Unit
|
||||
(1803, 1804),
|
||||
// Implosion Cannon
|
||||
(1807, 1807),
|
||||
// Signal Tower, Planetary Defense System, Jammer Tower, Plasma Turret,
|
||||
// ammo boxes, shell/missile sets, capsules, drones, corvettes, destroyers, suppressing/EM capsules
|
||||
(1809, 1825),
|
||||
// Auto Reconstruction Marking
|
||||
(2951, 2956),
|
||||
// Energy Shield
|
||||
(2801, 2807),
|
||||
// Kinetic Weapon Damage
|
||||
(5001, 5006),
|
||||
// Energy Weapon Damage
|
||||
(5101, 5106),
|
||||
// Explosive Weapon Damage
|
||||
(5201, 5206),
|
||||
// Combat Drone Damage
|
||||
(5301, 5305),
|
||||
// Combat Drone Attack Speed
|
||||
(5401, 5405),
|
||||
// Combat Drone Engine
|
||||
(5601, 5605),
|
||||
// Combat Drone Durability
|
||||
(5701, 5705),
|
||||
// Ground Squadron Expansion
|
||||
(5801, 5807),
|
||||
// Space Fleet Expansion
|
||||
(5901, 5907),
|
||||
// Enhanced Structure
|
||||
(6001, 6006),
|
||||
// Planetary Shield
|
||||
(6101, 6106)
|
||||
];
|
||||
|
||||
var set = new HashSet<int>();
|
||||
foreach (var (start, end) in ranges)
|
||||
{
|
||||
for (var id = start; id <= end; id++)
|
||||
{
|
||||
set.Add(id);
|
||||
}
|
||||
}
|
||||
|
||||
return set;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
namespace UXAssist.Common.GameConstants;
|
||||
|
||||
/// <summary>
|
||||
/// Galaxy generation defaults, slider limits and UI constants.
|
||||
/// </summary>
|
||||
public static class UniverseGenConstants
|
||||
{
|
||||
/* Default algorithm parameters for galaxy generation. */
|
||||
public const double DefaultMinDist = 2.0;
|
||||
public const double DefaultMinStep = 2.0;
|
||||
public const double DefaultMaxStep = 3.2;
|
||||
public const double DefaultFlatten = 0.18;
|
||||
|
||||
/* Vanilla game limits replaced by UniverseGenTweaks. */
|
||||
public const int VanillaMaxStarCount = 80;
|
||||
public const int VanillaGalaxyCapacity = 25700;
|
||||
public const int VanillaSectorCapacity = 25600;
|
||||
|
||||
/* Expanded capacities used by UniverseGenTweaks. */
|
||||
public const int ExpandedGalaxyCapacity = 102500;
|
||||
public const int ExpandedSectorCapacity = 102500;
|
||||
|
||||
/* Maximum star count settings. */
|
||||
public const int MinStarCount = 32;
|
||||
public const int MaxStarCount = 1024;
|
||||
public const int DefaultMaxStarCount = 128;
|
||||
public const float StarCountSliderMin = 64f;
|
||||
public const float StarCountSliderMax = 1024f;
|
||||
public const int StarCountAlignmentMask = 7; // round up to multiple of 8
|
||||
|
||||
/* UIGalaxySelect custom slider limits (slider value = parameter * StepSliderScale). */
|
||||
public const float StepSliderScale = 10f;
|
||||
|
||||
public const float MinDistSliderMin = 10f;
|
||||
public const float MinDistSliderMax = 50f;
|
||||
|
||||
public const float MaxStepSliderMax = 100f;
|
||||
|
||||
public const float FlattenSliderMin = 1f;
|
||||
public const float FlattenSliderMax = 50f;
|
||||
public const double FlattenSliderScale = 50.0;
|
||||
|
||||
/* Vertical spacing between added slider rows in the galaxy select UI. */
|
||||
public const float SliderRowSpacing = -36f;
|
||||
|
||||
/* Epic difficulty resource multiplier slider. */
|
||||
public const float ResourceMultiplierSliderMax = 11f;
|
||||
|
||||
/* Oil multiplier thresholds used by Epic difficulty. */
|
||||
public const float OilMultiplierThreshold = 0.05f;
|
||||
public const float OilMultiplierBase = 0.5f;
|
||||
}
|
||||
Reference in New Issue
Block a user