factorio-types 0.0.39 → 0.0.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/classes.d.ts CHANGED
@@ -2,9 +2,10 @@
2
2
  // Factorio API reference https://lua-api.factorio.com/latest/index.html
3
3
  // Generated from JSON source https://lua-api.factorio.com/latest/runtime-api.json
4
4
  // Definition source https://github.com/sguest/factorio-types
5
- // Factorio version 1.1.89
5
+ // Factorio version 1.1.90
6
6
  // API version 4
7
7
 
8
+ declare namespace runtime {
8
9
  /**
9
10
  * Collection of settings for overriding default ai behavior.
10
11
  */
@@ -12,7 +13,7 @@ interface LuaAISettings {
12
13
  /**
13
14
  * All methods and properties that this object supports.
14
15
  */
15
- help(this: void): void
16
+ help(this: void): string
16
17
 
17
18
  /**
18
19
  * If enabled, units that repeatedly fail to succeed at commands will be destroyed.
@@ -53,7 +54,7 @@ interface LuaAccumulatorControlBehavior extends LuaControlBehavior {
53
54
  /**
54
55
  * All methods and properties that this object supports.
55
56
  */
56
- help(this: void): void
57
+ help(this: void): string
57
58
 
58
59
  /**
59
60
  * The class name of this object. Available even when `valid` is false. For LuaStruct objects it may also be suffixed with a dotted path to a member of the struct.
@@ -76,7 +77,7 @@ interface LuaAchievementPrototype {
76
77
  /**
77
78
  * All methods and properties that this object supports.
78
79
  */
79
- help(this: void): void
80
+ help(this: void): string
80
81
 
81
82
  readonly allowed_without_fight: boolean
82
83
 
@@ -115,7 +116,7 @@ interface LuaAmmoCategoryPrototype {
115
116
  /**
116
117
  * All methods and properties that this object supports.
117
118
  */
118
- help(this: void): void
119
+ help(this: void): string
119
120
 
120
121
  readonly bonus_gui_order: string
121
122
 
@@ -152,7 +153,7 @@ interface LuaArithmeticCombinatorControlBehavior extends LuaCombinatorControlBeh
152
153
  /**
153
154
  * All methods and properties that this object supports.
154
155
  */
155
- help(this: void): void
156
+ help(this: void): string
156
157
 
157
158
  /**
158
159
  * The class name of this object. Available even when `valid` is false. For LuaStruct objects it may also be suffixed with a dotted path to a member of the struct.
@@ -181,7 +182,7 @@ interface LuaAutoplaceControlPrototype {
181
182
  /**
182
183
  * All methods and properties that this object supports.
183
184
  */
184
- help(this: void): void
185
+ help(this: void): string
185
186
 
186
187
  readonly can_be_disabled: boolean
187
188
 
@@ -226,34 +227,37 @@ interface LuaAutoplaceControlPrototype {
226
227
  interface LuaBootstrap {
227
228
  /**
228
229
  * Generate a new, unique event ID that can be used to raise custom events with {@link LuaBootstrap::raise_event | runtime:LuaBootstrap::raise_event}.
230
+ * @returns The newly generated event ID.
229
231
  */
230
- generate_event_name(this: void): void
232
+ generate_event_name(this: void): number
231
233
 
232
234
  /**
233
235
  * Gets the filters for the given event.
234
236
  * @param event - ID of the event to get.
237
+ * @returns The filters or `nil` if none are defined.
235
238
  */
236
239
  get_event_filter(this: void,
237
- event: number): void
240
+ event: number): EventFilter | null
238
241
 
239
242
  /**
240
243
  * Find the event handler for an event.
241
244
  * @param event - The event identifier to get a handler for.
245
+ * @returns Reference to the function currently registered as the handler, if it was found.
242
246
  */
243
247
  get_event_handler(this: void,
244
- event: number): void
248
+ event: number): (this: void, arg0: EventData) => any | null
245
249
 
246
250
  /**
247
251
  * Gets the mod event order as a string.
248
252
  */
249
- get_event_order(this: void): void
253
+ get_event_order(this: void): string
250
254
 
251
255
  /**
252
256
  * Gets the prototype history for the given type and name.
253
257
  */
254
258
  get_prototype_history(this: void,
255
259
  type: string,
256
- name: string): void
260
+ name: string): PrototypeHistory
257
261
 
258
262
  /**
259
263
  * Register a function to be run when mod configuration changes. This is called when the game version or any mod version changed, when any mod was added or removed, when a startup setting has changed, when any prototypes have been added or removed, or when a migration was applied. It allows the mod to make any changes it deems appropriate to both the data structures in its {@link global | runtime:global} table or to the game state through {@link LuaGameScript | runtime:LuaGameScript}.
@@ -287,7 +291,7 @@ interface LuaBootstrap {
287
291
  *
288
292
  */
289
293
  on_event<T extends event>(this: void,
290
- event: defines.events | defines.events[] | string,
294
+ event: defines.events | string | Array<defines.events | string>,
291
295
  handler: (this: void, arg0: EventData) => any | null,
292
296
  filters?: EventFilter): void
293
297
 
@@ -504,9 +508,10 @@ interface LuaBootstrap {
504
508
  * Depending on when a given entity is destroyed, {@link on_entity_destroyed | runtime:on_entity_destroyed} will either be fired at the end of the current tick or at the end of the next tick.
505
509
  *
506
510
  * @param entity - The entity to register.
511
+ * @returns The registration number. It is used to identify the entity in the [on_entity_destroyed](runtime:on_entity_destroyed) event.
507
512
  */
508
513
  register_on_entity_destroyed(this: void,
509
- entity: LuaEntity): void
514
+ entity: LuaEntity): number
510
515
 
511
516
  /**
512
517
  * Sets the filters for the given event. The filters are only retained when set after the actual event registration, because registering for an event with different or no filters will overwrite previously set ones.
@@ -598,7 +603,7 @@ interface LuaBurner {
598
603
  /**
599
604
  * All methods and properties that this object supports.
600
605
  */
601
- help(this: void): void
606
+ help(this: void): string
602
607
 
603
608
  /**
604
609
  * The burnt result inventory.
@@ -668,7 +673,7 @@ interface LuaBurnerPrototype {
668
673
  /**
669
674
  * All methods and properties that this object supports.
670
675
  */
671
- help(this: void): void
676
+ help(this: void): string
672
677
 
673
678
  readonly burnt_inventory_size: number
674
679
 
@@ -740,7 +745,7 @@ interface LuaChunkIterator {
740
745
  /**
741
746
  * All methods and properties that this object supports.
742
747
  */
743
- help(this: void): void
748
+ help(this: void): string
744
749
 
745
750
  /**
746
751
  * The class name of this object. Available even when `valid` is false. For LuaStruct objects it may also be suffixed with a dotted path to a member of the struct.
@@ -755,7 +760,7 @@ interface LuaChunkIterator {
755
760
  /**
756
761
  * Gets the next chunk position if the iterator is not yet done and increments the it.
757
762
  */
758
- (this: void): void
763
+ (this: void): ChunkPositionAndArea | null
759
764
 
760
765
  }
761
766
 
@@ -765,14 +770,15 @@ interface LuaChunkIterator {
765
770
  interface LuaCircuitNetwork {
766
771
  /**
767
772
  * @param signal - The signal to read.
773
+ * @returns The current value of the signal.
768
774
  */
769
775
  get_signal(this: void,
770
- signal: SignalID): void
776
+ signal: SignalID): number
771
777
 
772
778
  /**
773
779
  * All methods and properties that this object supports.
774
780
  */
775
- help(this: void): void
781
+ help(this: void): string
776
782
 
777
783
  /**
778
784
  * The circuit connector ID on the associated entity this network was gotten from.
@@ -822,7 +828,7 @@ interface LuaCombinatorControlBehavior extends LuaControlBehavior {
822
828
  * @param signal - The signal to get
823
829
  */
824
830
  get_signal_last_tick(this: void,
825
- signal: SignalID): void
831
+ signal: SignalID): number | null
826
832
 
827
833
  /**
828
834
  * The circuit network signals sent by this combinator last tick.
@@ -864,9 +870,10 @@ interface LuaCommandProcessor {
864
870
  /**
865
871
  * Remove a custom console command.
866
872
  * @param name - The name of the command to remove (case sensitive).
873
+ * @returns Whether the command was successfully removed. Returns `false` if the command didn't exist.
867
874
  */
868
875
  remove_command(this: void,
869
- name: string): void
876
+ name: string): boolean
870
877
 
871
878
  /**
872
879
  * Lists the custom commands registered by scripts through `LuaCommandProcessor`.
@@ -893,12 +900,12 @@ interface LuaConstantCombinatorControlBehavior extends LuaControlBehavior {
893
900
  * Gets the signal at the given index. Returned {@link Signal | runtime:Signal} will not contain signal if none is set for the index.
894
901
  */
895
902
  get_signal(this: void,
896
- index: number): void
903
+ index: number): Signal
897
904
 
898
905
  /**
899
906
  * All methods and properties that this object supports.
900
907
  */
901
- help(this: void): void
908
+ help(this: void): string
902
909
 
903
910
  /**
904
911
  * Sets the signal at the given index.
@@ -944,7 +951,7 @@ interface LuaContainerControlBehavior extends LuaControlBehavior {
944
951
  /**
945
952
  * All methods and properties that this object supports.
946
953
  */
947
- help(this: void): void
954
+ help(this: void): string
948
955
 
949
956
  /**
950
957
  * The class name of this object. Available even when `valid` is false. For LuaStruct objects it may also be suffixed with a dotted path to a member of the struct.
@@ -967,26 +974,28 @@ interface LuaControl {
967
974
  * @param table.count - The count to craft.
968
975
  * @param table.recipe - The recipe to craft.
969
976
  * @param table.silent - If false and the recipe can't be crafted the requested number of times printing the failure is skipped.
977
+ * @returns The count that was actually started crafting.
970
978
  */
971
979
  begin_crafting(this: void,
972
980
  table: {
973
981
  count: number,
974
982
  recipe: string | LuaRecipe,
975
983
  silent?: boolean
976
- }): void
984
+ }): number
977
985
 
978
986
  /**
979
987
  * Can at least some items be inserted?
980
988
  * @param items - Items that would be inserted.
989
+ * @returns `true` if at least a part of the given items could be inserted into this inventory.
981
990
  */
982
991
  can_insert(this: void,
983
- items: ItemStackIdentification): void
992
+ items: ItemStackIdentification): boolean
984
993
 
985
994
  /**
986
995
  * Can a given entity be opened or accessed?
987
996
  */
988
997
  can_reach_entity(this: void,
989
- entity: LuaEntity): void
998
+ entity: LuaEntity): boolean
990
999
 
991
1000
  /**
992
1001
  * Cancels crafting the given count of the given crafting queue index.
@@ -1044,36 +1053,40 @@ interface LuaControl {
1044
1053
 
1045
1054
  /**
1046
1055
  * Gets the entities that are part of the currently selected blueprint, regardless of it being in a blueprint book or picked from the blueprint library.
1056
+ * @returns Returns `nil` if there is no currently selected blueprint.
1047
1057
  */
1048
- get_blueprint_entities(this: void): void
1058
+ get_blueprint_entities(this: void): BlueprintEntity[] | null
1049
1059
 
1050
1060
  /**
1051
1061
  * Gets the count of the given recipe that can be crafted.
1052
1062
  * @param recipe - The recipe.
1063
+ * @returns The count that can be crafted.
1053
1064
  */
1054
1065
  get_craftable_count(this: void,
1055
- recipe: string | LuaRecipe): void
1066
+ recipe: string | LuaRecipe): number
1056
1067
 
1057
1068
  /**
1058
1069
  * Get an inventory belonging to this entity. This can be either the "main" inventory or some auxiliary one, like the module slots or logistic trash slots.
1059
1070
  * @remarks
1060
1071
  * A given {@link defines.inventory | runtime:defines.inventory} is only meaningful for the corresponding LuaObject type. EG: get_inventory(defines.inventory.character_main) is only meaningful if 'this' is a player character. You may get a value back but if the type of 'this' isn't the type referred to by the {@link defines.inventory | runtime:defines.inventory} it's almost guaranteed to not be the inventory asked for.
1061
1072
  *
1073
+ * @returns The inventory or `nil` if none with the given index was found.
1062
1074
  */
1063
1075
  get_inventory(this: void,
1064
- inventory: defines.inventory): void
1076
+ inventory: defines.inventory): LuaInventory | null
1065
1077
 
1066
1078
  /**
1067
1079
  * Get the number of all or some items in this entity.
1068
1080
  * @param item - Prototype name of the item to count. If not specified, count all items.
1069
1081
  */
1070
1082
  get_item_count(this: void,
1071
- item?: string): void
1083
+ item?: string): number
1072
1084
 
1073
1085
  /**
1074
1086
  * Gets the main inventory for this character or player if this is a character or player.
1087
+ * @returns The inventory or `nil` if this entity is not a character or player.
1075
1088
  */
1076
- get_main_inventory(this: void): void
1089
+ get_main_inventory(this: void): LuaInventory | null
1077
1090
 
1078
1091
  /**
1079
1092
  * The highest index of all inventories this entity can use. Allows iteration over all of them if desired.
@@ -1083,71 +1096,76 @@ interface LuaControl {
1083
1096
  * ```
1084
1097
  *
1085
1098
  */
1086
- get_max_inventory_index(this: void): void
1099
+ get_max_inventory_index(this: void): defines.inventory
1087
1100
 
1088
1101
  /**
1089
1102
  * Gets the parameters of a personal logistic request and auto-trash slot.
1090
1103
  * @param slot_index - The slot to get.
1104
+ * @returns The logistic parameters. If personal logistics are not researched yet, their `name` will be `nil`.
1091
1105
  */
1092
1106
  get_personal_logistic_slot(this: void,
1093
- slot_index: number): void
1107
+ slot_index: number): LogisticParameters
1094
1108
 
1095
1109
  /**
1096
1110
  * Gets the parameters of a vehicle logistic request and auto-trash slot. Only used on `spider-vehicle`.
1097
1111
  * @param slot_index - The slot to get.
1112
+ * @returns The logistic parameters. If the vehicle does not use logistics, their `name` will be `nil`.
1098
1113
  */
1099
1114
  get_vehicle_logistic_slot(this: void,
1100
- slot_index: number): void
1115
+ slot_index: number): LogisticParameters
1101
1116
 
1102
1117
  /**
1103
1118
  * Does this entity have any item inside it?
1104
1119
  */
1105
- has_items_inside(this: void): void
1120
+ has_items_inside(this: void): boolean
1106
1121
 
1107
1122
  /**
1108
1123
  * Insert items into this entity. This works the same way as inserters or shift-clicking: the "best" inventory is chosen automatically.
1109
1124
  * @param items - The items to insert.
1125
+ * @returns The number of items that were actually inserted.
1110
1126
  */
1111
1127
  insert(this: void,
1112
- items: ItemStackIdentification): void
1128
+ items: ItemStackIdentification): number
1113
1129
 
1114
1130
  /**
1115
1131
  * Returns whether the player is holding a blueprint. This takes both blueprint items as well as blueprint records from the blueprint library into account.
1116
1132
  *
1117
1133
  * Note that both this method and {@link LuaControl::get_blueprint_entities | runtime:LuaControl::get_blueprint_entities} refer to the currently selected blueprint, meaning a blueprint book with a selected blueprint will return the information as well.
1118
1134
  */
1119
- is_cursor_blueprint(this: void): void
1135
+ is_cursor_blueprint(this: void): boolean
1120
1136
 
1121
1137
  /**
1122
1138
  * Returns whether the player is holding something in the cursor. It takes into account items from the blueprint library, as well as items and ghost cursor.
1123
1139
  */
1124
- is_cursor_empty(this: void): void
1140
+ is_cursor_empty(this: void): boolean
1125
1141
 
1126
1142
  /**
1127
1143
  * Is the flashlight enabled.
1128
1144
  */
1129
- is_flashlight_enabled(this: void): void
1145
+ is_flashlight_enabled(this: void): boolean
1130
1146
 
1131
1147
  /**
1132
1148
  * When `true` control adapter is a LuaPlayer object, `false` for entities including characters with players.
1133
1149
  */
1134
- is_player(this: void): void
1150
+ is_player(this: void): boolean
1135
1151
 
1136
1152
  /**
1137
1153
  * Mines the given entity as if this player (or character) mined it.
1138
1154
  * @param entity - The entity to mine
1139
1155
  * @param force - Forces mining the entity even if the items can't fit in the player.
1156
+ * @returns Whether the mining succeeded.
1140
1157
  */
1141
1158
  mine_entity(this: void,
1142
1159
  entity: LuaEntity,
1143
- force?: boolean): void
1160
+ force?: boolean): boolean
1144
1161
 
1145
1162
  /**
1146
1163
  * Mines the given tile as if this player (or character) mined it.
1147
1164
  * @param tile - The tile to mine.
1165
+ * @returns Whether the mining succeeded.
1148
1166
  */
1149
1167
  mine_tile(this: void,
1150
- tile: LuaTile): void
1168
+ tile: LuaTile): boolean
1151
1169
 
1152
1170
  /**
1153
1171
  * Open the technology GUI and select a given technology.
@@ -1159,9 +1177,10 @@ interface LuaControl {
1159
1177
  /**
1160
1178
  * Remove items from this entity.
1161
1179
  * @param items - The items to remove.
1180
+ * @returns The number of items that were actually removed.
1162
1181
  */
1163
1182
  remove_item(this: void,
1164
- items: ItemStackIdentification): void
1183
+ items: ItemStackIdentification): number
1165
1184
 
1166
1185
  /**
1167
1186
  * Create an arrow which points at this entity. This is used in the tutorial. For examples, see `control.lua` in the campaign missions.
@@ -1176,19 +1195,21 @@ interface LuaControl {
1176
1195
  *
1177
1196
  * @param slot_index - The slot to set.
1178
1197
  * @param value - The logistic request parameters.
1198
+ * @returns Whether the slot was set successfully. `false` if personal logistics are not researched yet.
1179
1199
  */
1180
1200
  set_personal_logistic_slot(this: void,
1181
1201
  slot_index: number,
1182
- value: LogisticParameters): void
1202
+ value: LogisticParameters): boolean
1183
1203
 
1184
1204
  /**
1185
1205
  * Sets a vehicle logistic request and auto-trash slot to the given value. Only used on `spider-vehicle`.
1186
1206
  * @param slot_index - The slot to set.
1187
1207
  * @param value - The logistic request parameters.
1208
+ * @returns Whether the slot was set successfully. `false` if the vehicle does not use logistics.
1188
1209
  */
1189
1210
  set_vehicle_logistic_slot(this: void,
1190
1211
  slot_index: number,
1191
- value: LogisticParameters): void
1212
+ value: LogisticParameters): boolean
1192
1213
 
1193
1214
  /**
1194
1215
  * Teleport the entity to a given position, possibly on another surface.
@@ -1200,11 +1221,12 @@ interface LuaControl {
1200
1221
  * @param position - Where to teleport to.
1201
1222
  * @param raise_teleported - If true, [defines.events.script_raised_teleported](runtime:defines.events.script_raised_teleported) will be fired on successful entity teleportation.
1202
1223
  * @param surface - Surface to teleport to. If not given, will teleport to the entity's current surface. Only players, cars, and spidertrons can be teleported cross-surface.
1224
+ * @returns `true` if the entity was successfully teleported.
1203
1225
  */
1204
1226
  teleport(this: void,
1205
1227
  position: MapPosition,
1206
1228
  surface?: SurfaceIdentification,
1207
- raise_teleported?: boolean): void
1229
+ raise_teleported?: boolean): boolean
1208
1230
 
1209
1231
  /**
1210
1232
  * Select an entity, as if by hovering the mouse above it.
@@ -1561,10 +1583,11 @@ interface LuaControlBehavior {
1561
1583
  /**
1562
1584
  * @param circuit_connector - The connector to get circuit network for. Must be specified for entities with more than one circuit network connector.
1563
1585
  * @param wire - Wire color of the network connected to this entity.
1586
+ * @returns The circuit network or nil.
1564
1587
  */
1565
1588
  get_circuit_network(this: void,
1566
1589
  wire: defines.wire_type,
1567
- circuit_connector?: defines.circuit_connector_id): void
1590
+ circuit_connector?: defines.circuit_connector_id): LuaCircuitNetwork
1568
1591
 
1569
1592
  /**
1570
1593
  * The entity this control behavior belongs to.
@@ -1590,7 +1613,7 @@ interface LuaCustomChartTag {
1590
1613
  /**
1591
1614
  * All methods and properties that this object supports.
1592
1615
  */
1593
- help(this: void): void
1616
+ help(this: void): string
1594
1617
 
1595
1618
  /**
1596
1619
  * The force this tag belongs to.
@@ -1643,7 +1666,7 @@ interface LuaCustomInputPrototype {
1643
1666
  /**
1644
1667
  * All methods and properties that this object supports.
1645
1668
  */
1646
- help(this: void): void
1669
+ help(this: void): string
1647
1670
 
1648
1671
  /**
1649
1672
  * The action that happens when this custom input is triggered.
@@ -1764,7 +1787,7 @@ interface LuaCustomTable {
1764
1787
  /**
1765
1788
  * All methods and properties that this object supports.
1766
1789
  */
1767
- help(this: void): void
1790
+ help(this: void): string
1768
1791
 
1769
1792
  /**
1770
1793
  * The class name of this object. Available even when `valid` is false. For LuaStruct objects it may also be suffixed with a dotted path to a member of the struct.
@@ -1798,7 +1821,7 @@ interface LuaDamagePrototype {
1798
1821
  /**
1799
1822
  * All methods and properties that this object supports.
1800
1823
  */
1801
- help(this: void): void
1824
+ help(this: void): string
1802
1825
 
1803
1826
  /**
1804
1827
  * Whether this damage type is hidden from entity tooltips.
@@ -1838,7 +1861,7 @@ interface LuaDeciderCombinatorControlBehavior extends LuaCombinatorControlBehavi
1838
1861
  /**
1839
1862
  * All methods and properties that this object supports.
1840
1863
  */
1841
- help(this: void): void
1864
+ help(this: void): string
1842
1865
 
1843
1866
  /**
1844
1867
  * The class name of this object. Available even when `valid` is false. For LuaStruct objects it may also be suffixed with a dotted path to a member of the struct.
@@ -1867,7 +1890,7 @@ interface LuaDecorativePrototype {
1867
1890
  /**
1868
1891
  * All methods and properties that this object supports.
1869
1892
  */
1870
- help(this: void): void
1893
+ help(this: void): string
1871
1894
 
1872
1895
  /**
1873
1896
  * Autoplace specification for this decorative prototype, if any.
@@ -1919,7 +1942,7 @@ interface LuaElectricEnergySourcePrototype {
1919
1942
  /**
1920
1943
  * All methods and properties that this object supports.
1921
1944
  */
1922
- help(this: void): void
1945
+ help(this: void): string
1923
1946
 
1924
1947
  readonly buffer_capacity: number
1925
1948
 
@@ -1992,20 +2015,20 @@ interface LuaEntity extends LuaControl {
1992
2015
  /**
1993
2016
  * Whether the entity can be destroyed
1994
2017
  */
1995
- can_be_destroyed(this: void): void
2018
+ can_be_destroyed(this: void): boolean
1996
2019
 
1997
2020
  /**
1998
2021
  * Whether this character can shoot the given entity or position.
1999
2022
  */
2000
2023
  can_shoot(this: void,
2001
2024
  target: LuaEntity,
2002
- position: MapPosition): void
2025
+ position: MapPosition): boolean
2003
2026
 
2004
2027
  /**
2005
2028
  * Can wires reach between these entities.
2006
2029
  */
2007
2030
  can_wires_reach(this: void,
2008
- entity: LuaEntity): void
2031
+ entity: LuaEntity): boolean
2009
2032
 
2010
2033
  /**
2011
2034
  * Cancels deconstruction if it is scheduled, does nothing otherwise.
@@ -2020,10 +2043,11 @@ interface LuaEntity extends LuaControl {
2020
2043
  * Cancels upgrade if it is scheduled, does nothing otherwise.
2021
2044
  * @param force - The force who did the upgrade order.
2022
2045
  * @param player - The player to set the last_user to if any.
2046
+ * @returns Whether the cancel was successful.
2023
2047
  */
2024
2048
  cancel_upgrade(this: void,
2025
2049
  force: ForceIdentification,
2026
- player?: PlayerIdentification): void
2050
+ player?: PlayerIdentification): boolean
2027
2051
 
2028
2052
  /**
2029
2053
  * Remove all fluids from this entity.
@@ -2053,6 +2077,7 @@ interface LuaEntity extends LuaControl {
2053
2077
  * @param table.create_build_effect_smoke - If false, the building effect smoke will not be shown around the new entity.
2054
2078
  * @param table.position - The destination position
2055
2079
  * @param table.surface - The destination surface
2080
+ * @returns The cloned entity or `nil` if this entity can't be cloned/can't be cloned to the given location.
2056
2081
  */
2057
2082
  clone(this: void,
2058
2083
  table: {
@@ -2060,7 +2085,7 @@ interface LuaEntity extends LuaControl {
2060
2085
  surface?: LuaSurface,
2061
2086
  force?: ForceIdentification,
2062
2087
  create_build_effect_smoke?: boolean
2063
- }): void
2088
+ }): LuaEntity | null
2064
2089
 
2065
2090
  /**
2066
2091
  * Connects current linked belt with another one.
@@ -2081,23 +2106,26 @@ interface LuaEntity extends LuaControl {
2081
2106
  * - To connect two electric poles, `target` must be a {@link LuaEntity | runtime:LuaEntity} that specifies another electric pole. This will connect them with copper cable.
2082
2107
  * - To connect two devices with circuit wire, `target` must be a table of type {@link WireConnectionDefinition | runtime:WireConnectionDefinition}.
2083
2108
  * @param target - The target with which to establish a connection.
2109
+ * @returns Whether the connection was successfully formed.
2084
2110
  */
2085
2111
  connect_neighbour(this: void,
2086
- target: LuaEntity | WireConnectionDefinition): void
2112
+ target: LuaEntity | WireConnectionDefinition): boolean
2087
2113
 
2088
2114
  /**
2089
2115
  * Connects the rolling stock in the given direction.
2116
+ * @returns Whether any connection was made
2090
2117
  */
2091
2118
  connect_rolling_stock(this: void,
2092
- direction: defines.rail_direction): void
2119
+ direction: defines.rail_direction): boolean
2093
2120
 
2094
2121
  /**
2095
2122
  * Copies settings from the given entity onto this entity.
2096
2123
  * @param by_player - If provided, the copying is done 'as' this player and [on_entity_settings_pasted](runtime:on_entity_settings_pasted) is triggered.
2124
+ * @returns Any items removed from this entity as a result of copying the settings.
2097
2125
  */
2098
2126
  copy_settings(this: void,
2099
2127
  entity: LuaEntity,
2100
- by_player?: PlayerIdentification): void
2128
+ by_player?: PlayerIdentification): {[key: string]: number}
2101
2129
 
