typed-factorio 0.7.0 → 0.7.4
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/generated/classes.d.ts +71 -50
- package/generated/defines.d.ts +7 -0
- package/generated/events.d.ts +1 -1
- package/package.json +3 -3
package/generated/classes.d.ts
CHANGED
@@ -336,7 +336,7 @@ interface LuaBootstrap {
|
|
336
336
|
f: ((data: E["_eventData"]) => void) | undefined,
|
337
337
|
filters?: E["_filter"][]
|
338
338
|
): void
|
339
|
-
on_event<E extends EventId<any
|
339
|
+
on_event<E extends EventId<any>>(event: E | E[], f: ((data: E["_eventData"]) => void) | undefined): void
|
340
340
|
on_event(event: string, f: ((data: CustomInputEvent) => void) | undefined): void
|
341
341
|
/**
|
342
342
|
* Register a handler to run every nth-tick(s). When the game is on tick 0 it will trigger all registered handlers.
|
@@ -1388,9 +1388,15 @@ interface LuaControl {
|
|
1388
1388
|
*/
|
1389
1389
|
selected: LuaEntity | undefined
|
1390
1390
|
/**
|
1391
|
-
* The GUI
|
1391
|
+
* The GUI the player currently has open, or `nil` if no GUI is open. Writing to it fires the
|
1392
|
+
* {@link OnGuiOpenedEvent on_gui_opened} event.
|
1392
1393
|
*
|
1393
|
-
*
|
1394
|
+
* This is the GUI that will asked to close (by firing the {@link OnGuiClosedEvent on_gui_closed} event) when the
|
1395
|
+
* `Esc` or `E` keys are pressed. If this attribute is not `nil`, and a new GUI is written to it, the existing one
|
1396
|
+
* will be asked to close.
|
1397
|
+
*
|
1398
|
+
* **Note**: Write supports any of the types. Read will return the `entity`, `equipment`, `equipment-grid`,
|
1399
|
+
* `player`, `element` or `nil`.
|
1394
1400
|
*
|
1395
1401
|
* {@link https://lua-api.factorio.com/next/LuaControl.html#LuaControl.opened View documentation}
|
1396
1402
|
*/
|
@@ -2608,7 +2614,7 @@ interface LuaEntity extends LuaControl {
|
|
2608
2614
|
/**
|
2609
2615
|
* Get the rails that this signal is connected to.
|
2610
2616
|
*
|
2611
|
-
* *Can only be used if this is RailSignal*
|
2617
|
+
* *Can only be used if this is RailSignal or RailChainSignal*
|
2612
2618
|
*
|
2613
2619
|
* {@link https://lua-api.factorio.com/next/LuaEntity.html#LuaEntity.get_connected_rails View documentation}
|
2614
2620
|
*/
|
@@ -2868,7 +2874,7 @@ interface LuaEntity extends LuaControl {
|
|
2868
2874
|
/**
|
2869
2875
|
* Sets the current recipe in this assembly machine.
|
2870
2876
|
*
|
2871
|
-
* *Can only be used if this is
|
2877
|
+
* *Can only be used if this is AssemblingMachine*
|
2872
2878
|
*
|
2873
2879
|
* {@link https://lua-api.factorio.com/next/LuaEntity.html#LuaEntity.set_recipe View documentation}
|
2874
2880
|
*
|
@@ -3285,7 +3291,7 @@ interface LuaEntity extends LuaControl {
|
|
3285
3291
|
*
|
3286
3292
|
* {@link https://lua-api.factorio.com/next/LuaEntity.html#LuaEntity.name View documentation}
|
3287
3293
|
*/
|
3288
|
-
readonly name:
|
3294
|
+
readonly name: string
|
3289
3295
|
/**
|
3290
3296
|
* Name of the entity or tile contained in this ghost
|
3291
3297
|
*
|
@@ -3695,7 +3701,7 @@ interface LuaEntity extends LuaControl {
|
|
3695
3701
|
/**
|
3696
3702
|
* The state of this rail signal.
|
3697
3703
|
*
|
3698
|
-
* *Can only be used if this is RailSignal*
|
3704
|
+
* *Can only be used if this is RailSignal or RailChainSignal*
|
3699
3705
|
*
|
3700
3706
|
* {@link https://lua-api.factorio.com/next/LuaEntity.html#LuaEntity.signal_state View documentation}
|
3701
3707
|
*/
|
@@ -7890,53 +7896,59 @@ interface LuaGameScript {
|
|
7890
7896
|
*/
|
7891
7897
|
regenerate_entity(entities: string | string[]): void
|
7892
7898
|
/**
|
7893
|
-
* Take a screenshot and save it to a file.
|
7899
|
+
* Take a screenshot and save it to a file. The filename should include a file extension indicating the desired
|
7900
|
+
* image format. Supports `.png`, `.jpg` / `.jpeg`, `.tga` and `.bmp`.
|
7894
7901
|
*
|
7895
7902
|
* **Note**: If Factorio is running headless, this function will do nothing.
|
7896
7903
|
*
|
7897
7904
|
* {@link https://lua-api.factorio.com/next/LuaGameScript.html#LuaGameScript.take_screenshot View documentation}
|
7898
7905
|
*/
|
7899
7906
|
take_screenshot(params: {
|
7907
|
+
/** The player to focus on. Defaults to the local player. */
|
7900
7908
|
readonly player?: PlayerIdentification
|
7901
7909
|
/** If defined, the screenshot will only be taken for this player. */
|
7902
7910
|
readonly by_player?: PlayerIdentification
|
7903
7911
|
/** If defined, the screenshot will be taken on this surface. */
|
7904
7912
|
readonly surface?: SurfaceIdentification
|
7905
|
-
/** If defined, the screenshot will be centered on this position. */
|
7913
|
+
/** If defined, the screenshot will be centered on this position. Otherwise, the screenshot will center on `player`. */
|
7906
7914
|
readonly position?: Position
|
7907
7915
|
/**
|
7908
|
-
*
|
7909
|
-
* resolution is 4096x4096 (resp. 2048x2048).
|
7916
|
+
* The maximum allowed resolution is 16384x16384 (8192x8192 when `anti_alias` is `true`), but the maximum
|
7917
|
+
* recommended resolution is 4096x4096 (resp. 2048x2048).
|
7910
7918
|
*/
|
7911
7919
|
readonly resolution?: Position
|
7920
|
+
/** The map zoom to take the screenshot at. Defaults to `1`. */
|
7912
7921
|
readonly zoom?: double
|
7913
|
-
/**
|
7922
|
+
/** The sub-path in `"script-output"` to save the screenshot to. Defaults to `"screenshot.png"`. */
|
7914
7923
|
readonly path?: string
|
7915
|
-
/**
|
7924
|
+
/** Whether to include GUIs in the screenshot or not. Defaults to `false`. */
|
7916
7925
|
readonly show_gui?: boolean
|
7917
|
-
/**
|
7926
|
+
/** Whether to include entity info ("Alt mode") or not. Defaults to `false`. */
|
7918
7927
|
readonly show_entity_info?: boolean
|
7919
|
-
/**
|
7928
|
+
/**
|
7929
|
+
* When `true` and when `player` is specified, the building preview for the item in the player's cursor will
|
7930
|
+
* also be rendered. Defaults to `false`.
|
7931
|
+
*/
|
7920
7932
|
readonly show_cursor_building_preview?: boolean
|
7921
|
-
/**
|
7933
|
+
/** Whether to render in double resolution and downscale the result (including GUI). Defaults to `false`. */
|
7922
7934
|
readonly anti_alias?: boolean
|
7923
|
-
/** The render quality if using jpg format (0-100 inclusive). */
|
7924
|
-
readonly quality?: int
|
7925
7935
|
/**
|
7926
|
-
*
|
7927
|
-
*
|
7936
|
+
* The `.jpg` render quality as a percentage (from 0% to 100% inclusive), if used. A lower value means a more
|
7937
|
+
* compressed image. Defaults to `80`.
|
7928
7938
|
*/
|
7939
|
+
readonly quality?: int
|
7940
|
+
/** Whether to save the screenshot even during replay playback. Defaults to `false`. */
|
7929
7941
|
readonly allow_in_replay?: boolean
|
7930
|
-
/** Overrides current surface daytime for duration of screenshot rendering. */
|
7942
|
+
/** Overrides the current surface daytime for the duration of screenshot rendering. */
|
7931
7943
|
readonly daytime?: double
|
7932
|
-
/** Overrides tick of water animation
|
7944
|
+
/** Overrides the tick of water animation, if animated water is enabled. */
|
7933
7945
|
readonly water_tick?: uint
|
7934
7946
|
/**
|
7935
|
-
* Screenshot requests are processed in between update and render. The game may skip rendering (drop
|
7936
|
-
* previous frame has not finished rendering or the game simulation starts to fall
|
7937
|
-
* If force_render is set to true
|
7938
|
-
* the update in which the request was created. This is not honored on multiplayer clients
|
7939
|
-
* to server.
|
7947
|
+
* Screenshot requests are processed in between game update and render. The game may skip rendering (ie. drop
|
7948
|
+
* frames) if the previous frame has not finished rendering or the game simulation starts to fall below 60
|
7949
|
+
* updates per second. If `force_render` is set to `true`, the game won't drop frames and process the screenshot
|
7950
|
+
* request at the end of the update in which the request was created. This is not honored on multiplayer clients
|
7951
|
+
* that are catching up to server. Defaults to `false`.
|
7940
7952
|
*/
|
7941
7953
|
readonly force_render?: boolean
|
7942
7954
|
}): void
|
@@ -7946,12 +7958,18 @@ interface LuaGameScript {
|
|
7946
7958
|
* {@link https://lua-api.factorio.com/next/LuaGameScript.html#LuaGameScript.set_wait_for_screenshots_to_finish View documentation}
|
7947
7959
|
*/
|
7948
7960
|
set_wait_for_screenshots_to_finish(): void
|
7961
|
+
/**
|
7962
|
+
* Take a screenshot of the technology screen and save it to a file. The filename should include a file extension
|
7963
|
+
* indicating the desired image format. Supports `.png`, `.jpg` / `.jpeg`, `.tga` and `.bmp`.
|
7964
|
+
*
|
7965
|
+
* {@link https://lua-api.factorio.com/next/LuaGameScript.html#LuaGameScript.take_technology_screenshot View documentation}
|
7966
|
+
*/
|
7949
7967
|
take_technology_screenshot(params: {
|
7950
|
-
/** The force to
|
7968
|
+
/** The force whose technology to screenshot. If not given, the `"player`" force is used. */
|
7951
7969
|
readonly force?: ForceIdentification
|
7952
|
-
/**
|
7970
|
+
/** The sub-path in `"script-output"` to save the screenshot to. Defaults to `"technology-screenshot.png"`. */
|
7953
7971
|
readonly path?: string
|
7954
|
-
/** If
|
7972
|
+
/** If given, the screenshot will only be taken for this player. */
|
7955
7973
|
readonly by_player?: PlayerIdentification
|
7956
7974
|
/** The technology to highlight. */
|
7957
7975
|
readonly selected_technology?: TechnologyIdentification
|
@@ -7960,7 +7978,10 @@ interface LuaGameScript {
|
|
7960
7978
|
* technology's parents. Defaults to `false`.
|
7961
7979
|
*/
|
7962
7980
|
readonly skip_disabled?: boolean
|
7963
|
-
/**
|
7981
|
+
/**
|
7982
|
+
* The `.jpg` render quality as a percentage (from 0% to 100% inclusive), if used. A lower value means a more
|
7983
|
+
* compressed image. Defaults to `80`.
|
7984
|
+
*/
|
7964
7985
|
readonly quality?: int
|
7965
7986
|
}): void
|
7966
7987
|
/**
|
@@ -9838,7 +9859,7 @@ interface BaseGuiElement {
|
|
9838
9859
|
*/
|
9839
9860
|
show_percent_for_small_numbers: boolean
|
9840
9861
|
/**
|
9841
|
-
* The location of this widget when stored in {@link LuaGui.screen LuaGui::screen} or `nil` if not
|
9862
|
+
* The location of this widget when stored in {@link LuaGui.screen LuaGui::screen}, or `nil` if not set or not in
|
9842
9863
|
* {@link LuaGui.screen LuaGui::screen}.
|
9843
9864
|
*
|
9844
9865
|
* {@link https://lua-api.factorio.com/next/LuaGuiElement.html#LuaGuiElement.location View documentation}
|
@@ -11311,7 +11332,7 @@ interface LuaItemPrototype {
|
|
11311
11332
|
*
|
11312
11333
|
* {@link https://lua-api.factorio.com/next/LuaItemPrototype.html#LuaItemPrototype.type View documentation}
|
11313
11334
|
*/
|
11314
|
-
readonly type:
|
11335
|
+
readonly type: string
|
11315
11336
|
/**
|
11316
11337
|
* Name of this prototype.
|
11317
11338
|
*
|
@@ -14424,7 +14445,7 @@ interface LuaPlayer extends LuaControl {
|
|
14424
14445
|
* Gets the current per-player settings for the this player, indexed by prototype name. Returns the same structure
|
14425
14446
|
* as {@link LuaSettings.get_player_settings LuaSettings::get_player_settings}.
|
14426
14447
|
*
|
14427
|
-
* **Note**: This
|
14448
|
+
* **Note**: This table will become invalid if its associated player does.
|
14428
14449
|
*
|
14429
14450
|
* {@link https://lua-api.factorio.com/next/LuaPlayer.html#LuaPlayer.mod_settings View documentation}
|
14430
14451
|
*/
|
@@ -16705,7 +16726,7 @@ interface LuaSettings {
|
|
16705
16726
|
* Gets the current per-player settings for the given player, indexed by prototype name. Returns the same structure
|
16706
16727
|
* as {@link LuaPlayer.mod_settings LuaPlayer::mod_settings}.
|
16707
16728
|
*
|
16708
|
-
* **Note**: This
|
16729
|
+
* **Note**: This table will become invalid if its associated player does.
|
16709
16730
|
*
|
16710
16731
|
* {@link https://lua-api.factorio.com/next/LuaSettings.html#LuaSettings.get_player_settings View documentation}
|
16711
16732
|
*
|
@@ -17542,15 +17563,15 @@ interface LuaSurface {
|
|
17542
17563
|
*/
|
17543
17564
|
find_entities(area?: BoundingBox): LuaEntity[]
|
17544
17565
|
/**
|
17545
|
-
* Find entities of given type or name in
|
17566
|
+
* Find all entities of the given type or name in the given area.
|
17546
17567
|
*
|
17547
|
-
* If no filters (`name`, `type`, `force`, etc.) are given, returns all entities in the search area. If
|
17548
|
-
* filters are specified,
|
17568
|
+
* If no filters (`name`, `type`, `force`, etc.) are given, this returns all entities in the search area. If
|
17569
|
+
* multiple filters are specified, only entities matching all given filters are returned.
|
17549
17570
|
*
|
17550
|
-
* If no area or position are given,
|
17551
|
-
* colliding with that position (i.e the given position is within the entity's collision box). If
|
17552
|
-
* radius are given, returns entities
|
17553
|
-
* colliding with that area.
|
17571
|
+
* If no `area` or `position` are given, the entire surface is searched. If `position` is given, this returns the
|
17572
|
+
* entities colliding with that position (i.e the given position is within the entity's collision box). If
|
17573
|
+
* `position` and `radius` are given, this returns the entities within the radius of the position. If `area` is
|
17574
|
+
* specified, this returns the entities colliding with that area.
|
17554
17575
|
*
|
17555
17576
|
* {@link https://lua-api.factorio.com/next/LuaSurface.html#LuaSurface.find_entities_filtered View documentation}
|
17556
17577
|
*
|
@@ -17587,11 +17608,11 @@ interface LuaSurface {
|
|
17587
17608
|
readonly invert?: boolean
|
17588
17609
|
}): LuaEntity[]
|
17589
17610
|
/**
|
17590
|
-
* Find tiles of
|
17611
|
+
* Find all tiles of the given name in the given area.
|
17591
17612
|
*
|
17592
|
-
* If no filters are given returns all tiles in the search area.
|
17613
|
+
* If no filters are given, this returns all tiles in the search area.
|
17593
17614
|
*
|
17594
|
-
* If no area or position and radius is given,
|
17615
|
+
* If no `area` or `position` and `radius` is given, the entire surface is searched. If `position` and `radius` are
|
17595
17616
|
* given, only tiles within the radius of the position are included.
|
17596
17617
|
*
|
17597
17618
|
* {@link https://lua-api.factorio.com/next/LuaSurface.html#LuaSurface.find_tiles_filtered View documentation}
|
@@ -17613,10 +17634,10 @@ interface LuaSurface {
|
|
17613
17634
|
* As it doesn't construct all the wrapper objects, this is more efficient if one is only interested in the number
|
17614
17635
|
* of entities.
|
17615
17636
|
*
|
17616
|
-
* If no area or position are given,
|
17617
|
-
* colliding with that position (i.e the given position is within the entity's collision box). If
|
17618
|
-
* radius are given, returns entities in
|
17619
|
-
* colliding with that area.
|
17637
|
+
* If no `area` or `position` are given, the entire surface is searched. If `position` is given, this returns the
|
17638
|
+
* entities colliding with that position (i.e the given position is within the entity's collision box). If
|
17639
|
+
* `position` and `radius` are given, this returns entities in the radius of the position. If `area` is specified,
|
17640
|
+
* this returns entities colliding with that area.
|
17620
17641
|
*
|
17621
17642
|
* {@link https://lua-api.factorio.com/next/LuaSurface.html#LuaSurface.count_entities_filtered View documentation}
|
17622
17643
|
*/
|
@@ -17646,7 +17667,7 @@ interface LuaSurface {
|
|
17646
17667
|
* {@link LuaSurface.find_tiles_filtered LuaSurface::find_tiles_filtered}, except this only returns the count. As it
|
17647
17668
|
* doesn't construct all the wrapper objects, this is more efficient if one is only interested in the number of tiles.
|
17648
17669
|
*
|
17649
|
-
* If no area or position and radius is given,
|
17670
|
+
* If no `area` or `position` and `radius` is given, the entire surface is searched. If `position` and `radius` are
|
17650
17671
|
* given, only tiles within the radius of the position are included.
|
17651
17672
|
*
|
17652
17673
|
* {@link https://lua-api.factorio.com/next/LuaSurface.html#LuaSurface.count_tiles_filtered View documentation}
|
package/generated/defines.d.ts
CHANGED
@@ -1081,6 +1081,13 @@ declare namespace defines {
|
|
1081
1081
|
/** Event type: {@link OnEquipmentRemovedEvent} */
|
1082
1082
|
const on_equipment_removed: EventId<OnEquipmentRemovedEvent>
|
1083
1083
|
}
|
1084
|
+
/**
|
1085
|
+
* See the {@link https://lua-api.factorio.com/next/events.html events page} for more info on what events contain and
|
1086
|
+
* when they get raised.
|
1087
|
+
*
|
1088
|
+
* {@link https://lua-api.factorio.com/next/defines.html#defines.events View documentation}
|
1089
|
+
*/
|
1090
|
+
type events = typeof events[keyof typeof events]
|
1084
1091
|
enum flow_precision_index {
|
1085
1092
|
five_seconds,
|
1086
1093
|
one_minute,
|
package/generated/events.d.ts
CHANGED
@@ -2962,7 +2962,7 @@ interface ScriptRaisedSetTilesEvent {
|
|
2962
2962
|
}
|
2963
2963
|
|
2964
2964
|
/** An event id. */
|
2965
|
-
type EventId<T extends table, F
|
2965
|
+
type EventId<T extends table, F = unknown> = uint & {
|
2966
2966
|
readonly _eventData: T
|
2967
2967
|
readonly _filter: F
|
2968
2968
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "typed-factorio",
|
3
|
-
"version": "0.7.
|
3
|
+
"version": "0.7.4",
|
4
4
|
"description": "Featureful typescript definitions for the the Factorio modding lua api.",
|
5
5
|
"keywords": [
|
6
6
|
"factorio",
|
@@ -25,7 +25,6 @@
|
|
25
25
|
},
|
26
26
|
"dependencies": {
|
27
27
|
"lua-types": "^2.10.1",
|
28
|
-
"typescript": "~4.3.5",
|
29
28
|
"typescript-to-lua": "^1.0.0"
|
30
29
|
},
|
31
30
|
"devDependencies": {
|
@@ -34,6 +33,7 @@
|
|
34
33
|
"jest": "^27.0.6",
|
35
34
|
"prettier": "^2.3.2",
|
36
35
|
"ts-jest": "^27.0.4",
|
37
|
-
"ts-node": "^10.1.0"
|
36
|
+
"ts-node": "^10.1.0",
|
37
|
+
"typescript": "~4.3.5"
|
38
38
|
}
|
39
39
|
}
|