typed-factorio 1.14.0 → 1.15.0
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +15 -15
- package/runtime/generated/classes.d.ts +302 -102
- package/runtime/generated/concepts.d.ts +22 -20
- package/runtime/generated/defines.d.ts +18 -0
- package/runtime/generated/events.d.ts +90 -6
@@ -9,7 +9,7 @@
|
|
9
9
|
*
|
10
10
|
* The template can contain placeholders such as `__1__` or `__2__`. These will be replaced by the respective parameter in the LocalisedString. The parameters themselves can be other localised strings, which will be processed recursively in the same fashion. Localised strings can not be recursed deeper than 20 levels and can not have more than 20 parameters.
|
11
11
|
*
|
12
|
-
*
|
12
|
+
* There are two special flags for the localised string, indicated by the key being a particular string. First, if the key is the empty string (`""`), then all parameters will be concatenated (after processing, if any are localised strings themselves). Second, if the key is a question mark (`"?"`), then the first valid parameter will be used. A parameter can be invalid if its name doesn't match any string template. If no parameters are valid, the last one is returned. This is useful to implement a fallback for missing locale templates.
|
13
13
|
*
|
14
14
|
* Furthermore, when an API function expects a localised string, it will also accept a regular string (i.e. not a table) which will not be translated, as well as a number, boolean or `nil`, which will be converted to their textual representation.
|
15
15
|
* @example In the English translation, this will print `"No ammo"`; in the Czech translation, it will print `"Bez munice"`:
|
@@ -34,6 +34,13 @@
|
|
34
34
|
* ```
|
35
35
|
* game.print({"", {"item-name.iron-plate"}, ": ", 60})
|
36
36
|
* ```
|
37
|
+
* @example As an example of a localised string with fallback, consider this:
|
38
|
+
*
|
39
|
+
* ```
|
40
|
+
* {"?", {"", {"entity-description.furnace"}, "\n"}, {"item-description.furnace"}, "optional fallback"}
|
41
|
+
* ```
|
42
|
+
*
|
43
|
+
* If `entity-description.furnace` exists, it is concatenated with `"\n"` and returned. Otherwise, if `item-description.furnace` exists, it is returned as-is. Otherwise, `"optional fallback"` is returned. If this value wasn't specified, the translation result would be `"Unknown key: 'item-description.furnace'"`.
|
37
44
|
* @see {@link https://lua-api.factorio.com/latest/Concepts.html#LocalisedString Online documentation}
|
38
45
|
*/
|
39
46
|
type LocalisedString = string | number | boolean | LuaObject | nil | readonly [string, ...LocalisedString[]]
|
@@ -291,7 +298,7 @@ interface SmokeSource {
|
|
291
298
|
type Vector = MapPositionArray
|
292
299
|
|
293
300
|
/**
|
294
|
-
* Two positions, specifying the top-left and bottom-right corner of the box respectively. Like with {@link MapPosition}, the names of the members may be omitted. When read from the game, the third member `orientation` is present if it is non-zero
|
301
|
+
* Two positions, specifying the top-left and bottom-right corner of the box respectively. Like with {@link MapPosition}, the names of the members may be omitted. When read from the game, the third member `orientation` is present if it is non-zero.
|
295
302
|
* @see BoundingBoxArray
|
296
303
|
* @example Explicit definition:
|
297
304
|
*
|
@@ -1073,17 +1080,6 @@ interface MapExchangeStringData {
|
|
1073
1080
|
readonly map_gen_settings: MapGenSettings
|
1074
1081
|
}
|
1075
1082
|
|
1076
|
-
interface BlueprintItemIcon {
|
1077
|
-
/**
|
1078
|
-
* Name of the item prototype whose icon should be used.
|
1079
|
-
*/
|
1080
|
-
readonly name: string
|
1081
|
-
/**
|
1082
|
-
* Index of the icon in the blueprint icons slots. Has to be an integer in the range [1, 4].
|
1083
|
-
*/
|
1084
|
-
readonly index: uint
|
1085
|
-
}
|
1086
|
-
|
1087
1083
|
interface BlueprintSignalIcon {
|
1088
1084
|
/**
|
1089
1085
|
* The icon to use. It can be any item icon as well as any virtual signal icon.
|
@@ -2631,7 +2627,7 @@ interface CircuitConnectionDefinition {
|
|
2631
2627
|
|
2632
2628
|
interface WireConnectionDefinition {
|
2633
2629
|
/**
|
2634
|
-
*
|
2630
|
+
* The type of wire used.
|
2635
2631
|
*/
|
2636
2632
|
readonly wire: defines.wire_type
|
2637
2633
|
/**
|
@@ -4144,7 +4140,9 @@ type CapsuleAction =
|
|
4144
4140
|
* - `"entity-with-force"`: Deprecated. Replaced by `is-military-target`.
|
4145
4141
|
* - `"is-military-target"`: Selects entities that are {@link LuaEntity#is_military_target military targets}.
|
4146
4142
|
* - `"entity-with-owner"`: Selects entities that are {@link LuaEntity#is_entity_with_owner entities with owner}.
|
4147
|
-
* - `"avoid-rolling-stock"`: Selects entities that are not `rolling-
|
4143
|
+
* - `"avoid-rolling-stock"`: Selects entities that are not `rolling-stock`s.
|
4144
|
+
* - `"entity-ghost"`: Selects entities that are `entity-ghost`s.
|
4145
|
+
* - `"tile-ghost"`: Selects entities that are `tile-ghost`s.
|
4148
4146
|
* @see {@link https://lua-api.factorio.com/latest/Concepts.html#SelectionModeFlags Online documentation}
|
4149
4147
|
*/
|
4150
4148
|
interface SelectionModeFlags {
|
@@ -4233,9 +4231,17 @@ interface SelectionModeFlags {
|
|
4233
4231
|
*/
|
4234
4232
|
readonly "entity-with-owner"?: true
|
4235
4233
|
/**
|
4236
|
-
* Selects entities that are not `rolling-
|
4234
|
+
* Selects entities that are not `rolling-stock`s.
|
4237
4235
|
*/
|
4238
4236
|
readonly "avoid-rolling-stock"?: true
|
4237
|
+
/**
|
4238
|
+
* Selects entities that are `entity-ghost`s.
|
4239
|
+
*/
|
4240
|
+
readonly "entity-ghost"?: true
|
4241
|
+
/**
|
4242
|
+
* Selects entities that are `tile-ghost`s.
|
4243
|
+
*/
|
4244
|
+
readonly "tile-ghost"?: true
|
4239
4245
|
}
|
4240
4246
|
|
4241
4247
|
interface LogisticFilter {
|
@@ -4253,10 +4259,6 @@ interface LogisticFilter {
|
|
4253
4259
|
readonly count: uint
|
4254
4260
|
}
|
4255
4261
|
|
4256
|
-
/**
|
4257
|
-
* @remarks Runtime settings can be changed through console commands and by the mod that owns the settings by writing a new table to the ModSetting.
|
4258
|
-
* @see {@link https://lua-api.factorio.com/latest/Concepts.html#ModSetting Online documentation}
|
4259
|
-
*/
|
4260
4262
|
interface ModSetting {
|
4261
4263
|
/**
|
4262
4264
|
* The value of the mod setting. The type depends on the kind of setting.
|
@@ -1333,6 +1333,22 @@ declare namespace defines {
|
|
1333
1333
|
* Event type: {@link OnPlayerAltReverseSelectedAreaEvent}
|
1334
1334
|
*/
|
1335
1335
|
const on_player_alt_reverse_selected_area: EventId<OnPlayerAltReverseSelectedAreaEvent>
|
1336
|
+
/**
|
1337
|
+
* Event type: {@link OnGuiHoverEvent}
|
1338
|
+
*/
|
1339
|
+
const on_gui_hover: EventId<OnGuiHoverEvent>
|
1340
|
+
/**
|
1341
|
+
* Event type: {@link OnGuiLeaveEvent}
|
1342
|
+
*/
|
1343
|
+
const on_gui_leave: EventId<OnGuiLeaveEvent>
|
1344
|
+
/**
|
1345
|
+
* Event type: {@link OnCutsceneStartedEvent}
|
1346
|
+
*/
|
1347
|
+
const on_cutscene_started: EventId<OnCutsceneStartedEvent>
|
1348
|
+
/**
|
1349
|
+
* Event type: {@link OnCutsceneFinishedEvent}
|
1350
|
+
*/
|
1351
|
+
const on_cutscene_finished: EventId<OnCutsceneFinishedEvent>
|
1336
1352
|
}
|
1337
1353
|
/**
|
1338
1354
|
* See the {@linkplain https://lua-api.factorio.com/latest/events.html events page} for more info on what events contain and when they get raised.
|
@@ -1458,6 +1474,8 @@ declare namespace defines {
|
|
1458
1474
|
gui_click,
|
1459
1475
|
gui_confirmed,
|
1460
1476
|
gui_elem_changed,
|
1477
|
+
gui_hover,
|
1478
|
+
gui_leave,
|
1461
1479
|
gui_location_changed,
|
1462
1480
|
gui_selected_tab_changed,
|
1463
1481
|
gui_selection_state_changed,
|
@@ -449,6 +449,44 @@ interface OnCutsceneCancelledEvent extends EventData {
|
|
449
449
|
readonly tick: uint
|
450
450
|
}
|
451
451
|
|
452
|
+
/**
|
453
|
+
* Called when a cutscene finishes naturally (was not cancelled).
|
454
|
+
* @see {@link https://lua-api.factorio.com/latest/events.html#on_cutscene_finished Online documentation}
|
455
|
+
*/
|
456
|
+
interface OnCutsceneFinishedEvent extends EventData {
|
457
|
+
/**
|
458
|
+
* The player the cutscene was shown to.
|
459
|
+
*/
|
460
|
+
readonly player_index: PlayerIndex
|
461
|
+
/**
|
462
|
+
* Identifier of the event
|
463
|
+
*/
|
464
|
+
readonly name: typeof defines.events.on_cutscene_finished
|
465
|
+
/**
|
466
|
+
* Tick the event was generated.
|
467
|
+
*/
|
468
|
+
readonly tick: uint
|
469
|
+
}
|
470
|
+
|
471
|
+
/**
|
472
|
+
* Called when a cutscene starts.
|
473
|
+
* @see {@link https://lua-api.factorio.com/latest/events.html#on_cutscene_started Online documentation}
|
474
|
+
*/
|
475
|
+
interface OnCutsceneStartedEvent extends EventData {
|
476
|
+
/**
|
477
|
+
* The player the cutscene is being shown to.
|
478
|
+
*/
|
479
|
+
readonly player_index: PlayerIndex
|
480
|
+
/**
|
481
|
+
* Identifier of the event
|
482
|
+
*/
|
483
|
+
readonly name: typeof defines.events.on_cutscene_started
|
484
|
+
/**
|
485
|
+
* Tick the event was generated.
|
486
|
+
*/
|
487
|
+
readonly tick: uint
|
488
|
+
}
|
489
|
+
|
452
490
|
/**
|
453
491
|
* Called when a cutscene is playing, each time it reaches a waypoint in that cutscene.
|
454
492
|
*
|
@@ -1083,6 +1121,52 @@ interface OnGuiElemChangedEvent extends EventData {
|
|
1083
1121
|
readonly tick: uint
|
1084
1122
|
}
|
1085
1123
|
|
1124
|
+
/**
|
1125
|
+
* Called when {@link LuaGuiElement} is hovered by the mouse.
|
1126
|
+
* @see {@link https://lua-api.factorio.com/latest/events.html#on_gui_hover Online documentation}
|
1127
|
+
*/
|
1128
|
+
interface OnGuiHoverEvent extends EventData {
|
1129
|
+
/**
|
1130
|
+
* The element that is being hovered over.
|
1131
|
+
*/
|
1132
|
+
readonly element: LuaGuiElement
|
1133
|
+
/**
|
1134
|
+
* The player whose cursor is hovering.
|
1135
|
+
*/
|
1136
|
+
readonly player_index: PlayerIndex
|
1137
|
+
/**
|
1138
|
+
* Identifier of the event
|
1139
|
+
*/
|
1140
|
+
readonly name: typeof defines.events.on_gui_hover
|
1141
|
+
/**
|
1142
|
+
* Tick the event was generated.
|
1143
|
+
*/
|
1144
|
+
readonly tick: uint
|
1145
|
+
}
|
1146
|
+
|
1147
|
+
/**
|
1148
|
+
* Called when the player's cursor leaves a {@link LuaGuiElement} that was previously hovered.
|
1149
|
+
* @see {@link https://lua-api.factorio.com/latest/events.html#on_gui_leave Online documentation}
|
1150
|
+
*/
|
1151
|
+
interface OnGuiLeaveEvent extends EventData {
|
1152
|
+
/**
|
1153
|
+
* The element that was being hovered.
|
1154
|
+
*/
|
1155
|
+
readonly element: LuaGuiElement
|
1156
|
+
/**
|
1157
|
+
* The player whose cursor was hovering.
|
1158
|
+
*/
|
1159
|
+
readonly player_index: PlayerIndex
|
1160
|
+
/**
|
1161
|
+
* Identifier of the event
|
1162
|
+
*/
|
1163
|
+
readonly name: typeof defines.events.on_gui_leave
|
1164
|
+
/**
|
1165
|
+
* Tick the event was generated.
|
1166
|
+
*/
|
1167
|
+
readonly tick: uint
|
1168
|
+
}
|
1169
|
+
|
1086
1170
|
/**
|
1087
1171
|
* Called when {@link LuaGuiElement} element location is changed (related to frames in `player.gui.screen`).
|
1088
1172
|
* @see {@link https://lua-api.factorio.com/latest/events.html#on_gui_location_changed Online documentation}
|
@@ -1962,7 +2046,7 @@ interface OnPlayerCreatedEvent extends EventData {
|
|
1962
2046
|
}
|
1963
2047
|
|
1964
2048
|
/**
|
1965
|
-
* Called after a
|
2049
|
+
* Called after a player's {@link LuaControl#cursor_stack cursor stack} changed in some way.
|
1966
2050
|
* @see {@link https://lua-api.factorio.com/latest/events.html#on_player_cursor_stack_changed Online documentation}
|
1967
2051
|
*/
|
1968
2052
|
interface OnPlayerCursorStackChangedEvent extends EventData {
|
@@ -2455,12 +2539,12 @@ interface OnPlayerPromotedEvent extends EventData {
|
|
2455
2539
|
}
|
2456
2540
|
|
2457
2541
|
/**
|
2458
|
-
* Called when a player is removed (deleted) from the game.
|
2542
|
+
* Called when a player is removed (deleted) from the game. This is markedly different from a player temporarily {@link OnPlayerLeftGameEvent leaving} the game, and instead behaves like the player never existed in the save file.
|
2459
2543
|
* @see {@link https://lua-api.factorio.com/latest/events.html#on_player_removed Online documentation}
|
2460
2544
|
*/
|
2461
2545
|
interface OnPlayerRemovedEvent extends EventData {
|
2462
2546
|
/**
|
2463
|
-
* The
|
2547
|
+
* The index of the removed player.
|
2464
2548
|
*/
|
2465
2549
|
readonly player_index: PlayerIndex
|
2466
2550
|
/**
|
@@ -3158,12 +3242,12 @@ interface OnPrePlayerMinedItemEvent extends EventData {
|
|
3158
3242
|
}
|
3159
3243
|
|
3160
3244
|
/**
|
3161
|
-
* Called before a player is removed (deleted) from the game.
|
3245
|
+
* Called before a player is removed (deleted) from the game. This is markedly different from a player temporarily {@link OnPlayerLeftGameEvent leaving} the game, and instead behaves like the player never existed in the save file.
|
3162
3246
|
* @see {@link https://lua-api.factorio.com/latest/events.html#on_pre_player_removed Online documentation}
|
3163
3247
|
*/
|
3164
3248
|
interface OnPrePlayerRemovedEvent extends EventData {
|
3165
3249
|
/**
|
3166
|
-
* The
|
3250
|
+
* The index of the removed player.
|
3167
3251
|
*/
|
3168
3252
|
readonly player_index: PlayerIndex
|
3169
3253
|
/**
|
@@ -3886,7 +3970,7 @@ interface OnSurfaceDeletedEvent extends EventData {
|
|
3886
3970
|
}
|
3887
3971
|
|
3888
3972
|
/**
|
3889
|
-
* Called after a surface is imported.
|
3973
|
+
* Called after a surface is imported via the map editor.
|
3890
3974
|
* @see {@link https://lua-api.factorio.com/latest/events.html#on_surface_imported Online documentation}
|
3891
3975
|
*/
|
3892
3976
|
interface OnSurfaceImportedEvent extends EventData {
|