2102
2130
  /**
2103
2131
  * Creates the same smoke that is created when you place a building by hand. You can play the building sound to go with it by using {@link LuaSurface::play_sound | runtime:LuaSurface::play_sound}, eg: entity.surface.play_sound{path="entity-build/"..entity.prototype.name, position=entity.position}
@@ -2113,12 +2141,13 @@ interface LuaEntity extends LuaControl {
2113
2141
  * @param dealer - The entity to consider as the damage dealer. Needs to be on the same surface as the entity being damaged.
2114
2142
  * @param force - The force that will be doing the damage.
2115
2143
  * @param type - The type of damage to be done, defaults to "impact". Can't be `nil`.
2144
+ * @returns the total damage actually applied after resistances.
2116
2145
  */
2117
2146
  damage(this: void,
2118
2147
  damage: number,
2119
2148
  force: ForceIdentification,
2120
2149
  type?: string,
2121
- dealer?: LuaEntity): void
2150
+ dealer?: LuaEntity): number
2122
2151
 
2123
2152
  /**
2124
2153
  * Depletes and destroys this resource entity.
@@ -2135,12 +2164,13 @@ interface LuaEntity extends LuaControl {
2135
2164
  *
2136
2165
  * @param table.do_cliff_correction - Whether neighbouring cliffs should be corrected. Defaults to `false`.
2137
2166
  * @param table.raise_destroy - If `true`, [script_raised_destroy](runtime:script_raised_destroy) will be called. Defaults to `false`.
2167
+ * @returns Returns `false` if the entity was valid and destruction failed, `true` in all other cases.
2138
2168
  */
2139
2169
  destroy(this: void,
2140
2170
  table?: {
2141
2171
  do_cliff_correction?: boolean,
2142
2172
  raise_destroy?: boolean
2143
- }): void
2173
+ }): boolean
2144
2174
 
2145
2175
  /**
2146
2176
  * Immediately kills the entity. Does nothing if the entity doesn't have health.
@@ -2154,10 +2184,11 @@ interface LuaEntity extends LuaControl {
2154
2184
  * entity.die(nil, killer_entity)
2155
2185
  * ```
2156
2186
  *
2187
+ * @returns Whether the entity was successfully killed.
2157
2188
  */
2158
2189
  die(this: void,
2159
2190
  force?: ForceIdentification,
2160
- cause?: LuaEntity): void
2191
+ cause?: LuaEntity): boolean
2161
2192
 
2162
2193
  /**
2163
2194
  * Disconnects linked belt from its neighbour.
@@ -2182,9 +2213,10 @@ interface LuaEntity extends LuaControl {
2182
2213
 
2183
2214
  /**
2184
2215
  * Tries to disconnect this rolling stock in the given direction.
2216
+ * @returns If anything was disconnected
2185
2217
  */
2186
2218
  disconnect_rolling_stock(this: void,
2187
- direction: defines.rail_direction): void
2219
+ direction: defines.rail_direction): boolean
2188
2220
 
2189
2221
  /**
2190
2222
  * Returns a table with all entities affected by this beacon
@@ -2192,12 +2224,12 @@ interface LuaEntity extends LuaControl {
2192
2224
  * Applies to subclasses: Beacon
2193
2225
  *
2194
2226
  */
2195
- get_beacon_effect_receivers(this: void): void
2227
+ get_beacon_effect_receivers(this: void): LuaEntity[]
2196
2228
 
2197
2229
  /**
2198
2230
  * Returns a table with all beacons affecting this effect receiver. Can only be used when the entity has an effect receiver (AssemblingMachine, Furnace, Lab, MiningDrills)
2199
2231
  */
2200
- get_beacons(this: void): void
2232
+ get_beacons(this: void): LuaEntity[] | null
2201
2233
 
2202
2234
  /**
2203
2235
  * Get the source of this beam.
@@ -2205,7 +2237,7 @@ interface LuaEntity extends LuaControl {
2205
2237
  * Applies to subclasses: Beam
2206
2238
  *
2207
2239
  */
2208
- get_beam_source(this: void): void
2240
+ get_beam_source(this: void): BeamTarget | null
2209
2241
 
2210
2242
  /**
2211
2243
  * Get the target of this beam.
@@ -2213,12 +2245,12 @@ interface LuaEntity extends LuaControl {
2213
2245
  * Applies to subclasses: Beam
2214
2246
  *
2215
2247
  */
2216
- get_beam_target(this: void): void
2248
+ get_beam_target(this: void): BeamTarget | null
2217
2249
 
2218
2250
  /**
2219
2251
  * The burnt result inventory for this entity or `nil` if this entity doesn't have a burnt result inventory.
2220
2252
  */
2221
- get_burnt_result_inventory(this: void): void
2253
+ get_burnt_result_inventory(this: void): LuaInventory | null
2222
2254
 
2223
2255
  /**
2224
2256
  * Returns all child signals. Child signals can be either RailSignal or RailChainSignal. Child signals are signals which are checked by this signal to determine a chain state.
@@ -2226,26 +2258,31 @@ interface LuaEntity extends LuaControl {
2226
2258
  * Applies to subclasses: RailChainSignal
2227
2259
  *
2228
2260
  */
2229
- get_child_signals(this: void): void
2261
+ get_child_signals(this: void): LuaEntity[]
2230
2262
 
2231
2263
  /**
2232
2264
  * @param circuit_connector - The connector to get circuit network for. Must be specified for entities with more than one circuit network connector.
2233
2265
  * @param wire - Wire color of the network connected to this entity.
2266
+ * @returns The circuit network or nil.
2234
2267
  */
2235
2268
  get_circuit_network(this: void,
2236
2269
  wire: defines.wire_type,
2237
- circuit_connector?: defines.circuit_connector_id): void
2270
+ circuit_connector?: defines.circuit_connector_id): LuaCircuitNetwork | null
2238
2271
 
2239
2272
  /**
2240
2273
  * @remarks
2241
2274
  * Applies to subclasses: Rail
2242
2275
  *
2276
+ * @returns multiple values
2277
+ * [0] - Rail connected in the specified manner to this one, `nil` if unsuccessful.
2278
+ * [1] - Rail direction of the returned rail which points to origin rail
2279
+ * [2] - Turn to be taken when going back from returned rail to origin rail
2243
2280
  */
2244
2281
  get_connected_rail(this: void,
2245
2282
  table: {
2246
2283
  rail_direction: defines.rail_direction,
2247
2284
  rail_connection_direction: defines.rail_connection_direction
2248
- }): void
2285
+ }): LuaMultiReturn<[LuaEntity | null, defines.rail_direction | null, defines.rail_connection_direction | null]>
2249
2286
 
2250
2287
  /**
2251
2288
  * Get the rails that this signal is connected to.
@@ -2253,31 +2290,37 @@ interface LuaEntity extends LuaControl {
2253
2290
  * Applies to subclasses: RailSignal,RailChainSignal
2254
2291
  *
2255
2292
  */
2256
- get_connected_rails(this: void): void
2293
+ get_connected_rails(this: void): LuaEntity[]
2257
2294
 
2258
2295
  /**
2259
2296
  * Gets rolling stock connected to the given end of this stock.
2297
+ * @returns multiple values
2298
+ * [0] - The rolling stock connected at the given end, `nil` if none is connected there.
2299
+ * [1] - The rail direction of the connected rolling stock if any.
2260
2300
  */
2261
2301
  get_connected_rolling_stock(this: void,
2262
- direction: defines.rail_direction): void
2302
+ direction: defines.rail_direction): LuaMultiReturn<[LuaEntity | null, defines.rail_direction | null]>
2263
2303
 
2264
2304
  /**
2265
2305
  * Gets the control behavior of the entity (if any).
2306
+ * @returns The control behavior or `nil`.
2266
2307
  */
2267
- get_control_behavior(this: void): void
2308
+ get_control_behavior(this: void): LuaControlBehavior | null
2268
2309
 
2269
2310
  /**
2270
2311
  * Returns the amount of damage to be taken by this entity.
2312
+ * @returns `nil` if this entity does not have health.
2271
2313
  */
2272
- get_damage_to_be_taken(this: void): void
2314
+ get_damage_to_be_taken(this: void): number | null
2273
2315
 
2274
2316
  /**
2275
2317
  * Gets the driver of this vehicle if any.
2276
2318
  * @remarks
2277
2319
  * Applies to subclasses: Vehicle
2278
2320
  *
2321
+ * @returns `nil` if the vehicle contains no driver. To check if there's a passenger see [LuaEntity::get_passenger](runtime:LuaEntity::get_passenger).
2279
2322
  */
2280
- get_driver(this: void): void
2323
+ get_driver(this: void): LuaEntity | LuaPlayer | null
2281
2324
 
2282
2325
  /**
2283
2326
  * Get the filter for a slot in an inserter, loader, or logistic storage container.
@@ -2285,17 +2328,19 @@ interface LuaEntity extends LuaControl {
2285
2328
  * The entity must allow filters.
2286
2329
  *
2287
2330
  * @param slot_index - Index of the slot to get the filter for.
2331
+ * @returns Prototype name of the item being filtered. `nil` if the given slot has no filter.
2288
2332
  */
2289
2333
  get_filter(this: void,
2290
- slot_index: number): void
2334
+ slot_index: number): string | null
2291
2335
 
2292
2336
  /**
2293
2337
  * Get amounts of all fluids in this entity.
2294
2338
  * @remarks
2295
2339
  * If information about fluid temperatures is required, {@link LuaEntity::fluidbox | runtime:LuaEntity::fluidbox} should be used instead.
2296
2340
  *
2341
+ * @returns The amounts, indexed by fluid names.
2297
2342
  */
2298
- get_fluid_contents(this: void): void
2343
+ get_fluid_contents(this: void): {[key: string]: number}
2299
2344
 
2300
2345
  /**
2301
2346
  * Get the amount of all or some fluid in this entity.
@@ -2305,17 +2350,18 @@ interface LuaEntity extends LuaControl {
2305
2350
  * @param fluid - Prototype name of the fluid to count. If not specified, count all fluids.
2306
2351
  */
2307
2352
  get_fluid_count(this: void,
2308
- fluid?: string): void
2353
+ fluid?: string): number
2309
2354
 
2310
2355
  /**
2311
2356
  * The fuel inventory for this entity or `nil` if this entity doesn't have a fuel inventory.
2312
2357
  */
2313
- get_fuel_inventory(this: void): void
2358
+ get_fuel_inventory(this: void): LuaInventory | null
2314
2359
 
2315
2360
  /**
2316
2361
  * The health ratio of this entity between 1 and 0 (for full health and no health respectively).
2362
+ * @returns `nil` if this entity doesn't have health.
2317
2363
  */
2318
- get_health_ratio(this: void): void
2364
+ get_health_ratio(this: void): number | null
2319
2365
 
2320
2366
  /**
2321
2367
  * Gets the heat setting for this heat interface.
@@ -2323,7 +2369,7 @@ interface LuaEntity extends LuaControl {
2323
2369
  * Applies to subclasses: HeatInterface
2324
2370
  *
2325
2371
  */
2326
- get_heat_setting(this: void): void
2372
+ get_heat_setting(this: void): HeatSetting
2327
2373
 
2328
2374
  /**
2329
2375
  * Returns all signals guarding entrance to a rail block this rail belongs to.
@@ -2331,7 +2377,7 @@ interface LuaEntity extends LuaControl {
2331
2377
  * Applies to subclasses: Rail
2332
2378
  *
2333
2379
  */
2334
- get_inbound_signals(this: void): void
2380
+ get_inbound_signals(this: void): LuaEntity[]
2335
2381
 
2336
2382
  /**
2337
2383
  * Gets the filter for this infinity container at the given index, or `nil` if the filter index doesn't exist or is empty.
@@ -2341,7 +2387,7 @@ interface LuaEntity extends LuaControl {
2341
2387
  * @param index - The index to get.
2342
2388
  */
2343
2389
  get_infinity_container_filter(this: void,
2344
- index: number): void
2390
+ index: number): InfinityInventoryFilter | null
2345
2391
 
2346
2392
  /**
2347
2393
  * Gets the filter for this infinity pipe, or `nil` if the filter is empty.
@@ -2349,7 +2395,7 @@ interface LuaEntity extends LuaControl {
2349
2395
  * Applies to subclasses: InfinityPipe
2350
2396
  *
2351
2397
  */
2352
- get_infinity_pipe_filter(this: void): void
2398
+ get_infinity_pipe_filter(this: void): InfinityPipeFilter | null
2353
2399
 
2354
2400
  /**
2355
2401
  * Gets all the `LuaLogisticPoint`s that this entity owns. Optionally returns only the point specified by the index parameter.
@@ -2359,7 +2405,7 @@ interface LuaEntity extends LuaControl {
2359
2405
  * @param index - If provided, only returns the `LuaLogisticPoint` specified by this index.
2360
2406
  */
2361
2407
  get_logistic_point(this: void,
2362
- index?: defines.logistic_member_index): void
2408
+ index?: defines.logistic_member_index): LuaLogisticPoint | {[key: string]: LuaLogisticPoint} | null
2363
2409
 
2364
2410
  /**
2365
2411
  * Get all offers in a market as an array.
@@ -2367,7 +2413,7 @@ interface LuaEntity extends LuaControl {
2367
2413
  * Applies to subclasses: Market
2368
2414
  *
2369
2415
  */
2370
- get_market_items(this: void): void
2416
+ get_market_items(this: void): Offer[]
2371
2417
 
2372
2418
  /**
2373
2419
  * Get the maximum transport line index of a belt or belt connectable entity.
@@ -2375,33 +2421,36 @@ interface LuaEntity extends LuaControl {
2375
2421
  * Applies to subclasses: TransportBeltConnectable
2376
2422
  *
2377
2423
  */
2378
- get_max_transport_line_index(this: void): void
2424
+ get_max_transport_line_index(this: void): number
2379
2425
 
2380
2426
  /**
2381
2427
  * Read a single signal from the combined circuit networks.
2382
2428
  * @param circuit_connector - The connector to get signals for. Must be specified for entities with more than one circuit network connector.
2383
2429
  * @param signal - The signal to read.
2430
+ * @returns The current value of the signal.
2384
2431
  */
2385
2432
  get_merged_signal(this: void,
2386
2433
  signal: SignalID,
2387
- circuit_connector?: defines.circuit_connector_id): void
2434
+ circuit_connector?: defines.circuit_connector_id): number
2388
2435
 
2389
2436
  /**
2390
2437
  * The merged circuit network signals or `nil` if there are no signals.
2391
2438
  * @param circuit_connector - The connector to get signals for. Must be specified for entities with more than one circuit network connector.
2439
+ * @returns The sum of signals on both the red and green networks, or `nil` if it doesn't have a circuit connector.
2392
2440
  */
2393
2441
  get_merged_signals(this: void,
2394
- circuit_connector?: defines.circuit_connector_id): void
2442
+ circuit_connector?: defines.circuit_connector_id): Signal[] | null
2395
2443
 
2396
2444
  /**
2397
2445
  * Inventory for storing modules of this entity; `nil` if this entity has no module inventory.
2398
2446
  */
2399
- get_module_inventory(this: void): void
2447
+ get_module_inventory(this: void): LuaInventory | null
2400
2448
 
2401
2449
  /**
2402
2450
  * Gets (and or creates if needed) the control behavior of the entity.
2451
+ * @returns The control behavior or `nil`.
2403
2452
  */
2404
- get_or_create_control_behavior(this: void): void
2453
+ get_or_create_control_behavior(this: void): LuaControlBehavior | null
2405
2454
 
2406
2455
  /**
2407
2456
  * Returns all signals guarding exit from a rail block this rail belongs to.
@@ -2409,12 +2458,13 @@ interface LuaEntity extends LuaControl {
2409
2458
  * Applies to subclasses: Rail
2410
2459
  *
2411
2460
  */
2412
- get_outbound_signals(this: void): void
2461
+ get_outbound_signals(this: void): LuaEntity[]
2413
2462
 
2414
2463
  /**
2415
2464
  * Gets the entity's output inventory if it has one.
2465
+ * @returns A reference to the entity's output inventory.
2416
2466
  */
2417
- get_output_inventory(this: void): void
2467
+ get_output_inventory(this: void): LuaInventory | null
2418
2468
 
2419
2469
  /**
2420
2470
  * Returns all parent signals. Parent signals are always RailChainSignal. Parent signals are those signals that are checking state of this signal to determine their own chain state.
@@ -2422,7 +2472,7 @@ interface LuaEntity extends LuaControl {
2422
2472
  * Applies to subclasses: RailSignal,RailChainSignal
2423
2473
  *
2424
2474
  */
2425
- get_parent_signals(this: void): void
2475
+ get_parent_signals(this: void): LuaEntity[]
2426
2476
 
2427
2477
  /**
2428
2478
  * Gets the passenger of this car or spidertron if any.
@@ -2430,13 +2480,14 @@ interface LuaEntity extends LuaControl {
2430
2480
  * This differs over {@link LuaEntity::get_driver | runtime:LuaEntity::get_driver} in that the passenger can't drive the car.
2431
2481
  * Applies to subclasses: Car,SpiderVehicle
2432
2482
  *
2483
+ * @returns `nil` if the vehicle contains no passenger. To check if there's a driver see [LuaEntity::get_driver](runtime:LuaEntity::get_driver).
2433
2484
  */
2434
- get_passenger(this: void): void
2485
+ get_passenger(this: void): LuaEntity | LuaPlayer | null
2435
2486
 
2436
2487
  /**
2437
2488
  * The radius of this entity.
2438
2489
  */
2439
- get_radius(this: void): void
2490
+ get_radius(this: void): number
2440
2491
 
2441
2492
  /**
2442
2493
  * Get the rail at the end of the rail segment this rail is in.
@@ -2444,9 +2495,12 @@ interface LuaEntity extends LuaControl {
2444
2495
  * A rail segment is a continuous section of rail with no branches, signals, nor train stops.
2445
2496
  * Applies to subclasses: Rail
2446
2497
  *
2498
+ * @returns multiple values
2499
+ * [0] - The rail entity.
2500
+ * [1] - A rail direction pointing out of the rail segment from the end rail.
2447
2501
  */
2448
2502
  get_rail_segment_end(this: void,
2449
- direction: defines.rail_direction): void
2503
+ direction: defines.rail_direction): LuaMultiReturn<[LuaEntity, defines.rail_direction]>
2450
2504
 
2451
2505
  /**
2452
2506
  * Get the rail signal or train stop at the start/end of the rail segment this rail is in.
@@ -2456,10 +2510,11 @@ interface LuaEntity extends LuaControl {
2456
2510
  *
2457
2511
  * @param direction - The direction of travel relative to this rail.
2458
2512
  * @param in_else_out - If true, gets the entity at the entrance of the rail segment, otherwise gets the entity at the exit of the rail segment.
2513
+ * @returns `nil` if the rail segment doesn't start/end with a signal nor a train stop.
2459
2514
  */
2460
2515
  get_rail_segment_entity(this: void,
2461
2516
  direction: defines.rail_direction,
2462
- in_else_out: boolean): void
2517
+ in_else_out: boolean): LuaEntity | null
2463
2518
 
2464
2519
  /**
2465
2520
  * Get the length of the rail segment this rail is in.
@@ -2468,7 +2523,7 @@ interface LuaEntity extends LuaControl {
2468
2523
  * Applies to subclasses: Rail
2469
2524
  *
2470
2525
  */
2471
- get_rail_segment_length(this: void): void
2526
+ get_rail_segment_length(this: void): number
2472
2527
 
2473
2528
  /**
2474
2529
  * Get a rail from each rail segment that overlaps with this rail's rail segment.
@@ -2477,7 +2532,7 @@ interface LuaEntity extends LuaControl {
2477
2532
  * Applies to subclasses: Rail
2478
2533
  *
2479
2534
  */
2480
- get_rail_segment_overlaps(this: void): void
2535
+ get_rail_segment_overlaps(this: void): LuaEntity[]
2481
2536
 
2482
2537
  /**
2483
2538
  * Get all rails of a rail segment this rail is in
@@ -2486,9 +2541,10 @@ interface LuaEntity extends LuaControl {
2486
2541
  * Applies to subclasses: Rail
2487
2542
  *
2488
2543
  * @param direction - Selects end of this rail that points to a rail segment end from which to start returning rails
2544
+ * @returns Rails of this rail segment
2489
2545
  */
2490
2546
  get_rail_segment_rails(this: void,
2491
- direction: defines.rail_direction): void
2547
+ direction: defines.rail_direction): LuaEntity[]
2492
2548
 
2493
2549
  /**
2494
2550
  * Current recipe being assembled by this machine, if any.
@@ -2496,7 +2552,7 @@ interface LuaEntity extends LuaControl {
2496
2552
  * Applies to subclasses: CraftingMachine
2497
2553
  *
2498
2554
  */
2499
- get_recipe(this: void): void
2555
+ get_recipe(this: void): LuaRecipe | null
2500
2556
 
2501
2557
  /**
2502
2558
  * Get a logistic requester slot.
@@ -2504,9 +2560,10 @@ interface LuaEntity extends LuaControl {
2504
2560
  * Useable only on entities that have requester slots.
2505
2561
  *
2506
2562
  * @param slot - The slot index.
2563
+ * @returns Contents of the specified slot; `nil` if the given slot contains no request.
2507
2564
  */
2508
2565
  get_request_slot(this: void,
2509
- slot: number): void
2566
+ slot: number): SimpleItemStack | null
2510
2567
 
2511
2568
  /**
2512
2569
  * Gets legs of given SpiderVehicle.
@@ -2514,7 +2571,7 @@ interface LuaEntity extends LuaControl {
2514
2571
  * Applies to subclasses: SpiderVehicle
2515
2572
  *
2516
2573
  */
2517
- get_spider_legs(this: void): void
2574
+ get_spider_legs(this: void): LuaEntity[]
2518
2575
 
2519
2576
  /**
2520
2577
  * The train currently stopped at this train stop, if any.
@@ -2522,7 +2579,7 @@ interface LuaEntity extends LuaControl {
2522
2579
  * Applies to subclasses: TrainStop
2523
2580
  *
2524
2581
  */
2525
- get_stopped_train(this: void): void
2582
+ get_stopped_train(this: void): LuaTrain | null
2526
2583
 
2527
2584
  /**
2528
2585
  * The trains scheduled to stop at this train stop.
@@ -2530,7 +2587,7 @@ interface LuaEntity extends LuaControl {
2530
2587
  * Applies to subclasses: TrainStop
2531
2588
  *
2532
2589
  */
2533
- get_train_stop_trains(this: void): void
2590
+ get_train_stop_trains(this: void): LuaTrain[]
2534
2591
 
2535
2592
  /**
2536
2593
  * Get a transport line of a belt or belt connectable entity.
@@ -2540,17 +2597,19 @@ interface LuaEntity extends LuaControl {
2540
2597
  * @param index - Index of the requested transport line. Transport lines are 1-indexed.
2541
2598
  */
2542
2599
  get_transport_line(this: void,
2543
- index: number): void
2600
+ index: number): LuaTransportLine
2544
2601
 
2545
2602
  /**
2546
2603
  * Returns the new entity direction after upgrading.
2604
+ * @returns `nil` if this entity is not marked for upgrade.
2547
2605
  */
2548
- get_upgrade_direction(this: void): void
2606
+ get_upgrade_direction(this: void): defines.direction | null
2549
2607
 
2550
2608
  /**
2551
2609
  * Returns the new entity prototype.
2610
+ * @returns `nil` if this entity is not marked for upgrade.
2552
2611
  */
2553
- get_upgrade_target(this: void): void
2612
+ get_upgrade_target(this: void): LuaEntityPrototype | null
2554
2613
 
2555
2614
  /**
2556
2615
  * Same as {@link LuaEntity::has_flag | runtime:LuaEntity::has_flag}, but targets the inner entity on a entity ghost.
@@ -2558,9 +2617,10 @@ interface LuaEntity extends LuaControl {
2558
2617
  * Applies to subclasses: EntityGhost
2559
2618
  *
2560
2619
  * @param flag - The flag to test. See [EntityPrototypeFlags](runtime:EntityPrototypeFlags) for a list of flags.
2620
+ * @returns `true` if the entity has the given flag set.
2561
2621
  */
2562
2622
  ghost_has_flag(this: void,
2563
- flag: string): void
2623
+ flag: string): boolean
2564
2624
 
2565
2625
  /**
2566
2626
  * Has this unit been assigned a command?
@@ -2568,7 +2628,7 @@ interface LuaEntity extends LuaControl {
2568
2628
  * Applies to subclasses: Unit
2569
2629
  *
2570
2630
  */
2571
- has_command(this: void): void
2631
+ has_command(this: void): boolean
2572
2632
 
2573
2633
  /**
2574
2634
  * Test whether this entity's prototype has a certain flag set.
@@ -2576,40 +2636,44 @@ interface LuaEntity extends LuaControl {
2576
2636
  * `entity.has_flag(f)` is a shortcut for `entity.prototype.has_flag(f)`.
2577
2637
  *
2578
2638
  * @param flag - The flag to test. See [EntityPrototypeFlags](runtime:EntityPrototypeFlags) for a list of flags.
2639
+ * @returns `true` if this entity has the given flag set.
2579
2640
  */
2580
2641
  has_flag(this: void,
2581
- flag: string): void
2642
+ flag: string): boolean
2582
2643
 
2583
2644
  /**
2584
2645
  * All methods and properties that this object supports.
2585
2646
  */
2586
- help(this: void): void
2647
+ help(this: void): string
2587
2648
 
2588
2649
  /**
2589
2650
  * Insert fluid into this entity. Fluidbox is chosen automatically.
2590
2651
  * @param fluid - Fluid to insert.
2652
+ * @returns Amount of fluid actually inserted.
2591
2653
  */
2592
2654
  insert_fluid(this: void,
2593
- fluid: Fluid): void
2655
+ fluid: Fluid): number
2594
2656
 
2595
2657
  /**
2596
2658
  * @remarks
2597
2659
  * Applies to subclasses: Gate
2598
2660
  *
2661
+ * @returns `true` if this gate is currently closed.
2599
2662
  */
2600
- is_closed(this: void): void
2663
+ is_closed(this: void): boolean
2601
2664
 
2602
2665
  /**
2603
2666
  * @remarks
2604
2667
  * Applies to subclasses: Gate
2605
2668
  *
2669
+ * @returns `true` if this gate is currently closing
2606
2670
  */
2607
- is_closing(this: void): void
2671
+ is_closing(this: void): boolean
2608
2672
 
2609
2673
  /**
2610
2674
  * Returns `true` if this entity produces or consumes electricity and is connected to an electric network that has at least one entity that can produce power.
2611
2675
  */
2612
- is_connected_to_electric_network(this: void): void
2676
+ is_connected_to_electric_network(this: void): boolean
2613
2677
 
2614
2678
  /**
2615
2679
  * Returns whether a craft is currently in process. It does not indicate whether progress is currently being made, but whether a crafting process has been started in this machine.
@@ -2617,21 +2681,23 @@ interface LuaEntity extends LuaControl {
2617
2681
  * Applies to subclasses: CraftingMachine
2618
2682
  *
2619
2683
  */
2620
- is_crafting(this: void): void
2684
+ is_crafting(this: void): boolean
2621
2685
 
2622
2686
  /**
2623
2687
  * @remarks
2624
2688
  * Applies to subclasses: Gate
2625
2689
  *
2690
+ * @returns `true` if this gate is currently opened.
2626
2691
  */
2627
- is_opened(this: void): void
2692
+ is_opened(this: void): boolean
2628
2693
 
2629
2694
  /**
2630
2695
  * @remarks
2631
2696
  * Applies to subclasses: Gate
2632
2697
  *
2698
+ * @returns `true` if this gate is currently opening.
2633
2699
  */
