typed-factorio 0.14.1 → 0.17.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -101,16 +101,20 @@ type PositionArray = readonly [x: int, y: int]
101
101
  */
102
102
  type Position = PositionTable | PositionArray
103
103
 
104
+ interface MapPositionTable {
105
+ readonly x: double
106
+ readonly y: double
107
+ }
108
+
109
+ type MapPositionArray = readonly [x: double, y: double]
110
+
104
111
  /**
105
112
  * Coordinates of an entity on a map. This uses the same format as {@link Position}, meaning it can be specified either
106
113
  * with or without explicit keys.
107
114
  *
108
115
  * {@link https://lua-api.factorio.com/latest/Concepts.html#MapPosition View documentation}
109
116
  */
110
- interface MapPosition {
111
- readonly x: double
112
- readonly y: double
113
- }
117
+ type MapPosition = MapPositionTable | MapPositionArray
114
118
 
115
119
  interface ChunkPositionTable {
116
120
  readonly x: int
@@ -167,7 +171,7 @@ type GuiLocation = GuiLocationTable | GuiLocationArray
167
171
  interface ChunkPositionAndArea {
168
172
  readonly x: int
169
173
  readonly y: int
170
- readonly area: BoundingBox
174
+ readonly area: BoundingBoxRead
171
175
  }
172
176
 
173
177
  /**
@@ -201,7 +205,7 @@ interface TabAndContent {
201
205
 
202
206
  interface OldTileAndPosition {
203
207
  readonly old_tile: LuaTilePrototype
204
- readonly position: TilePosition
208
+ readonly position: TilePositionTable
205
209
  }
206
210
 
207
211
  /**
@@ -230,7 +234,7 @@ interface SmokeSource {
230
234
  readonly east_position?: PositionTable
231
235
  readonly south_position?: PositionTable
232
236
  readonly west_position?: PositionTable
233
- readonly deviation?: Position
237
+ readonly deviation?: PositionTable
234
238
  readonly starting_frame_speed: uint16
235
239
  readonly starting_frame_speed_deviation: double
236
240
  readonly starting_frame: uint16
@@ -285,6 +289,13 @@ type BoundingBoxArray = readonly [left_top: Position, right_bottom: Position, or
285
289
  */
286
290
  type BoundingBox = BoundingBoxTable | BoundingBoxArray
287
291
 
292
+ /** @addAfter BoundingBox */
293
+ interface BoundingBoxRead extends BoundingBoxTable {
294
+ readonly left_top: PositionTable
295
+ readonly right_bottom: PositionTable
296
+ readonly orientation?: RealOrientation
297
+ }
298
+
288
299
  /**
289
300
  * An area defined using the map editor.
290
301
  *
@@ -297,6 +308,11 @@ interface ScriptArea {
297
308
  readonly id: uint
298
309
  }
299
310
 
311
+ interface ScriptAreaRead extends ScriptArea {
312
+ readonly area: BoundingBoxRead
313
+ readonly color: ColorTable
314
+ }
315
+
300
316
  /**
301
317
  * A position defined using the map editor.
302
318
  *
@@ -309,6 +325,11 @@ interface ScriptPosition {
309
325
  readonly id: uint
310
326
  }
311
327
 
328
+ interface ScriptPositionRead extends ScriptPosition {
329
+ readonly position: PositionTable
330
+ readonly color: ColorTable
331
+ }
332
+
312
333
  interface ColorTable {
313
334
  readonly r?: float
314
335
  readonly g?: float
@@ -368,7 +389,7 @@ interface Alert {
368
389
  readonly tick: uint
369
390
  readonly target?: LuaEntity
370
391
  readonly prototype?: LuaEntityPrototype
371
- readonly position?: Position
392
+ readonly position?: PositionTable
372
393
  /** The SignalID used for a custom alert. Only present for custom alerts. */
373
394
  readonly icon?: SignalID
374
395
  /** The message for a custom alert. Only present for custom alerts. */
@@ -388,7 +409,7 @@ interface ScriptRenderVertexTarget {
388
409
 
389
410
  interface PathfinderWaypoint {
390
411
  /** The position of the waypoint on its surface. */
391
- readonly position: Position
412
+ readonly position: PositionTable
392
413
  /** `true` if the path from the previous waypoint to this one goes through an entity that must be destroyed. */
393
414
  readonly needs_destroy_to_reach: boolean
394
415
  }
@@ -414,7 +435,7 @@ interface Decorative {
414
435
  }
415
436
 
416
437
  interface DecorativeResult {
417
- readonly position: TilePosition
438
+ readonly position: TilePositionTable
418
439
  readonly decorative: LuaDecorativePrototype
419
440
  readonly amount: uint
420
441
  }
@@ -900,7 +921,7 @@ interface MapAndDifficultySettings {
900
921
  */
901
922
  interface MapExchangeStringData {
902
923
  readonly map_settings: MapAndDifficultySettings
903
- readonly map_gen_settings: MapGenSettings
924
+ readonly map_gen_settings: MapGenSettingsRead
904
925
  }
905
926
 
906
927
  interface BlueprintItemIcon {
@@ -998,6 +1019,11 @@ interface BlueprintEntity {
998
1019
  readonly schedule?: TrainScheduleRecord[]
999
1020
  }
1000
1021
 
1022
+ interface BlueprintEntityRead extends BlueprintEntity {
1023
+ /** The position of the entity. */
1024
+ readonly position: PositionTable
1025
+ }
1026
+
1001
1027
  interface Tile {
1002
1028
  /** The position of the tile. */
1003
1029
  readonly position: Position
@@ -1005,6 +1031,11 @@ interface Tile {
1005
1031
  readonly name: string
1006
1032
  }
1007
1033
 
1034
+ interface TileRead extends Tile {
1035
+ /** The position of the tile. */
1036
+ readonly position: PositionTable
1037
+ }
1038
+
1008
1039
  interface Fluid {
1009
1040
  /** Fluid prototype name of the fluid. */
1010
1041
  readonly name: string
@@ -1600,6 +1631,11 @@ interface MapGenSettings {
1600
1631
  readonly property_expression_names: Record<string, string>
1601
1632
  }
1602
1633
 
1634
+ interface MapGenSettingsRead extends MapGenSettings {
1635
+ /** Positions of the starting areas. */
1636
+ readonly starting_points: PositionTable[]
1637
+ }
1638
+
1603
1639
  interface SignalID {
1604
1640
  /** `"item"`, `"fluid"`, or `"virtual"`. */
1605
1641
  readonly type: "item" | "fluid" | "virtual"
@@ -1864,6 +1900,15 @@ interface GoToLocationCommand extends BaseCommand {
1864
1900
  readonly radius?: double
1865
1901
  }
1866
1902
 
1903
+ interface GoToLocationCommandRead extends BaseCommand, GoToLocationCommand {
1904
+ readonly type: defines.command.go_to_location
1905
+ /**
1906
+ * The position to path to. Either this or `destination_entity` need to be specified. If both are,
1907
+ * `destination_entity` is used.
1908
+ */
1909
+ readonly destination?: PositionTable
1910
+ }
1911
+
1867
1912
  interface CompoundCommand extends BaseCommand {
1868
1913
  readonly type: defines.command.compound
1869
1914
  /** How the commands should be chained together. */
@@ -1872,6 +1917,12 @@ interface CompoundCommand extends BaseCommand {
1872
1917
  readonly commands: Command[]
1873
1918
  }
1874
1919
 
1920
+ interface CompoundCommandRead extends BaseCommand, CompoundCommand {
1921
+ readonly type: defines.command.compound
1922
+ /** The sub-commands. */
1923
+ readonly commands: CommandRead[]
1924
+ }
1925
+
1875
1926
  interface GroupCommand extends BaseCommand {
1876
1927
  readonly type: defines.command.group
1877
1928
  /** The group whose command to follow. */
@@ -1892,6 +1943,12 @@ interface AttackAreaCommand extends BaseCommand {
1892
1943
  readonly distraction?: defines.distraction
1893
1944
  }
1894
1945
 
1946
+ interface AttackAreaCommandRead extends BaseCommand, AttackAreaCommand {
1947
+ readonly type: defines.command.attack_area
1948
+ /** Center of the attack area. */
1949
+ readonly destination: PositionTable
1950
+ }
1951
+
1895
1952
  interface WanderCommand extends BaseCommand {
1896
1953
  readonly type: defines.command.wander
1897
1954
  /** Defaults to `defines.distraction.by_enemy`. */
@@ -1938,6 +1995,23 @@ interface BuildBaseCommand extends BaseCommand {
1938
1995
  readonly ignore_planner?: boolean
1939
1996
  }
1940
1997
 
1998
+ interface BuildBaseCommandRead extends BaseCommand, BuildBaseCommand {
1999
+ readonly type: defines.command.build_base
2000
+ /** Where to build the base. */
2001
+ readonly destination: PositionTable
2002
+ }
2003
+
2004
+ type CommandRead =
2005
+ | AttackCommand
2006
+ | GoToLocationCommandRead
2007
+ | CompoundCommandRead
2008
+ | GroupCommand
2009
+ | AttackAreaCommandRead
2010
+ | WanderCommand
2011
+ | StopCommand
2012
+ | FleeCommand
2013
+ | BuildBaseCommandRead
2014
+
1941
2015
  /**
1942
2016
  * Commands can be given to enemies and unit groups.
1943
2017
  *
@@ -2259,7 +2333,7 @@ interface BeamTarget {
2259
2333
  /** The target entity. */
2260
2334
  readonly entity?: LuaEntity
2261
2335
  /** The target position. */
2262
- readonly position?: Position
2336
+ readonly position?: PositionTable
2263
2337
  }
2264
2338
 
2265
2339
  interface RidingState {
@@ -2853,7 +2927,7 @@ interface SelectedPrototypeData {
2853
2927
  interface ScriptRenderTarget {
2854
2928
  readonly entity?: LuaEntity
2855
2929
  readonly entity_offset?: Vector
2856
- readonly position?: Position
2930
+ readonly position?: PositionTable
2857
2931
  }
2858
2932
 
2859
2933
  type MouseButtonFlag =
@@ -6565,6 +6639,17 @@ type StyleValuesArray =
6565
6639
 
6566
6640
  type SizeArray = readonly [width: int, height: int]
6567
6641
 
6642
+ type RaiseableEvents =
6643
+ | typeof defines.events.on_console_chat
6644
+ | typeof defines.events.on_player_crafted_item
6645
+ | typeof defines.events.on_player_fast_transferred
6646
+ | typeof defines.events.on_biter_base_built
6647
+ | typeof defines.events.on_market_item_purchased
6648
+ | typeof defines.events.script_raised_built
6649
+ | typeof defines.events.script_raised_destroy
6650
+ | typeof defines.events.script_raised_revive
6651
+ | typeof defines.events.script_raised_set_tiles
6652
+
6568
6653
  /**
6569
6654
  * A map gen preset. Used in {@link https://wiki.factorio.com/Prototype/MapGenPresets Prototype/MapGenPresets}.
6570
6655
  *