factorio-types 1.2.23 → 1.2.25
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 +360 -18
- package/dist/concepts.d.ts +82 -10
- package/dist/datacollection.d.ts +1 -1
- package/dist/defines.d.ts +431 -379
- package/dist/events.d.ts +80 -2
- package/dist/global.d.ts +1 -1
- package/dist/prototypes.d.ts +56 -11
- package/dist/types.d.ts +104 -66
- package/package.json +2 -2
package/dist/classes.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
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 2.0.
|
|
5
|
+
// Factorio version 2.0.37
|
|
6
6
|
// API version 6
|
|
7
7
|
|
|
8
8
|
declare namespace runtime {
|
|
@@ -563,6 +563,24 @@ interface LuaBootstrap {
|
|
|
563
563
|
script.on_event(defines.events.on_built_entity,
|
|
564
564
|
function(event) game.print("Gotta go fast!") end,
|
|
565
565
|
{{filter = "name", name = "fast-inserter"}})
|
|
566
|
+
```
|
|
567
|
+
*/
|
|
568
|
+
on_event(this: void, event: defines.events.on_cargo_pod_delivered_cargo, handler: ((this: void, arg0: runtime.on_cargo_pod_delivered_cargo) => any) | nil, filters?: EventFilter): void;
|
|
569
|
+
/**
|
|
570
|
+
* Register a handler to run on the specified event(s). Each mod can only register once for every event, as any additional registration will overwrite the previous one. This holds true even if different filters are used for subsequent registrations.
|
|
571
|
+
* @param event The event(s) or custom-input to invoke the handler on.
|
|
572
|
+
* @param handler The handler for this event. Passing `nil` will unregister it.
|
|
573
|
+
* @param filters The filters for this event. Can only be used when registering for individual events.
|
|
574
|
+
* @example ```
|
|
575
|
+
-- Register for the on_tick event to print the current tick to console each tick
|
|
576
|
+
script.on_event(defines.events.on_tick,
|
|
577
|
+
function(event) game.print(event.tick) end)
|
|
578
|
+
```
|
|
579
|
+
* @example ```
|
|
580
|
+
-- Register for the on_built_entity event, limiting it to only be received when a `"fast-inserter"` is built
|
|
581
|
+
script.on_event(defines.events.on_built_entity,
|
|
582
|
+
function(event) game.print("Gotta go fast!") end,
|
|
583
|
+
{{filter = "name", name = "fast-inserter"}})
|
|
566
584
|
```
|
|
567
585
|
*/
|
|
568
586
|
on_event(this: void, event: defines.events.on_cargo_pod_finished_ascending, handler: ((this: void, arg0: runtime.on_cargo_pod_finished_ascending) => any) | nil, filters?: EventFilter): void;
|
|
@@ -581,6 +599,24 @@ interface LuaBootstrap {
|
|
|
581
599
|
script.on_event(defines.events.on_built_entity,
|
|
582
600
|
function(event) game.print("Gotta go fast!") end,
|
|
583
601
|
{{filter = "name", name = "fast-inserter"}})
|
|
602
|
+
```
|
|
603
|
+
*/
|
|
604
|
+
on_event(this: void, event: defines.events.on_cargo_pod_finished_descending, handler: ((this: void, arg0: runtime.on_cargo_pod_finished_descending) => any) | nil, filters?: EventFilter): void;
|
|
605
|
+
/**
|
|
606
|
+
* Register a handler to run on the specified event(s). Each mod can only register once for every event, as any additional registration will overwrite the previous one. This holds true even if different filters are used for subsequent registrations.
|
|
607
|
+
* @param event The event(s) or custom-input to invoke the handler on.
|
|
608
|
+
* @param handler The handler for this event. Passing `nil` will unregister it.
|
|
609
|
+
* @param filters The filters for this event. Can only be used when registering for individual events.
|
|
610
|
+
* @example ```
|
|
611
|
+
-- Register for the on_tick event to print the current tick to console each tick
|
|
612
|
+
script.on_event(defines.events.on_tick,
|
|
613
|
+
function(event) game.print(event.tick) end)
|
|
614
|
+
```
|
|
615
|
+
* @example ```
|
|
616
|
+
-- Register for the on_built_entity event, limiting it to only be received when a `"fast-inserter"` is built
|
|
617
|
+
script.on_event(defines.events.on_built_entity,
|
|
618
|
+
function(event) game.print("Gotta go fast!") end,
|
|
619
|
+
{{filter = "name", name = "fast-inserter"}})
|
|
584
620
|
```
|
|
585
621
|
*/
|
|
586
622
|
on_event(this: void, event: defines.events.on_character_corpse_expired, handler: ((this: void, arg0: runtime.on_character_corpse_expired) => any) | nil, filters?: EventFilter): void;
|
|
@@ -1499,6 +1535,24 @@ interface LuaBootstrap {
|
|
|
1499
1535
|
script.on_event(defines.events.on_built_entity,
|
|
1500
1536
|
function(event) game.print("Gotta go fast!") end,
|
|
1501
1537
|
{{filter = "name", name = "fast-inserter"}})
|
|
1538
|
+
```
|
|
1539
|
+
*/
|
|
1540
|
+
on_event(this: void, event: defines.events.on_multiplayer_init, handler: ((this: void, arg0: runtime.on_multiplayer_init) => any) | nil, filters?: EventFilter): void;
|
|
1541
|
+
/**
|
|
1542
|
+
* Register a handler to run on the specified event(s). Each mod can only register once for every event, as any additional registration will overwrite the previous one. This holds true even if different filters are used for subsequent registrations.
|
|
1543
|
+
* @param event The event(s) or custom-input to invoke the handler on.
|
|
1544
|
+
* @param handler The handler for this event. Passing `nil` will unregister it.
|
|
1545
|
+
* @param filters The filters for this event. Can only be used when registering for individual events.
|
|
1546
|
+
* @example ```
|
|
1547
|
+
-- Register for the on_tick event to print the current tick to console each tick
|
|
1548
|
+
script.on_event(defines.events.on_tick,
|
|
1549
|
+
function(event) game.print(event.tick) end)
|
|
1550
|
+
```
|
|
1551
|
+
* @example ```
|
|
1552
|
+
-- Register for the on_built_entity event, limiting it to only be received when a `"fast-inserter"` is built
|
|
1553
|
+
script.on_event(defines.events.on_built_entity,
|
|
1554
|
+
function(event) game.print("Gotta go fast!") end,
|
|
1555
|
+
{{filter = "name", name = "fast-inserter"}})
|
|
1502
1556
|
```
|
|
1503
1557
|
*/
|
|
1504
1558
|
on_event(this: void, event: defines.events.on_object_destroyed, handler: ((this: void, arg0: runtime.on_object_destroyed) => any) | nil, filters?: EventFilter): void;
|
|
@@ -3425,6 +3479,24 @@ interface LuaBootstrap {
|
|
|
3425
3479
|
script.on_event(defines.events.on_built_entity,
|
|
3426
3480
|
function(event) game.print("Gotta go fast!") end,
|
|
3427
3481
|
{{filter = "name", name = "fast-inserter"}})
|
|
3482
|
+
```
|
|
3483
|
+
*/
|
|
3484
|
+
on_event(this: void, event: defines.events.on_singleplayer_init, handler: ((this: void, arg0: runtime.on_singleplayer_init) => any) | nil, filters?: EventFilter): void;
|
|
3485
|
+
/**
|
|
3486
|
+
* Register a handler to run on the specified event(s). Each mod can only register once for every event, as any additional registration will overwrite the previous one. This holds true even if different filters are used for subsequent registrations.
|
|
3487
|
+
* @param event The event(s) or custom-input to invoke the handler on.
|
|
3488
|
+
* @param handler The handler for this event. Passing `nil` will unregister it.
|
|
3489
|
+
* @param filters The filters for this event. Can only be used when registering for individual events.
|
|
3490
|
+
* @example ```
|
|
3491
|
+
-- Register for the on_tick event to print the current tick to console each tick
|
|
3492
|
+
script.on_event(defines.events.on_tick,
|
|
3493
|
+
function(event) game.print(event.tick) end)
|
|
3494
|
+
```
|
|
3495
|
+
* @example ```
|
|
3496
|
+
-- Register for the on_built_entity event, limiting it to only be received when a `"fast-inserter"` is built
|
|
3497
|
+
script.on_event(defines.events.on_built_entity,
|
|
3498
|
+
function(event) game.print("Gotta go fast!") end,
|
|
3499
|
+
{{filter = "name", name = "fast-inserter"}})
|
|
3428
3500
|
```
|
|
3429
3501
|
*/
|
|
3430
3502
|
on_event(this: void, event: defines.events.on_space_platform_built_entity, handler: ((this: void, arg0: runtime.on_space_platform_built_entity) => any) | nil, filters?: EventFilter): void;
|
|
@@ -4163,7 +4235,8 @@ interface LuaBootstrap {
|
|
|
4163
4235
|
* The metatable first needs to be defined in the mod's root scope, then registered using this method. From then on, it will be properly restored for tables in {@link storage | runtime:storage}.
|
|
4164
4236
|
*
|
|
4165
4237
|
* ```
|
|
4166
|
-
* local metatable =
|
|
4238
|
+
* local metatable =
|
|
4239
|
+
* {
|
|
4167
4240
|
* __index = function(key)
|
|
4168
4241
|
* return "no value for key " .. key
|
|
4169
4242
|
* end
|
|
@@ -4393,6 +4466,28 @@ interface LuaBurnerUsagePrototype extends LuaPrototypeBase {
|
|
|
4393
4466
|
*/
|
|
4394
4467
|
readonly valid: boolean;
|
|
4395
4468
|
}
|
|
4469
|
+
/**
|
|
4470
|
+
* A cargo hatch.
|
|
4471
|
+
*/
|
|
4472
|
+
interface LuaCargoHatch {
|
|
4473
|
+
/**
|
|
4474
|
+
* Creates a cargo pod for output at the owning entity hatch location.
|
|
4475
|
+
*/
|
|
4476
|
+
create_cargo_pod(this: void): LuaEntity;
|
|
4477
|
+
readonly busy: boolean;
|
|
4478
|
+
readonly is_input_compatible: boolean;
|
|
4479
|
+
readonly is_output_compatible: boolean;
|
|
4480
|
+
/**
|
|
4481
|
+
* 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.
|
|
4482
|
+
*/
|
|
4483
|
+
readonly object_name: string;
|
|
4484
|
+
readonly owner: LuaEntity;
|
|
4485
|
+
readonly reserved: boolean;
|
|
4486
|
+
/**
|
|
4487
|
+
* Is this object valid? This Lua object holds a reference to an object within the game engine. It is possible that the game-engine object is removed whilst a mod still holds the corresponding Lua object. If that happens, the object becomes invalid, i.e. this attribute will be `false`. Mods are advised to check for object validity if any change to the game state might have occurred between the creation of the Lua object and its access.
|
|
4488
|
+
*/
|
|
4489
|
+
readonly valid: boolean;
|
|
4490
|
+
}
|
|
4396
4491
|
/**
|
|
4397
4492
|
* Control behavior for cargo landing pad.
|
|
4398
4493
|
*/
|
|
@@ -5664,6 +5759,13 @@ interface LuaEntity extends LuaControl {
|
|
|
5664
5759
|
* 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}`
|
|
5665
5760
|
*/
|
|
5666
5761
|
create_build_effect_smoke(this: void): void;
|
|
5762
|
+
/**
|
|
5763
|
+
* Creates a cargo pod if possible.
|
|
5764
|
+
*
|
|
5765
|
+
* Cargo pod will be created with {@link invalid | runtime:defines.cargo_destination.invalid} destination type. Setting {@link cargo_pod_destination | runtime:LuaEntity::cargo_pod_destination} will cause it to launch.
|
|
5766
|
+
* @param cargo_hatch The hatch to create the pod at. A random (available) one is picked if not provided.
|
|
5767
|
+
*/
|
|
5768
|
+
create_cargo_pod(this: void, cargo_hatch?: LuaCargoHatch): LuaEntity | null;
|
|
5667
5769
|
/**
|
|
5668
5770
|
* Damages the entity.
|
|
5669
5771
|
* @param damage The amount of damage to be done.
|
|
@@ -6159,7 +6261,7 @@ interface LuaEntity extends LuaControl {
|
|
|
6159
6261
|
* Plays a note with the given instrument and note.
|
|
6160
6262
|
* @returns Whether the request is valid. The sound may or may not be played depending on polyphony settings.
|
|
6161
6263
|
*/
|
|
6162
|
-
play_note(this: void, instrument: uint, note: uint): boolean;
|
|
6264
|
+
play_note(this: void, instrument: uint, note: uint, stop_playing_sounds?: boolean): boolean;
|
|
6163
6265
|
/**
|
|
6164
6266
|
* Release the unit from the spawner which spawned it. This allows the spawner to continue spawning additional units.
|
|
6165
6267
|
*/
|
|
@@ -6381,6 +6483,10 @@ interface LuaEntity extends LuaControl {
|
|
|
6381
6483
|
* A character associated with a player is not directly controlled by any player.
|
|
6382
6484
|
*/
|
|
6383
6485
|
associated_player?: LuaPlayer | PlayerIdentification;
|
|
6486
|
+
/**
|
|
6487
|
+
* The cargo pod attached to this rocket silo rocket if any.
|
|
6488
|
+
*/
|
|
6489
|
+
readonly attached_cargo_pod?: LuaEntity;
|
|
6384
6490
|
/**
|
|
6385
6491
|
* Destination of this spidertron's autopilot, if any. Writing `nil` clears all destinations.
|
|
6386
6492
|
*/
|
|
@@ -6438,6 +6544,20 @@ interface LuaEntity extends LuaControl {
|
|
|
6438
6544
|
* The burner energy source for this entity, if any.
|
|
6439
6545
|
*/
|
|
6440
6546
|
readonly burner?: LuaBurner;
|
|
6547
|
+
/**
|
|
6548
|
+
* The cargo hatches owned by this entity if any.
|
|
6549
|
+
*/
|
|
6550
|
+
readonly cargo_hatches: LuaCargoHatch[];
|
|
6551
|
+
/**
|
|
6552
|
+
* The destination of this cargo pod entity.
|
|
6553
|
+
*
|
|
6554
|
+
* Use {@link force_finish_ascending | runtime:LuaEntity::force_finish_ascending} if you want it to only descend from orbit.
|
|
6555
|
+
*/
|
|
6556
|
+
cargo_pod_destination: CargoDestination;
|
|
6557
|
+
/**
|
|
6558
|
+
* The state of this cargo pod entity.
|
|
6559
|
+
*/
|
|
6560
|
+
readonly cargo_pod_state: 'awaiting_launch' | 'ascending' | 'surface_transition' | 'descending' | 'parking';
|
|
6441
6561
|
/**
|
|
6442
6562
|
* The state of this chain signal.
|
|
6443
6563
|
*/
|
|
@@ -6826,6 +6946,10 @@ interface LuaEntity extends LuaControl {
|
|
|
6826
6946
|
* Can also be used on entity ghost if it contains linked-belt.
|
|
6827
6947
|
*/
|
|
6828
6948
|
linked_belt_type: 'input' | 'output';
|
|
6949
|
+
/**
|
|
6950
|
+
* The belt stack size override for this loader. Set to `0` to disable. Writing this value requires {@link LoaderPrototype::adjustable_belt_stack_size | prototype:LoaderPrototype::adjustable_belt_stack_size} to be `true`.
|
|
6951
|
+
*/
|
|
6952
|
+
loader_belt_stack_size_override: uint8;
|
|
6829
6953
|
/**
|
|
6830
6954
|
* The container entity this loader is pointing at/pulling from depending on the {@link LuaEntity::loader_type | runtime:LuaEntity::loader_type}, if any.
|
|
6831
6955
|
*/
|
|
@@ -7045,6 +7169,10 @@ interface LuaEntity extends LuaControl {
|
|
|
7045
7169
|
* Get the current queue of robot orders.
|
|
7046
7170
|
*/
|
|
7047
7171
|
readonly robot_order_queue: WorkerRobotOrder[];
|
|
7172
|
+
/**
|
|
7173
|
+
* The rocket silo rocket this cargo pod is attached to, or rocket silo rocket attached to this rocket silo - if any.
|
|
7174
|
+
*/
|
|
7175
|
+
readonly rocket?: LuaEntity;
|
|
7048
7176
|
/**
|
|
7049
7177
|
* Number of rocket parts in the silo.
|
|
7050
7178
|
*/
|
|
@@ -7150,7 +7278,7 @@ interface LuaEntity extends LuaControl {
|
|
|
7150
7278
|
*/
|
|
7151
7279
|
readonly supports_direction: boolean;
|
|
7152
7280
|
/**
|
|
7153
|
-
* The tags associated with this entity ghost. `nil` if this is not an entity ghost.
|
|
7281
|
+
* The tags associated with this entity ghost. `nil` if this is not an entity ghost or when the ghost has no tags.
|
|
7154
7282
|
*/
|
|
7155
7283
|
tags?: Tags;
|
|
7156
7284
|
/**
|
|
@@ -7336,6 +7464,10 @@ interface LuaEntityPrototype extends LuaPrototypeBase {
|
|
|
7336
7464
|
* The maximum wire distance for this entity. 0 if the entity doesn't support wires.
|
|
7337
7465
|
*/
|
|
7338
7466
|
get_max_wire_distance(this: void, quality?: QualityID): double;
|
|
7467
|
+
/**
|
|
7468
|
+
* The pumping speed of this offshore or normal pump.
|
|
7469
|
+
*/
|
|
7470
|
+
get_pumping_speed(this: void, quality?: QualityID): double;
|
|
7339
7471
|
/**
|
|
7340
7472
|
* The base researching speed of this lab prototype.
|
|
7341
7473
|
*/
|
|
@@ -7883,6 +8015,14 @@ interface LuaEntityPrototype extends LuaPrototypeBase {
|
|
|
7883
8015
|
* The light blinking speed for this rocket silo prototype.
|
|
7884
8016
|
*/
|
|
7885
8017
|
readonly light_blinking_speed?: double;
|
|
8018
|
+
/**
|
|
8019
|
+
* True if this loader supports a runtime-adjustable belt stack size.
|
|
8020
|
+
*/
|
|
8021
|
+
readonly loader_adjustable_belt_stack_size?: boolean;
|
|
8022
|
+
/**
|
|
8023
|
+
* The max belt stack size for this loader.
|
|
8024
|
+
*/
|
|
8025
|
+
readonly loader_max_belt_stack_size?: uint8;
|
|
7886
8026
|
/**
|
|
7887
8027
|
* The logistic mode of this logistic container.
|
|
7888
8028
|
*/
|
|
@@ -7949,6 +8089,10 @@ interface LuaEntityPrototype extends LuaPrototypeBase {
|
|
|
7949
8089
|
* How many friendly units are required within the spawning_radius of this spawner for it to stop producing more units.
|
|
7950
8090
|
*/
|
|
7951
8091
|
readonly max_friends_around_to_spawn?: double;
|
|
8092
|
+
/**
|
|
8093
|
+
* The max number of item products this crafting machine prototype supports.
|
|
8094
|
+
*/
|
|
8095
|
+
readonly max_item_product_count?: uint;
|
|
7952
8096
|
/**
|
|
7953
8097
|
* The max payload size of this logistics or construction robot.
|
|
7954
8098
|
*/
|
|
@@ -8041,7 +8185,7 @@ interface LuaEntityPrototype extends LuaPrototypeBase {
|
|
|
8041
8185
|
*/
|
|
8042
8186
|
readonly protected_from_tile_building: boolean;
|
|
8043
8187
|
/**
|
|
8044
|
-
* The pumping speed of this offshore or normal pump.
|
|
8188
|
+
* The pumping speed of this offshore or normal pump. This property is deprecated in favor of {@link LuaEntityPrototype::get_pumping_speed | runtime:LuaEntityPrototype::get_pumping_speed} and should not be used.
|
|
8045
8189
|
*/
|
|
8046
8190
|
readonly pumping_speed?: double;
|
|
8047
8191
|
/**
|
|
@@ -9278,7 +9422,7 @@ interface LuaForce {
|
|
|
9278
9422
|
*
|
|
9279
9423
|
* The sound is not played if its location is not {@link charted | runtime:LuaForce::chart} for this force.
|
|
9280
9424
|
* @param table.path The sound to play.
|
|
9281
|
-
* @param table.position Where the sound should be played. If not given, it's played
|
|
9425
|
+
* @param table.position Where the sound should be played. If not given, it's played globally on each player's controller's surface.
|
|
9282
9426
|
* @param table.volume_modifier The volume of the sound to play. Must be between 0 and 1 inclusive.
|
|
9283
9427
|
* @param table.override_sound_type The volume mixer to play the sound through. Defaults to the default mixer for the given sound type.
|
|
9284
9428
|
*/
|
|
@@ -9620,6 +9764,51 @@ interface LuaFuelCategoryPrototype extends LuaPrototypeBase {
|
|
|
9620
9764
|
*/
|
|
9621
9765
|
readonly valid: boolean;
|
|
9622
9766
|
}
|
|
9767
|
+
/**
|
|
9768
|
+
* Control behavior for furnaces.
|
|
9769
|
+
*/
|
|
9770
|
+
interface LuaFurnaceControlBehavior extends LuaGenericOnOffControlBehavior {
|
|
9771
|
+
/**
|
|
9772
|
+
* `true` if the furnace reads its ingredients contents, product contents and materials in crafting.
|
|
9773
|
+
*/
|
|
9774
|
+
circuit_read_contents: boolean;
|
|
9775
|
+
/**
|
|
9776
|
+
* `true` if the furnace outputs ingredients of current recipe as a signals to circuit network.
|
|
9777
|
+
*/
|
|
9778
|
+
circuit_read_ingredients: boolean;
|
|
9779
|
+
/**
|
|
9780
|
+
* `true` if the the furnace sends a signal when the recipe finishes.
|
|
9781
|
+
*/
|
|
9782
|
+
circuit_read_recipe_finished: boolean;
|
|
9783
|
+
/**
|
|
9784
|
+
* `true` if the the furnace sends a signal when it is working.
|
|
9785
|
+
*/
|
|
9786
|
+
circuit_read_working: boolean;
|
|
9787
|
+
/**
|
|
9788
|
+
* The signal sent when the furnace finishes a recipe.
|
|
9789
|
+
*/
|
|
9790
|
+
circuit_recipe_finished_signal?: SignalID;
|
|
9791
|
+
/**
|
|
9792
|
+
* The signal sent when the furnace is working.
|
|
9793
|
+
*/
|
|
9794
|
+
circuit_working_signal?: SignalID;
|
|
9795
|
+
/**
|
|
9796
|
+
* `true` if the read contents should include fuel (content of energy source)
|
|
9797
|
+
*/
|
|
9798
|
+
include_fuel: boolean;
|
|
9799
|
+
/**
|
|
9800
|
+
* `true` if the read contents should include items in crafting.
|
|
9801
|
+
*/
|
|
9802
|
+
include_in_crafting: boolean;
|
|
9803
|
+
/**
|
|
9804
|
+
* 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.
|
|
9805
|
+
*/
|
|
9806
|
+
readonly object_name: string;
|
|
9807
|
+
/**
|
|
9808
|
+
* Is this object valid? This Lua object holds a reference to an object within the game engine. It is possible that the game-engine object is removed whilst a mod still holds the corresponding Lua object. If that happens, the object becomes invalid, i.e. this attribute will be `false`. Mods are advised to check for object validity if any change to the game state might have occurred between the creation of the Lua object and its access.
|
|
9809
|
+
*/
|
|
9810
|
+
readonly valid: boolean;
|
|
9811
|
+
}
|
|
9623
9812
|
/**
|
|
9624
9813
|
* Main toplevel type, provides access to most of the API though its members. An instance of LuaGameScript is available as the global object named `game`.
|
|
9625
9814
|
*/
|
|
@@ -9779,7 +9968,7 @@ interface LuaGameScript {
|
|
|
9779
9968
|
*
|
|
9780
9969
|
* The sound is not played if its location is not {@link charted | runtime:LuaForce::chart} for that player.
|
|
9781
9970
|
* @param table.path The sound to play.
|
|
9782
|
-
* @param table.position Where the sound should be played. If not given, it's played
|
|
9971
|
+
* @param table.position Where the sound should be played. If not given, it's played globally on each player's controller's surface.
|
|
9783
9972
|
* @param table.volume_modifier The volume of the sound to play. Must be between 0 and 1 inclusive.
|
|
9784
9973
|
* @param table.override_sound_type The volume mixer to play the sound through. Defaults to the default mixer for the given sound type.
|
|
9785
9974
|
*/
|
|
@@ -10078,7 +10267,7 @@ interface LuaGameScript {
|
|
|
10078
10267
|
/**
|
|
10079
10268
|
* Current map tick.
|
|
10080
10269
|
*/
|
|
10081
|
-
readonly tick:
|
|
10270
|
+
readonly tick: MapTick;
|
|
10082
10271
|
/**
|
|
10083
10272
|
* If the tick has been paused. This means that entity update has been paused.
|
|
10084
10273
|
*/
|
|
@@ -10088,7 +10277,7 @@ interface LuaGameScript {
|
|
|
10088
10277
|
*
|
|
10089
10278
|
* This differs from {@link LuaGameScript::tick | runtime:LuaGameScript::tick} in that creating a game from a scenario always starts with this value at `0`, even if the scenario has its own level data where the `tick` has progressed past `0`.
|
|
10090
10279
|
*/
|
|
10091
|
-
readonly ticks_played:
|
|
10280
|
+
readonly ticks_played: MapTick;
|
|
10092
10281
|
/**
|
|
10093
10282
|
* The number of ticks to be run while the tick is paused.
|
|
10094
10283
|
*
|
|
@@ -10343,7 +10532,7 @@ interface LuaGuiElement {
|
|
|
10343
10532
|
/**
|
|
10344
10533
|
* Removes the given tab and its associated content from this tabbed pane.
|
|
10345
10534
|
*
|
|
10346
|
-
* Removing a tab does not destroy the tab or the tab contents. It just removes them from the view.
|
|
10535
|
+
* Removing a tab does not destroy the tab or the tab contents. It just removes them from the view.
|
|
10347
10536
|
* @param tab The tab to remove or `nil` to remove all tabs.
|
|
10348
10537
|
*/
|
|
10349
10538
|
remove_tab(this: void, tab?: LuaGuiElement): void;
|
|
@@ -12348,7 +12537,7 @@ interface LuaItemPrototype extends LuaPrototypeBase {
|
|
|
12348
12537
|
*/
|
|
12349
12538
|
readonly valid: boolean;
|
|
12350
12539
|
/**
|
|
12351
|
-
* Weight of this item
|
|
12540
|
+
* Weight of this item. More information on how item weight is determined can be found on its {@link auxiliary page | runtime:item-weight}.
|
|
12352
12541
|
*/
|
|
12353
12542
|
readonly weight: double;
|
|
12354
12543
|
}
|
|
@@ -12470,7 +12659,7 @@ interface LuaItemStack extends LuaItemCommon {
|
|
|
12470
12659
|
/**
|
|
12471
12660
|
* The tick this item spoils, or `0` if it does not spoil. When writing, setting to anything < the current game tick will spoil the item instantly.
|
|
12472
12661
|
*/
|
|
12473
|
-
spoil_tick:
|
|
12662
|
+
spoil_tick: MapTick;
|
|
12474
12663
|
/**
|
|
12475
12664
|
* Type of the item prototype.
|
|
12476
12665
|
*/
|
|
@@ -13436,6 +13625,7 @@ interface LuaPlayer extends LuaControl {
|
|
|
13436
13625
|
* Local flying text is not saved, which means it will disappear after a save/load-cycle.
|
|
13437
13626
|
* @param table.text The flying text to show.
|
|
13438
13627
|
* @param table.position The location on the map at which to show the flying text.
|
|
13628
|
+
* @param table.surface The surface which this text will be shown on. Defaults to player surface.
|
|
13439
13629
|
* @param table.create_at_cursor If `true`, the flying text is created at the player's cursor. Defaults to `false`.
|
|
13440
13630
|
* @param table.color The color of the flying text. Defaults to white text.
|
|
13441
13631
|
* @param table.time_to_live The amount of ticks that the flying text will be shown for. Defaults to `80`.
|
|
@@ -13444,6 +13634,7 @@ interface LuaPlayer extends LuaControl {
|
|
|
13444
13634
|
create_local_flying_text(this: void, table: {
|
|
13445
13635
|
text: LocalisedString;
|
|
13446
13636
|
position?: MapPosition;
|
|
13637
|
+
surface?: SurfaceIdentification;
|
|
13447
13638
|
create_at_cursor?: boolean;
|
|
13448
13639
|
color?: Color;
|
|
13449
13640
|
time_to_live?: uint;
|
|
@@ -13584,7 +13775,7 @@ interface LuaPlayer extends LuaControl {
|
|
|
13584
13775
|
*
|
|
13585
13776
|
* The sound is not played if its location is not {@link charted | runtime:LuaForce::chart} for this player.
|
|
13586
13777
|
* @param table.path The sound to play.
|
|
13587
|
-
* @param table.position Where the sound should be played. If not given, it's played
|
|
13778
|
+
* @param table.position Where the sound should be played. If not given, it's played globally on the player's controller's surface.
|
|
13588
13779
|
* @param table.volume_modifier The volume of the sound to play. Must be between 0 and 1 inclusive.
|
|
13589
13780
|
* @param table.override_sound_type The volume mixer to play the sound through. Defaults to the default mixer for the given sound type.
|
|
13590
13781
|
*/
|
|
@@ -13902,7 +14093,7 @@ interface LuaPlayer extends LuaControl {
|
|
|
13902
14093
|
*/
|
|
13903
14094
|
remove_unfiltered_items: boolean;
|
|
13904
14095
|
/**
|
|
13905
|
-
* The render mode of the player, like map or zoom to world.
|
|
14096
|
+
* The render mode of the player, like map or zoom to world.
|
|
13906
14097
|
*/
|
|
13907
14098
|
readonly render_mode: defines.render_mode;
|
|
13908
14099
|
/**
|
|
@@ -15021,9 +15212,13 @@ interface LuaRecord {
|
|
|
15021
15212
|
*/
|
|
15022
15213
|
blueprint_snap_to_grid?: TilePosition;
|
|
15023
15214
|
/**
|
|
15024
|
-
* The contents of this BlueprintBookRecord.
|
|
15215
|
+
* The contents of this BlueprintBookRecord. This is sparse array - it may have gaps, so using `#` will not be reliable. Use {@link LuaRecord::contents_size | runtime:LuaRecord::contents_size} or `pairs()` to iterate this table.
|
|
15025
15216
|
*/
|
|
15026
|
-
readonly contents: LuaRecord
|
|
15217
|
+
readonly contents: LuaTable<ItemStackIndex, LuaRecord>;
|
|
15218
|
+
/**
|
|
15219
|
+
* The highest populated index in the contents of this BlueprintBookRecord.
|
|
15220
|
+
*/
|
|
15221
|
+
readonly contents_size: ItemStackIndex;
|
|
15027
15222
|
/**
|
|
15028
15223
|
* List of raw materials required to build this blueprint.
|
|
15029
15224
|
*/
|
|
@@ -15056,6 +15251,10 @@ interface LuaRecord {
|
|
|
15056
15251
|
* 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.
|
|
15057
15252
|
*/
|
|
15058
15253
|
readonly object_name: string;
|
|
15254
|
+
/**
|
|
15255
|
+
* The preview icons for this record.
|
|
15256
|
+
*/
|
|
15257
|
+
preview_icons: BlueprintSignalIcon[];
|
|
15059
15258
|
/**
|
|
15060
15259
|
* The number of tile filters this deconstruction planner supports.
|
|
15061
15260
|
*/
|
|
@@ -15746,6 +15945,122 @@ interface LuaRocketSiloControlBehavior extends LuaControlBehavior {
|
|
|
15746
15945
|
*/
|
|
15747
15946
|
readonly valid: boolean;
|
|
15748
15947
|
}
|
|
15948
|
+
/**
|
|
15949
|
+
* The schedule of a particular {@link LuaTrain | runtime:LuaTrain} or {@link LuaSpacePlatform | runtime:LuaSpacePlatform}.
|
|
15950
|
+
*/
|
|
15951
|
+
interface LuaSchedule {
|
|
15952
|
+
/**
|
|
15953
|
+
* Activates the interrupt at the given index, if the index is valid.
|
|
15954
|
+
*/
|
|
15955
|
+
activate_interrupt(this: void, index: uint): void;
|
|
15956
|
+
/**
|
|
15957
|
+
* Adds the given interrupt to the schedule if an interrupt with the given name does not already exist.
|
|
15958
|
+
*/
|
|
15959
|
+
add_interrupt(this: void, interrupt: ScheduleInterrupt): void;
|
|
15960
|
+
/**
|
|
15961
|
+
* Adds a record to the end of the current schedule using the provided data.
|
|
15962
|
+
*/
|
|
15963
|
+
add_record(this: void, data: AddRecordData): void;
|
|
15964
|
+
/**
|
|
15965
|
+
* Adds the given wait condition to the given record.
|
|
15966
|
+
*/
|
|
15967
|
+
add_wait_condition(this: void, record_index: ScheduleRecordPosition, condition_index: uint, type: WaitCondition): void;
|
|
15968
|
+
/**
|
|
15969
|
+
* Changes the interrupt at the given index to the provided values. Note, the names must match.
|
|
15970
|
+
*/
|
|
15971
|
+
change_interrupt(this: void, index: uint, interrupt: ScheduleInterrupt): void;
|
|
15972
|
+
/**
|
|
15973
|
+
* Changes the wait condition on the given record to the new values.
|
|
15974
|
+
*/
|
|
15975
|
+
change_wait_condition(this: void, record_index: ScheduleRecordPosition, condition_index: uint, wait_condition: WaitCondition): void;
|
|
15976
|
+
/**
|
|
15977
|
+
* Copies the record from the given schedule at the given index into this schedule at the given index.
|
|
15978
|
+
*/
|
|
15979
|
+
copy_record(this: void, source_schedule: LuaSchedule, source_index: uint, destination_index: uint): void;
|
|
15980
|
+
drag_interrupt(this: void, from: uint, to: uint): void;
|
|
15981
|
+
/**
|
|
15982
|
+
* @param interrupt_index The interrupt to operate on, if any.
|
|
15983
|
+
*/
|
|
15984
|
+
drag_record(this: void, from: uint, to: uint, interrupt_index?: uint): void;
|
|
15985
|
+
/**
|
|
15986
|
+
* @param index The record to change.
|
|
15987
|
+
*/
|
|
15988
|
+
drag_wait_condition(this: void, index: ScheduleRecordPosition, from: uint, to: uint): void;
|
|
15989
|
+
get_interrupt(this: void, index: uint): ScheduleInterrupt | null;
|
|
15990
|
+
get_record(this: void, index: ScheduleRecordPosition): ScheduleRecord | null;
|
|
15991
|
+
/**
|
|
15992
|
+
* If the given index is invalid, `nil` is returned.
|
|
15993
|
+
* @param interrupt_index If provided, the record count in this interrupt is read.
|
|
15994
|
+
*/
|
|
15995
|
+
get_record_count(this: void, interrupt_index?: uint): uint | null;
|
|
15996
|
+
/**
|
|
15997
|
+
* Gets the wait condition at the given index if one exists.
|
|
15998
|
+
*/
|
|
15999
|
+
get_wait_condition(this: void, schedule_index: ScheduleRecordPosition, condition_index: uint): WaitCondition | null;
|
|
16000
|
+
/**
|
|
16001
|
+
* The number of wait conditions in the given schedule record.
|
|
16002
|
+
*/
|
|
16003
|
+
get_wait_condition_count(this: void, index: ScheduleRecordPosition): uint | null;
|
|
16004
|
+
/**
|
|
16005
|
+
* Gets the wait conditions at the given index if they exist.
|
|
16006
|
+
*/
|
|
16007
|
+
get_wait_conditions(this: void, schedule_index: ScheduleRecordPosition): WaitCondition[] | null;
|
|
16008
|
+
/**
|
|
16009
|
+
* @param schedule_index The schedule index
|
|
16010
|
+
*/
|
|
16011
|
+
go_to_station(this: void, schedule_index: uint): void;
|
|
16012
|
+
/**
|
|
16013
|
+
* Removes the interrupt at the given index, if the index is valid.
|
|
16014
|
+
*/
|
|
16015
|
+
remove_interrupt(this: void, index: uint): void;
|
|
16016
|
+
/**
|
|
16017
|
+
* Removes the record at the given index, if the index is valid.
|
|
16018
|
+
*/
|
|
16019
|
+
remove_record(this: void, index: ScheduleRecordPosition): void;
|
|
16020
|
+
/**
|
|
16021
|
+
* Removes the given wait condition from the given record.
|
|
16022
|
+
*/
|
|
16023
|
+
remove_wait_condition(this: void, record_index: ScheduleRecordPosition, condition_index: uint): void;
|
|
16024
|
+
/**
|
|
16025
|
+
* @param old_name The interrupt to rename
|
|
16026
|
+
* @param new_name The new name - if it already exists, does nothing.
|
|
16027
|
+
*/
|
|
16028
|
+
rename_interrupt(this: void, old_name: string, new_name: string): void;
|
|
16029
|
+
/**
|
|
16030
|
+
* Sets if unloading is allowed at the given schedule index.
|
|
16031
|
+
*/
|
|
16032
|
+
set_allow_unloading(this: void, index: ScheduleRecordPosition, allow: boolean): void;
|
|
16033
|
+
set_stopped(this: void, stopped: boolean): void;
|
|
16034
|
+
/**
|
|
16035
|
+
* Sets the comparison on the given wait condition.
|
|
16036
|
+
* @param mode `"and"`, or `"or"`
|
|
16037
|
+
*/
|
|
16038
|
+
set_wait_condition_mode(this: void, record_index: ScheduleRecordPosition, condition_index: uint, mode: string): void;
|
|
16039
|
+
readonly current: uint;
|
|
16040
|
+
/**
|
|
16041
|
+
* The group this schedule is part of, if any.
|
|
16042
|
+
*/
|
|
16043
|
+
group?: string;
|
|
16044
|
+
readonly interrupt_count: uint;
|
|
16045
|
+
/**
|
|
16046
|
+
* 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.
|
|
16047
|
+
*/
|
|
16048
|
+
readonly object_name: string;
|
|
16049
|
+
/**
|
|
16050
|
+
* The owner of this schedule.
|
|
16051
|
+
*/
|
|
16052
|
+
readonly owner?: LuaTrain | LuaSpacePlatform;
|
|
16053
|
+
/**
|
|
16054
|
+
* Note: when writing, value must not be larger than LuaGameScript::tick
|
|
16055
|
+
*/
|
|
16056
|
+
tick_of_last_activity: MapTick;
|
|
16057
|
+
readonly tick_of_last_schedule_change: MapTick;
|
|
16058
|
+
readonly ticks_in_station: MapTick;
|
|
16059
|
+
/**
|
|
16060
|
+
* Is this object valid? This Lua object holds a reference to an object within the game engine. It is possible that the game-engine object is removed whilst a mod still holds the corresponding Lua object. If that happens, the object becomes invalid, i.e. this attribute will be `false`. Mods are advised to check for object validity if any change to the game state might have occurred between the creation of the Lua object and its access.
|
|
16061
|
+
*/
|
|
16062
|
+
readonly valid: boolean;
|
|
16063
|
+
}
|
|
15749
16064
|
/**
|
|
15750
16065
|
* Control behavior for selector combinators.
|
|
15751
16066
|
*/
|
|
@@ -16003,6 +16318,10 @@ interface LuaSpacePlatform {
|
|
|
16003
16318
|
* @returns The platform hub.
|
|
16004
16319
|
*/
|
|
16005
16320
|
apply_starter_pack(this: void): LuaEntity | null;
|
|
16321
|
+
/**
|
|
16322
|
+
* Returns `true` when the space platform isn't waiting on any delivery from the planet.
|
|
16323
|
+
*/
|
|
16324
|
+
can_leave_current_location(this: void): boolean;
|
|
16006
16325
|
/**
|
|
16007
16326
|
* Cancels deletion of this space platform if it was scheduled for deletion.
|
|
16008
16327
|
*/
|
|
@@ -16052,6 +16371,7 @@ interface LuaSpacePlatform {
|
|
|
16052
16371
|
limit?: uint;
|
|
16053
16372
|
invert?: boolean;
|
|
16054
16373
|
}): AsteroidChunk[];
|
|
16374
|
+
get_schedule(this: void): LuaSchedule;
|
|
16055
16375
|
/**
|
|
16056
16376
|
* Repairs the given tile if it's damaged.
|
|
16057
16377
|
*/
|
|
@@ -16063,6 +16383,12 @@ interface LuaSpacePlatform {
|
|
|
16063
16383
|
position: TilePosition;
|
|
16064
16384
|
damage: float;
|
|
16065
16385
|
}[];
|
|
16386
|
+
/**
|
|
16387
|
+
* The point on space connection this platform is at or `nil`.
|
|
16388
|
+
*
|
|
16389
|
+
* It is represented as a number in range `[0, 1]`, with 0 being {@link LuaSpaceConnectionPrototype::from | runtime:LuaSpaceConnectionPrototype::from} and 1 being {@link LuaSpaceConnectionPrototype::to | runtime:LuaSpaceConnectionPrototype::to}.
|
|
16390
|
+
*/
|
|
16391
|
+
distance?: double;
|
|
16066
16392
|
/**
|
|
16067
16393
|
* The force of this space platform.
|
|
16068
16394
|
*/
|
|
@@ -16105,10 +16431,18 @@ interface LuaSpacePlatform {
|
|
|
16105
16431
|
* Returns how many ticks are left before the platform will be deleted. 0 if not scheduled for deletion.
|
|
16106
16432
|
*/
|
|
16107
16433
|
readonly scheduled_for_deletion: uint;
|
|
16434
|
+
/**
|
|
16435
|
+
* The space connection this space platform is traveling through or `nil`.
|
|
16436
|
+
*
|
|
16437
|
+
* Write operation requires a valid space connection and it sets the distance to 0.5.
|
|
16438
|
+
*/
|
|
16439
|
+
space_connection?: LuaSpaceConnectionPrototype;
|
|
16108
16440
|
/**
|
|
16109
16441
|
* The space location this space platform is stopped at or `nil`.
|
|
16442
|
+
*
|
|
16443
|
+
* Write operation requires a valid space location and will cancel pending item requests.
|
|
16110
16444
|
*/
|
|
16111
|
-
|
|
16445
|
+
space_location?: LuaSpaceLocationPrototype;
|
|
16112
16446
|
speed: double;
|
|
16113
16447
|
/**
|
|
16114
16448
|
* The starter pack used to create this space platform.
|
|
@@ -17010,7 +17344,7 @@ interface LuaSurface {
|
|
|
17010
17344
|
*
|
|
17011
17345
|
* The sound is not played if its location is not {@link charted | runtime:LuaForce::chart} for that player.
|
|
17012
17346
|
* @param table.path The sound to play.
|
|
17013
|
-
* @param table.position Where the sound should be played. If not given, it's played
|
|
17347
|
+
* @param table.position Where the sound should be played. If not given, it's played globally on this surface.
|
|
17014
17348
|
* @param table.volume_modifier The volume of the sound to play. Must be between 0 and 1 inclusive.
|
|
17015
17349
|
* @param table.override_sound_type The volume mixer to play the sound through. Defaults to the default mixer for the given sound type.
|
|
17016
17350
|
*/
|
|
@@ -18201,6 +18535,7 @@ interface LuaTrain {
|
|
|
18201
18535
|
* Gets all rails under the train.
|
|
18202
18536
|
*/
|
|
18203
18537
|
get_rails(this: void): LuaEntity[];
|
|
18538
|
+
get_schedule(this: void): LuaSchedule;
|
|
18204
18539
|
/**
|
|
18205
18540
|
* Go to the station specified by the index in the train's schedule.
|
|
18206
18541
|
*/
|
|
@@ -18516,6 +18851,13 @@ interface LuaTransportLine {
|
|
|
18516
18851
|
* Remove all items from this transport line.
|
|
18517
18852
|
*/
|
|
18518
18853
|
clear(this: void): void;
|
|
18854
|
+
/**
|
|
18855
|
+
* Force insert item at a given position. Inserts item onto a transport line. If a position is out of range, it is clamped to a closest valid position on the transport line. Item will be inserted regardless of other items nearby, possibly forcing items to become squashed.
|
|
18856
|
+
* @param position Where on the line to insert the items.
|
|
18857
|
+
* @param items Items to insert.
|
|
18858
|
+
* @param belt_stack_size Maximum size of stack created on belt
|
|
18859
|
+
*/
|
|
18860
|
+
force_insert_at(this: void, position: float, items: ItemStackIdentification, belt_stack_size?: uint8): void;
|
|
18519
18861
|
/**
|
|
18520
18862
|
* Get counts of all items on this line, similar to how {@link LuaInventory::get_contents | runtime:LuaInventory::get_contents} does.
|
|
18521
18863
|
* @returns List of all items on this line.
|