2634
- is_opening(this: void): void
2700
+ is_opening(this: void): boolean
2635
2701
 
2636
2702
  /**
2637
2703
  * Checks if this rail and other rail both belong to the same rail block.
@@ -2640,7 +2706,7 @@ interface LuaEntity extends LuaControl {
2640
2706
  *
2641
2707
  */
2642
2708
  is_rail_in_same_rail_block_as(this: void,
2643
- other_rail: LuaEntity): void
2709
+ other_rail: LuaEntity): boolean
2644
2710
 
2645
2711
  /**
2646
2712
  * Checks if this rail and other rail both belong to the same rail segment.
@@ -2649,36 +2715,37 @@ interface LuaEntity extends LuaControl {
2649
2715
  *
2650
2716
  */
2651
2717
  is_rail_in_same_rail_segment_as(this: void,
2652
- other_rail: LuaEntity): void
2718
+ other_rail: LuaEntity): boolean
2653
2719
 
2654
2720
  /**
2655
2721
  * Is this entity or tile ghost or item request proxy registered for construction? If false, it means a construction robot has been dispatched to build the entity, or it is not an entity that can be constructed.
2656
2722
  */
2657
- is_registered_for_construction(this: void): void
2723
+ is_registered_for_construction(this: void): boolean
2658
2724
 
2659
2725
  /**
2660
2726
  * Is this entity registered for deconstruction with this force? If false, it means a construction robot has been dispatched to deconstruct it, or it is not marked for deconstruction. The complexity is effectively O(1) - it depends on the number of objects targeting this entity which should be small enough.
2661
2727
  * @param force - The force construction manager to check.
2662
2728
  */
2663
2729
  is_registered_for_deconstruction(this: void,
2664
- force: ForceIdentification): void
2730
+ force: ForceIdentification): boolean
2665
2731
 
2666
2732
  /**
2667
2733
  * Is this entity registered for repair? If false, it means a construction robot has been dispatched to upgrade it, or it is not damaged. This is worst-case O(N) complexity where N is the current number of things in the repair queue.
2668
2734
  */
2669
- is_registered_for_repair(this: void): void
2735
+ is_registered_for_repair(this: void): boolean
2670
2736
 
2671
2737
  /**
2672
2738
  * Is this entity registered for upgrade? If false, it means a construction robot has been dispatched to upgrade it, or it is not marked for upgrade. This is worst-case O(N) complexity where N is the current number of things in the upgrade queue.
2673
2739
  */
2674
- is_registered_for_upgrade(this: void): void
2740
+ is_registered_for_upgrade(this: void): boolean
2675
2741
 
2676
2742
  /**
2677
2743
  * @remarks
2678
2744
  * Applies to subclasses: RocketSilo
2679
2745
  *
2746
+ * @returns `true` if the rocket was successfully launched. Return value of `false` means the silo is not ready for launch.
2680
2747
  */
2681
- launch_rocket(this: void): void
2748
+ launch_rocket(this: void): boolean
2682
2749
 
2683
2750
  /**
2684
2751
  * Mines this entity.
@@ -2690,6 +2757,7 @@ interface LuaEntity extends LuaControl {
2690
2757
  * @param table.ignore_minable - If true, the minable state of the entity is ignored. Defaults to `false`. If false, an entity that isn't minable (set as not-minable in the prototype or isn't minable for other reasons) will fail to be mined.
2691
2758
  * @param table.inventory - If provided the item(s) will be transferred into this inventory. If provided, this must be an inventory created with [LuaGameScript::create_inventory](runtime:LuaGameScript::create_inventory) or be a basic inventory owned by some entity.
2692
2759
  * @param table.raise_destroyed - If true, [script_raised_destroy](runtime:script_raised_destroy) will be raised. Defaults to `true`.
2760
+ * @returns Whether mining succeeded.
2693
2761
  */
2694
2762
  mine(this: void,
2695
2763
  table?: {
@@ -2697,22 +2765,24 @@ interface LuaEntity extends LuaControl {
2697
2765
  force?: boolean,
2698
2766
  raise_destroyed?: boolean,
2699
2767
  ignore_minable?: boolean
2700
- }): void
2768
+ }): boolean
2701
2769
 
2702
2770
  /**
2703
2771
  * Sets the entity to be deconstructed by construction robots.
2704
2772
  * @param force - The force whose robots are supposed to do the deconstruction.
2705
2773
  * @param player - The player to set the `last_user` to if any.
2774
+ * @returns if the entity was marked for deconstruction.
2706
2775
  */
2707
2776
  order_deconstruction(this: void,
2708
2777
  force: ForceIdentification,
2709
- player?: PlayerIdentification): void
2778
+ player?: PlayerIdentification): boolean
2710
2779
 
2711
2780
  /**
2712
2781
  * Sets the entity to be upgraded by construction robots.
2713
2782
  * @param table.direction - The new direction if any.
2714
2783
  * @param table.force - The force whose robots are supposed to do the upgrade.
2715
2784
  * @param table.target - The prototype of the entity to upgrade to.
2785
+ * @returns Whether the entity was marked for upgrade.
2716
2786
  */
2717
2787
  order_upgrade(this: void,
2718
2788
  table: {
@@ -2720,17 +2790,18 @@ interface LuaEntity extends LuaControl {
2720
2790
  target: EntityPrototypeIdentification,
2721
2791
  player?: PlayerIdentification,
2722
2792
  direction?: defines.direction
2723
- }): void
2793
+ }): boolean
2724
2794
 
2725
2795
  /**
2726
2796
  * Plays a note with the given instrument and note.
2727
2797
  * @remarks
2728
2798
  * Applies to subclasses: ProgrammableSpeaker
2729
2799
  *
2800
+ * @returns Whether the request is valid. The sound may or may not be played depending on polyphony settings.
2730
2801
  */
2731
2802
  play_note(this: void,
2732
2803
  instrument: number,
2733
- note: number): void
2804
+ note: number): boolean
2734
2805
 
2735
2806
  /**
2736
2807
  * Release the unit from the spawner which spawned it. This allows the spawner to continue spawning additional units.
@@ -2747,6 +2818,7 @@ interface LuaEntity extends LuaControl {
2747
2818
  *
2748
2819
  * @param table.amount - Amount to remove
2749
2820
  * @param table.name - Fluid prototype name.
2821
+ * @returns Amount of fluid actually removed.
2750
2822
  */
2751
2823
  remove_fluid(this: void,
2752
2824
  table: {
@@ -2755,7 +2827,7 @@ interface LuaEntity extends LuaControl {
2755
2827
  minimum_temperature?: number,
2756
2828
  maximum_temperature?: number,
2757
2829
  temperature?: number
2758
- }): void
2830
+ }): number
2759
2831
 
2760
2832
  /**
2761
2833
  * Remove an offer from a market.
@@ -2764,9 +2836,10 @@ interface LuaEntity extends LuaControl {
2764
2836
  * Applies to subclasses: Market
2765
2837
  *
2766
2838
  * @param offer - Index of offer to remove.
2839
+ * @returns `true` if the offer was successfully removed; `false` when the given index was not valid.
2767
2840
  */
2768
2841
  remove_market_item(this: void,
2769
- offer: number): void
2842
+ offer: number): boolean
2770
2843
 
2771
2844
  /**
2772
2845
  * @remarks
@@ -2792,12 +2865,16 @@ interface LuaEntity extends LuaControl {
2792
2865
  * Revive a ghost. I.e. turn it from a ghost to a real entity or tile.
2793
2866
  * @param table.raise_revive - If true, and an entity ghost; [script_raised_revive](runtime:script_raised_revive) will be called. Else if true, and a tile ghost; [script_raised_set_tiles](runtime:script_raised_set_tiles) will be called.
2794
2867
  * @param table.return_item_request_proxy - If `true` the function will return item request proxy as the third return value.
2868
+ * @returns multiple values
2869
+ * [0] - Any items the new real entity collided with or `nil` if the ghost could not be revived.
2870
+ * [1] - The revived entity if an entity ghost was successfully revived.
2871
+ * [2] - The item request proxy if it was requested with `return_item_request_proxy`.
2795
2872
  */
2796
2873
  revive(this: void,
2797
2874
  table?: {
2798
2875
  return_item_request_proxy?: boolean,
2799
2876
  raise_revive?: boolean
2800
- }): void
2877
+ }): LuaMultiReturn<[{[key: string]: number} | null, LuaEntity | null, LuaEntity | null]>
2801
2878
 
2802
2879
  /**
2803
2880
  * Rotates this entity as if the player rotated it.
@@ -2806,6 +2883,9 @@ interface LuaEntity extends LuaControl {
2806
2883
  * @param table.force - When provided the spilled items will be marked for deconstruction by this force.
2807
2884
  * @param table.reverse - If `true`, rotate the entity in the counter-clockwise direction.
2808
2885
  * @param table.spill_items - If the player is not given should extra items be spilled or returned as a second return value from this.
2886
+ * @returns multiple values
2887
+ * [0] - Whether the rotation was successful.
2888
+ * [1] - Count of spilled items indexed by their prototype names if `spill_items` was `true`.
2809
2889
  */
2810
2890
  rotate(this: void,
2811
2891
  table?: {
@@ -2814,7 +2894,7 @@ interface LuaEntity extends LuaControl {
2814
2894
  spill_items?: boolean,
2815
2895
  enable_looted?: boolean,
2816
2896
  force?: LuaForce | string
2817
- }): void
2897
+ }): LuaMultiReturn<[boolean, {[key: string]: number} | null]>
2818
2898
 
2819
2899
  /**
2820
2900
  * Set the source of this beam.
@@ -2924,9 +3004,10 @@ interface LuaEntity extends LuaControl {
2924
3004
  * Applies to subclasses: AssemblingMachine
2925
3005
  *
2926
3006
  * @param recipe - The new recipe. Writing `nil` clears the recipe, if any.
3007
+ * @returns Any items removed from this entity as a result of setting the recipe.
2927
3008
  */
2928
3009
  set_recipe(this: void,
2929
- recipe?: string | LuaRecipe): void
3010
+ recipe?: string | LuaRecipe): {[key: string]: number}
2930
3011
 
2931
3012
  /**
2932
3013
  * Set a logistic requester slot.
@@ -2935,21 +3016,26 @@ interface LuaEntity extends LuaControl {
2935
3016
  *
2936
3017
  * @param request - What to request.
2937
3018
  * @param slot - The slot index.
3019
+ * @returns Whether the slot was set.
2938
3020
  */
2939
3021
  set_request_slot(this: void,
2940
3022
  request: ItemStackIdentification,
2941
- slot: number): void
3023
+ slot: number): boolean
2942
3024
 
2943
3025
  /**
2944
3026
  * Revives a ghost silently.
2945
3027
  * @param table.raise_revive - If true, and an entity ghost; [script_raised_revive](runtime:script_raised_revive) will be called. Else if true, and a tile ghost; [script_raised_set_tiles](runtime:script_raised_set_tiles) will be called.
2946
3028
  * @param table.return_item_request_proxy - If `true` the function will return item request proxy as the third parameter.
3029
+ * @returns multiple values
3030
+ * [0] - Any items the new real entity collided with or `nil` if the ghost could not be revived.
3031
+ * [1] - The revived entity if an entity ghost was successfully revived.
3032
+ * [2] - The item request proxy if it was requested with `return_item_request_proxy`.
2947
3033
  */
2948
3034
  silent_revive(this: void,
2949
3035
  table?: {
2950
3036
  return_item_request_proxy?: boolean,
2951
3037
  raise_revive?: boolean
2952
- }): void
3038
+ }): LuaMultiReturn<[{[key: string]: number} | null, LuaEntity | null, LuaEntity | null]>
2953
3039
 
2954
3040
  /**
2955
3041
  * Triggers spawn_decoration actions defined in the entity prototype or does nothing if entity is not "turret" or "unit-spawner".
@@ -2972,17 +3058,17 @@ interface LuaEntity extends LuaControl {
2972
3058
  /**
2973
3059
  * Whether this entity supports a backer name.
2974
3060
  */
2975
- supports_backer_name(this: void): void
3061
+ supports_backer_name(this: void): boolean
2976
3062
 
2977
3063
  /**
2978
3064
  * Is this entity marked for deconstruction?
2979
3065
  */
2980
- to_be_deconstructed(this: void): void
3066
+ to_be_deconstructed(this: void): boolean
2981
3067
 
2982
3068
  /**
2983
3069
  * Is this entity marked for upgrade?
2984
3070
  */
2985
- to_be_upgraded(this: void): void
3071
+ to_be_upgraded(this: void): boolean
2986
3072
 
2987
3073
  /**
2988
3074
  * Toggle this entity's equipment movement bonus. Does nothing if the entity does not have an equipment grid.
@@ -4278,19 +4364,20 @@ interface LuaEntityPrototype {
4278
4364
  * Gets the base size of the given inventory on this entity or `nil` if the given inventory doesn't exist.
4279
4365
  */
4280
4366
  get_inventory_size(this: void,
4281
- index: defines.inventory): void
4367
+ index: defines.inventory): number | null
4282
4368
 
4283
4369
  /**
4284
4370
  * Test whether this entity prototype has a certain flag set.
4285
4371
  * @param flag - The flag to test. See [EntityPrototypeFlags](runtime:EntityPrototypeFlags) for a list of flags.
4372
+ * @returns `true` if this prototype has the given flag set.
4286
4373
  */
4287
4374
  has_flag(this: void,
4288
- flag: string): void
4375
+ flag: string): boolean
4289
4376
 
4290
4377
  /**
4291
4378
  * All methods and properties that this object supports.
4292
4379
  */
4293
- help(this: void): void
4380
+ help(this: void): string
4294
4381
 
4295
4382
  /**
4296
4383
  * The active energy usage of this rocket silo or combinator prototype.
@@ -5033,14 +5120,6 @@ interface LuaEntityPrototype {
5033
5120
  */
5034
5121
  readonly height?: number
5035
5122
 
5036
- /**
5037
- * The idle energy usage of this rocket silo prototype.
5038
- * @remarks
5039
- * Applies to subclasses: RocketSilo
5040
- *
5041
- */
5042
- readonly idle_energy_usage?: number
5043
-
5044
5123
  /**
5045
5124
  * A vector of the gun prototypes of this car, spider vehicle, artillery wagon, or turret.
5046
5125
  * @remarks
@@ -6056,7 +6135,7 @@ interface LuaEquipment {
6056
6135
  /**
6057
6136
  * All methods and properties that this object supports.
6058
6137
  */
6059
- help(this: void): void
6138
+ help(this: void): string
6060
6139
 
6061
6140
  /**
6062
6141
  * The burner energy source for this equipment, if any.
@@ -6145,7 +6224,7 @@ interface LuaEquipmentCategoryPrototype {
6145
6224
  /**
6146
6225
  * All methods and properties that this object supports.
6147
6226
  */
6148
- help(this: void): void
6227
+ help(this: void): string
6149
6228
 
6150
6229
  readonly localised_description: LocalisedString
6151
6230
 
@@ -6186,7 +6265,7 @@ interface LuaEquipmentGrid {
6186
6265
  table: {
6187
6266
  equipment: LuaEquipment,
6188
6267
  position: EquipmentPosition
6189
- }): void
6268
+ }): boolean
6190
6269
 
6191
6270
  /**
6192
6271
  * Clear all equipment from the grid, removing it without actually returning it.
@@ -6200,75 +6279,82 @@ interface LuaEquipmentGrid {
6200
6279
  * @param equipment - Prototype name of the equipment to count. If not specified, count all equipment.
6201
6280
  */
6202
6281
  count(this: void,
6203
- equipment?: string): void
6282
+ equipment?: string): number
6204
6283
 
6205
6284
  /**
6206
6285
  * Find equipment by name.
6207
6286
  * @param equipment - Prototype name of the equipment to find.
6287
+ * @returns The first found equipment, or `nil` if equipment could not be found.
6208
6288
  */
6209
6289
  find(this: void,
6210
- equipment: string): void
6290
+ equipment: string): LuaEquipment | null
6211
6291
 
6212
6292
  /**
6213
6293
  * Find equipment in the Equipment Grid based off a position.
6214
6294
  * @param position - The position
6295
+ * @returns The found equipment, or `nil` if equipment could not be found at the given position.
6215
6296
  */
6216
6297
  get(this: void,
6217
- position: EquipmentPosition): void
6298
+ position: EquipmentPosition): LuaEquipment | null
6218
6299
 
6219
6300
  /**
6220
6301
  * Get counts of all equipment in this grid.
6302
+ * @returns The counts, indexed by equipment names.
6221
6303
  */
6222
- get_contents(this: void): void
6304
+ get_contents(this: void): {[key: string]: number}
6223
6305
 
6224
6306
  /**
6225
6307
  * All methods and properties that this object supports.
6226
6308
  */
6227
- help(this: void): void
6309
+ help(this: void): string
6228
6310
 
6229
6311
  /**
6230
6312
  * Move an equipment within this grid.
6231
6313
  * @param table.equipment - The equipment to move
6232
6314
  * @param table.position - Where to put it
6315
+ * @returns `true` if the equipment was successfully moved.
6233
6316
  */
6234
6317
  move(this: void,
6235
6318
  table: {
6236
6319
  equipment: LuaEquipment,
6237
6320
  position: EquipmentPosition
6238
- }): void
6321
+ }): boolean
6239
6322
 
6240
6323
  /**
6241
6324
  * Insert an equipment into the grid.
6242
6325
  * @param table.by_player - If provided the action is done 'as' this player and [on_player_placed_equipment](runtime:on_player_placed_equipment) is triggered.
6243
6326
  * @param table.name - Equipment prototype name
6244
6327
  * @param table.position - Grid position to put the equipment in.
6328
+ * @returns The newly-added equipment, or `nil` if the equipment could not be added.
6245
6329
  */
6246
6330
  put(this: void,
6247
6331
  table: {
6248
6332
  name: string,
6249
6333
  position?: EquipmentPosition,
6250
6334
  by_player?: PlayerIdentification
6251
- }): void
6335
+ }): LuaEquipment | null
6252
6336
 
6253
6337
  /**
6254
6338
  * Remove an equipment from the grid.
6255
6339
  * @param table.by_player - If provided the action is done 'as' this player and [on_player_removed_equipment](runtime:on_player_removed_equipment) is triggered.
6256
6340
  * @param table.equipment - Take this exact equipment.
6257
6341
  * @param table.position - Take the equipment that contains this position in the grid.
6342
+ * @returns The removed equipment, or `nil` if no equipment was removed.
6258
6343
  */
6259
6344
  take(this: void,
6260
6345
  table: {
6261
6346
  position?: EquipmentPosition,
6262
6347
  equipment?: LuaEquipment,
6263
6348
  by_player?: PlayerIdentification
6264
- }): void
6349
+ }): SimpleItemStack | null
6265
6350
 
6266
6351
  /**
6267
6352
  * Remove all equipment from the grid.
6268
6353
  * @param by_player - If provided, the action is done 'as' this player and [on_player_removed_equipment](runtime:on_player_removed_equipment) is triggered.
6354
+ * @returns Count of each removed equipment, indexed by their prototype names.
6269
6355
  */
6270
6356
  take_all(this: void,
6271
- by_player?: PlayerIdentification): void
6357
+ by_player?: PlayerIdentification): {[key: string]: number}
6272
6358
 
6273
6359
  /**
6274
6360
  * The total energy stored in all batteries in the equipment grid.
@@ -6346,7 +6432,7 @@ interface LuaEquipmentGridPrototype {
6346
6432
  /**
6347
6433
  * All methods and properties that this object supports.
6348
6434
  */
6349
- help(this: void): void
6435
+ help(this: void): string
6350
6436
 
6351
6437
  /**
6352
6438
  * Equipment category names for the {@link categories | runtime:LuaEquipmentPrototype::equipment_categories} that may be inserted into this equipment grid. The grid will accept any equipment that has at least one category in this list.
@@ -6395,7 +6481,7 @@ interface LuaEquipmentPrototype {
6395
6481
  /**
6396
6482
  * All methods and properties that this object supports.
6397
6483
  */
6398
- help(this: void): void
6484
+ help(this: void): string
6399
6485
 
6400
6486
  /**
6401
6487
  * The equipment attack parameters.
@@ -6566,26 +6652,26 @@ interface LuaFlowStatistics {
6566
6652
  precision_index: defines.flow_precision_index,
6567
6653
  sample_index?: number,
6568
6654
  count?: boolean
6569
- }): void
6655
+ }): number
6570
6656
 
6571
6657
  /**
6572
6658
  * Gets the total input count for a given prototype.
6573
6659
  * @param name - The prototype name.
6574
6660
  */
6575
6661
  get_input_count(this: void,
6576
- name: string): void
6662
+ name: string): number
6577
6663
 
6578
6664
  /**
6579
6665
  * Gets the total output count for a given prototype.
6580
6666
  * @param name - The prototype name.
6581
6667
  */
6582
6668
  get_output_count(this: void,
6583
- name: string): void
6669
+ name: string): number
6584
6670
 
6585
6671
  /**
6586
6672
  * All methods and properties that this object supports.
6587
6673
  */
6588
- help(this: void): void
6674
+ help(this: void): string
6589
6675
 
6590
6676
  /**
6591
6677
  * Adds a value to this flow statistics.
@@ -6658,29 +6744,31 @@ interface LuaFluidBox {
6658
6744
  /**
6659
6745
  * Flushes all fluid from this fluidbox and its fluid system.
6660
6746
  * @param fluid - If provided, only this fluid is flushed.
6747
+ * @returns The removed fluid.
6661
6748
  */
6662
6749
  flush(this: void,
6663
6750
  index: number,
6664
- fluid?: FluidIdentification): void
6751
+ fluid?: FluidIdentification): {[key: string]: number}
6665
6752
 
6666
6753
  /**
6667
6754
  * The capacity of the given fluidbox index.
6668
6755
  */
6669
6756
  get_capacity(this: void,
6670
- index: number): void
6757
+ index: number): number
6671
6758
 
6672
6759
  /**
6673
6760
  * The fluidboxes to which the fluidbox at the given index is connected.
6674
6761
  */
6675
6762
  get_connections(this: void,
6676
- index: number): void
6763
+ index: number): LuaFluidBox[]
6677
6764
 
6678
6765
  /**
6679
6766
  * Get a fluid box filter
6680
6767
  * @param index - The index of the filter to get.
6768
+ * @returns The filter at the requested index, or `nil` if there isn't one.
6681
6769
  */
6682
6770
  get_filter(this: void,
6683
- index: number): void
6771
+ index: number): FluidBoxFilter | null
6684
6772
 
6685
6773
  /**
6686
6774
  * Flow through the fluidbox in the last tick. It is the larger of in-flow and out-flow.
@@ -6689,42 +6777,44 @@ interface LuaFluidBox {
6689
6777
  *
6690
6778
  */
6691
6779
  get_flow(this: void,
6692
- index: number): void
6780
+ index: number): number
6693
6781
 
6694
6782
  /**
6695
6783
  * Gets counts of all fluids in the fluid system. May return `nil` for fluid wagon, fluid turret's internal buffer, or a fluidbox which does not belong to a fluid system.
6784
+ * @returns The counts, indexed by fluid name.
6696
6785
  */
6697
6786
  get_fluid_system_contents(this: void,
6698
- index: number): void
6787
+ index: number): {[key: string]: number} | null
6699
6788
 
6700
6789
  /**
6701
6790
  * Gets unique fluid system identifier of selected fluid box. May return nil for fluid wagon, fluid turret's internal buffer or a fluidbox which does not belong to a fluid system
6702
6791
  */
6703
6792
  get_fluid_system_id(this: void,
6704
- index: number): void
6793
+ index: number): number
6705
6794
 
6706
6795
  /**
6707
6796
  * Returns the fluid the fluidbox is locked onto
6797
+ * @returns `nil` if the fluidbox is not locked to any fluid.
6708
6798
  */
6709
6799
  get_locked_fluid(this: void,
6710
- index: number): void
6800
+ index: number): string | null
6711
6801
 
6712
6802
  /**
6713
6803
  * Get the fluid box's connections and associated data.
6714
6804
  */
6715
6805
  get_pipe_connections(this: void,
6716
- index: number): void
6806
+ index: number): PipeConnection[]
6717
6807
 
6718
6808
  /**
6719
6809
  * The prototype of this fluidbox index. If this is used on a fluidbox of a crafting machine which due to recipe was created by merging multiple prototypes, a table of prototypes that were merged will be returned instead
6720
6810
  */
6721
6811
  get_prototype(this: void,
6722
- index: number): void
6812
+ index: number): LuaFluidBoxPrototype | LuaFluidBoxPrototype[]
6723
6813
 
6724
6814
  /**
6725
6815
  * All methods and properties that this object supports.
6726
6816
  */
6727
- help(this: void): void
6817
+ help(this: void): string
6728
6818
 
6729
6819
  /**
6730
6820
  * Set a fluid box filter.
@@ -6733,10 +6823,11 @@ interface LuaFluidBox {
6733
6823
  *
6734
6824
  * @param filter - The filter to set. Setting `nil` clears the filter.
6735
6825
  * @param index - The index of the filter to set.
6826
+ * @returns Whether the filter was set successfully.
6736
6827
  */
6737
6828
  set_filter(this: void,
6738
6829
  index: number,
6739
- filter: FluidBoxFilterSpec | null): void
6830
+ filter: FluidBoxFilterSpec | null): boolean
6740
6831
 
6741
6832
  /**
6742
6833
  * The class name of this object. Available even when `valid` is false. For LuaStruct objects it may also be suffixed with a dotted path to a member of the struct.
@@ -6777,7 +6868,7 @@ interface LuaFluidBoxPrototype {
6777
6868
  /**
6778
6869
  * All methods and properties that this object supports.
6779
6870
  */
6780
- help(this: void): void
6871
+ help(this: void): string
6781
6872
 
6782
6873
  readonly base_area: number
6783
6874
 
@@ -6851,7 +6942,7 @@ interface LuaFluidEnergySourcePrototype {
6851
6942
  /**
6852
6943
  * All methods and properties that this object supports.
6853
6944
  */
6854
- help(this: void): void
6945
+ help(this: void): string
6855
6946
 
6856
6947
  readonly burns_fluid: boolean
6857
6948
 
@@ -6903,7 +6994,7 @@ interface LuaFluidPrototype {
6903
6994
  /**
6904
6995
  * All methods and properties that this object supports.
6905
6996
  */
6906
- help(this: void): void
6997
+ help(this: void): string
6907
6998
 
6908
6999
  readonly base_color: Color
6909
7000
 
@@ -6987,7 +7078,7 @@ interface LuaFontPrototype {
6987
7078
  /**
6988
7079
  * All methods and properties that this object supports.
6989
7080
  */
6990
- help(this: void): void
7081
+ help(this: void): string
6991
7082
 
6992
7083
  readonly border: boolean
6993
7084
 
@@ -7035,13 +7126,14 @@ interface LuaForce {
7035
7126
  */
7036
7127
  add_chart_tag(this: void,
7037
7128
  surface: SurfaceIdentification,
7038
- tag: ChartTagSpec): void
7129
+ tag: ChartTagSpec): LuaCustomChartTag | null
7039
7130
 
7040
7131
  /**
7041
7132
  * Add this technology to the back of the research queue if the queue is enabled. Otherwise, set this technology to be researched now.
7133
+ * @returns Whether the technology was successfully added.
7042
7134
  */
7043
7135
  add_research(this: void,
7044
- technology: TechnologyIdentification): void
7136
+ technology: TechnologyIdentification): boolean
7045
7137
 
7046
7138
  /**
7047
7139
  * Cancels pending chart requests for the given surface or all surfaces.
@@ -7117,27 +7209,28 @@ interface LuaForce {
7117
7209
  */
7118
7210
  find_chart_tags(this: void,
7119
7211
  surface: SurfaceIdentification,
7120
- area?: BoundingBox): void
7212
+ area?: BoundingBox): LuaCustomChartTag[]
7121
7213
 
7122
7214
  /**
7123
7215
  * @param position - Position to find a network for
7124
7216
  * @param surface - Surface to search on
7217
+ * @returns The found network or `nil`.
7125
7218
  */
7126
7219
  find_logistic_network_by_position(this: void,
7127
7220
  position: MapPosition,
7128
- surface: SurfaceIdentification): void
7221
+ surface: SurfaceIdentification): LuaLogisticNetwork | null
7129
7222
 
