factorio-process-data.models.ts 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. import * as M from "./factorio-dump.models.ts";
  2. import type { Group } from "./helpers/groups.helper.ts";
  3. import type { Recipe } from "./helpers/recipes.helper.ts";
  4. export interface ModList {
  5. mods: { name: string; enabled: boolean }[];
  6. }
  7. export type EffectType = "speed" | "productivity" | "consumption" | "pollution" | "quality";
  8. export const allEffects: EffectType[] = ["consumption", "speed", "productivity", "pollution", "quality"];
  9. type Entities<T = string> = Record<string, T>;
  10. export interface DataRawDump {
  11. "agricultural-tower"?: Entities<M.AgriculturalTowerPrototype>;
  12. ammo: Entities<M.AmmoItemPrototype>;
  13. armor: Entities<M.ArmorPrototype>;
  14. "assembling-machine": Entities<M.AssemblingMachinePrototype>;
  15. asteroid?: Entities<M.AsteroidPrototype>;
  16. "asteroid-chunk": Entities<M.AsteroidChunkPrototype>;
  17. "asteroid-collector"?: Entities<M.AsteroidCollectorPrototype>;
  18. beacon: Entities<M.BeaconPrototype>;
  19. boiler: Entities<M.BoilerPrototype>;
  20. capsule: Entities<M.CapsulePrototype>;
  21. "cargo-wagon": Entities<M.CargoWagonPrototype>;
  22. fluid: Entities<M.FluidPrototype>;
  23. "fluid-wagon": Entities<M.FluidWagonPrototype>;
  24. furnace: Entities<M.FurnacePrototype>;
  25. gun: Entities<M.GunPrototype>;
  26. item: Entities<M.ItemPrototype>;
  27. "item-group": Entities<M.ItemGroup>;
  28. "item-subgroup": Entities<M.ItemSubGroup>;
  29. "item-with-entity-data": Entities<M.ItemWithEntityDataPrototype>;
  30. lab: Entities<M.LabPrototype>;
  31. "mining-drill": Entities<M.MiningDrillPrototype>;
  32. module: Entities<M.ModulePrototype>;
  33. "offshore-pump": Entities<M.OffshorePumpPrototype>;
  34. planet: Entities<M.PlanetPrototype>;
  35. plant: Entities<M.PlantPrototype>;
  36. pump: Entities<M.PumpPrototype>;
  37. quality: Entities<M.QualityPrototype>;
  38. "rail-planner": Entities<M.RailPlannerPrototype>;
  39. reactor: Entities<M.ReactorPrototype>;
  40. recipe: Entities<M.RecipePrototype>;
  41. "recipe-category": Entities<M.RecipeCategory>;
  42. "repair-tool": Entities<M.RepairToolPrototype>;
  43. resource: Entities<M.ResourceEntityPrototype>;
  44. "rocket-silo": Entities<M.RocketSiloPrototype>;
  45. "rocket-silo-rocket": Entities<M.RocketSiloRocketPrototype>;
  46. "selection-tool": Entities<M.SelectionToolPrototype>;
  47. "space-connection"?: Entities<M.SpaceConnectionPrototype>;
  48. "space-location": Entities<M.SpaceLocationPrototype>;
  49. "space-platform-starter-pack"?: Entities<M.SpacePlatformStarterPackPrototype>;
  50. "spidertron-remote": Entities<M.SpidertronRemotePrototype>;
  51. surface: Entities<M.SurfacePrototype>;
  52. "surface-property": Entities<M.SurfacePropertyPrototype>;
  53. technology: Entities<M.TechnologyPrototype>;
  54. tile: Entities<M.TilePrototype>;
  55. tool: Entities<M.ToolPrototype>;
  56. "transport-belt": Entities<M.TransportBeltPrototype>;
  57. "utility-constants": { default: M.UtilityConstants };
  58. "virtual-signal": Entities<M.VirtualSignalPrototype>;
  59. }
  60. export interface Locale {
  61. names: Entities;
  62. }
  63. export type Item = {
  64. name: string;
  65. icon?: string;
  66. subgroup: string;
  67. order?: string;
  68. };
  69. export type Machine = {
  70. name: string;
  71. icon?: string;
  72. allowed_effects?: string | Array<string>;
  73. crafting_categories: string[];
  74. crafting_speed: number;
  75. selection_box?: M.BoundingBox;
  76. module_slots?: number;
  77. effect_receiver?: M.EffectReceiver;
  78. };
  79. export type Module = {
  80. name: string;
  81. icon?: string;
  82. subgroup?: string;
  83. category: string;
  84. tier: number;
  85. order?: string;
  86. effect?: M.Effect;
  87. };
  88. export type RecipeCategory = {
  89. name: string;
  90. subgroup?: string;
  91. order?: string;
  92. };
  93. export type Quality = M.QualityPrototype & {
  94. icon: string;
  95. };
  96. export type Signal = {
  97. name: string;
  98. icon?: string;
  99. subgroup: string;
  100. order?: string;
  101. };
  102. export type ProcessedData = {
  103. machines: Machine[];
  104. qualityLevels: Quality[];
  105. modules: Module[];
  106. recipeCategories: RecipeCategory[];
  107. recipeGroup: Group<Recipe>[];
  108. signalGroup: Group<Signal>[];
  109. };