factorio-api.models.ts 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. export interface PrototypeApi {
  2. application: string;
  3. application_version: string;
  4. api_version: number;
  5. stage: string;
  6. prototypes: Prototype[];
  7. types: Concept[];
  8. }
  9. export interface Prototype {
  10. name: string;
  11. order: number;
  12. description: string;
  13. lists?: string[];
  14. examples?: string[];
  15. images?: Image[];
  16. parent?: string;
  17. abstract: boolean;
  18. typename?: string;
  19. instance_limit?: number;
  20. deprecated: boolean;
  21. properties: Property[];
  22. custom_properties: CustomProperty[];
  23. }
  24. export interface Concept {
  25. name: string;
  26. order: number;
  27. description: string;
  28. lists?: string[];
  29. examples?: string[];
  30. images?: Image[];
  31. parent?: string;
  32. abstract: boolean;
  33. inline: false;
  34. type: DataType;
  35. properties?: Property[];
  36. }
  37. export interface Property {
  38. name: string;
  39. order: number;
  40. description: string;
  41. lists?: string[];
  42. examples?: string[];
  43. images?: Image[];
  44. alt_name?: string;
  45. override: boolean;
  46. type: DataType;
  47. optional: boolean;
  48. default?: [string, LiteralDataType];
  49. }
  50. export interface ComplexDataType {
  51. complex_type: string;
  52. }
  53. export interface ArrayDataType extends ComplexDataType {
  54. complex_type: "array";
  55. value: DataType;
  56. }
  57. export interface DictionaryDataType extends ComplexDataType {
  58. complex_type: "dictionary";
  59. key: DataType;
  60. value: DataType;
  61. }
  62. export interface TupleDataType extends ComplexDataType {
  63. complex_type: "tuple";
  64. values: DataType[];
  65. }
  66. export interface UnionDataType extends ComplexDataType {
  67. complex_type: "union";
  68. options: DataType[];
  69. full_format: boolean;
  70. }
  71. export interface LiteralDataType extends ComplexDataType {
  72. complex_type: "literal";
  73. value: string | number | boolean;
  74. description?: string;
  75. }
  76. export interface TypeDataType extends ComplexDataType {
  77. complex_type: "type";
  78. value: DataType;
  79. description: string;
  80. }
  81. export interface StructDataType extends ComplexDataType {
  82. complex_type: "struct";
  83. }
  84. export type DataType =
  85. | string
  86. | ArrayDataType
  87. | DictionaryDataType
  88. | TupleDataType
  89. | UnionDataType
  90. | LiteralDataType
  91. | TypeDataType
  92. | StructDataType;
  93. export interface Image {
  94. filename: string;
  95. caption?: string;
  96. }
  97. export interface CustomProperty {
  98. description: string;
  99. lists?: string[];
  100. examples?: string[];
  101. images?: Image[];
  102. key_type: DataType;
  103. value_type: DataType;
  104. }