7130
7223
  /**
7131
7224
  * @param ammo - Ammo category
7132
7225
  */
7133
7226
  get_ammo_damage_modifier(this: void,
7134
- ammo: string): void
7227
+ ammo: string): number
7135
7228
 
7136
7229
  /**
7137
7230
  * Is `other` force in this force's cease fire list?
7138
7231
  */
7139
7232
  get_cease_fire(this: void,
7140
- other: ForceIdentification): void
7233
+ other: ForceIdentification): boolean
7141
7234
 
7142
7235
  /**
7143
7236
  * Count entities of given type.
@@ -7145,51 +7238,54 @@ interface LuaForce {
7145
7238
  * This function has O(1) time complexity as entity counts are kept and maintained in the game engine.
7146
7239
  *
7147
7240
  * @param name - Prototype name of the entity.
7241
+ * @returns Number of entities of given prototype belonging to this force.
7148
7242
  */
7149
7243
  get_entity_count(this: void,
7150
- name: string): void
7244
+ name: string): number
7151
7245
 
7152
7246
  /**
7153
7247
  * Is `other` force in this force's friends list.
7154
7248
  */
7155
7249
  get_friend(this: void,
7156
- other: ForceIdentification): void
7250
+ other: ForceIdentification): boolean
7157
7251
 
7158
7252
  /**
7159
7253
  * @param ammo - Ammo category
7160
7254
  */
7161
7255
  get_gun_speed_modifier(this: void,
7162
- ammo: string): void
7256
+ ammo: string): number
7163
7257
 
7164
7258
  /**
7165
7259
  * Gets if the given recipe is explicitly disabled from being hand crafted.
7166
7260
  */
7167
7261
  get_hand_crafting_disabled_for_recipe(this: void,
7168
- recipe: string | LuaRecipe): void
7262
+ recipe: string | LuaRecipe): boolean
7169
7263
 
7170
7264
  /**
7171
7265
  * Gets the count of a given item launched in rockets.
7172
7266
  * @param item - The item to get
7267
+ * @returns The count of the item that has been launched.
7173
7268
  */
7174
7269
  get_item_launched(this: void,
7175
- item: string): void
7270
+ item: string): number
7176
7271
 
7177
7272
  /**
7178
7273
  * Gets the linked inventory for the given prototype and link ID if it exists or `nil`.
7179
7274
  */
7180
7275
  get_linked_inventory(this: void,
7181
7276
  prototype: EntityPrototypeIdentification,
7182
- link_id: number): void
7277
+ link_id: number): LuaInventory | null
7183
7278
 
7184
7279
  /**
7185
7280
  * Gets the saved progress for the given technology or `nil` if there is no saved progress.
7186
7281
  * @param technology - The technology
7282
+ * @returns The progress as a percent.
7187
7283
  */
7188
7284
  get_saved_technology_progress(this: void,
7189
- technology: TechnologyIdentification): void
7285
+ technology: TechnologyIdentification): number | null
7190
7286
 
7191
7287
  get_spawn_position(this: void,
7192
- surface: SurfaceIdentification): void
7288
+ surface: SurfaceIdentification): MapPosition
7193
7289
 
7194
7290
  /**
7195
7291
  * Gets train stops matching the given filters.
@@ -7200,24 +7296,24 @@ interface LuaForce {
7200
7296
  table?: {
7201
7297
  name?: string | string[],
7202
7298
  surface?: SurfaceIdentification
7203
- }): void
7299
+ }): LuaEntity[]
7204
7300
 
7205
7301
  /**
7206
7302
  * @param surface - The surface to search. Not providing a surface will match trains on any surface.
7207
7303
  */
7208
7304
  get_trains(this: void,
7209
- surface?: SurfaceIdentification): void
7305
+ surface?: SurfaceIdentification): LuaTrain[]
7210
7306
 
7211
7307
  /**
7212
7308
  * @param turret - Turret prototype name
7213
7309
  */
7214
7310
  get_turret_attack_modifier(this: void,
7215
- turret: string): void
7311
+ turret: string): number
7216
7312
 
7217
7313
  /**
7218
7314
  * All methods and properties that this object supports.
7219
7315
  */
7220
- help(this: void): void
7316
+ help(this: void): string
7221
7317
 
7222
7318
  /**
7223
7319
  * Has a chunk been charted?
@@ -7225,31 +7321,31 @@ interface LuaForce {
7225
7321
  */
7226
7322
  is_chunk_charted(this: void,
7227
7323
  surface: SurfaceIdentification,
7228
- position: ChunkPosition): void
7324
+ position: ChunkPosition): boolean
7229
7325
 
7230
7326
  /**
7231
7327
  * Is the given chunk currently charted and visible (not covered by fog of war) on the map.
7232
7328
  */
7233
7329
  is_chunk_visible(this: void,
7234
7330
  surface: SurfaceIdentification,
7235
- position: ChunkPosition): void
7331
+ position: ChunkPosition): boolean
7236
7332
 
7237
7333
  /**
7238
7334
  * Is this force an enemy? This differs from `get_cease_fire` in that it is always false for neutral force. This is equivalent to checking the `enemy` ForceCondition.
7239
7335
  */
7240
7336
  is_enemy(this: void,
7241
- other: ForceIdentification): void
7337
+ other: ForceIdentification): boolean
7242
7338
 
7243
7339
  /**
7244
7340
  * Is this force a friend? This differs from `get_friend` in that it is always true for neutral force. This is equivalent to checking the `friend` ForceCondition.
7245
7341
  */
7246
7342
  is_friend(this: void,
7247
- other: ForceIdentification): void
7343
+ other: ForceIdentification): boolean
7248
7344
 
7249
7345
  /**
7250
7346
  * Is pathfinder busy? When the pathfinder is busy, it won't accept any more pathfinding requests.
7251
7347
  */
7252
- is_pathfinder_busy(this: void): void
7348
+ is_pathfinder_busy(this: void): boolean
7253
7349
 
7254
7350
  /**
7255
7351
  * Kill all units and flush the pathfinder.
@@ -7709,7 +7805,7 @@ interface LuaFuelCategoryPrototype {
7709
7805
  /**
7710
7806
  * All methods and properties that this object supports.
7711
7807
  */
7712
- help(this: void): void
7808
+ help(this: void): string
7713
7809
 
7714
7810
  readonly localised_description: LocalisedString
7715
7811
 
@@ -7788,9 +7884,10 @@ interface LuaGameScript {
7788
7884
  * Force names must be unique.
7789
7885
  *
7790
7886
  * @param force - Name of the new force
7887
+ * @returns The force that was just created
7791
7888
  */
7792
7889
  create_force(this: void,
7793
- force: string): void
7890
+ force: string): LuaForce
7794
7891
 
7795
7892
  /**
7796
7893
  * Creates an inventory that is not owned by any game object. It can be resized later with {@link LuaInventory::resize | runtime:LuaInventory::resize}.
@@ -7800,7 +7897,7 @@ interface LuaGameScript {
7800
7897
  * @param size - The number of slots the inventory initially has.
7801
7898
  */
7802
7899
  create_inventory(this: void,
7803
- size: number): void
7900
+ size: number): LuaInventory
7804
7901
 
7805
7902
  /**
7806
7903
  * Creates a {@link LuaProfiler | runtime:LuaProfiler}, which is used for measuring script performance.
@@ -7810,7 +7907,7 @@ interface LuaGameScript {
7810
7907
  * @param stopped - Create the timer stopped
7811
7908
  */
7812
7909
  create_profiler(this: void,
7813
- stopped?: boolean): void
7910
+ stopped?: boolean): LuaProfiler
7814
7911
 
7815
7912
  /**
7816
7913
  * Creates a deterministic standalone random generator with the given seed or if a seed is not provided the initial map seed is used.
@@ -7819,7 +7916,7 @@ interface LuaGameScript {
7819
7916
  *
7820
7917
  */
7821
7918
  create_random_generator(this: void,
7822
- seed?: number): void
7919
+ seed?: number): LuaRandomGenerator
7823
7920
 
7824
7921
  /**
7825
7922
  * Create a new surface.
@@ -7829,17 +7926,19 @@ interface LuaGameScript {
7829
7926
  *
7830
7927
  * @param name - Name of the new surface.
7831
7928
  * @param settings - Map generation settings.
7929
+ * @returns The surface that was just created.
7832
7930
  */
7833
7931
  create_surface(this: void,
7834
7932
  name: string,
7835
- settings?: MapGenSettings): void
7933
+ settings?: MapGenSettings): LuaSurface
7836
7934
 
7837
7935
  /**
7838
7936
  * Base64 decodes and inflates the given string.
7839
7937
  * @param string - The string to decode.
7938
+ * @returns The decoded string or `nil` if the decode failed.
7840
7939
  */
7841
7940
  decode_string(this: void,
7842
- string: string): void
7941
+ string: string): string | null
7843
7942
 
7844
7943
  /**
7845
7944
  * Deletes the given surface and all entities on it.
@@ -7867,9 +7966,10 @@ interface LuaGameScript {
7867
7966
  /**
7868
7967
  * Deflates and base64 encodes the given string.
7869
7968
  * @param string - The string to encode.
7969
+ * @returns The encoded string or `nil` if the encode failed.
7870
7970
  */
7871
7971
  encode_string(this: void,
7872
- string: string): void
7972
+ string: string): string | null
7873
7973
 
7874
7974
  /**
7875
7975
  * Evaluate an expression, substituting variables as provided. For details on the formula, see {@link TechnologyPrototype::unit | prototype:TechnologyPrototype::unit}.
@@ -7885,7 +7985,7 @@ interface LuaGameScript {
7885
7985
  */
7886
7986
  evaluate_expression(this: void,
7887
7987
  expression: string,
7888
- variables?: {[key: string]: number}): void
7988
+ variables?: {[key: string]: number}): number
7889
7989
 
7890
7990
  /**
7891
7991
  * Force a CRC check. Tells all peers to calculate their current CRC, which are then compared to each other. If a mismatch is detected, the game desyncs and some peers are forced to reconnect.
@@ -7900,10 +8000,10 @@ interface LuaGameScript {
7900
8000
  * @param surface - If given, only the entities active on this surface are counted.
7901
8001
  */
7902
8002
  get_active_entities_count(this: void,
7903
- surface?: SurfaceIdentification): void
8003
+ surface?: SurfaceIdentification): number
7904
8004
 
7905
8005
  get_entity_by_tag(this: void,
7906
- tag: string): void
8006
+ tag: string): LuaEntity | null
7907
8007
 
7908
8008
  /**
7909
8009
  * Returns a dictionary of all LuaAchievementPrototypes that fit the given filters. The prototypes are indexed by `name`.
@@ -7915,7 +8015,7 @@ interface LuaGameScript {
7915
8015
  *
7916
8016
  */
7917
8017
  get_filtered_achievement_prototypes(this: void,
7918
- filters: AchievementPrototypeFilter[]): void
8018
+ filters: AchievementPrototypeFilter[]): {[key: string]: LuaAchievementPrototype}
7919
8019
 
7920
8020
  /**
7921
8021
  * Returns a dictionary of all LuaDecorativePrototypes that fit the given filters. The prototypes are indexed by `name`.
@@ -7927,7 +8027,7 @@ interface LuaGameScript {
7927
8027
  *
7928
8028
  */
7929
8029
  get_filtered_decorative_prototypes(this: void,
7930
- filters: DecorativePrototypeFilter[]): void
8030
+ filters: DecorativePrototypeFilter[]): {[key: string]: LuaDecorativePrototype}
7931
8031
 
7932
8032
  /**
7933
8033
  * Returns a dictionary of all LuaEntityPrototypes that fit the given filters. The prototypes are indexed by `name`.
@@ -7939,7 +8039,7 @@ interface LuaGameScript {
7939
8039
  *
7940
8040
  */
7941
8041
  get_filtered_entity_prototypes(this: void,
7942
- filters: EntityPrototypeFilter[]): void
8042
+ filters: EntityPrototypeFilter[]): {[key: string]: LuaEntityPrototype}
7943
8043
 
7944
8044
  /**
7945
8045
  * Returns a dictionary of all LuaEquipmentPrototypes that fit the given filters. The prototypes are indexed by `name`.
@@ -7951,7 +8051,7 @@ interface LuaGameScript {
7951
8051
  *
7952
8052
  */
7953
8053
  get_filtered_equipment_prototypes(this: void,
7954
- filters: EquipmentPrototypeFilter[]): void
8054
+ filters: EquipmentPrototypeFilter[]): {[key: string]: LuaEquipmentPrototype}
7955
8055
 
7956
8056
  /**
7957
8057
  * Returns a dictionary of all LuaFluidPrototypes that fit the given filters. The prototypes are indexed by `name`.
@@ -7963,7 +8063,7 @@ interface LuaGameScript {
7963
8063
  *
7964
8064
  */
7965
8065
  get_filtered_fluid_prototypes(this: void,
7966
- filters: FluidPrototypeFilter[]): void
8066
+ filters: FluidPrototypeFilter[]): {[key: string]: LuaFluidPrototype}
7967
8067
 
7968
8068
  /**
7969
8069
  * Returns a dictionary of all LuaItemPrototypes that fit the given filters. The prototypes are indexed by `name`.
@@ -7975,7 +8075,7 @@ interface LuaGameScript {
7975
8075
  *
7976
8076
  */
7977
8077
  get_filtered_item_prototypes(this: void,
7978
- filters: ItemPrototypeFilter[]): void
8078
+ filters: ItemPrototypeFilter[]): {[key: string]: LuaItemPrototype}
7979
8079
 
7980
8080
  /**
7981
8081
  * Returns a dictionary of all LuaModSettingPrototypes that fit the given filters. The prototypes are indexed by `name`.
@@ -7987,7 +8087,7 @@ interface LuaGameScript {
7987
8087
  *
7988
8088
  */
7989
8089
  get_filtered_mod_setting_prototypes(this: void,
7990
- filters: ModSettingPrototypeFilter[]): void
8090
+ filters: ModSettingPrototypeFilter[]): {[key: string]: LuaModSettingPrototype}
7991
8091
 
7992
8092
  /**
7993
8093
  * Returns a dictionary of all LuaRecipePrototypes that fit the given filters. The prototypes are indexed by `name`.
@@ -7999,7 +8099,7 @@ interface LuaGameScript {
7999
8099
  *
8000
8100
  */
8001
8101
  get_filtered_recipe_prototypes(this: void,
8002
- filters: RecipePrototypeFilter[]): void
8102
+ filters: RecipePrototypeFilter[]): {[key: string]: LuaRecipePrototype}
8003
8103
 
8004
8104
  /**
8005
8105
  * Returns a dictionary of all LuaTechnologyPrototypes that fit the given filters. The prototypes are indexed by `name`.
@@ -8011,7 +8111,7 @@ interface LuaGameScript {
8011
8111
  *
8012
8112
  */
8013
8113
  get_filtered_technology_prototypes(this: void,
8014
- filters: TechnologyPrototypeFilter[]): void
8114
+ filters: TechnologyPrototypeFilter[]): {[key: string]: LuaTechnologyPrototype}
8015
8115
 
8016
8116
  /**
8017
8117
  * Returns a dictionary of all LuaTilePrototypes that fit the given filters. The prototypes are indexed by `name`.
@@ -8023,19 +8123,19 @@ interface LuaGameScript {
8023
8123
  *
8024
8124
  */
8025
8125
  get_filtered_tile_prototypes(this: void,
8026
- filters: TilePrototypeFilter[]): void
8126
+ filters: TilePrototypeFilter[]): {[key: string]: LuaTilePrototype}
8027
8127
 
8028
8128
  /**
8029
8129
  * Gets the map exchange string for the map generation settings that were used to create this map.
8030
8130
  */
8031
- get_map_exchange_string(this: void): void
8131
+ get_map_exchange_string(this: void): string
8032
8132
 
8033
8133
  /**
8034
8134
  * Gets the given player or returns `nil` if no player is found.
8035
8135
  * @param player - The player index or name.
8036
8136
  */
8037
8137
  get_player(this: void,
8038
- player: number | string): void
8138
+ player: number | string): LuaPlayer | null
8039
8139
 
8040
8140
  /**
8041
8141
  * Gets the inventories created through {@link LuaGameScript::create_inventory | runtime:LuaGameScript::create_inventory}
@@ -8043,9 +8143,10 @@ interface LuaGameScript {
8043
8143
  * Inventories created through console commands will be owned by `"core"`.
8044
8144
  *
8045
8145
  * @param mod - The mod who's inventories to get. If not provided all inventories are returned.
8146
+ * @returns A mapping of mod name to array of inventories owned by that mod.
8046
8147
  */
8047
8148
  get_script_inventories(this: void,
8048
- mod?: string): void
8149
+ mod?: string): {[key: string]: LuaInventory[]}
8049
8150
 
8050
8151
  /**
8051
8152
  * Gets the given surface or returns `nil` if no surface is found.
@@ -8055,7 +8156,7 @@ interface LuaGameScript {
8055
8156
  * @param surface - The surface index or name.
8056
8157
  */
8057
8158
  get_surface(this: void,
8058
- surface: number | string): void
8159
+ surface: number | string): LuaSurface | null
8059
8160
 
8060
8161
  /**
8061
8162
  * Gets train stops matching the given filters.
@@ -8068,38 +8169,39 @@ interface LuaGameScript {
8068
8169
  name?: string | string[],
8069
8170
  surface?: SurfaceIdentification,
8070
8171
  force?: ForceIdentification
8071
- }): void
8172
+ }): LuaEntity[]
8072
8173
 
8073
8174
  /**
8074
8175
  * Is this the demo version of Factorio?
8075
8176
  */
8076
- is_demo(this: void): void
8177
+ is_demo(this: void): boolean
8077
8178
 
8078
8179
  /**
8079
8180
  * Whether the save is loaded as a multiplayer map.
8080
8181
  */
8081
- is_multiplayer(this: void): void
8182
+ is_multiplayer(this: void): boolean
8082
8183
 
8083
8184
  /**
8084
8185
  * Checks if the given SoundPath is valid.
8085
8186
  * @param sound_path - Path to the sound.
8086
8187
  */
8087
8188
  is_valid_sound_path(this: void,
8088
- sound_path: SoundPath): void
8189
+ sound_path: SoundPath): boolean
8089
8190
 
8090
8191
  /**
8091
8192
  * Checks if the given SpritePath is valid and contains a loaded sprite. The existence of the image is not checked for paths of type `file`.
8092
8193
  * @param sprite_path - Path to the image.
8093
8194
  */
8094
8195
  is_valid_sprite_path(this: void,
8095
- sprite_path: SpritePath): void
8196
+ sprite_path: SpritePath): boolean
8096
8197
 
8097
8198
  /**
8098
8199
  * Convert a JSON string to a table.
8099
8200
  * @param json - The string to convert.
8201
+ * @returns The returned object, or `nil` if the JSON string was invalid.
8100
8202
  */
8101
8203
  json_to_table(this: void,
8102
- json: string): void
8204
+ json: string): AnyBasic | null
8103
8205
 
8104
8206
  /**
8105
8207
  * Kicks the given player from this multiplayer game. Does nothing if this is a single player game or if the player running this isn't an admin.
@@ -8134,7 +8236,7 @@ interface LuaGameScript {
8134
8236
  * Convert a map exchange string to map gen settings and map settings.
8135
8237
  */
8136
8238
  parse_map_exchange_string(this: void,
8137
- map_exchange_string: string): void
8239
+ map_exchange_string: string): MapExchangeStringData
8138
8240
 
8139
8241
  /**
8140
8242
  * Play a sound for every player in the game.
@@ -8276,7 +8378,7 @@ interface LuaGameScript {
8276
8378
  * Convert a table to a JSON string
8277
8379
  */
8278
8380
  table_to_json(this: void,
8279
- data: Table): void
8381
+ data: Table): string
8280
8382
 
8281
8383
  /**
8282
8384
  * Take a screenshot of the game and save it to the `script-output` folder, located in the game's {@link user data directory | https://wiki.factorio.com/User_data_directory}. The name of the image file can be specified via the `path` parameter.
@@ -8704,7 +8806,7 @@ interface LuaGenericOnOffControlBehavior extends LuaControlBehavior {
8704
8806
  /**
8705
8807
  * All methods and properties that this object supports.
8706
8808
  */
8707
- help(this: void): void
8809
+ help(this: void): string
8708
8810
 
8709
8811
  /**
8710
8812
  * The circuit condition. Writing `nil` clears the circuit condition.
@@ -8761,7 +8863,7 @@ interface LuaGroup {
8761
8863
  /**
8762
8864
  * All methods and properties that this object supports.
8763
8865
  */
8764
- help(this: void): void
8866
+ help(this: void): string
8765
8867
 
8766
8868
  /**
8767
8869
  * The parent group, if any.
@@ -8814,7 +8916,7 @@ interface LuaGui {
8814
8916
  /**
8815
8917
  * All methods and properties that this object supports.
8816
8918
  */
8817
- help(this: void): void
8919
+ help(this: void): string
8818
8920
 
8819
8921
  /**
8820
8922
  * Returns `true` if sprite_path is valid and contains loaded sprite, otherwise `false`. Sprite path of type `file` doesn't validate if file exists.
@@ -8823,7 +8925,7 @@ interface LuaGui {
8823
8925
  * @param sprite_path - Path to a image.
8824
8926
  */
8825
8927
  is_valid_sprite_path(this: void,
8826
- sprite_path: SpritePath): void
8928
+ sprite_path: SpritePath): boolean
8827
8929
 
8828
8930
  /**
8829
8931
  * The center part of the GUI. It is a flow element.
@@ -8907,9 +9009,10 @@ interface LuaGui {
8907
9009
  interface LuaGuiElement {
8908
9010
  /**
8909
9011
  * Add a new child element to this GuiElement.
9012
+ * @returns The GUI element that was added.
8910
9013
  */
8911
9014
  add(this: void,
8912
- table: LuaGuiElementAddParams): void
9015
+ table: LuaGuiElementAddParams): LuaGuiElement
8913
9016
 
8914
9017
  /**
8915
9018
  * Inserts a string at the end or at the given index of this dropdown or listbox.
@@ -8998,7 +9101,7 @@ interface LuaGuiElement {
8998
9101
  * This iterates through the children of the parent of this element, meaning this has a non-free cost to get, but is faster than doing the equivalent in Lua.
8999
9102
  *
9000
9103
  */
9001
- get_index_in_parent(this: void): void
9104
+ get_index_in_parent(this: void): number
9002
9105
 
9003
9106
  /**
9004
9107
  * Gets the item at the given index from this dropdown or listbox.
@@ -9008,7 +9111,7 @@ interface LuaGuiElement {
9008
9111
  * @param index - The index to get
9009
9112
  */
9010
9113
  get_item(this: void,
9011
- index: number): void
9114
+ index: number): LocalisedString
9012
9115
 
9013
9116
  /**
9014
9117
  * The mod that owns this Gui element or `nil` if it's owned by the scenario script.
@@ -9016,37 +9119,37 @@ interface LuaGuiElement {
9016
9119
  * This has a not-super-expensive, but non-free cost to get.
9017
9120
  *
9018
9121
  */
9019
- get_mod(this: void): void
9122
+ get_mod(this: void): string | null
9020
9123
 
9021
9124
  /**
9022
9125
  * Returns whether this slider only allows being moved to discrete positions.
9023
9126
  */
9024
- get_slider_discrete_slider(this: void): void
9127
+ get_slider_discrete_slider(this: void): boolean
9025
9128
 
9026
9129
  /**
9027
9130
  * Returns whether this slider only allows discrete values.
9028
9131
  */
9029
- get_slider_discrete_values(this: void): void
9132
+ get_slider_discrete_values(this: void): boolean
9030
9133
 
9031
9134
  /**
9032
9135
  * Gets this sliders maximum value.
9033
9136
  */
9034
- get_slider_maximum(this: void): void
9137
+ get_slider_maximum(this: void): number
9035
9138
 
9036
9139
  /**
9037
9140
  * Gets this sliders minimum value.
9038
9141
  */
9039
- get_slider_minimum(this: void): void
9142
+ get_slider_minimum(this: void): number
9040
9143
 
9041
9144
  /**
9042
9145
  * Gets the minimum distance this slider can move.
9043
9146
  */
9044
- get_slider_value_step(this: void): void
9147
+ get_slider_value_step(this: void): number
9045
9148
 
9046
9149
  /**
9047
9150
  * All methods and properties that this object supports.
9048
9151
  */
9049
- help(this: void): void
9152
+ help(this: void): string
9050
9153
 
9051
9154
  /**
9052
9155
  * Removes the item at the given index from this dropdown or listbox.
@@ -9796,7 +9899,7 @@ interface LuaHeatBufferPrototype {
9796
9899
  /**
9797
9900
  * All methods and properties that this object supports.
9798
9901
  */
9799
- help(this: void): void
9902
+ help(this: void): string
9800
9903
 
9801
9904
  readonly connections: HeatConnection[]
9802
9905
 
@@ -9833,7 +9936,7 @@ interface LuaHeatEnergySourcePrototype {
9833
9936
  /**
9834
9937
  * All methods and properties that this object supports.
9835
9938
  */
9836
- help(this: void): void
9939
+ help(this: void): string
9837
9940
 
9838
9941
  readonly connections: HeatConnection[]
9839
9942
 
@@ -9881,7 +9984,7 @@ interface LuaInserterControlBehavior extends LuaGenericOnOffControlBehavior {
9881
9984
  /**
9882
9985
  * All methods and properties that this object supports.
9883
9986
  */
9884
- help(this: void): void
9987
+ help(this: void): string
9885
9988
 
9886
9989
  /**
9887
9990
  * The hand read mode for the inserter.
@@ -9927,9 +10030,10 @@ interface LuaInventory {
9927
10030
  /**
9928
10031
  * Can at least some items be inserted?
9929
10032
  * @param items - Items that would be inserted.
10033
+ * @returns `true` if at least a part of the given items could be inserted into this inventory.
9930
10034
  */
9931
10035
  can_insert(this: void,
9932
- items: ItemStackIdentification): void
10036
+ items: ItemStackIdentification): boolean
9933
10037
 
9934
10038
  /**
9935
10039
  * If the given inventory slot filter can be set to the given filter.
@@ -9938,7 +10042,7 @@ interface LuaInventory {
9938
10042
  */
9939
10043
  can_set_filter(this: void,
9940
10044
  index: number,
9941
- filter: string): void
10045
+ filter: string): boolean
9942
10046
 
9943
10047
  /**
9944
10048
  * Make this inventory empty.
@@ -9952,7 +10056,7 @@ interface LuaInventory {
9952
10056
  */
9953
10057
  count_empty_stacks(this: void,
9954
10058
  include_filtered?: boolean,
9955
- include_bar?: boolean): void
10059
+ include_bar?: boolean): number
9956
10060
 
9957
10061
  /**
9958
10062
  * Destroys this inventory.
@@ -9965,16 +10069,22 @@ interface LuaInventory {
9965
10069
  /**
9966
10070
  * Finds the first empty stack. Filtered slots are excluded unless a filter item is given.
9967
10071
  * @param item - If given, empty stacks that are filtered for this item will be included.
10072
+ * @returns multiple values
10073
+ * [0] - The first empty stack, or `nil` if there aren't any empty stacks.
10074
+ * [1] - The stack index of the matching stack, if any is found.
9968
10075
  */
9969
10076
  find_empty_stack(this: void,
9970
- item?: string): void
10077
+ item?: string): LuaMultiReturn<[LuaItemStack | null, number | null]>
9971
10078
 
9972
10079
  /**
9973
10080
  * Finds the first LuaItemStack in the inventory that matches the given item name.
9974
10081
  * @param item - The item name to find
10082
+ * @returns multiple values
10083
+ * [0] - The first matching stack, or `nil` if none match.
10084
+ * [1] - The stack index of the matching stack, if any is found.
9975
10085
  */
9976
10086
  find_item_stack(this: void,
9977
- item: string): void
10087
+ item: string): LuaMultiReturn<[LuaItemStack | null, number | null]>
9978
10088
 
9979
10089
  /**
9980
10090
  * Get the current bar. This is the index at which the red area starts.
@@ -9982,19 +10092,21 @@ interface LuaInventory {
9982
10092
  * Only useable if this inventory supports having a bar.
9983
10093
  *
9984
10094
  */
9985
- get_bar(this: void): void
10095
+ get_bar(this: void): number
9986
10096
 
9987
10097
  /**
9988
10098
  * Get counts of all items in this inventory.
10099
+ * @returns The counts, indexed by item names.
9989
10100
  */
9990
- get_contents(this: void): void
10101
+ get_contents(this: void): {[key: string]: number}
9991
10102
 
9992
10103
  /**
9993
10104
  * Gets the filter for the given item stack index.
9994
10105
  * @param index - The item stack index
10106
+ * @returns The current filter or `nil` if none.
9995
10107
  */
9996
10108
  get_filter(this: void,
9997
- index: number): void
10109
+ index: number): string | null
9998
10110
 
9999
10111
  /**
10000
10112
  * Gets the number of the given item that can be inserted into this inventory.
@@ -10013,41 +10125,43 @@ interface LuaInventory {
10013
10125
  * @param item - Prototype name of the item to count. If not specified, count all items.
10014
10126
  */
10015
10127
  get_item_count(this: void,
10016
- item?: string): void
10128
+ item?: string): number
10017
10129
 
10018
10130
  /**
10019
10131
  * All methods and properties that this object supports.
10020
10132
  */
10021
- help(this: void): void
10133
+ help(this: void): string
10022
10134
 
10023
10135
  /**
10024
10136
  * Insert items into this inventory.
10025
10137
  * @param items - Items to insert.
10138
+ * @returns Number of items actually inserted.
10026
10139
  */
10027
10140
  insert(this: void,
10028
- items: ItemStackIdentification): void
10141
+ items: ItemStackIdentification): number
10029
10142
 
10030
10143
  /**
10031
10144
  * Does this inventory contain nothing?
10032
10145
  */
10033
- is_empty(this: void): void
10146
+ is_empty(this: void): boolean
10034
10147
 
10035
10148
  /**
10036
10149
  * If this inventory supports filters and has at least 1 filter set.
10037
10150
  */
10038
- is_filtered(this: void): void
10151
+ is_filtered(this: void): boolean
10039
10152
 
10040
10153
  /**
10041
10154
  * Is every stack in this inventory full? Ignores stacks blocked by the current bar.
10042
10155
  */
10043
- is_full(this: void): void
10156
+ is_full(this: void): boolean
10044
10157
 
10045
10158
  /**
10046
10159
  * Remove items from this inventory.
10047
10160
  * @param items - Items to remove.
10161
+ * @returns Number of items actually removed.
10048
10162
  */
10049
10163
  remove(this: void,
10050
- items: ItemStackIdentification): void
10164
+ items: ItemStackIdentification): number
10051
10165
 
10052
10166
  /**
10053
10167
  * Resizes the inventory.
@@ -10077,10 +10191,11 @@ interface LuaInventory {
10077
10191
  *
10078
10192
  * @param filter - The new filter. `nil` erases any existing filter.
10079
10193
  * @param index - The item stack index.
10194
+ * @returns If the filter was allowed to be set.
10080
10195
  */
10081
10196
  set_filter(this: void,
10082
10197
  index: number,
10083
- filter: string | null): void
10198
+ filter: string | null): boolean
10084
10199
 
10085
10200
  /**
10086
10201
  * Sorts and merges the items in this inventory.
@@ -10093,12 +10208,12 @@ interface LuaInventory {
10093
10208
  * "Supporting a bar" doesn't mean that the bar is set to some nontrivial value. Supporting a bar means the inventory supports having this limit at all. The character's inventory is an example of an inventory without a bar; the wooden chest's inventory is an example of one with a bar.
10094
10209
  *
10095
10210
  */
10096
- supports_bar(this: void): void
10211
+ supports_bar(this: void): boolean
10097
10212
 
10098
10213
  /**
10099
10214
  * If this inventory supports filters.
10100
10215
  */
10101
- supports_filters(this: void): void
10216
+ supports_filters(this: void): boolean
10102
10217
 
10103
10218
  /**
10104
10219
  * The entity that owns this inventory, if any.
@@ -10179,19 +10294,19 @@ interface LuaItemPrototype {
10179
10294
  * @param ammo_source_type - One of `"default"`, `"player"`, `"turret"`, or `"vehicle"`. Defaults to `"default"`.
10180
10295
  */
10181
10296
  get_ammo_type(this: void,
10182
- ammo_source_type?: string): void
10297
+ ammo_source_type?: string): AmmoType | null
10183
10298
 
10184
10299
  /**
10185
10300
  * Does this prototype have a flag enabled?
10186
10301
  * @param flag - The flag to check. Can be one of [ItemPrototypeFlags](runtime:ItemPrototypeFlags). Any other value will cause an error.
10187
10302
  */
10188
10303
  has_flag(this: void,
10189
- flag: string): void
10304
+ flag: string): boolean
10190
10305
 
10191
10306
  /**
10192
10307
  * All methods and properties that this object supports.
10193
10308
  */
10194
- help(this: void): void
10309
+ help(this: void): string
10195
10310
 
10196
10311
  /**
10197
10312
  * The alt entity filter mode used by this selection tool.
@@ -10871,6 +10986,7 @@ interface LuaItemStack {
10871
10986
  * @param table.raise_built - If true; [defines.events.script_raised_built](runtime:defines.events.script_raised_built) will be fired on successful entity creation. Note: this is ignored if by_player is provided.
10872
10987
  * @param table.skip_fog_of_war - If chunks covered by fog-of-war are skipped.
10873
10988
  * @param table.surface - Surface to build on
10989
+ * @returns Array of created ghosts
10874
10990
  */
10875
10991
  build_blueprint(this: void,
10876
10992
  table: {
@@ -10882,14 +10998,14 @@ interface LuaItemStack {
10882
10998
  skip_fog_of_war?: boolean,
10883
10999
  by_player?: PlayerIdentification,
10884
11000
  raise_built?: boolean
10885
- }): void
11001
+ }): LuaEntity[]
10886
11002
 
10887
11003
  /**
10888
11004
  * Would a call to {@link LuaItemStack::set_stack | runtime:LuaItemStack::set_stack} succeed?
10889
11005
  * @param stack - Stack that would be set, possibly `nil`.
10890
11006
  */
10891
11007
  can_set_stack(this: void,
10892
- stack?: ItemStackIdentification): void
11008
+ stack?: ItemStackIdentification): boolean
10893
11009
 
10894
11010
  /**
10895
11011
  * Cancel deconstruct the given area with this deconstruction item.
@@ -10948,6 +11064,7 @@ interface LuaItemStack {
10948
11064
  * @param table.include_station_names - When true, station names are included in the blueprint. Defaults to false.
10949
11065
  * @param table.include_trains - When true, trains are included in the blueprint. Defaults to false.
10950
11066
  * @param table.surface - Surface to create from
11067
+ * @returns The blueprint entity index to source entity mapping.
10951
11068
  */
10952
11069
  create_blueprint(this: void,
10953
11070
  table: {
@@ -10960,7 +11077,7 @@ interface LuaItemStack {
10960
11077
  include_station_names?: boolean,
10961
11078
  include_trains?: boolean,
10962
11079
  include_fuel?: boolean
10963
- }): void
11080
+ }): {[key: number]: LuaEntity}
10964
11081
 
10965
11082
  /**
10966
11083
  * Creates the equipment grid for this item if it doesn't exist and this is an item-with-entity-data that supports equipment grids.
@@ -10968,7 +11085,7 @@ interface LuaItemStack {
10968
11085
  * Applies to subclasses: ItemWithEntityData
10969
11086
  *
10970
11087
  */
10971
- create_grid(this: void): void
11088
+ create_grid(this: void): LuaEquipmentGrid
10972
11089
 
10973
11090
  /**
10974
11091
  * Deconstruct the given area with this deconstruction item.
@@ -11009,8 +11126,9 @@ interface LuaItemStack {
11009
11126
 
11010
11127
  /**
11011
11128
  * Export a supported item (blueprint, blueprint-book, deconstruction-planner, upgrade-planner, item-with-tags) to a string.
11129
+ * @returns The exported string
11012
11130
  */
11013
- export_stack(this: void): void
11131
+ export_stack(this: void): string
11014
11132
 
11015
11133
  /**
11016
11134
  * The entities in this blueprint.
@@ -11018,7 +11136,7 @@ interface LuaItemStack {
11018
11136
  * Applies to subclasses: BlueprintItem
11019
11137
  *
11020
11138
  */
11021
- get_blueprint_entities(this: void): void
11139
+ get_blueprint_entities(this: void): BlueprintEntity[] | null
11022
11140
 
11023
11141
  /**
11024
11142
  * Gets the number of entities in this blueprint item.
@@ -11026,7 +11144,7 @@ interface LuaItemStack {
11026
11144
  * Applies to subclasses: BlueprintItem
11027
11145
  *
11028
11146
  */
11029
- get_blueprint_entity_count(this: void): void
11147
+ get_blueprint_entity_count(this: void): number
11030
11148
 
11031
11149
  /**
11032
11150
  * Gets the given tag on the given blueprint entity index in this blueprint item.
@@ -11038,7 +11156,7 @@ interface LuaItemStack {
11038
11156
  */
11039
11157
  get_blueprint_entity_tag(this: void,
11040
11158
  index: number,
11041
- tag: string): void
11159
+ tag: string): AnyBasic | null
11042
11160
 
11043
11161
  /**
11044
11162
  * Gets the tags for the given blueprint entity index in this blueprint item.
@@ -11047,7 +11165,7 @@ interface LuaItemStack {
11047
11165
  *
11048
11166
  */
11049
11167
  get_blueprint_entity_tags(this: void,
11050
- index: number): void
11168
+ index: number): Tags
11051
11169
 
11052
11170
  /**
11053
11171
  * A list of the tiles in this blueprint.
@@ -11055,7 +11173,7 @@ interface LuaItemStack {
11055
11173
  * Applies to subclasses: BlueprintItem
11056
11174
  *
11057
11175
  */
11058
- get_blueprint_tiles(this: void): void
11176
+ get_blueprint_tiles(this: void): Tile[] | null
11059
11177
 
11060
11178
  /**
11061
11179
  * Gets the entity filter at the given index for this deconstruction item.
@@ -11064,14 +11182,15 @@ interface LuaItemStack {
11064
11182
  *
11065
11183
  */
11066
11184
  get_entity_filter(this: void,
11067
- index: number): void
11185
+ index: number): string | null
11068
11186
 
11069
11187
  /**
11070
11188
  * Access the inner inventory of an item.
11071
11189
  * @param inventory - Index of the inventory to access, which can only be [defines.inventory.item_main](runtime:defines.inventory.item_main).
11190
+ * @returns `nil` if there is no inventory with the given index.
11072
11191
  */
11073
11192
  get_inventory(this: void,
11074
- inventory: defines.inventory): void
11193
+ inventory: defines.inventory): LuaInventory | null
11075
11194
 
11076
11195
  /**
11077
11196
  * Gets the filter at the given index for this upgrade item.
@@ -11083,7 +11202,7 @@ interface LuaItemStack {
11083
11202
  */
11084
11203
  get_mapper(this: void,
11085
11204
  index: number,
11086
- type: string): void
11205
+ type: string): UpgradeFilter
11087
11206
 
11088
11207
  /**
11089
11208
  * Gets the tag with the given name or returns `nil` if it doesn't exist.
@@ -11092,7 +11211,7 @@ interface LuaItemStack {
11092
11211
  *
11093
11212
  */
11094
11213
  get_tag(this: void,
11095
- tag_name: string): void
11214
+ tag_name: string): AnyBasic | null
11096
11215
 
11097
11216
  /**
11098
11217
  * Gets the tile filter at the given index for this deconstruction item.
@@ -11101,33 +11220,35 @@ interface LuaItemStack {
11101
11220
  *
11102
11221
  */
11103
11222
  get_tile_filter(this: void,
11104
- index: number): void
11223
+ index: number): string | null
11105
11224
 
11106
11225
  /**
11107
11226
  * All methods and properties that this object supports.
11108
11227
  */
11109
- help(this: void): void
11228
+ help(this: void): string
11110
11229
 
11111
11230
  /**
11112
11231
  * Import a supported item (blueprint, blueprint-book, deconstruction-planner, upgrade-planner, item-with-tags) from a string.
11113
11232
  * @param data - The string to import
11233
+ * @returns 0 if the import succeeded with no errors. -1 if the import succeeded with errors. 1 if the import failed.
11114
11234
  */
11115
11235
  import_stack(this: void,
11116
- data: string): void
11236
+ data: string): number
11117
11237
 
11118
11238
  /**
11119
11239
  * Is this blueprint item setup? I.e. is it a non-empty blueprint?
11120
11240
  */
11121
- is_blueprint_setup(this: void): void
11241
+ is_blueprint_setup(this: void): boolean
11122
11242
 
11123
11243
  /**
11124
11244
  * Removes a tag with the given name.
11125
11245
  * @remarks
11126
11246
  * Applies to subclasses: ItemWithTags
11127
11247
  *
11248
+ * @returns If the tag existed and was removed.
11128
11249
  */
11129
11250
  remove_tag(this: void,
11130
- tag: string): void
11251
+ tag: string): boolean
11131
11252
 
11132
11253
  /**
11133
11254
  * Set new entities to be a part of this blueprint.
@@ -11180,10 +11301,11 @@ interface LuaItemStack {
11180
11301
  * Applies to subclasses: DeconstructionItem
11181
11302
  *
11182
11303
  * @param filter - Writing `nil` removes the filter.
11304
+ * @returns Whether the new filter was successfully set (ie. was valid).
11183
11305
  */
11184
11306
  set_entity_filter(this: void,
11185
11307
  index: number,
11186
- filter: string | LuaEntityPrototype | LuaEntity | null): void
11308
+ filter: string | LuaEntityPrototype | LuaEntity | null): boolean
11187
11309
 
11188
11310
  /**
11189
11311
  * Sets the module filter at the given index for this upgrade item.
@@ -11202,9 +11324,10 @@ interface LuaItemStack {
11202
11324
  /**
11203
11325
  * Set this item stack to another item stack.
11204
11326
  * @param stack - Item stack to set it to. Omitting this parameter or passing `nil` will clear this item stack, as if [LuaItemStack::clear](runtime:LuaItemStack::clear) was called.
11327
+ * @returns Whether the stack was set successfully. Returns `false` if this stack was not [valid for write](runtime:LuaItemStack::can_set_stack).
11205
11328
  */
11206
11329
  set_stack(this: void,
11207
- stack?: ItemStackIdentification): void
11330
+ stack?: ItemStackIdentification): boolean
11208
11331
 
11209
11332
  /**
11210
11333
  * Sets the tag with the given name and value.
@@ -11222,31 +11345,35 @@ interface LuaItemStack {
11222
11345
  * Applies to subclasses: DeconstructionItem
11223
11346
  *
11224
11347
  * @param filter - Setting to nil erases the filter.
11348
+ * @returns Whether the new filter was successfully set (ie. was valid).
11225
11349
  */
11226
11350
  set_tile_filter(this: void,
11227
11351
  index: number,
11228
- filter: string | LuaTilePrototype | LuaTile): void
11352
+ filter: string | LuaTilePrototype | LuaTile): boolean
11229
11353
 
11230
11354
  /**
11231
11355
  * Swaps this item stack with the given item stack if allowed.
11356
+ * @returns Whether the 2 stacks were swapped successfully.
11232
11357
  */
11233
11358
  swap_stack(this: void,
11234
- stack: LuaItemStack): void
11359
+ stack: LuaItemStack): boolean
11235
11360
 
11236
11361
  /**
11237
11362
  * Transfers the given item stack into this item stack.
11363
+ * @returns `true` if the full stack was transferred.
11238
11364
  */
11239
11365
  transfer_stack(this: void,
11240
- stack: ItemStackIdentification): void
11366
+ stack: ItemStackIdentification): boolean
11241
11367
 
11242
11368
  /**
11243
11369
  * Use the capsule item with the entity as the source, targeting the given position.
11244
11370
  * @param entity - The entity to use the capsule item with.
11245
11371
  * @param target_position - The position to use the capsule item with.
11372
+ * @returns Array of the entities that were created by the capsule action.
11246
11373
  */
11247
11374
  use_capsule(this: void,
11248
11375
  entity: LuaEntity,
11249
- target_position: MapPosition): void
11376
+ target_position: MapPosition): LuaEntity[]
11250
11377
 
11251
11378
  /**
11252
11379
  * The active blueprint index for this blueprint book. `nil` if this blueprint book is empty.
@@ -11596,7 +11723,7 @@ interface LuaLampControlBehavior extends LuaGenericOnOffControlBehavior {
11596
11723
  /**
11597
11724
  * All methods and properties that this object supports.
11598
11725
  */
11599
- help(this: void): void
11726
+ help(this: void): string
11600
11727
 
11601
11728
  /**
11602
11729
  * The color the lamp is showing, if any.
@@ -11634,7 +11761,7 @@ interface LuaLazyLoadedValue<T> {
11634
11761
  /**
11635
11762
  * All methods and properties that this object supports.
11636
11763
  */
11637
- help(this: void): void
11764
+ help(this: void): string
11638
11765
 
11639
11766
  /**
11640
11767
  * The class name of this object. Available even when `valid` is false. For LuaStruct objects it may also be suffixed with a dotted path to a member of the struct.
@@ -11655,25 +11782,25 @@ interface LuaLogisticCell {
11655
11782
  /**
11656
11783
  * All methods and properties that this object supports.
11657
11784
  */
11658
- help(this: void): void
11785
+ help(this: void): string
11659
11786
 
11660
11787
  /**
11661
11788
  * Is a given position within the construction range of this cell?
11662
11789
  */
11663
11790
  is_in_construction_range(this: void,
11664
- position: MapPosition): void
11791
+ position: MapPosition): boolean
11665
11792
 
11666
11793
  /**
11667
11794
  * Is a given position within the logistic range of this cell?
11668
11795
  */
11669
11796
  is_in_logistic_range(this: void,
11670
- position: MapPosition): void
11797
+ position: MapPosition): boolean
11671
11798
 
11672
11799
  /**
11673
11800
  * Are two cells neighbours?
11674
11801
  */
11675
11802
  is_neighbour_with(this: void,
11676
- other: LuaLogisticCell): void
11803
+ other: LuaLogisticCell): boolean
11677
11804
 
11678
11805
  /**
11679
11806
  * Radius at which the robots hover when waiting to be charged.
@@ -11769,7 +11896,7 @@ interface LuaLogisticContainerControlBehavior extends LuaControlBehavior {
11769
11896
  /**
11770
11897
  * All methods and properties that this object supports.
11771
11898
  */
11772
- help(this: void): void
11899
+ help(this: void): string
11773
11900
 
11774
11901
  /**
11775
11902
  * The circuit mode of operations for the logistic container. Can only be set on containers whose {@link logistic_mode | runtime:LuaEntityPrototype::logistic_mode} is set to "requester".
@@ -11797,22 +11924,25 @@ interface LuaLogisticNetwork {
11797
11924
  * @param count - Count to check. Defaults to 1.
11798
11925
  * @param include_buffers - Should buffers be considered? Defaults to false.
11799
11926
  * @param item - Item name to check.
11927
+ * @returns Whether the network can satisfy the request.
11800
11928
  */
11801
11929
  can_satisfy_request(this: void,
11802
11930
  item: string,
11803
11931
  count?: number,
11804
- include_buffers?: boolean): void
11932
+ include_buffers?: boolean): boolean
11805
11933
 
11806
11934
  /**
11807
11935
  * Find logistic cell closest to a given position.
11936
+ * @returns `nil` if no cell was found.
11808
11937
  */
11809
11938
  find_cell_closest_to(this: void,
11810
- position: MapPosition): void
11939
+ position: MapPosition): LuaLogisticCell | null
11811
11940
 
11812
11941
  /**
11813
11942
  * Get item counts for the entire network, similar to how {@link LuaInventory::get_contents | runtime:LuaInventory::get_contents} does.
11943
+ * @returns A mapping of item prototype names to the number available in the network.
11814
11944
  */
11815
- get_contents(this: void): void
11945
+ get_contents(this: void): {[key: string]: number}
11816
11946
 
11817
11947
  /**
11818
11948
  * Count given or all items in the network or given members.
@@ -11821,55 +11951,60 @@ interface LuaLogisticNetwork {
11821
11951
  */
11822
11952
  get_item_count(this: void,
11823
11953
  item?: string,
11824
- member?: string): void
11954
+ member?: string): number
11825
11955
 
11826
11956
  /**
11827
11957
  * Get the amount of items of the given type indexed by the storage member.
11828
11958
  * @param item - Item name to check.
11959
+ * @returns A mapping of member types ("storage", "passive-provider", "buffer", "active-provider") to the number available in the members.
11829
11960
  */
11830
11961
  get_supply_counts(this: void,
11831
- item: string): void
11962
+ item: string): {[key: string]: number}
11832
11963
 
11833
11964
  /**
11834
11965
  * Gets the logistic points with of the given type indexed by the storage member.
11835
11966
  * @param item - Item name to check.
11967
+ * @returns A mapping of member types ("storage", "passive-provider", "buffer", "active-provider") to an array of LuaLogisticPoint.
11836
11968
  */
11837
11969
  get_supply_points(this: void,
11838
- item: string): void
11970
+ item: string): {[key: string]: LuaLogisticPoint[]}
11839
11971
 
11840
11972
  /**
11841
11973
  * All methods and properties that this object supports.
11842
11974
  */
11843
- help(this: void): void
11975
+ help(this: void): string
11844
11976
 
11845
11977
  /**
11846
11978
  * Insert items into the logistic network. This will actually insert the items into some logistic chests.
11847
11979
  * @param item - What to insert.
11848
11980
  * @param members - Which logistic members to insert the items to. Must be `"storage"`, `"storage-empty"` (storage chests that are completely empty), `"storage-empty-slot"` (storage chests that have an empty slot), or `"requester"`. If not specified, inserts items into the logistic network in the usual order.
11981
+ * @returns Number of items actually inserted.
11849
11982
  */
11850
11983
  insert(this: void,
11851
11984
  item: ItemStackIdentification,
11852
- members?: string): void
11985
+ members?: string): number
11853
11986
 
11854
11987
  /**
11855
11988
  * Remove items from the logistic network. This will actually remove the items from some logistic chests.
11856
11989
  * @param item - What to remove.
11857
11990
  * @param members - Which logistic members to remove from. Must be `"storage"`, `"passive-provider"`, `"buffer"`, or `"active-provider"`. If not specified, removes from the network in the usual order.
11991
+ * @returns Number of items removed.
11858
11992
  */
11859
11993
  remove_item(this: void,
11860
11994
  item: ItemStackIdentification,
11861
- members?: string): void
11995
+ members?: string): number
11862
11996
 
11863
11997
  /**
11864
11998
  * Find a logistic point to drop the specific item stack.
11865
11999
  * @param table.members - When given, it will find from only the specific type of member. Must be `"storage"`, `"storage-empty"`, `"storage-empty-slot"` or `"requester"`. If not specified, selects with normal priorities.
11866
12000
  * @param table.stack - Name of the item to select.
12001
+ * @returns `nil` if no point was found.
11867
12002
  */
11868
12003
  select_drop_point(this: void,
11869
12004
  table: {
11870
12005
  stack: ItemStackIdentification,
11871
12006
  members?: string
11872
- }): void
12007
+ }): LuaLogisticPoint | null
11873
12008
 
11874
12009
  /**
11875
12010
  * Find the 'best' logistic point with this item ID and from the given position or from given chest type.
@@ -11877,6 +12012,7 @@ interface LuaLogisticNetwork {
11877
12012
  * @param table.members - When given, it will find from only the specific type of member. Must be `"storage"`, `"passive-provider"`, `"buffer"` or `"active-provider"`. If not specified, selects with normal priorities. Not considered if position is specified.
11878
12013
  * @param table.name - Name of the item to select.
11879
12014
  * @param table.position - When given, it will find the storage 'best' storage point from this position.
12015
+ * @returns `nil` if no point was found.
11880
12016
  */
11881
12017
  select_pickup_point(this: void,
11882
12018
  table: {
@@ -11884,7 +12020,7 @@ interface LuaLogisticNetwork {
11884
12020
  position?: MapPosition,
11885
12021
  include_buffers?: boolean,
11886
12022
  members?: string
11887
- }): void
12023
+ }): LuaLogisticPoint | null
11888
12024
 
11889
12025
  /**
11890
12026
  * All active provider points in this network.
@@ -12010,7 +12146,7 @@ interface LuaLogisticPoint {
12010
12146
  /**
12011
12147
  * All methods and properties that this object supports.
12012
12148
  */
12013
- help(this: void): void
12149
+ help(this: void): string
12014
12150
 
12015
12151
  /**
12016
12152
  * If this logistic point is using the exact mode. In exact mode robots never over-deliver requests.
@@ -12079,7 +12215,7 @@ interface LuaMiningDrillControlBehavior extends LuaGenericOnOffControlBehavior {
12079
12215
  /**
12080
12216
  * All methods and properties that this object supports.
12081
12217
  */
12082
- help(this: void): void
12218
+ help(this: void): string
12083
12219
 
12084
12220
  /**
12085
12221
  * `true` if this drill is enabled or disabled using the logistics or circuit condition.
@@ -12120,7 +12256,7 @@ interface LuaModSettingPrototype {
12120
12256
  /**
12121
12257
  * All methods and properties that this object supports.
12122
12258
  */
12123
- help(this: void): void
12259
+ help(this: void): string
12124
12260
 
12125
12261
  /**
12126
12262
  * Whether this string setting allows blank values. `nil` if not a string setting.
@@ -12202,7 +12338,7 @@ interface LuaModuleCategoryPrototype {
12202
12338
  /**
12203
12339
  * All methods and properties that this object supports.
12204
12340
  */
12205
- help(this: void): void
12341
+ help(this: void): string
12206
12342
 
12207
12343
  readonly localised_description: LocalisedString
12208
12344
 
@@ -12237,7 +12373,7 @@ interface LuaNamedNoiseExpression {
12237
12373
  /**
12238
12374
  * All methods and properties that this object supports.
12239
12375
  */
12240
- help(this: void): void
12376
+ help(this: void): string
12241
12377
 
12242
12378
  /**
12243
12379
  * The expression itself.
@@ -12282,7 +12418,7 @@ interface LuaNoiseLayerPrototype {
12282
12418
  /**
12283
12419
  * All methods and properties that this object supports.
12284
12420
  */
12285
- help(this: void): void
12421
+ help(this: void): string
12286
12422
 
12287
12423
  readonly localised_description: LocalisedString
12288
12424
 
@@ -12317,7 +12453,7 @@ interface LuaParticlePrototype {
12317
12453
  /**
12318
12454
  * All methods and properties that this object supports.
12319
12455
  */
12320
- help(this: void): void
12456
+ help(this: void): string
12321
12457
 
12322
12458
  readonly ended_in_water_trigger_effect: TriggerEffectItem
12323
12459
 
@@ -12369,41 +12505,45 @@ interface LuaParticlePrototype {
12369
12505
  interface LuaPermissionGroup {
12370
12506
  /**
12371
12507
  * Adds the given player to this group.
12508
+ * @returns Whether the player was added.
12372
12509
  */
12373
12510
  add_player(this: void,
12374
- player: PlayerIdentification): void
12511
+ player: PlayerIdentification): boolean
12375
12512
 
12376
12513
  /**
12377
12514
  * Whether this group allows the given action.
12378
12515
  * @param action - The action in question.
12379
12516
  */
12380
12517
  allows_action(this: void,
12381
- action: defines.input_action): void
12518
+ action: defines.input_action): boolean
12382
12519
 
12383
12520
  /**
12384
12521
  * Destroys this group.
12522
+ * @returns Whether the group was successfully destroyed.
12385
12523
  */
12386
- destroy(this: void): void
12524
+ destroy(this: void): boolean
12387
12525
 
12388
12526
  /**
12389
12527
  * All methods and properties that this object supports.
12390
12528
  */
12391
- help(this: void): void
12529
+ help(this: void): string
12392
12530
 
12393
12531
  /**
12394
12532
  * Removes the given player from this group.
12533
+ * @returns Whether the player was removed.
12395
12534
  */
12396
12535
  remove_player(this: void,
12397
- player: PlayerIdentification): void
12536
+ player: PlayerIdentification): boolean
12398
12537
 
12399
12538
  /**
12400
12539
  * Sets whether this group allows the performance the given action.
12401
12540
  * @param action - The action in question.
12402
12541
  * @param allow_action - Whether to allow the specified action.
12542
+ * @returns Whether the value was successfully applied.
12403
12543
  */
12404
12544
  set_allows_action(this: void,
12405
12545
  action: defines.input_action,
12406
- allow_action: boolean): void
12546
+ allow_action: boolean): boolean
12407
12547
 
12408
12548
  /**
12409
12549
  * The group ID
@@ -12441,20 +12581,22 @@ interface LuaPermissionGroup {
12441
12581
  interface LuaPermissionGroups {
12442
12582
  /**
12443
12583
  * Creates a new permission group.
12584
+ * @returns `nil` if the calling player doesn't have permission to make groups.
12444
12585
  */
12445
12586
  create_group(this: void,
12446
- name?: string): void
12587
+ name?: string): LuaPermissionGroup | null
12447
12588
 
12448
12589
  /**
12449
12590
  * Gets the permission group with the given name or group ID.
12591
+ * @returns `nil` if there is no matching group.
12450
12592
  */
12451
12593
  get_group(this: void,
12452
- group: string | number): void
12594
+ group: string | number): LuaPermissionGroup | null
12453
12595
 
12454
12596
  /**
12455
12597
  * All methods and properties that this object supports.
12456
12598
  */
12457
- help(this: void): void
12599
+ help(this: void): string
12458
12600
 
12459
12601
  /**
12460
12602
  * All of the permission groups.
@@ -12557,7 +12699,7 @@ interface LuaPlayer extends LuaControl {
12557
12699
  alt?: boolean,
12558
12700
  terrain_building_size?: number,
12559
12701
  skip_fog_of_war?: boolean
12560
- }): void
12702
+ }): boolean
12561
12703
 
12562
12704
  /**
12563
12705
  * Checks if this player can build the given entity at the given location on the surface the player is on.
@@ -12570,7 +12712,7 @@ interface LuaPlayer extends LuaControl {
12570
12712
  name: string,
12571
12713
  position: MapPosition,
12572
12714
  direction?: defines.direction
12573
- }): void
12715
+ }): boolean
12574
12716
 
12575
12717
  /**
12576
12718
  * Clear the chat console.
@@ -12579,8 +12721,9 @@ interface LuaPlayer extends LuaControl {
12579
12721
 
12580
12722
  /**
12581
12723
  * Invokes the "clear cursor" action on the player as if the user pressed it.
12724
+ * @returns Whether the cursor is now empty.
12582
12725
  */
12583
- clear_cursor(this: void): void
12726
+ clear_cursor(this: void): boolean
12584
12727
 
12585
12728
  /**
12586
12729
  * Clears all recipe notifications for this player.
@@ -12620,9 +12763,10 @@ interface LuaPlayer extends LuaControl {
12620
12763
  * The player must not have a character already connected and must be online (see {@link LuaPlayer::connected | runtime:LuaPlayer::connected}).
12621
12764
  *
12622
12765
  * @param character - The character to create else the default is used.
12766
+ * @returns Whether the character was created.
12623
12767
  */
12624
12768
  create_character(this: void,
12625
- character?: string): void
12769
+ character?: string): boolean
12626
12770
 
12627
12771
  /**
12628
12772
  * Spawn flying text that is only visible to this player. Either `position` or `create_at_cursor` are required. When `create_at_cursor` is `true`, all parameters other than `text` are ignored.
@@ -12649,9 +12793,10 @@ interface LuaPlayer extends LuaControl {
12649
12793
 
12650
12794
  /**
12651
12795
  * Disables alerts for the given alert category.
12796
+ * @returns Whether the alert type was disabled (false if it was already disabled).
12652
12797
  */
12653
12798
  disable_alert(this: void,
12654
- alert_type: defines.alert_type): void
12799
+ alert_type: defines.alert_type): boolean
12655
12800
 
12656
12801
  /**
12657
12802
  * Disable recipe groups.
@@ -12676,17 +12821,19 @@ interface LuaPlayer extends LuaControl {
12676
12821
  /**
12677
12822
  * Start/end wire dragging at the specified location, wire type is based on the cursor contents
12678
12823
  * @param table.position - Position at which cursor was clicked. Used only to decide which side of arithmetic combinator, decider combinator or power switch is to be connected. Entity itself to be connected is based on the player's selected entity.
12824
+ * @returns `true` if the action did something
12679
12825
  */
12680
12826
  drag_wire(this: void,
12681
12827
  table: {
12682
12828
  position: MapPosition
12683
- }): void
12829
+ }): boolean
12684
12830
 
12685
12831
  /**
12686
12832
  * Enables alerts for the given alert category.
12833
+ * @returns Whether the alert type was enabled (false if it was already enabled).
12687
12834
  */
12688
12835
  enable_alert(this: void,
12689
- alert_type: defines.alert_type): void
12836
+ alert_type: defines.alert_type): boolean
12690
12837
 
12691
12838
  /**
12692
12839
  * Enable recipe groups.
@@ -12708,10 +12855,11 @@ interface LuaPlayer extends LuaControl {
12708
12855
  * @param index - The screen page. Index 1 is the top row in the gui. Index can go beyond the visible number of bars on the screen to account for the interface config setting change.
12709
12856
  */
12710
12857
  get_active_quick_bar_page(this: void,
12711
- index: number): void
12858
+ index: number): number | null
12712
12859
 
12713
12860
  /**
12714
12861
  * Get all alerts matching the given filters, or all alerts if no filters are given.
12862
+ * @returns A mapping of surface index to an array of arrays of [alerts](runtime:Alert) indexed by the [alert type](runtime:defines.alert_type).
12715
12863
  */
12716
12864
  get_alerts(this: void,
12717
12865
  table: {
@@ -12720,7 +12868,7 @@ interface LuaPlayer extends LuaControl {
12720
12868
  position?: MapPosition,
12721
12869
  type?: defines.alert_type,
12722
12870
  surface?: SurfaceIdentification
12723
- }): void
12871
+ }): {[key: number]: {[key: string]: Alert[]}}
12724
12872
 
12725
12873
  /**
12726
12874
  * The characters associated with this player.
@@ -12729,57 +12877,57 @@ interface LuaPlayer extends LuaControl {
12729
12877
  * Characters associated with this player will be logged off when this player disconnects but are not controlled by any player.
12730
12878
  *
12731
12879
  */
12732
- get_associated_characters(this: void): void
12880
+ get_associated_characters(this: void): LuaEntity[]
12733
12881
 
12734
12882
  /**
12735
12883
  * Get the current goal description, as a localised string.
12736
12884
  */
12737
- get_goal_description(this: void): void
12885
+ get_goal_description(this: void): LocalisedString
12738
12886
 
12739
12887
  /**
12740
12888
  * Gets the filter for this map editor infinity filters at the given index or `nil` if the filter index doesn't exist or is empty.
12741
12889
  * @param index - The index to get.
12742
12890
  */
12743
12891
  get_infinity_inventory_filter(this: void,
12744
- index: number): void
12892
+ index: number): InfinityInventoryFilter | null
12745
12893
 
12746
12894
  /**
12747
12895
  * Gets the quick bar filter for the given slot or `nil`.
12748
12896
  * @param index - The slot index. 1 for the first slot of page one, 2 for slot two of page one, 11 for the first slot of page 2, etc.
12749
12897
  */
12750
12898
  get_quick_bar_slot(this: void,
12751
- index: number): void
12899
+ index: number): LuaItemPrototype | null
12752
12900
 
12753
12901
  /**
12754
12902
  * All methods and properties that this object supports.
12755
12903
  */
12756
- help(this: void): void
12904
+ help(this: void): string
12757
12905
 
12758
12906
  /**
12759
12907
  * If the given alert type is currently enabled.
12760
12908
  */
12761
12909
  is_alert_enabled(this: void,
12762
- alert_type: defines.alert_type): void
12910
+ alert_type: defines.alert_type): boolean
12763
12911
 
12764
12912
  /**
12765
12913
  * If the given alert type is currently muted.
12766
12914
  */
12767
12915
  is_alert_muted(this: void,
12768
- alert_type: defines.alert_type): void
12916
+ alert_type: defines.alert_type): boolean
12769
12917
 
12770
12918
  /**
12771
12919
  * Is a custom Lua shortcut currently available?
12772
12920
  * @param prototype_name - Prototype name of the custom shortcut.
12773
12921
  */
12774
12922
  is_shortcut_available(this: void,
12775
- prototype_name: string): void
12923
+ prototype_name: string): boolean
12776
12924
 
12777
12925
  /**
12778
12926
  * Is a custom Lua shortcut currently toggled?
12779
12927
  * @param prototype_name - Prototype name of the custom shortcut.
12780
12928
  */
12781
12929
  is_shortcut_toggled(this: void,
12782
- prototype_name: string): void
12930
+ prototype_name: string): boolean
12783
12931
 
12784
12932
  /**
12785
12933
  * Jump to the specified cutscene waypoint. Only works when the player is viewing a cutscene.
@@ -12799,9 +12947,10 @@ interface LuaPlayer extends LuaControl {
12799
12947
 
12800
12948
  /**
12801
12949
  * Mutes alerts for the given alert category.
12950
+ * @returns Whether the alert type was muted (false if it was already muted).
12802
12951
  */
12803
12952
  mute_alert(this: void,
12804
- alert_type: defines.alert_type): void
12953
+ alert_type: defines.alert_type): boolean
12805
12954
 
12806
12955
  /**
12807
12956
  * Queues a request to open the map at the specified position. If the map is already opened, the request will simply set the position, scale, and entity to follow. Render mode change requests are processed before rendering of the next frame.
@@ -12814,9 +12963,10 @@ interface LuaPlayer extends LuaControl {
12814
12963
 
12815
12964
  /**
12816
12965
  * Invokes the "smart pipette" action on the player as if the user pressed it.
12966
+ * @returns Whether the smart pipette found something to place.
12817
12967
  */
12818
12968
  pipette_entity(this: void,
12819
- entity: string | LuaEntity | LuaEntityPrototype): void
12969
+ entity: string | LuaEntity | LuaEntityPrototype): boolean
12820
12970
 
12821
12971
  /**
12822
12972
  * Play a sound for this player.
@@ -12879,18 +13029,20 @@ interface LuaPlayer extends LuaControl {
12879
13029
  * @remarks
12880
13030
  * Does nothing if this player is not connected (see {@link LuaPlayer::connected | runtime:LuaPlayer::connected}).
12881
13031
  *
13032
+ * @returns The unique ID for the requested translation.
12882
13033
  */
12883
13034
  request_translation(this: void,
12884
- localised_string: LocalisedString): void
13035
+ localised_string: LocalisedString): number | null
12885
13036
 
12886
13037
  /**
12887
13038
  * Requests translation for the given set of localised strings. If the request is successful, a {@link on_string_translated | runtime:on_string_translated} event will be fired for each string with the results.
12888
13039
  * @remarks
12889
13040
  * Does nothing if this player is not connected (see {@link LuaPlayer::connected | runtime:LuaPlayer::connected}).
12890
13041
  *
13042
+ * @returns The unique IDs for the requested translations.
12891
13043
  */
12892
13044
  request_translations(this: void,
12893
- localised_strings: LocalisedString[]): void
13045
+ localised_strings: LocalisedString[]): number[] | null
12894
13046
 
12895
13047
  /**
12896
13048
  * Sets which quick bar page is being used for the given screen page.
@@ -13001,9 +13153,10 @@ interface LuaPlayer extends LuaControl {
13001
13153
 
13002
13154
  /**
13003
13155
  * Unmutes alerts for the given alert category.
13156
+ * @returns Whether the alert type was unmuted (false if it was wasn't muted).
13004
13157
  */
13005
13158
  unmute_alert(this: void,
13006
- alert_type: defines.alert_type): void
13159
+ alert_type: defines.alert_type): boolean
13007
13160
 
13008
13161
  /**
13009
13162
  * Uses the current item in the cursor if it's a capsule or does nothing if not.
@@ -13267,7 +13420,7 @@ interface LuaProfiler {
13267
13420
  /**
13268
13421
  * All methods and properties that this object supports.
13269
13422
  */
13270
- help(this: void): void
13423
+ help(this: void): string
13271
13424
 
13272
13425
  /**
13273
13426
  * Resets the clock, also restarting it.
@@ -13303,7 +13456,7 @@ interface LuaProgrammableSpeakerControlBehavior extends LuaControlBehavior {
13303
13456
  /**
13304
13457
  * All methods and properties that this object supports.
13305
13458
  */
13306
- help(this: void): void
13459
+ help(this: void): string
13307
13460
 
13308
13461
  circuit_condition: CircuitConditionDefinition
13309
13462
 
@@ -13345,7 +13498,7 @@ interface LuaRailChainSignalControlBehavior extends LuaControlBehavior {
13345
13498
  /**
13346
13499
  * All methods and properties that this object supports.
13347
13500
  */
13348
- help(this: void): void
13501
+ help(this: void): string
13349
13502
 
13350
13503
  blue_signal: SignalID
13351
13504
 
@@ -13374,7 +13527,7 @@ interface LuaRailPath {
13374
13527
  /**
13375
13528
  * All methods and properties that this object supports.
13376
13529
  */
13377
- help(this: void): void
13530
+ help(this: void): string
13378
13531
 
13379
13532
  /**
13380
13533
  * The current rail index.
@@ -13425,7 +13578,7 @@ interface LuaRailSignalControlBehavior extends LuaControlBehavior {
13425
13578
  /**
13426
13579
  * All methods and properties that this object supports.
13427
13580
  */
13428
- help(this: void): void
13581
+ help(this: void): string
13429
13582
 
13430
13583
  /**
13431
13584
  * The circuit condition when controlling the signal through the circuit network.
@@ -13474,7 +13627,7 @@ interface LuaRandomGenerator {
13474
13627
  /**
13475
13628
  * All methods and properties that this object supports.
13476
13629
  */
13477
- help(this: void): void
13630
+ help(this: void): string
13478
13631
 
13479
13632
  /**
13480
13633
  * Re-seeds the random generator with the given value.
@@ -13502,7 +13655,7 @@ interface LuaRandomGenerator {
13502
13655
  */
13503
13656
  (this: void,
13504
13657
  lower?: number,
13505
- upper?: number): void
13658
+ upper?: number): number
13506
13659
 
13507
13660
  }
13508
13661
 
@@ -13513,7 +13666,7 @@ interface LuaRecipe {
13513
13666
  /**
13514
13667
  * All methods and properties that this object supports.
13515
13668
  */
13516
- help(this: void): void
13669
+ help(this: void): string
13517
13670
 
13518
13671
  /**
13519
13672
  * Reload the recipe from the prototype.
@@ -13623,7 +13776,7 @@ interface LuaRecipeCategoryPrototype {
13623
13776
  /**
13624
13777
  * All methods and properties that this object supports.
13625
13778
  */
13626
- help(this: void): void
13779
+ help(this: void): string
13627
13780
 
13628
13781
  readonly localised_description: LocalisedString
13629
13782
 
@@ -13658,7 +13811,7 @@ interface LuaRecipePrototype {
13658
13811
  /**
13659
13812
  * All methods and properties that this object supports.
13660
13813
  */
13661
- help(this: void): void
13814
+ help(this: void): string
13662
13815
 
13663
13816
  /**
13664
13817
  * If this recipe is enabled for the purpose of intermediate hand-crafting.
@@ -13844,14 +13997,15 @@ interface LuaRemote {
13844
13997
  call(this: void,
13845
13998
  interface: string,
13846
13999
  fn: string,
13847
- ...args: any[]): void
14000
+ ...args: any[]): any | null
13848
14001
 
13849
14002
  /**
13850
14003
  * Removes an interface with the given name.
13851
14004
  * @param name - Name of the interface.
14005
+ * @returns Whether the interface was removed. `False` if the interface didn't exist.
13852
14006
  */
13853
14007
  remove_interface(this: void,
13854
- name: string): void
14008
+ name: string): boolean
13855
14009
 
13856
14010
  /**
13857
14011
  * List of all registered interfaces. For each interface name, `remote.interfaces[name]` is a dictionary mapping the interface's registered functions to `true`.
@@ -13918,6 +14072,7 @@ interface LuaRendering {
13918
14072
  * @param table.visible - If this is rendered to anyone at all. Defaults to true.
13919
14073
  * @param table.x_scale - Horizontal scale of the animation. Default is 1.
13920
14074
  * @param table.y_scale - Vertical scale of the animation. Default is 1.
14075
+ * @returns Id of the render object
13921
14076
  */
13922
14077
  draw_animation(this: void,
13923
14078
  table: {
@@ -13941,7 +14096,7 @@ interface LuaRendering {
13941
14096
  players?: PlayerIdentification[],
13942
14097
  visible?: boolean,
13943
14098
  only_in_alt_mode?: boolean
13944
- }): void
14099
+ }): number
13945
14100
 
13946
14101
  /**
13947
14102
  * Create an arc.
@@ -13956,6 +14111,7 @@ interface LuaRendering {
13956
14111
  * @param table.target_offset - Only used if `target` is a LuaEntity.
13957
14112
  * @param table.time_to_live - In ticks. Defaults to living forever.
13958
14113
  * @param table.visible - If this is rendered to anyone at all. Defaults to true.
14114
+ * @returns Id of the render object
13959
14115
  */
13960
14116
  draw_arc(this: void,
13961
14117
  table: {
@@ -13973,7 +14129,7 @@ interface LuaRendering {
13973
14129
  visible?: boolean,
13974
14130
  draw_on_ground?: boolean,
13975
14131
  only_in_alt_mode?: boolean
13976
- }): void
14132
+ }): number
13977
14133
 
13978
14134
  /**
13979
14135
  * Create a circle.
@@ -13987,6 +14143,7 @@ interface LuaRendering {
13987
14143
  * @param table.time_to_live - In ticks. Defaults to living forever.
13988
14144
  * @param table.visible - If this is rendered to anyone at all. Defaults to true.
13989
14145
  * @param table.width - Width of the outline, used only if filled = false. Value is in pixels (32 per tile).
14146
+ * @returns Id of the render object
13990
14147
  */
13991
14148
  draw_circle(this: void,
13992
14149
  table: {
@@ -14003,7 +14160,7 @@ interface LuaRendering {
14003
14160
  visible?: boolean,
14004
14161
  draw_on_ground?: boolean,
14005
14162
  only_in_alt_mode?: boolean
14006
- }): void
14163
+ }): number
14007
14164
 
14008
14165
  /**
14009
14166
  * Create a light.
@@ -14023,6 +14180,7 @@ interface LuaRendering {
14023
14180
  * @param table.target_offset - Only used if `target` is a LuaEntity.
14024
14181
  * @param table.time_to_live - In ticks. Defaults to living forever.
14025
14182
  * @param table.visible - If this is rendered to anyone at all. Defaults to true.
14183
+ * @returns Id of the render object
14026
14184
  */
14027
14185
  draw_light(this: void,
14028
14186
  table: {
@@ -14041,7 +14199,7 @@ interface LuaRendering {
14041
14199
  players?: PlayerIdentification[],
14042
14200
  visible?: boolean,
14043
14201
  only_in_alt_mode?: boolean
14044
- }): void
14202
+ }): number
14045
14203
 
14046
14204
  /**
14047
14205
  * Create a line.
@@ -14069,6 +14227,7 @@ interface LuaRendering {
14069
14227
  * rendering.draw_line{surface = game.player.surface, from = {0, 0}, to = {0, 5}, color = {r = 1}, width = 3, gap_length = 1, dash_length = 1}
14070
14228
  * ```
14071
14229
  *
14230
+ * @returns Id of the render object
14072
14231
  */
14073
14232
  draw_line(this: void,
14074
14233
  table: {
@@ -14088,7 +14247,7 @@ interface LuaRendering {
14088
14247
  visible?: boolean,
14089
14248
  draw_on_ground?: boolean,
14090
14249
  only_in_alt_mode?: boolean
14091
- }): void
14250
+ }): number
14092
14251
 
14093
14252
  /**
14094
14253
  * Create a triangle mesh defined by a triangle strip.
@@ -14104,6 +14263,7 @@ interface LuaRendering {
14104
14263
  * @param table.time_to_live - In ticks. Defaults to living forever.
14105
14264
  * @param table.use_target_orientation - Only used if `orientation_target` is a LuaEntity.
14106
14265
  * @param table.visible - If this is rendered to anyone at all. Defaults to true.
14266
+ * @returns Id of the render object
14107
14267
  */
14108
14268
  draw_polygon(this: void,
14109
14269
  table: {
@@ -14122,7 +14282,7 @@ interface LuaRendering {
14122
14282
  visible?: boolean,
14123
14283
  draw_on_ground?: boolean,
14124
14284
  only_in_alt_mode?: boolean
14125
- }): void
14285
+ }): number
14126
14286
 
14127
14287
  /**
14128
14288
  * Create a rectangle.
@@ -14136,6 +14296,7 @@ interface LuaRendering {
14136
14296
  * @param table.time_to_live - In ticks. Defaults to living forever.
14137
14297
  * @param table.visible - If this is rendered to anyone at all. Defaults to true.
14138
14298
  * @param table.width - Width of the outline, used only if filled = false. Value is in pixels (32 per tile).
14299
+ * @returns Id of the render object
14139
14300
  */
14140
14301
  draw_rectangle(this: void,
14141
14302
  table: {
@@ -14153,7 +14314,7 @@ interface LuaRendering {
14153
14314
  visible?: boolean,
14154
14315
  draw_on_ground?: boolean,
14155
14316
  only_in_alt_mode?: boolean
14156
- }): void
14317
+ }): number
14157
14318
 
14158
14319
  /**
14159
14320
  * Create a sprite.
@@ -14184,6 +14345,7 @@ interface LuaRendering {
14184
14345
  * rendering.draw_sprite{sprite = "item.iron-plate", target = game.player.character, target_offset = {0, -2}, surface = game.player.surface}
14185
14346
  * ```
14186
14347
  *
14348
+ * @returns Id of the render object
14187
14349
  */
14188
14350
  draw_sprite(this: void,
14189
14351
  table: {
@@ -14205,7 +14367,7 @@ interface LuaRendering {
14205
14367
  players?: PlayerIdentification[],
14206
14368
  visible?: boolean,
14207
14369
  only_in_alt_mode?: boolean
14208
- }): void
14370
+ }): number
14209
14371
 
14210
14372
  /**
14211
14373
  * Create a text.
@@ -14226,6 +14388,7 @@ interface LuaRendering {
14226
14388
  * @param table.use_rich_text - If rich text rendering is enabled. Defaults to false.
14227
14389
  * @param table.vertical_alignment - Defaults to "top". Other options are "middle", "baseline" and "bottom".
14228
14390
  * @param table.visible - If this is rendered to anyone at all. Defaults to true.
14391
+ * @returns Id of the render object
14229
14392
  */
14230
14393
  draw_text(this: void,
14231
14394
  table: {
@@ -14247,77 +14410,84 @@ interface LuaRendering {
14247
14410
  scale_with_zoom?: boolean,
14248
14411
  only_in_alt_mode?: boolean,
14249
14412
  use_rich_text?: boolean
14250
- }): void
14413
+ }): number
14251
14414
 
14252
14415
  /**
14253
14416
  * Get the alignment of the text with this id.
14254
14417
  * @remarks
14255
14418
  * Applies to subclasses: Text
14256
14419
  *
14420
+ * @returns `nil` if the object is not a text.
14257
14421
  */
14258
14422
  get_alignment(this: void,
14259
- id: number): void
14423
+ id: number): string | null
14260
14424
 
14261
14425
  /**
14262
14426
  * Gets an array of all valid object ids.
14263
14427
  * @param mod_name - If provided, get only the render objects created by this mod. An empty string (`""`) refers to all objects not belonging to a mod, such as those created using console commands.
14264
14428
  */
14265
14429
  get_all_ids(this: void,
14266
- mod_name?: string): void
14430
+ mod_name?: string): number[]
14267
14431
 
14268
14432
  /**
14269
14433
  * Get the angle of the arc with this id.
14270
14434
  * @remarks
14271
14435
  * Applies to subclasses: Arc
14272
14436
  *
14437
+ * @returns Angle in radian. `nil` if the object is not a arc.
14273
14438
  */
14274
14439
  get_angle(this: void,
14275
- id: number): void
14440
+ id: number): number | null
14276
14441
 
14277
14442
  /**
14278
14443
  * Get the animation prototype name of the animation with this id.
14279
14444
  * @remarks
14280
14445
  * Applies to subclasses: Animation
14281
14446
  *
14447
+ * @returns `nil` if the object is not an animation.
14282
14448
  */
14283
14449
  get_animation(this: void,
14284
- id: number): void
14450
+ id: number): string | null
14285
14451
 
14286
14452
  /**
14287
14453
  * Get the animation offset of the animation with this id.
14288
14454
  * @remarks
14289
14455
  * Applies to subclasses: Animation
14290
14456
  *
14457
+ * @returns Animation offset in frames. `nil` if the object is not an animation.
14291
14458
  */
14292
14459
  get_animation_offset(this: void,
14293
- id: number): void
14460
+ id: number): number | null
14294
14461
 
14295
14462
  /**
14296
14463
  * Get the animation speed of the animation with this id.
14297
14464
  * @remarks
14298
14465
  * Applies to subclasses: Animation
14299
14466
  *
14467
+ * @returns Animation speed in frames per tick. `nil` if the object is not an animation.
14300
14468
  */
14301
14469
  get_animation_speed(this: void,
14302
- id: number): void
14470
+ id: number): number | null
14303
14471
 
14304
14472
  /**
14305
14473
  * Get the color or tint of the object with this id.
14306
14474
  * @remarks
14307
14475
  * Applies to subclasses: Text,Line,Circle,Rectangle,Arc,Polygon,Sprite,Light,Animation
14308
14476
  *
14477
+ * @returns `nil` if the object does not support color.
14309
14478
  */
14310
14479
  get_color(this: void,
14311
- id: number): void
14480
+ id: number): Color | null
14312
14481
 
14313
14482
  /**
14314
14483
  * Get the dash length of the line with this id.
14315
14484
  * @remarks
14316
14485
  * Applies to subclasses: Line
14317
14486
  *
14487
+ * @returns `nil` if the object is not a line.
14318
14488
  */
14319
14489
  get_dash_length(this: void,
14320
- id: number): void
14490
+ id: number): number | null
14321
14491
 
14322
14492
  /**
14323
14493
  * Get whether this is being drawn on the ground, under most entities and sprites.
@@ -14326,100 +14496,109 @@ interface LuaRendering {
14326
14496
  *
14327
14497
  */
14328
14498
  get_draw_on_ground(this: void,
14329
- id: number): void
14499
+ id: number): boolean
14330
14500
 
14331
14501
  /**
14332
14502
  * Get if the circle or rectangle with this id is filled.
14333
14503
  * @remarks
14334
14504
  * Applies to subclasses: Circle,Rectangle
14335
14505
  *
14506
+ * @returns `nil` if the object is not a circle or rectangle.
14336
14507
  */
14337
14508
  get_filled(this: void,
14338
- id: number): void
14509
+ id: number): boolean | null
14339
14510
 
14340
14511
  /**
14341
14512
  * Get the font of the text with this id.
14342
14513
  * @remarks
14343
14514
  * Applies to subclasses: Text
14344
14515
  *
14516
+ * @returns `nil` if the object is not a text.
14345
14517
  */
14346
14518
  get_font(this: void,
14347
- id: number): void
14519
+ id: number): string | null
14348
14520
 
14349
14521
  /**
14350
14522
  * Get the forces that the object with this id is rendered to or `nil` if visible to all forces.
14351
14523
  */
14352
14524
  get_forces(this: void,
14353
- id: number): void
14525
+ id: number): LuaForce[] | null
14354
14526
 
14355
14527
  /**
14356
14528
  * Get from where the line with this id is drawn.
14357
14529
  * @remarks
14358
14530
  * Applies to subclasses: Line
14359
14531
  *
14532
+ * @returns `nil` if this object is not a line.
14360
14533
  */
14361
14534
  get_from(this: void,
14362
- id: number): void
14535
+ id: number): ScriptRenderTarget | null
14363
14536
 
14364
14537
  /**
14365
14538
  * Get the length of the gaps in the line with this id.
14366
14539
  * @remarks
14367
14540
  * Applies to subclasses: Line
14368
14541
  *
14542
+ * @returns `nil` if the object is not a line.
14369
14543
  */
14370
14544
  get_gap_length(this: void,
14371
- id: number): void
14545
+ id: number): number | null
14372
14546
 
14373
14547
  /**
14374
14548
  * Get the intensity of the light with this id.
14375
14549
  * @remarks
14376
14550
  * Applies to subclasses: Light
14377
14551
  *
14552
+ * @returns `nil` if the object is not a light.
14378
14553
  */
14379
14554
  get_intensity(this: void,
14380
- id: number): void
14555
+ id: number): number | null
14381
14556
 
14382
14557
  /**
14383
14558
  * Get where top left corner of the rectangle with this id is drawn.
14384
14559
  * @remarks
14385
14560
  * Applies to subclasses: Rectangle
14386
14561
  *
14562
+ * @returns `nil` if the object is not a rectangle.
14387
14563
  */
14388
14564
  get_left_top(this: void,
14389
- id: number): void
14565
+ id: number): ScriptRenderTarget | null
14390
14566
 
14391
14567
  /**
14392
14568
  * Get the radius of the outer edge of the arc with this id.
14393
14569
  * @remarks
14394
14570
  * Applies to subclasses: Arc
14395
14571
  *
14572
+ * @returns `nil` if the object is not a arc.
14396
14573
  */
14397
14574
  get_max_radius(this: void,
14398
- id: number): void
14575
+ id: number): number | null
14399
14576
 
14400
14577
  /**
14401
14578
  * Get the radius of the inner edge of the arc with this id.
14402
14579
  * @remarks
14403
14580
  * Applies to subclasses: Arc
14404
14581
  *
14582
+ * @returns `nil` if the object is not a arc.
14405
14583
  */
14406
14584
  get_min_radius(this: void,
14407
- id: number): void
14585
+ id: number): number | null
14408
14586
 
14409
14587
  /**
14410
14588
  * Get the minimum darkness at which the light with this id is rendered.
14411
14589
  * @remarks
14412
14590
  * Applies to subclasses: Light
14413
14591
  *
14592
+ * @returns `nil` if the object is not a light.
14414
14593
  */
14415
14594
  get_minimum_darkness(this: void,
14416
- id: number): void
14595
+ id: number): number | null
14417
14596
 
14418
14597
  /**
14419
14598
  * Get whether this is only rendered in alt-mode.
14420
14599
  */
14421
14600
  get_only_in_alt_mode(this: void,
14422
- id: number): void
14601
+ id: number): boolean
14423
14602
 
14424
14603
  /**
14425
14604
  * Get the orientation of the object with this id.
@@ -14427,9 +14606,10 @@ interface LuaRendering {
14427
14606
  * Polygon vertices that are set to an entity will ignore this.
14428
14607
  * Applies to subclasses: Text,Polygon,Sprite,Light,Animation
14429
14608
  *
14609
+ * @returns `nil` if the object is not a text, polygon, sprite, light or animation.
14430
14610
  */
14431
14611
  get_orientation(this: void,
14432
- id: number): void
14612
+ id: number): RealOrientation | null
14433
14613
 
14434
14614
  /**
14435
14615
  * The object rotates so that it faces this target. Note that `orientation` is still applied to the object. Get the orientation_target of the object with this id.
@@ -14437,102 +14617,112 @@ interface LuaRendering {
14437
14617
  * Polygon vertices that are set to an entity will ignore this.
14438
14618
  * Applies to subclasses: Polygon,Sprite,Animation
14439
14619
  *
14620
+ * @returns `nil` if no target or if this object is not a polygon, sprite, or animation.
14440
14621
  */
14441
14622
  get_orientation_target(this: void,
14442
- id: number): void
14623
+ id: number): ScriptRenderTarget | null
14443
14624
 
14444
14625
  /**
14445
14626
  * Get if the light with this id is rendered has the same orientation as the target entity. Note that `orientation` is still applied to the sprite.
14446
14627
  * @remarks
14447
14628
  * Applies to subclasses: Light
14448
14629
  *
14630
+ * @returns `nil` if the object is not a light.
14449
14631
  */
14450
14632
  get_oriented(this: void,
14451
- id: number): void
14633
+ id: number): boolean | null
14452
14634
 
14453
14635
  /**
14454
14636
  * Offsets the center of the sprite or animation if `orientation_target` is given. This offset will rotate together with the sprite or animation. Get the oriented_offset of the sprite or animation with this id.
14455
14637
  * @remarks
14456
14638
  * Applies to subclasses: Sprite,Animation
14457
14639
  *
14640
+ * @returns `nil` if this object is not a sprite or animation.
14458
14641
  */
14459
14642
  get_oriented_offset(this: void,
14460
- id: number): void
14643
+ id: number): Vector | null
14461
14644
 
14462
14645
  /**
14463
14646
  * Get the players that the object with this id is rendered to or `nil` if visible to all players.
14464
14647
  */
14465
14648
  get_players(this: void,
14466
- id: number): void
14649
+ id: number): LuaPlayer[] | null
14467
14650
 
14468
14651
  /**
14469
14652
  * Get the radius of the circle with this id.
14470
14653
  * @remarks
14471
14654
  * Applies to subclasses: Circle
14472
14655
  *
14656
+ * @returns `nil` if the object is not a circle.
14473
14657
  */
14474
14658
  get_radius(this: void,
14475
- id: number): void
14659
+ id: number): number | null
14476
14660
 
14477
14661
  /**
14478
14662
  * Get the render layer of the sprite or animation with this id.
14479
14663
  * @remarks
14480
14664
  * Applies to subclasses: Sprite,Animation
14481
14665
  *
14666
+ * @returns `nil` if the object is not a sprite or animation.
14482
14667
  */
14483
14668
  get_render_layer(this: void,
14484
- id: number): void
14669
+ id: number): RenderLayer | null
14485
14670
 
14486
14671
  /**
14487
14672
  * Get where bottom right corner of the rectangle with this id is drawn.
14488
14673
  * @remarks
14489
14674
  * Applies to subclasses: Rectangle
14490
14675
  *
14676
+ * @returns `nil` if the object is not a rectangle.
14491
14677
  */
14492
14678
  get_right_bottom(this: void,
14493
- id: number): void
14679
+ id: number): ScriptRenderTarget | null
14494
14680
 
14495
14681
  /**
14496
14682
  * Get the scale of the text or light with this id.
14497
14683
  * @remarks
14498
14684
  * Applies to subclasses: Text,Light
14499
14685
  *
14686
+ * @returns `nil` if the object is not a text or light.
14500
14687
  */
14501
14688
  get_scale(this: void,
14502
- id: number): void
14689
+ id: number): number | null
14503
14690
 
14504
14691
  /**
14505
14692
  * Get if the text with this id scales with player zoom.
14506
14693
  * @remarks
14507
14694
  * Applies to subclasses: Text
14508
14695
  *
14696
+ * @returns `nil` if the object is not a text.
14509
14697
  */
14510
14698
  get_scale_with_zoom(this: void,
14511
- id: number): void
14699
+ id: number): boolean | null
14512
14700
 
14513
14701
  /**
14514
14702
  * Get the sprite of the sprite or light with this id.
14515
14703
  * @remarks
14516
14704
  * Applies to subclasses: Sprite,Light
14517
14705
  *
14706
+ * @returns `nil` if the object is not a sprite or light.
14518
14707
  */
14519
14708
  get_sprite(this: void,
14520
- id: number): void
14709
+ id: number): SpritePath | null
14521
14710
 
14522
14711
  /**
14523
14712
  * Get where the arc with this id starts.
14524
14713
  * @remarks
14525
14714
  * Applies to subclasses: Arc
14526
14715
  *
14716
+ * @returns Angle in radian. `nil` if the object is not a arc.
14527
14717
  */
14528
14718
  get_start_angle(this: void,
14529
- id: number): void
14719
+ id: number): number | null
14530
14720
 
14531
14721
  /**
14532
14722
  * The surface the object with this id is rendered on.
14533
14723
  */
14534
14724
  get_surface(this: void,
14535
- id: number): void
14725
+ id: number): LuaSurface
14536
14726
 
14537
14727
  /**
14538
14728
  * Get where the object with this id is drawn.
@@ -14540,117 +14730,127 @@ interface LuaRendering {
14540
14730
  * Polygon vertices that are set to an entity will ignore this.
14541
14731
  * Applies to subclasses: Text,Circle,Arc,Polygon,Sprite,Light,Animation
14542
14732
  *
14733
+ * @returns `nil` if the object does not support target.
14543
14734
  */
14544
14735
  get_target(this: void,
14545
- id: number): void
14736
+ id: number): ScriptRenderTarget | null
14546
14737
 
14547
14738
  /**
14548
14739
  * Get the text that is displayed by the text with this id.
14549
14740
  * @remarks
14550
14741
  * Applies to subclasses: Text
14551
14742
  *
14743
+ * @returns `nil` if the object is not a text.
14552
14744
  */
14553
14745
  get_text(this: void,
14554
- id: number): void
14746
+ id: number): LocalisedString | null
14555
14747
 
14556
14748
  /**
14557
14749
  * Get the time to live of the object with this id. This will be 0 if the object does not expire.
14558
14750
  */
14559
14751
  get_time_to_live(this: void,
14560
- id: number): void
14752
+ id: number): number
14561
14753
 
14562
14754
  /**
14563
14755
  * Get where the line with this id is drawn to.
14564
14756
  * @remarks
14565
14757
  * Applies to subclasses: Line
14566
14758
  *
14759
+ * @returns `nil` if the object is not a line.
14567
14760
  */
14568
14761
  get_to(this: void,
14569
- id: number): void
14762
+ id: number): ScriptRenderTarget | null
14570
14763
 
14571
14764
  /**
14572
14765
  * Gets the type of the given object. The types are "text", "line", "circle", "rectangle", "arc", "polygon", "sprite", "light" and "animation".
14573
14766
  */
14574
14767
  get_type(this: void,
14575
- id: number): void
14768
+ id: number): string
14576
14769
 
14577
14770
  /**
14578
14771
  * Get if the text with this id parses rich text tags.
14579
14772
  * @remarks
14580
14773
  * Applies to subclasses: Text
14581
14774
  *
14775
+ * @returns `nil` if the object is not a text.
14582
14776
  */
14583
14777
  get_use_rich_text(this: void,
14584
- id: number): void
14778
+ id: number): boolean | null
14585
14779
 
14586
14780
  /**
14587
14781
  * Get whether this uses the target orientation.
14782
+ * @returns `nil` if the object is not a sprite, polygon, or animation.
14588
14783
  */
14589
14784
  get_use_target_orientation(this: void,
14590
- id: number): void
14785
+ id: number): boolean
14591
14786
 
14592
14787
  /**
14593
14788
  * Get the vertical alignment of the text with this id.
14594
14789
  * @remarks
14595
14790
  * Applies to subclasses: Text
14596
14791
  *
14792
+ * @returns `nil` if the object is not a text.
14597
14793
  */
14598
14794
  get_vertical_alignment(this: void,
14599
- id: number): void
14795
+ id: number): string | null
14600
14796
 
14601
14797
  /**
14602
14798
  * Get the vertices of the polygon with this id.
14603
14799
  * @remarks
14604
14800
  * Applies to subclasses: Polygon
14605
14801
  *
14802
+ * @returns `nil` if the object is not a polygon.
14606
14803
  */
14607
14804
  get_vertices(this: void,
14608
- id: number): void
14805
+ id: number): ScriptRenderTarget[] | null
14609
14806
 
14610
14807
  /**
14611
14808
  * Get whether this is rendered to anyone at all.
14612
14809
  */
14613
14810
  get_visible(this: void,
14614
- id: number): void
14811
+ id: number): boolean
14615
14812
 
14616
14813
  /**
14617
14814
  * Get the width of the object with this id. Value is in pixels (32 per tile).
14618
14815
  * @remarks
14619
14816
  * Applies to subclasses: Line,Circle,Rectangle
14620
14817
  *
14818
+ * @returns `nil` if the object does not support width.
14621
14819
  */
14622
14820
  get_width(this: void,
14623
- id: number): void
14821
+ id: number): number | null
14624
14822
 
14625
14823
  /**
14626
14824
  * Get the horizontal scale of the sprite or animation with this id.
14627
14825
  * @remarks
14628
14826
  * Applies to subclasses: Sprite,Animation
14629
14827
  *
14828
+ * @returns `nil` if the object is not a sprite or animation.
14630
14829
  */
14631
14830
  get_x_scale(this: void,
14632
- id: number): void
14831
+ id: number): number | null
14633
14832
 
14634
14833
  /**
14635
14834
  * Get the vertical scale of the sprite or animation with this id.
14636
14835
  * @remarks
14637
14836
  * Applies to subclasses: Sprite,Animation
14638
14837
  *
14838
+ * @returns `nil` if the object is not a sprite or animation.
14639
14839
  */
14640
14840
  get_y_scale(this: void,
14641
- id: number): void
14841
+ id: number): number | null
14642
14842
 
14643
14843
  /**
14644
14844
  * Does a font with this name exist?
14645
14845
  */
14646
14846
  is_font_valid(this: void,
14647
- font_name: string): void
14847
+ font_name: string): boolean
14648
14848
 
14649
14849
  /**
14650
14850
  * Does a valid object with this id exist?
14651
14851
  */
14652
14852
  is_valid(this: void,
14653
- id: number): void
14853
+ id: number): boolean
14654
14854
 
14655
14855
  /**
14656
14856
  * Set the alignment of the text with this id. Does nothing if this object is not a text.
@@ -15119,7 +15319,7 @@ interface LuaResourceCategoryPrototype {
15119
15319
  /**
15120
15320
  * All methods and properties that this object supports.
15121
15321
  */
15122
- help(this: void): void
15322
+ help(this: void): string
15123
15323
 
15124
15324
  readonly localised_description: LocalisedString
15125
15325
 
@@ -15154,7 +15354,7 @@ interface LuaRoboportControlBehavior extends LuaControlBehavior {
15154
15354
  /**
15155
15355
  * All methods and properties that this object supports.
15156
15356
  */
15157
- help(this: void): void
15357
+ help(this: void): string
15158
15358
 
15159
15359
  available_construction_output_signal: SignalID
15160
15360
 
@@ -15202,7 +15402,7 @@ interface LuaSettings {
15202
15402
  *
15203
15403
  */
15204
15404
  get_player_settings(this: void,
15205
- player: PlayerIdentification): void
15405
+ player: PlayerIdentification): {[key: string]: ModSetting}
15206
15406
 
15207
15407
  /**
15208
15408
  * The current global mod settings, indexed by prototype name.
@@ -15237,7 +15437,7 @@ interface LuaShortcutPrototype {
15237
15437
  /**
15238
15438
  * All methods and properties that this object supports.
15239
15439
  */
15240
- help(this: void): void
15440
+ help(this: void): string
15241
15441
 
15242
15442
  readonly action: string
15243
15443
 
@@ -15291,7 +15491,7 @@ interface LuaStorageTankControlBehavior extends LuaControlBehavior {
15291
15491
  /**
15292
15492
  * All methods and properties that this object supports.
15293
15493
  */
15294
- help(this: void): void
15494
+ help(this: void): string
15295
15495
 
15296
15496
  /**
15297
15497
  * The class name of this object. Available even when `valid` is false. For LuaStruct objects it may also be suffixed with a dotted path to a member of the struct.
@@ -15312,7 +15512,7 @@ interface LuaStyle {
15312
15512
  /**
15313
15513
  * All methods and properties that this object supports.
15314
15514
  */
15315
- help(this: void): void
15515
+ help(this: void): string
15316
15516
 
15317
15517
  /**
15318
15518
  * @remarks
@@ -15720,15 +15920,17 @@ interface LuaStyle {
15720
15920
  interface LuaSurface {
15721
15921
  /**
15722
15922
  * Adds the given script area.
15923
+ * @returns The id of the created area.
15723
15924
  */
15724
15925
  add_script_area(this: void,
15725
- area: ScriptArea): void
15926
+ area: ScriptArea): number
15726
15927
 
15727
15928
  /**
15728
15929
  * Adds the given script position.
15930
+ * @returns The id of the created position.
15729
15931
  */
15730
15932
  add_script_position(this: void,
15731
- area: ScriptPosition): void
15933
+ area: ScriptPosition): number
15732
15934
 
15733
15935
  /**
15734
15936
  * Sets the given area to the checkerboard lab tiles.
@@ -15754,10 +15956,11 @@ interface LuaSurface {
15754
15956
  /**
15755
15957
  * @param positions - Positions for which to calculate property values
15756
15958
  * @param property_names - Names of properties (e.g. "elevation") to calculate
15959
+ * @returns Table of property value lists, keyed by property name
15757
15960
  */
15758
15961
  calculate_tile_properties(this: void,
15759
15962
  property_names: string[],
15760
- positions: MapPosition[]): void
15963
+ positions: MapPosition[]): {[key: string]: number[]}
15761
15964
 
15762
15965
  /**
15763
15966
  * If there exists an entity at the given location that can be fast-replaced with the given entity parameters.
@@ -15772,7 +15975,7 @@ interface LuaSurface {
15772
15975
  position: MapPosition,
15773
15976
  direction?: defines.direction,
15774
15977
  force?: ForceIdentification
15775
- }): void
15978
+ }): boolean
15776
15979
 
15777
15980
  /**
15778
15981
  * Check for collisions with terrain or other entities.
@@ -15793,7 +15996,7 @@ interface LuaSurface {
15793
15996
  build_check_type?: defines.build_check_type,
15794
15997
  forced?: boolean,
15795
15998
  inner_name?: string
15796
- }): void
15999
+ }): boolean
15797
16000
 
15798
16001
  /**
15799
16002
  * Cancel a deconstruction order.
@@ -15942,7 +16145,7 @@ interface LuaSurface {
15942
16145
  limit?: number,
15943
16146
  is_military_target?: boolean,
15944
16147
  invert?: boolean
15945
- }): void
16148
+ }): number
15946
16149
 
15947
16150
  /**
15948
16151
  * Count tiles of a given name in a given area. Works just like {@link LuaSurface::find_tiles_filtered | runtime:LuaSurface::find_tiles_filtered}, except this only returns the count. As it doesn't construct all the wrapper objects, this is more efficient if one is only interested in the number of tiles.
@@ -15967,7 +16170,7 @@ interface LuaSurface {
15967
16170
  to_be_deconstructed?: boolean,
15968
16171
  collision_mask?: CollisionMaskLayer | CollisionMaskLayer[],
15969
16172
  invert?: boolean
15970
- }): void
16173
+ }): number
15971
16174
 
15972
16175
  /**
15973
16176
  * Adds the given decoratives to the surface.
@@ -16022,9 +16225,10 @@ interface LuaSurface {
16022
16225
  * game.surfaces[1].create_entity{name = "inserter", position = game.player.position, direction = defines.direction.north}
16023
16226
  * ```
16024
16227
  *
16228
+ * @returns The created entity or `nil` if the creation failed.
16025
16229
  */
16026
16230
  create_entity(this: void,
16027
- table: LuaSurfaceCreateEntityParams): void
16231
+ table: LuaSurfaceCreateEntityParams): LuaEntity | null
16028
16232
 
16029
16233
  /**
16030
16234
  * Creates a particle at the given location
@@ -16060,7 +16264,7 @@ interface LuaSurface {
16060
16264
  table: {
16061
16265
  position: MapPosition,
16062
16266
  force?: ForceIdentification
16063
- }): void
16267
+ }): LuaUnitGroup
16064
16268
 
16065
16269
  /**
16066
16270
  * Place a deconstruction request.
@@ -16086,7 +16290,7 @@ interface LuaSurface {
16086
16290
  */
16087
16291
  decorative_prototype_collides(this: void,
16088
16292
  prototype: string,
16089
- position: MapPosition): void
16293
+ position: MapPosition): boolean
16090
16294
 
16091
16295
  /**
16092
16296
  * @param position - The chunk position to delete
@@ -16138,15 +16342,16 @@ interface LuaSurface {
16138
16342
  prototype: EntityPrototypeIdentification,
16139
16343
  position: MapPosition,
16140
16344
  use_map_generation_bounding_box: boolean,
16141
- direction?: defines.direction): void
16345
+ direction?: defines.direction): boolean
16142
16346
 
16143
16347
  /**
16144
16348
  * Find the logistic network with a cell closest to a given position.
16145
16349
  * @param force - Force the logistic network should belong to.
16350
+ * @returns The found network or `nil` if no such network was found.
16146
16351
  */
16147
16352
  find_closest_logistic_network_by_position(this: void,
16148
16353
  position: MapPosition,
16149
- force: ForceIdentification): void
16354
+ force: ForceIdentification): LuaLogisticNetwork | null
16150
16355
 
16151
16356
  /**
16152
16357
  * Find decoratives of a given name in a given area.
@@ -16172,7 +16377,7 @@ interface LuaSurface {
16172
16377
  exclude_soft?: boolean,
16173
16378
  limit?: number,
16174
16379
  invert?: boolean
16175
- }): void
16380
+ }): DecorativeResult[]
16176
16381
 
16177
16382
  /**
16178
16383
  * Find enemy units (entities with type "unit") of a given force within an area.
@@ -16192,7 +16397,7 @@ interface LuaSurface {
16192
16397
  find_enemy_units(this: void,
16193
16398
  center: MapPosition,
16194
16399
  radius: number,
16195
- force?: LuaForce | string): void
16400
+ force?: LuaForce | string): LuaEntity[]
16196
16401
 
16197
16402
  /**
16198
16403
  * Find entities in a given area.
@@ -16206,7 +16411,7 @@ interface LuaSurface {
16206
16411
  *
16207
16412
  */
16208
16413
  find_entities(this: void,
16209
- area?: BoundingBox): void
16414
+ area?: BoundingBox): LuaEntity[]
16210
16415
 
16211
16416
  /**
16212
16417
  * Find all entities of the given type or name in the given area.
@@ -16248,7 +16453,7 @@ interface LuaSurface {
16248
16453
  is_military_target?: boolean,
16249
16454
  has_item_inside?: LuaItemPrototype,
16250
16455
  invert?: boolean
16251
- }): void
16456
+ }): LuaEntity[]
16252
16457
 
16253
16458
  /**
16254
16459
  * Find an entity of the given type at the given position. This checks both the exact position and the bounding box of the entity.
@@ -16259,18 +16464,20 @@ interface LuaSurface {
16259
16464
  * game.player.selected.surface.find_entity('filter-inserter', {0,0})
16260
16465
  * ```
16261
16466
  *
16467
+ * @returns `nil` if no such entity is found.
16262
16468
  */
16263
16469
  find_entity(this: void,
16264
16470
  entity: string,
16265
- position: MapPosition): void
16471
+ position: MapPosition): LuaEntity | null
16266
16472
 
16267
16473
  /**
16268
16474
  * Find the logistic network that covers a given position.
16269
16475
  * @param force - Force the logistic network should belong to.
16476
+ * @returns The found network or `nil` if no such network was found.
16270
16477
  */
16271
16478
  find_logistic_network_by_position(this: void,
16272
16479
  position: MapPosition,
16273
- force: ForceIdentification): void
16480
+ force: ForceIdentification): LuaLogisticNetwork | null
16274
16481
 
16275
16482
  /**
16276
16483
  * Finds all of the logistics networks whose construction area intersects with the given position.
@@ -16278,33 +16485,35 @@ interface LuaSurface {
16278
16485
  */
16279
16486
  find_logistic_networks_by_construction_area(this: void,
16280
16487
  position: MapPosition,
16281
- force: ForceIdentification): void
16488
+ force: ForceIdentification): LuaLogisticNetwork[]
16282
16489
 
16283
16490
  /**
16284
16491
  * Find the enemy military target ({@link military entity | https://wiki.factorio.com/Military_units_and_structures}) closest to the given position.
16285
16492
  * @param table.force - The force the result will be an enemy of. Uses the player force if not specified.
16286
16493
  * @param table.max_distance - Radius of the circular search area.
16287
16494
  * @param table.position - Center of the search area.
16495
+ * @returns The nearest enemy military target or `nil` if no enemy could be found within the given area.
16288
16496
  */
16289
16497
  find_nearest_enemy(this: void,
16290
16498
  table: {
16291
16499
  position: MapPosition,
16292
16500
  max_distance: number,
16293
16501
  force?: ForceIdentification
16294
- }): void
16502
+ }): LuaEntity | null
16295
16503
 
16296
16504
  /**
16297
16505
  * Find the enemy entity-with-owner closest to the given position.
16298
16506
  * @param table.force - The force the result will be an enemy of. Uses the player force if not specified.
16299
16507
  * @param table.max_distance - Radius of the circular search area.
16300
16508
  * @param table.position - Center of the search area.
16509
+ * @returns The nearest enemy entity-with-owner or `nil` if no enemy could be found within the given area.
16301
16510
  */
16302
16511
  find_nearest_enemy_entity_with_owner(this: void,
16303
16512
  table: {
16304
16513
  position: MapPosition,
16305
16514
  max_distance: number,
16306
16515
  force?: ForceIdentification
16307
- }): void
16516
+ }): LuaEntity
16308
16517
 
16309
16518
  /**
16310
16519
  * Find a non-colliding position within a given radius.
@@ -16316,13 +16525,14 @@ interface LuaSurface {
16316
16525
  * @param name - Prototype name of the entity to find a position for. (The bounding box for the collision checking is taken from this prototype.)
16317
16526
  * @param precision - The step length from the given position as it searches, in tiles. Minimum value is `0.01`.
16318
16527
  * @param radius - Max distance from `center` to search in. A radius of `0` means an infinitely-large search area.
16528
+ * @returns The non-colliding position. May be `nil` if no suitable position was found.
16319
16529
  */
16320
16530
  find_non_colliding_position(this: void,
16321
16531
  name: string,
16322
16532
  center: MapPosition,
16323
16533
  radius: number,
16324
16534
  precision: number,
16325
- force_to_tile_center?: boolean): void
16535
+ force_to_tile_center?: boolean): MapPosition | null
16326
16536
 
16327
16537
  /**
16328
16538
  * Find a non-colliding position within a given rectangle.
@@ -16330,12 +16540,13 @@ interface LuaSurface {
16330
16540
  * @param name - Prototype name of the entity to find a position for. (The bounding box for the collision checking is taken from this prototype.)
16331
16541
  * @param precision - The step length from the given position as it searches, in tiles. Minimum value is 0.01.
16332
16542
  * @param search_space - The rectangle to search inside.
16543
+ * @returns The non-colliding position. May be `nil` if no suitable position was found.
16333
16544
  */
16334
16545
  find_non_colliding_position_in_box(this: void,
16335
16546
  name: string,
16336
16547
  search_space: BoundingBox,
16337
16548
  precision: number,
16338
- force_to_tile_center?: boolean): void
16549
+ force_to_tile_center?: boolean): MapPosition | null
16339
16550
 
16340
16551
  /**
16341
16552
  * Find all tiles of the given name in the given area.
@@ -16362,7 +16573,7 @@ interface LuaSurface {
16362
16573
  to_be_deconstructed?: boolean,
16363
16574
  collision_mask?: CollisionMaskLayer | CollisionMaskLayer[],
16364
16575
  invert?: boolean
16365
- }): void
16576
+ }): LuaTile[]
16366
16577
 
16367
16578
  /**
16368
16579
  * Find units (entities with type "unit") of a given force and force condition within a given area.
@@ -16390,7 +16601,7 @@ interface LuaSurface {
16390
16601
  area: BoundingBox,
16391
16602
  force: LuaForce | string,
16392
16603
  condition: ForceCondition
16393
- }): void
16604
+ }): LuaEntity[]
16394
16605
 
16395
16606
  /**
16396
16607
  * Blocks and generates all chunks that have been requested using all available threads.
@@ -16400,7 +16611,7 @@ interface LuaSurface {
16400
16611
  /**
16401
16612
  * Get an iterator going over every chunk on this surface.
16402
16613
  */
16403
- get_chunks(this: void): void
16614
+ get_chunks(this: void): LuaChunkIterator
16404
16615
 
16405
16616
  /**
16406
16617
  * Gets the closest entity in the list to this position.
@@ -16408,7 +16619,7 @@ interface LuaSurface {
16408
16619
  */
16409
16620
  get_closest(this: void,
16410
16621
  position: MapPosition,
16411
- entities: LuaEntity[]): void
16622
+ entities: LuaEntity[]): LuaEntity | null
16412
16623
 
16413
16624
  /**
16414
16625
  * Gets all tiles of the given types that are connected horizontally or vertically to the given tile position including the given tile position.
@@ -16419,12 +16630,13 @@ interface LuaSurface {
16419
16630
  * @param include_diagonal - Include tiles that are connected diagonally.
16420
16631
  * @param position - The tile position to start at.
16421
16632
  * @param tiles - The tiles to search for.
16633
+ * @returns The resulting set of tiles.
16422
16634
  */
16423
16635
  get_connected_tiles(this: void,
16424
16636
  position: TilePosition,
16425
16637
  tiles: string[],
16426
16638
  include_diagonal?: boolean,
16427
- area?: BoundingBox): void
16639
+ area?: BoundingBox): TilePosition[]
16428
16640
 
16429
16641
  /**
16430
16642
  * Returns all the military targets (entities with force) on this chunk for the given force.
@@ -16433,19 +16645,20 @@ interface LuaSurface {
16433
16645
  */
16434
16646
  get_entities_with_force(this: void,
16435
16647
  position: ChunkPosition,
16436
- force: LuaForce | string): void
16648
+ force: LuaForce | string): LuaEntity[]
16437
16649
 
16438
16650
  /**
16439
16651
  * The hidden tile name.
16440
16652
  * @param position - The tile position.
16653
+ * @returns `nil` if there isn't one for the given position.
16441
16654
  */
16442
16655
  get_hidden_tile(this: void,
16443
- position: TilePosition): void
16656
+ position: TilePosition): string | null
16444
16657
 
16445
16658
  /**
16446
16659
  * Gets the map exchange string for the current map generation settings of this surface.
16447
16660
  */
16448
- get_map_exchange_string(this: void): void
16661
+ get_map_exchange_string(this: void): string
16449
16662
 
16450
16663
  /**
16451
16664
  * Get the pollution for a given position.
@@ -16459,48 +16672,48 @@ interface LuaSurface {
16459
16672
  *
16460
16673
  */
16461
16674
  get_pollution(this: void,
16462
- position: MapPosition): void
16675
+ position: MapPosition): number
16463
16676
 
16464
16677
  /**
16465
16678
  * Gets a random generated chunk position or 0,0 if no chunks have been generated on this surface.
16466
16679
  */
16467
- get_random_chunk(this: void): void
16680
+ get_random_chunk(this: void): ChunkPosition
16468
16681
 
16469
16682
  /**
16470
16683
  * Gets the resource amount of all resources on this surface
16471
16684
  */
16472
- get_resource_counts(this: void): void
16685
+ get_resource_counts(this: void): {[key: string]: number}
16473
16686
 
16474
16687
  /**
16475
16688
  * Gets the first script area by name or id.
16476
16689
  * @param key - The name or id of the area to get.
16477
16690
  */
16478
16691
  get_script_area(this: void,
16479
- key?: string | number): void
16692
+ key?: string | number): ScriptArea | null
16480
16693
 
16481
16694
  /**
16482
16695
  * Gets the script areas that match the given name or if no name is given all areas are returned.
16483
16696
  */
16484
16697
  get_script_areas(this: void,
16485
- name?: string): void
16698
+ name?: string): ScriptArea[]
16486
16699
 
16487
16700
  /**
16488
16701
  * Gets the first script position by name or id.
16489
16702
  * @param key - The name or id of the position to get.
16490
16703
  */
16491
16704
  get_script_position(this: void,
16492
- key?: string | number): void
16705
+ key?: string | number): ScriptPosition | null
16493
16706
 
16494
16707
  /**
16495
16708
  * Gets the script positions that match the given name or if no name is given all positions are returned.
16496
16709
  */
16497
16710
  get_script_positions(this: void,
16498
- name?: string): void
16711
+ name?: string): ScriptPosition[]
16499
16712
 
16500
16713
  /**
16501
16714
  * Gets the starting area radius of this surface.
16502
16715
  */
16503
- get_starting_area_radius(this: void): void
16716
+ get_starting_area_radius(this: void): number
16504
16717
 
16505
16718
  /**
16506
16719
  * Get the tile at a given position. An alternative call signature for this method is passing it a single {@link TilePosition | runtime:TilePosition}.
@@ -16510,12 +16723,12 @@ interface LuaSurface {
16510
16723
  */
16511
16724
  get_tile(this: void,
16512
16725
  x: number,
16513
- y: number): void
16726
+ y: number): LuaTile
16514
16727
 
16515
16728
  /**
16516
16729
  * Gets the total amount of pollution on the surface by iterating over all of the chunks containing pollution.
16517
16730
  */
16518
- get_total_pollution(this: void): void
16731
+ get_total_pollution(this: void): number
16519
16732
 
16520
16733
  /**
16521
16734
  * Gets train stops matching the given filters.
@@ -16526,25 +16739,25 @@ interface LuaSurface {
16526
16739
  table?: {
16527
16740
  name?: string | string[],
16528
16741
  force?: ForceIdentification
16529
- }): void
16742
+ }): LuaEntity[]
16530
16743
 
16531
16744
  /**
16532
16745
  * @param force - The force to search. Not providing a force will match trains in any force.
16533
16746
  */
16534
16747
  get_trains(this: void,
16535
- force?: ForceIdentification): void
16748
+ force?: ForceIdentification): LuaTrain[]
16536
16749
 
16537
16750
  /**
16538
16751
  * All methods and properties that this object supports.
16539
16752
  */
16540
- help(this: void): void
16753
+ help(this: void): string
16541
16754
 
16542
16755
  /**
16543
16756
  * Is a given chunk generated?
16544
16757
  * @param position - The chunk's position.
16545
16758
  */
16546
16759
  is_chunk_generated(this: void,
16547
- position: ChunkPosition): void
16760
+ position: ChunkPosition): boolean
16548
16761
 
16549
16762
  /**
16550
16763
  * Play a sound for every player on this surface.
@@ -16606,15 +16819,17 @@ interface LuaSurface {
16606
16819
 
16607
16820
  /**
16608
16821
  * Removes the given script area.
16822
+ * @returns If the area was actually removed. False when it didn't exist.
16609
16823
  */
16610
16824
  remove_script_area(this: void,
16611
- id: number): void
16825
+ id: number): boolean
16612
16826
 
16613
16827
  /**
16614
16828
  * Removes the given script position.
16829
+ * @returns If the position was actually removed. False when it didn't exist.
16615
16830
  */
16616
16831
  remove_script_position(this: void,
16617
- id: number): void
16832
+ id: number): boolean
16618
16833
 
16619
16834
  /**
16620
16835
  * Generates a path with the specified constraints (as an array of {@link PathfinderWaypoints | runtime:PathfinderWaypoint}) using the unit pathfinding algorithm. This path can be used to emulate pathing behavior by script for non-unit entities, such as vehicles. If you want to command actual units (such as biters or spitters) to move, use {@link LuaEntity::set_command | runtime:LuaEntity::set_command} instead.
@@ -16630,6 +16845,7 @@ interface LuaSurface {
16630
16845
  * @param table.pathfind_flags - Flags that affect pathfinder behavior.
16631
16846
  * @param table.radius - How close the pathfinder needs to get to its `goal` (in tiles). Defaults to `1`.
16632
16847
  * @param table.start - The position from which to start pathfinding.
16848
+ * @returns A unique handle to identify this call when [on_script_path_request_finished](runtime:on_script_path_request_finished) fires.
16633
16849
  */
16634
16850
  request_path(this: void,
16635
16851
  table: {
@@ -16643,7 +16859,7 @@ interface LuaSurface {
16643
16859
  can_open_gates?: boolean,
16644
16860
  path_resolution_modifier?: number,
16645
16861
  entity_to_ignore?: LuaEntity
16646
- }): void
16862
+ }): number
16647
16863
 
16648
16864
  /**
16649
16865
  * Request that the game's map generator generate chunks at the given position for the given radius on this surface.
@@ -16677,6 +16893,7 @@ interface LuaSurface {
16677
16893
  * @param table.force - Force of the units this command is to be given to. If not specified, uses the enemy force.
16678
16894
  * @param table.unit_count - Number of units to give the command to.
16679
16895
  * @param table.unit_search_distance - Radius to search for units. The search area is centered on the destination of the command.
16896
+ * @returns Number of units actually sent. May be less than `count` if not enough units were available.
16680
16897
  */
16681
16898
  set_multi_command(this: void,
16682
16899
  table: {
@@ -16684,7 +16901,7 @@ interface LuaSurface {
16684
16901
  unit_count: number,
16685
16902
  force?: ForceIdentification,
16686
16903
  unit_search_distance?: number
16687
- }): void
16904
+ }): number
16688
16905
 
16689
16906
  /**
16690
16907
  * Set tiles at specified locations. Can automatically correct the edges around modified tiles.
@@ -16712,13 +16929,14 @@ interface LuaSurface {
16712
16929
  * @param force - When provided (and not `nil`) the items will be marked for deconstruction by this force.
16713
16930
  * @param items - Items to spill
16714
16931
  * @param position - Center of the spillage
16932
+ * @returns The created item-on-ground entities.
16715
16933
  */
16716
16934
  spill_item_stack(this: void,
16717
16935
  position: MapPosition,
16718
16936
  items: ItemStackIdentification,
16719
16937
  enable_looted?: boolean,
16720
16938
  force?: LuaForce | string,
16721
- allow_belts?: boolean): void
16939
+ allow_belts?: boolean): LuaEntity[]
16722
16940
 
16723
16941
  /**
16724
16942
  * Place an upgrade request.
@@ -16880,7 +17098,7 @@ interface LuaTechnology {
16880
17098
  /**
16881
17099
  * All methods and properties that this object supports.
16882
17100
  */
16883
- help(this: void): void
17101
+ help(this: void): string
16884
17102
 
16885
17103
  /**
16886
17104
  * Reload this technology from its prototype.
@@ -16991,7 +17209,7 @@ interface LuaTechnologyPrototype {
16991
17209
  /**
16992
17210
  * All methods and properties that this object supports.
16993
17211
  */
16994
- help(this: void): void
17212
+ help(this: void): string
16995
17213
 
16996
17214
  /**
16997
17215
  * Effects applied when this technology is researched.
@@ -17116,42 +17334,43 @@ interface LuaTile {
17116
17334
  *
17117
17335
  */
17118
17336
  collides_with(this: void,
17119
- layer: CollisionMaskLayer): void
17337
+ layer: CollisionMaskLayer): boolean
17120
17338
 
17121
17339
  /**
17122
17340
  * Gets all tile ghosts on this tile.
17123
17341
  * @param force - Get tile ghosts of this force.
17124
17342
  */
17125
17343
  get_tile_ghosts(this: void,
17126
- force?: ForceIdentification): void
17344
+ force?: ForceIdentification): LuaTile[]
17127
17345
 
17128
17346
  /**
17129
17347
  * Does this tile have any tile ghosts on it.
17130
17348
  * @param force - Check for tile ghosts of this force.
17131
17349
  */
17132
17350
  has_tile_ghost(this: void,
17133
- force?: ForceIdentification): void
17351
+ force?: ForceIdentification): boolean
17134
17352
 
17135
17353
  /**
17136
17354
  * All methods and properties that this object supports.
17137
17355
  */
17138
- help(this: void): void
17356
+ help(this: void): string
17139
17357
 
17140
17358
  /**
17141
17359
  * Orders deconstruction of this tile by the given force.
17142
17360
  * @param force - The force whose robots are supposed to do the deconstruction.
17143
17361
  * @param player - The player to set the last_user to if any.
17362
+ * @returns The deconstructible tile proxy created, if any.
17144
17363
  */
17145
17364
  order_deconstruction(this: void,
17146
17365
  force: ForceIdentification,
17147
- player?: PlayerIdentification): void
17366
+ player?: PlayerIdentification): LuaEntity | null
17148
17367
 
17149
17368
  /**
17150
17369
  * Is this tile marked for deconstruction?
17151
17370
  * @param force - The force who did the deconstruction order.
17152
17371
  */
17153
17372
  to_be_deconstructed(this: void,
17154
- force?: ForceIdentification): void
17373
+ force?: ForceIdentification): boolean
17155
17374
 
17156
17375
  /**
17157
17376
  * The name of the {@link LuaTilePrototype | runtime:LuaTilePrototype} hidden under this tile, if any. During normal gameplay, only {@link non-mineable | runtime:LuaTilePrototype::mineable_properties} tiles can become hidden. This can however be circumvented with {@link LuaSurface::set_hidden_tile | runtime:LuaSurface::set_hidden_tile}.
@@ -17194,7 +17413,7 @@ interface LuaTilePrototype {
17194
17413
  /**
17195
17414
  * All methods and properties that this object supports.
17196
17415
  */
17197
- help(this: void): void
17416
+ help(this: void): string
17198
17417
 
17199
17418
  readonly allowed_neighbors: {[key: string]: LuaTilePrototype}
17200
17419
 
@@ -17274,7 +17493,7 @@ interface LuaTilePrototype {
17274
17493
  readonly name: string
17275
17494
 
17276
17495
  /**
17277
- * If this tile needs correction logic applied when it's generated in the world..
17496
+ * If this tile needs correction logic applied when it's generated in the world.
17278
17497
  */
17279
17498
  readonly needs_correction: boolean
17280
17499
 
@@ -17320,32 +17539,34 @@ interface LuaTrain {
17320
17539
 
17321
17540
  /**
17322
17541
  * Get a mapping of the train's inventory.
17542
+ * @returns The counts, indexed by item names.
17323
17543
  */
17324
- get_contents(this: void): void
17544
+ get_contents(this: void): {[key: string]: number}
17325
17545
 
17326
17546
  /**
17327
17547
  * Gets a mapping of the train's fluid inventory.
17548
+ * @returns The counts, indexed by fluid names.
17328
17549
  */
17329
- get_fluid_contents(this: void): void
17550
+ get_fluid_contents(this: void): {[key: string]: number}
17330
17551
 
17331
17552
  /**
17332
17553
  * Get the amount of a particular fluid stored in the train.
17333
17554
  * @param fluid - Fluid name to count. If not given, counts all fluids.
17334
17555
  */
17335
17556
  get_fluid_count(this: void,
17336
- fluid?: string): void
17557
+ fluid?: string): number
17337
17558
 
17338
17559
  /**
17339
17560
  * Get the amount of a particular item stored in the train.
17340
17561
  * @param item - Item name to count. If not given, counts all items.
17341
17562
  */
17342
17563
  get_item_count(this: void,
17343
- item?: string): void
17564
+ item?: string): number
17344
17565
 
17345
17566
  /**
17346
17567
  * Gets all rails under the train.
17347
17568
  */
17348
- get_rails(this: void): void
17569
+ get_rails(this: void): LuaEntity[]
17349
17570
 
17350
17571
  /**
17351
17572
  * Go to the station specified by the index in the train's schedule.
@@ -17356,7 +17577,7 @@ interface LuaTrain {
17356
17577
  /**
17357
17578
  * All methods and properties that this object supports.
17358
17579
  */
17359
- help(this: void): void
17580
+ help(this: void): string
17360
17581
 
17361
17582
  /**
17362
17583
  * Insert a stack into the train.
@@ -17366,29 +17587,33 @@ interface LuaTrain {
17366
17587
 
17367
17588
  /**
17368
17589
  * Inserts the given fluid into the first available location in this train.
17590
+ * @returns The amount inserted.
17369
17591
  */
17370
17592
  insert_fluid(this: void,
17371
- fluid: Fluid): void
17593
+ fluid: Fluid): number
17372
17594
 
17373
17595
  /**
17374
17596
  * Checks if the path is invalid and tries to re-path if it isn't.
17375
17597
  * @param force - Forces the train to re-path regardless of the current path being valid or not.
17598
+ * @returns If the train has a path after the repath attempt.
17376
17599
  */
17377
17600
  recalculate_path(this: void,
17378
- force?: boolean): void
17601
+ force?: boolean): boolean
17379
17602
 
17380
17603
  /**
17381
17604
  * Remove some fluid from the train.
17605
+ * @returns The amount of fluid actually removed.
17382
17606
  */
17383
17607
  remove_fluid(this: void,
17384
- fluid: Fluid): void
17608
+ fluid: Fluid): number
17385
17609
 
17386
17610
  /**
17387
17611
  * Remove some items from the train.
17388
17612
  * @param stack - The amount and type of items to remove
17613
+ * @returns Number of items actually removed.
17389
17614
  */
17390
17615
  remove_item(this: void,
17391
- stack: ItemStackIdentification): void
17616
+ stack: ItemStackIdentification): number
17392
17617
 
17393
17618
  /**
17394
17619
  * The rail at the back end of the train, if any.
@@ -17554,7 +17779,7 @@ interface LuaTrainStopControlBehavior extends LuaGenericOnOffControlBehavior {
17554
17779
  /**
17555
17780
  * All methods and properties that this object supports.
17556
17781
  */
17557
- help(this: void): void
17782
+ help(this: void): string
17558
17783
 
17559
17784
  /**
17560
17785
  * `true` if the train stop is enabled/disabled through the circuit network.
@@ -17620,7 +17845,7 @@ interface LuaTransportBeltControlBehavior extends LuaGenericOnOffControlBehavior
17620
17845
  /**
17621
17846
  * All methods and properties that this object supports.
17622
17847
  */
17623
- help(this: void): void
17848
+ help(this: void): string
17624
17849
 
17625
17850
  /**
17626
17851
  * If the belt will be enabled/disabled based off the circuit network.
@@ -17658,12 +17883,12 @@ interface LuaTransportLine {
17658
17883
  * @param position - Where to insert an item.
17659
17884
  */
17660
17885
  can_insert_at(this: void,
17661
- position: number): void
17886
+ position: number): boolean
17662
17887
 
17663
17888
  /**
17664
17889
  * Can an item be inserted at the back of this line?
17665
17890
  */
17666
- can_insert_at_back(this: void): void
17891
+ can_insert_at_back(this: void): boolean
17667
17892
 
17668
17893
  /**
17669
17894
  * Remove all items from this transport line.
@@ -17672,35 +17897,38 @@ interface LuaTransportLine {
17672
17897
 
17673
17898
  /**
17674
17899
  * Get counts of all items on this line, similar to how {@link LuaInventory::get_contents | runtime:LuaInventory::get_contents} does.
17900
+ * @returns The counts, indexed by item names.
17675
17901
  */
17676
- get_contents(this: void): void
17902
+ get_contents(this: void): {[key: string]: number}
17677
17903
 
17678
17904
  /**
17679
17905
  * Count some or all items on this line, similar to how {@link LuaInventory::get_item_count | runtime:LuaInventory::get_item_count} does.
17680
17906
  * @param item - Prototype name of the item to count. If not specified, count all items.
17681
17907
  */
17682
17908
  get_item_count(this: void,
17683
- item?: string): void
17909
+ item?: string): number
17684
17910
 
17685
17911
  /**
17686
17912
  * All methods and properties that this object supports.
17687
17913
  */
17688
- help(this: void): void
17914
+ help(this: void): string
17689
17915
 
17690
17916
  /**
17691
17917
  * Insert items at a given position.
17692
17918
  * @param items - Items to insert.
17693
17919
  * @param position - Where on the line to insert the items.
17920
+ * @returns Were the items inserted successfully?
17694
17921
  */
17695
17922
  insert_at(this: void,
17696
17923
  position: number,
17697
- items: ItemStackIdentification): void
17924
+ items: ItemStackIdentification): boolean
17698
17925
 
17699
17926
  /**
17700
17927
  * Insert items at the back of this line.
17928
+ * @returns Were the items inserted successfully?
17701
17929
  */
17702
17930
  insert_at_back(this: void,
17703
- items: ItemStackIdentification): void
17931
+ items: ItemStackIdentification): boolean
17704
17932
 
17705
17933
  /**
17706
17934
  * Returns whether the associated internal transport line of this line is the same as the others associated internal transport line.
@@ -17709,14 +17937,15 @@ interface LuaTransportLine {
17709
17937
  *
17710
17938
  */
17711
17939
  line_equals(this: void,
17712
- other: LuaTransportLine): void
17940
+ other: LuaTransportLine): boolean
17713
17941
 
17714
17942
  /**
17715
17943
  * Remove some items from this line.
17716
17944
  * @param items - Items to remove.
17945
+ * @returns Number of items actually removed.
17717
17946
  */
17718
17947
  remove_item(this: void,
17719
- items: ItemStackIdentification): void
17948
+ items: ItemStackIdentification): number
17720
17949
 
17721
17950
  /**
17722
17951
  * The transport lines that this transport line is fed by or an empty table if none.
@@ -17765,7 +17994,7 @@ interface LuaTrivialSmokePrototype {
17765
17994
  /**
17766
17995
  * All methods and properties that this object supports.
17767
17996
  */
17768
- help(this: void): void
17997
+ help(this: void): string
17769
17998
 
17770
17999
  readonly affected_by_wind: boolean
17771
18000
 
@@ -17842,7 +18071,7 @@ interface LuaUnitGroup {
17842
18071
  /**
17843
18072
  * All methods and properties that this object supports.
17844
18073
  */
17845
- help(this: void): void
18074
+ help(this: void): string
17846
18075
 
17847
18076
  /**
17848
18077
  * Make this group autonomous. Autonomous groups will automatically attack polluted areas. Autonomous groups aren't considered to be {@link script-driven | runtime:LuaUnitGroup::is_script_driven}.
@@ -17930,7 +18159,7 @@ interface LuaVirtualSignalPrototype {
17930
18159
  /**
17931
18160
  * All methods and properties that this object supports.
17932
18161
  */
17933
- help(this: void): void
18162
+ help(this: void): string
17934
18163
 
17935
18164
  readonly localised_description: LocalisedString
17936
18165
 
@@ -17972,7 +18201,7 @@ interface LuaVoidEnergySourcePrototype {
17972
18201
  /**
17973
18202
  * All methods and properties that this object supports.
17974
18203
  */
17975
- help(this: void): void
18204
+ help(this: void): string
17976
18205
 
17977
18206
  /**
17978
18207
  * The emissions of this energy source in `pollution/Joule`. Multiplying it by energy consumption in `Watt` gives `pollution/second`.
@@ -18002,7 +18231,7 @@ interface LuaWallControlBehavior extends LuaControlBehavior {
18002
18231
  /**
18003
18232
  * All methods and properties that this object supports.
18004
18233
  */
18005
- help(this: void): void
18234
+ help(this: void): string
18006
18235
 
18007
18236
  /**
18008
18237
  * The circuit condition.
@@ -19174,3 +19403,5 @@ interface LuaSurfaceCreateEntityParamsUndergroundBelt extends LuaSurfaceCreateEn
19174
19403
 
19175
19404
  }
19176
19405
 
19406
+
19407
+ }