typed-factorio 0.13.2 → 0.14.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -2172,17 +2172,8 @@ interface LuaElectricEnergySourcePrototype {
2172
2172
  help(): string
2173
2173
  }
2174
2174
 
2175
- /**
2176
- * The primary interface for interacting with entities through the Lua API. Entities are everything that exists on the
2177
- * map except for tiles (see {@link LuaTile}).
2178
- *
2179
- * Most functions on LuaEntity also work when the entity is contained in a ghost.
2180
- *
2181
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html View documentation}
2182
- *
2183
- * @noSelf
2184
- */
2185
- interface LuaEntity extends LuaControl {
2175
+ /** @noSelf */
2176
+ interface BaseEntity extends LuaControl {
2186
2177
  /**
2187
2178
  * Gets the entities output inventory if it has one.
2188
2179
  *
@@ -2209,20 +2200,6 @@ interface LuaEntity extends LuaControl {
2209
2200
  * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_burnt_result_inventory View documentation}
2210
2201
  */
2211
2202
  get_burnt_result_inventory(): LuaInventory | undefined
2212
- /**
2213
- * Damages the entity.
2214
- *
2215
- * *Can only be used if this is EntityWithHealth*
2216
- *
2217
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.damage View documentation}
2218
- *
2219
- * @param damage - The amount of damage to be done
2220
- * @param force - The force that will be doing the damage.
2221
- * @param type - The type of damage to be done, defaults to "impact".
2222
- * @param dealer - The entity to consider as the damage dealer.
2223
- * @returns The total damage actually applied after resistances.
2224
- */
2225
- damage(damage: float, force: ForceIdentification, type?: string, dealer?: LuaEntity): float
2226
2203
  /**
2227
2204
  * Checks if the entity can be destroyed
2228
2205
  *
@@ -2247,34 +2224,6 @@ interface LuaEntity extends LuaControl {
2247
2224
  /** If `true`, {@link ScriptRaisedDestroyEvent script_raised_destroy} will be called. Defaults to `false`. */
2248
2225
  readonly raise_destroy?: boolean
2249
2226
  }): boolean
2250
- /**
2251
- * Give the entity a command.
2252
- *
2253
- * *Can only be used if this is Unit*
2254
- *
2255
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.set_command View documentation}
2256
- *
2257
- * @param command
2258
- */
2259
- set_command(command: Command): void
2260
- /**
2261
- * Give the entity a distraction command.
2262
- *
2263
- * *Can only be used if this is Unit*
2264
- *
2265
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.set_distraction_command View documentation}
2266
- *
2267
- * @param command
2268
- */
2269
- set_distraction_command(command: Command): void
2270
- /**
2271
- * Has this unit been assigned a command?
2272
- *
2273
- * *Can only be used if this is Unit*
2274
- *
2275
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.has_command View documentation}
2276
- */
2277
- has_command(): boolean
2278
2227
  /**
2279
2228
  * Immediately kills the entity. Does nothing if the entity doesn't have health.
2280
2229
  *
@@ -2308,71 +2257,6 @@ interface LuaEntity extends LuaControl {
2308
2257
  * @returns `true` if this entity has the given flag set.
2309
2258
  */
2310
2259
  has_flag(flag: string): boolean
2311
- /**
2312
- * Same as {@link LuaEntity.has_flag LuaEntity::has_flag}, but targets the inner entity on a entity ghost.
2313
- *
2314
- * *Can only be used if this is EntityGhost*
2315
- *
2316
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.ghost_has_flag View documentation}
2317
- *
2318
- * @param flag - The flag to test. See {@link EntityPrototypeFlags} for a list of flags.
2319
- * @returns `true` if the entity has the given flag set.
2320
- */
2321
- ghost_has_flag(flag: string): boolean
2322
- /**
2323
- * Offer a thing on the market.
2324
- *
2325
- * *Can only be used if this is Market*
2326
- *
2327
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.add_market_item View documentation}
2328
- *
2329
- * @example
2330
- * Adds market offer, 1 copper ore for 10 iron ore.
2331
- *
2332
- * ```lua
2333
- * market.add_market_item{price={{"iron-ore", 10}}, offer={type="give-item", item="copper-ore"}}
2334
- * ```
2335
- *
2336
- * @example
2337
- * Adds market offer, 1 copper ore for 5 iron ore and 5 stone ore.
2338
- *
2339
- * ```lua
2340
- * market.add_market_item{price={{"iron-ore", 5}, {"stone", 5}}, offer={type="give-item", item="copper-ore"}}
2341
- * ```
2342
- *
2343
- * @param offer
2344
- */
2345
- add_market_item(offer: Offer): void
2346
- /**
2347
- * Remove an offer from a market.
2348
- *
2349
- * **Note**: The other offers are moved down to fill the gap created by removing the offer, which decrements the
2350
- * overall size of the offer array.
2351
- *
2352
- * *Can only be used if this is Market*
2353
- *
2354
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.remove_market_item View documentation}
2355
- *
2356
- * @param offer - Index of offer to remove.
2357
- * @returns `true` if the offer was successfully removed; `false` when the given index was not valid.
2358
- */
2359
- remove_market_item(offer: uint): boolean
2360
- /**
2361
- * Get all offers in a market as an array.
2362
- *
2363
- * *Can only be used if this is Market*
2364
- *
2365
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_market_items View documentation}
2366
- */
2367
- get_market_items(): Offer[]
2368
- /**
2369
- * Removes all offers from a market.
2370
- *
2371
- * *Can only be used if this is Market*
2372
- *
2373
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.clear_market_items View documentation}
2374
- */
2375
- clear_market_items(): void
2376
2260
  /**
2377
2261
  * Connect two devices with a circuit wire or copper cable. Depending on which type of connection should be made,
2378
2262
  * there are different procedures:
@@ -2492,90 +2376,6 @@ interface LuaEntity extends LuaControl {
2492
2376
  * @param slot - The slot index.
2493
2377
  */
2494
2378
  clear_request_slot(slot: uint): void
2495
- /**
2496
- * Returns whether a craft is currently in process. It does not indicate whether progress is currently being made,
2497
- * but whether any crafting action has made progress in this machine.
2498
- *
2499
- * *Can only be used if this is CraftingMachine*
2500
- *
2501
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.is_crafting View documentation}
2502
- */
2503
- is_crafting(): void
2504
- /**
2505
- * *Can only be used if this is Gate*
2506
- *
2507
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.is_opened View documentation}
2508
- *
2509
- * @returns `true` if this gate is currently opened.
2510
- */
2511
- is_opened(): boolean
2512
- /**
2513
- * *Can only be used if this is Gate*
2514
- *
2515
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.is_opening View documentation}
2516
- *
2517
- * @returns `true` if this gate is currently opening.
2518
- */
2519
- is_opening(): boolean
2520
- /**
2521
- * *Can only be used if this is Gate*
2522
- *
2523
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.is_closed View documentation}
2524
- *
2525
- * @returns `true` if this gate is currently closed.
2526
- */
2527
- is_closed(): boolean
2528
- /**
2529
- * *Can only be used if this is Gate*
2530
- *
2531
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.is_closing View documentation}
2532
- *
2533
- * @returns `true` if this gate is currently closing
2534
- */
2535
- is_closing(): boolean
2536
- /**
2537
- * *Can only be used if this is Gate*
2538
- *
2539
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.request_to_open View documentation}
2540
- *
2541
- * @param force - The force that requests the gate to be open.
2542
- * @param extra_time - Extra ticks to stay open.
2543
- */
2544
- request_to_open(force: ForceIdentification, extra_time?: uint): void
2545
- /**
2546
- * *Can only be used if this is Gate*
2547
- *
2548
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.request_to_close View documentation}
2549
- *
2550
- * @param force - The force that requests the gate to be closed.
2551
- */
2552
- request_to_close(force: ForceIdentification): void
2553
- /**
2554
- * Get a transport line of a belt or belt connectable entity.
2555
- *
2556
- * *Can only be used if this is TransportBeltConnectable*
2557
- *
2558
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_transport_line View documentation}
2559
- *
2560
- * @param index - Index of the requested transport line. Transport lines are 1-indexed.
2561
- */
2562
- get_transport_line(index: uint): LuaTransportLine
2563
- /**
2564
- * Get the maximum transport line index of a belt or belt connectable entity.
2565
- *
2566
- * *Can only be used if this is TransportBeltConnectable*
2567
- *
2568
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_max_transport_line_index View documentation}
2569
- */
2570
- get_max_transport_line_index(): uint
2571
- /**
2572
- * *Can only be used if this is RocketSilo*
2573
- *
2574
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.launch_rocket View documentation}
2575
- *
2576
- * @returns `true` if the rocket was successfully launched. Return value of `false` means the silo is not ready for launch.
2577
- */
2578
- launch_rocket(): boolean
2579
2379
  /**
2580
2380
  * Revive a ghost. I.e. turn it from a ghost to a real entity or tile.
2581
2381
  *
@@ -2617,163 +2417,37 @@ interface LuaEntity extends LuaControl {
2617
2417
  readonly raise_revive?: boolean
2618
2418
  }): LuaMultiReturn<[undefined] | [Record<string, uint>, LuaEntity, LuaEntity | undefined]>
2619
2419
  /**
2620
- * *Can only be used if this is Rail*
2621
- *
2622
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_connected_rail View documentation}
2420
+ * Get the filter for a slot in an inserter, loader, or logistic storage container.
2623
2421
  *
2624
- * @returns Rail connected in the specified manner to this one.
2625
- */
2626
- get_connected_rail(params: {
2627
- readonly rail_direction: defines.rail_direction
2628
- readonly rail_connection_direction: defines.rail_connection_direction
2629
- }): LuaEntity
2630
- /**
2631
- * Get the rails that this signal is connected to.
2422
+ * **Note**: The entity must allow filters.
2632
2423
  *
2633
- * *Can only be used if this is RailSignal or RailChainSignal*
2424
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_filter View documentation}
2634
2425
  *
2635
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_connected_rails View documentation}
2426
+ * @param slot_index - Index of the slot to get the filter for.
2427
+ * @returns Prototype name of the item being filtered. `nil` if the given slot has no filter.
2636
2428
  */
2637
- get_connected_rails(): LuaEntity[]
2429
+ get_filter(slot_index: uint): string | undefined
2638
2430
  /**
2639
- * Get the rail signal or train stop at the start/end of the rail segment this rail is in, or `nil` if the rail
2640
- * segment doesn't start/end with a signal nor a train stop.
2641
- *
2642
- * **Note**: A rail segment is a continuous section of rail with no branches, signals, nor train stops.
2431
+ * Set the filter for a slot in an inserter, loader, or logistic storage container.
2643
2432
  *
2644
- * *Can only be used if this is Rail*
2433
+ * **Note**: The entity must allow filters.
2645
2434
  *
2646
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_rail_segment_entity View documentation}
2435
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.set_filter View documentation}
2647
2436
  *
2648
- * @param direction - The direction of travel relative to this rail.
2649
- * @param in_else_out - If true, gets the entity at the entrance of the rail segment, otherwise gets the entity at
2650
- * the exit of the rail segment.
2437
+ * @param slot_index - Index of the slot to set the filter for.
2438
+ * @param item - Prototype name of the item to filter.
2651
2439
  */
2652
- get_rail_segment_entity(direction: defines.rail_direction, in_else_out: boolean): LuaEntity | undefined
2440
+ set_filter(slot_index: uint, item: string): void
2653
2441
  /**
2654
- * Get the rail at the end of the rail segment this rail is in.
2655
- *
2656
- * **Note**: A rail segment is a continuous section of rail with no branches, signals, nor train stops.
2657
- *
2658
- * **Note**: This function has a second return value. A {@link defines.rail_direction} that points out of the rail
2659
- * segment from the end rail.
2660
- *
2661
- * *Can only be used if this is Rail*
2442
+ * Gets the control behavior of the entity (if any).
2662
2443
  *
2663
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_rail_segment_end View documentation}
2444
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_control_behavior View documentation}
2664
2445
  *
2665
- * @param direction
2446
+ * @returns The control behavior or nil.
2666
2447
  */
2667
- get_rail_segment_end(direction: defines.rail_direction): LuaMultiReturn<[LuaEntity, defines.rail_direction]>
2448
+ get_control_behavior(): LuaControlBehavior | undefined
2668
2449
  /**
2669
- * Get the length of the rail segment this rail is in.
2670
- *
2671
- * **Note**: A rail segment is a continuous section of rail with no branches, signals, nor train stops.
2672
- *
2673
- * *Can only be used if this is Rail*
2674
- *
2675
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_rail_segment_length View documentation}
2676
- */
2677
- get_rail_segment_length(): double
2678
- /**
2679
- * Get a rail from each rail segment that overlaps with this rail's rail segment.
2680
- *
2681
- * **Note**: A rail segment is a continuous section of rail with no branches, signals, nor train stops.
2682
- *
2683
- * *Can only be used if this is Rail*
2684
- *
2685
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_rail_segment_overlaps View documentation}
2686
- */
2687
- get_rail_segment_overlaps(): LuaEntity[]
2688
- /**
2689
- * Get the filter for a slot in an inserter, loader, or logistic storage container.
2690
- *
2691
- * **Note**: The entity must allow filters.
2692
- *
2693
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_filter View documentation}
2694
- *
2695
- * @param slot_index - Index of the slot to get the filter for.
2696
- * @returns Prototype name of the item being filtered. `nil` if the given slot has no filter.
2697
- */
2698
- get_filter(slot_index: uint): string | undefined
2699
- /**
2700
- * Set the filter for a slot in an inserter, loader, or logistic storage container.
2701
- *
2702
- * **Note**: The entity must allow filters.
2703
- *
2704
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.set_filter View documentation}
2705
- *
2706
- * @param slot_index - Index of the slot to set the filter for.
2707
- * @param item - Prototype name of the item to filter.
2708
- */
2709
- set_filter(slot_index: uint, item: string): void
2710
- /**
2711
- * Gets the filter for this infinity container at the given index or `nil` if the filter index doesn't exist or is empty.
2712
- *
2713
- * *Can only be used if this is InfinityContainer*
2714
- *
2715
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_infinity_container_filter View documentation}
2716
- *
2717
- * @param index - The index to get.
2718
- */
2719
- get_infinity_container_filter(index: uint): InfinityInventoryFilter | undefined
2720
- /**
2721
- * Sets the filter for this infinity container at the given index.
2722
- *
2723
- * *Can only be used if this is InfinityContainer*
2724
- *
2725
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.set_infinity_container_filter View documentation}
2726
- *
2727
- * @param index - The index to set.
2728
- * @param filter - The new filter or `nil` to clear the filter.
2729
- */
2730
- set_infinity_container_filter(index: uint, filter: InfinityInventoryFilter | undefined): void
2731
- /**
2732
- * Gets the filter for this infinity pipe or `nil` if the filter is empty.
2733
- *
2734
- * *Can only be used if this is InfinityPipe*
2735
- *
2736
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_infinity_pipe_filter View documentation}
2737
- */
2738
- get_infinity_pipe_filter(): InfinityPipeFilter | undefined
2739
- /**
2740
- * Sets the filter for this infinity pipe.
2741
- *
2742
- * *Can only be used if this is InfinityPipe*
2743
- *
2744
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.set_infinity_pipe_filter View documentation}
2745
- *
2746
- * @param filter - The new filter or `nil` to clear the filter.
2747
- */
2748
- set_infinity_pipe_filter(filter: InfinityPipeFilter | undefined): void
2749
- /**
2750
- * Gets the heat setting for this heat interface.
2751
- *
2752
- * *Can only be used if this is HeatInterface*
2753
- *
2754
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_heat_setting View documentation}
2755
- */
2756
- get_heat_setting(): HeatSetting
2757
- /**
2758
- * Sets the heat setting for this heat interface.
2759
- *
2760
- * *Can only be used if this is HeatInterface*
2761
- *
2762
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.set_heat_setting View documentation}
2763
- *
2764
- * @param filter - The new setting.
2765
- */
2766
- set_heat_setting(filter: HeatSetting): void
2767
- /**
2768
- * Gets the control behavior of the entity (if any).
2769
- *
2770
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_control_behavior View documentation}
2771
- *
2772
- * @returns The control behavior or nil.
2773
- */
2774
- get_control_behavior(): LuaControlBehavior | undefined
2775
- /**
2776
- * Gets (and or creates if needed) the control behavior of the entity.
2450
+ * Gets (and or creates if needed) the control behavior of the entity.
2777
2451
  *
2778
2452
  * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_or_create_control_behavior View documentation}
2779
2453
  *
@@ -2841,18 +2515,6 @@ interface LuaEntity extends LuaControl {
2841
2515
  * @param index - If provided, only returns the `LuaLogisticPoint` specified by this index.
2842
2516
  */
2843
2517
  get_logistic_point(index?: defines.logistic_member_index): LuaLogisticPoint | LuaLogisticPoint[]
2844
- /**
2845
- * Plays a note with the given instrument and note.
2846
- *
2847
- * *Can only be used if this is ProgrammableSpeaker*
2848
- *
2849
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.play_note View documentation}
2850
- *
2851
- * @param instrument
2852
- * @param note
2853
- * @returns If the request is valid. The sound may or may not be played depending on polyphony settings.
2854
- */
2855
- play_note(instrument: uint, note: uint): boolean
2856
2518
  /**
2857
2519
  * Connects the rolling stock in the given direction.
2858
2520
  *
@@ -2879,25 +2541,6 @@ interface LuaEntity extends LuaControl {
2879
2541
  * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.update_connections View documentation}
2880
2542
  */
2881
2543
  update_connections(): void
2882
- /**
2883
- * Current recipe being assembled by this machine or `nil` if no recipe is set.
2884
- *
2885
- * *Can only be used if this is CraftingMachine*
2886
- *
2887
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_recipe View documentation}
2888
- */
2889
- get_recipe(): LuaRecipe | undefined
2890
- /**
2891
- * Sets the current recipe in this assembly machine.
2892
- *
2893
- * *Can only be used if this is AssemblingMachine*
2894
- *
2895
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.set_recipe View documentation}
2896
- *
2897
- * @param recipe - The new recipe or `nil` to clear the recipe.
2898
- * @returns Any items removed from this entity as a result of setting the recipe.
2899
- */
2900
- set_recipe(recipe: string | LuaRecipe | undefined): Record<string, uint>
2901
2544
  /**
2902
2545
  * Rotates this entity as if the player rotated it.
2903
2546
  *
@@ -2916,77 +2559,12 @@ interface LuaEntity extends LuaControl {
2916
2559
  /** When provided the spilled items will be marked for deconstruction by this force. */
2917
2560
  readonly force?: LuaForce | string
2918
2561
  }): boolean
2919
- /**
2920
- * Gets the driver of this vehicle if any.
2921
- *
2922
- * **Note**: May be `nil` if the vehicle contains no driver. To check if there's a passenger see
2923
- * {@link LuaEntity.get_passenger LuaEntity::get_passenger}.
2924
- *
2925
- * *Can only be used if this is Vehicle*
2926
- *
2927
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_driver View documentation}
2928
- */
2929
- get_driver(): LuaEntity | LuaPlayer | undefined
2930
- /**
2931
- * Sets the driver of this vehicle.
2932
- *
2933
- * **Note**: This differs over {@link LuaEntity.set_passenger LuaEntity::set_passenger} in that the passenger can't
2934
- * drive the vehicle.
2935
- *
2936
- * *Can only be used if this is Vehicle*
2937
- *
2938
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.set_driver View documentation}
2939
- *
2940
- * @param driver - The new driver or `nil` to eject the current driver if any.
2941
- */
2942
- set_driver(driver: LuaEntity | PlayerIdentification | undefined): void
2943
- /**
2944
- * Gets the passenger of this car or spidertron if any.
2945
- *
2946
- * **Note**: May be `nil` if the vehicle contains no passenger. To check if there's a driver see
2947
- * {@link LuaEntity.get_driver LuaEntity::get_driver}.
2948
- *
2949
- * **Note**: This differs over {@link LuaEntity.get_driver LuaEntity::get_driver} in that the passenger can't drive the car.
2950
- *
2951
- * *Can only be used if this is Vehicle*
2952
- *
2953
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_passenger View documentation}
2954
- */
2955
- get_passenger(): LuaEntity | LuaPlayer | undefined
2956
- /**
2957
- * Sets the passenger of this car or spidertron.
2958
- *
2959
- * **Note**: This differs over {@link LuaEntity.get_driver LuaEntity::get_driver} in that the passenger can't drive the car.
2960
- *
2961
- * *Can only be used if this is Vehicle*
2962
- *
2963
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.set_passenger View documentation}
2964
- *
2965
- * @param passenger
2966
- */
2967
- set_passenger(passenger: LuaEntity | PlayerIdentification): void
2968
2562
  /**
2969
2563
  * Returns true if this entity is connected to an electric network.
2970
2564
  *
2971
2565
  * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.is_connected_to_electric_network View documentation}
2972
2566
  */
2973
2567
  is_connected_to_electric_network(): boolean
2974
- /**
2975
- * The trains scheduled to stop at this train stop.
2976
- *
2977
- * *Can only be used if this is TrainStop*
2978
- *
2979
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_train_stop_trains View documentation}
2980
- */
2981
- get_train_stop_trains(): LuaTrain[]
2982
- /**
2983
- * The train currently stopped at this train stop or `nil` if none.
2984
- *
2985
- * *Can only be used if this is TrainStop*
2986
- *
2987
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_stopped_train View documentation}
2988
- */
2989
- get_stopped_train(): LuaTrain | undefined
2990
2568
  /**
2991
2569
  * Clones this entity.
2992
2570
  *
@@ -3061,42 +2639,6 @@ interface LuaEntity extends LuaControl {
3061
2639
  * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.clear_fluid_inside View documentation}
3062
2640
  */
3063
2641
  clear_fluid_inside(): void
3064
- /**
3065
- * Get the source of this beam.
3066
- *
3067
- * *Can only be used if this is Beam*
3068
- *
3069
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_beam_source View documentation}
3070
- */
3071
- get_beam_source(): BeamTarget
3072
- /**
3073
- * Set the source of this beam.
3074
- *
3075
- * *Can only be used if this is Beam*
3076
- *
3077
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.set_beam_source View documentation}
3078
- *
3079
- * @param source
3080
- */
3081
- set_beam_source(source: LuaEntity | Position): void
3082
- /**
3083
- * Get the target of this beam.
3084
- *
3085
- * *Can only be used if this is Beam*
3086
- *
3087
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_beam_target View documentation}
3088
- */
3089
- get_beam_target(): BeamTarget
3090
- /**
3091
- * Set the target of this beam.
3092
- *
3093
- * *Can only be used if this is Beam*
3094
- *
3095
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.set_beam_target View documentation}
3096
- *
3097
- * @param target
3098
- */
3099
- set_beam_target(target: LuaEntity | Position): void
3100
2642
  /**
3101
2643
  * The radius of this entity.
3102
2644
  *
@@ -3117,14 +2659,6 @@ interface LuaEntity extends LuaControl {
3117
2659
  * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.create_build_effect_smoke View documentation}
3118
2660
  */
3119
2661
  create_build_effect_smoke(): void
3120
- /**
3121
- * Release the unit from the spawner which spawned it. This allows the spawner to continue spawning additional units.
3122
- *
3123
- * *Can only be used if this is Unit*
3124
- *
3125
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.release_from_spawner View documentation}
3126
- */
3127
- release_from_spawner(): void
3128
2662
  /**
3129
2663
  * Toggle this entity's equipment movement bonus. Does nothing if the entity does not have an equipment grid.
3130
2664
  *
@@ -3171,14 +2705,6 @@ interface LuaEntity extends LuaControl {
3171
2705
  * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_damage_to_be_taken View documentation}
3172
2706
  */
3173
2707
  get_damage_to_be_taken(): float
3174
- /**
3175
- * Depletes and destroys this resource entity.
3176
- *
3177
- * *Can only be used if this is ResourceEntity*
3178
- *
3179
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.deplete View documentation}
3180
- */
3181
- deplete(): void
3182
2708
  /**
3183
2709
  * Mines this entity.
3184
2710
  *
@@ -3273,55 +2799,11 @@ interface LuaEntity extends LuaControl {
3273
2799
  */
3274
2800
  is_registered_for_repair(): boolean
3275
2801
  /**
3276
- * Adds the given position to this spidertron's autopilot's queue of destinations.
3277
- *
3278
- * *Can only be used if this is SpiderVehicle*
3279
- *
3280
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.add_autopilot_destination View documentation}
3281
- *
3282
- * @param position - The position the spidertron should move to.
3283
- */
3284
- add_autopilot_destination(position: MapPosition): void
3285
- /**
3286
- * Connects current linked belt with another one.
3287
- *
3288
- * Neighbours have to be of different type. If given linked belt is connected to something else it will be
3289
- * disconnected first. If provided neighbour is connected to something else it will also be disconnected first.
3290
- * Automatically updates neighbour to be connected back to this one.
3291
- *
3292
- * **Note**: Can also be used on entity ghost if it contains linked-belt
3293
- *
3294
- * *Can only be used if this is LinkedBelt*
3295
- *
3296
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.connect_linked_belts View documentation}
3297
- *
3298
- * @param neighbour - Another linked belt or entity ghost containing linked belt to connect or nil to disconnect
3299
- */
3300
- connect_linked_belts(neighbour: LuaEntity | undefined): void
3301
- /**
3302
- * Disconnects linked belt from its neighbour.
3303
- *
3304
- * **Note**: Can also be used on entity ghost if it contains linked-belt
3305
- *
3306
- * *Can only be used if this is LinkedBelt*
3307
- *
3308
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.disconnect_linked_belts View documentation}
3309
- */
3310
- disconnect_linked_belts(): void
3311
- /**
3312
- * Name of the entity prototype. E.g. "inserter" or "filter-inserter".
2802
+ * Name of the entity prototype. E.g. "inserter" or "filter-inserter".
3313
2803
  *
3314
2804
  * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.name View documentation}
3315
2805
  */
3316
2806
  readonly name: string
3317
- /**
3318
- * Name of the entity or tile contained in this ghost
3319
- *
3320
- * *Can only be used if this is Ghost*
3321
- *
3322
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.ghost_name View documentation}
3323
- */
3324
- readonly ghost_name: string
3325
2807
  /**
3326
2808
  * Localised name of the entity.
3327
2809
  *
@@ -3329,34 +2811,12 @@ interface LuaEntity extends LuaControl {
3329
2811
  */
3330
2812
  readonly localised_name: LocalisedString
3331
2813
  readonly localised_description: LocalisedString
3332
- /**
3333
- * Localised name of the entity or tile contained in this ghost.
3334
- *
3335
- * *Can only be used if this is Ghost*
3336
- *
3337
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.ghost_localised_name View documentation}
3338
- */
3339
- readonly ghost_localised_name: LocalisedString
3340
- /**
3341
- * *Can only be used if this is Ghost*
3342
- *
3343
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.ghost_localised_description View documentation}
3344
- */
3345
- readonly ghost_localised_description: LocalisedString
3346
2814
  /**
3347
2815
  * The entity prototype type of this entity.
3348
2816
  *
3349
2817
  * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.type View documentation}
3350
2818
  */
3351
2819
  readonly type: string
3352
- /**
3353
- * The prototype type of the entity or tile contained in this ghost.
3354
- *
3355
- * *Can only be used if this is Ghost*
3356
- *
3357
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.ghost_type View documentation}
3358
- */
3359
- readonly ghost_type: string
3360
2820
  /**
3361
2821
  * Deactivating an entity will stop all its operations (car will stop moving, inserters will stop working, fish will
3362
2822
  * stop moving etc).
@@ -3446,77 +2906,12 @@ interface LuaEntity extends LuaControl {
3446
2906
  * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.relative_turret_orientation View documentation}
3447
2907
  */
3448
2908
  relative_turret_orientation: RealOrientation | undefined
3449
- /**
3450
- * The torso orientation of this spider vehicle.
3451
- *
3452
- * *Can only be used if this is SpiderVehicle*
3453
- *
3454
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.torso_orientation View documentation}
3455
- */
3456
- torso_orientation: RealOrientation
3457
- /**
3458
- * Count of resource units contained.
3459
- *
3460
- * *Can only be used if this is ResourceEntity*
3461
- *
3462
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.amount View documentation}
3463
- */
3464
- amount: uint
3465
- /**
3466
- * Count of initial resource units contained.
3467
- *
3468
- * **Note**: If this is not an infinite resource reading will give `nil` and writing will give an error.
3469
- *
3470
- * *Can only be used if this is ResourceEntity*
3471
- *
3472
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.initial_amount View documentation}
3473
- */
3474
- initial_amount: uint | undefined
3475
- /**
3476
- * Multiplies the acceleration the vehicle can create for one unit of energy. By default is `1`.
3477
- *
3478
- * *Can only be used if this is Car*
3479
- *
3480
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.effectivity_modifier View documentation}
3481
- */
3482
- effectivity_modifier: float
3483
- /**
3484
- * Multiplies the energy consumption.
3485
- *
3486
- * *Can only be used if this is Car*
3487
- *
3488
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.consumption_modifier View documentation}
3489
- */
3490
- consumption_modifier: float
3491
- /**
3492
- * Multiplies the car friction rate.
3493
- *
3494
- * *Can only be used if this is Car*
3495
- *
3496
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.friction_modifier View documentation}
3497
- *
3498
- * @example
3499
- * This will allow the car to go much faster
3500
- *
3501
- * ```lua
3502
- * game.player.vehicle.friction_modifier = 0.5
3503
- * ```
3504
- */
3505
- friction_modifier: float
3506
2909
  /**
3507
2910
  * Whether the driver of this car or spidertron is the gunner, if false, the passenger is the gunner.
3508
2911
  *
3509
2912
  * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.driver_is_gunner View documentation}
3510
2913
  */
3511
2914
  driver_is_gunner: boolean
3512
- /**
3513
- * Read when this spidertron auto-targets enemies
3514
- *
3515
- * *Can only be used if this is SpiderVehicle*
3516
- *
3517
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.vehicle_automatic_targeting_parameters View documentation}
3518
- */
3519
- vehicle_automatic_targeting_parameters: VehicleAutomaticTargetingParameters
3520
2915
  /**
3521
2916
  * The current speed of this car in tiles per tick, rolling stock, projectile or spider vehicle, or current max
3522
2917
  * speed of the unit. Only the speed of units, cars, and projectiles are writable.
@@ -3524,35 +2919,12 @@ interface LuaEntity extends LuaControl {
3524
2919
  * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.speed View documentation}
3525
2920
  */
3526
2921
  speed: float
3527
- /**
3528
- * The current speed of this unit in tiles per tick, taking into account any walking speed modifier given by the
3529
- * tile the unit is standing on.
3530
- *
3531
- * *Can only be used if this is Unit*
3532
- *
3533
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.effective_speed View documentation}
3534
- */
3535
- readonly effective_speed: float
3536
- /**
3537
- * *Can only be used if this is ItemEntity*
3538
- *
3539
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.stack View documentation}
3540
- */
3541
- readonly stack: LuaItemStack
3542
2922
  /**
3543
2923
  * The entity prototype of this entity.
3544
2924
  *
3545
2925
  * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.prototype View documentation}
3546
2926
  */
3547
2927
  readonly prototype: LuaEntityPrototype
3548
- /**
3549
- * The prototype of the entity or tile contained in this ghost.
3550
- *
3551
- * *Can only be used if this is Ghost*
3552
- *
3553
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.ghost_prototype View documentation}
3554
- */
3555
- readonly ghost_prototype: LuaEntityPrototype | LuaTilePrototype
3556
2928
  /**
3557
2929
  * Position where the entity puts its stuff.
3558
2930
  *
@@ -3563,16 +2935,6 @@ interface LuaEntity extends LuaControl {
3563
2935
  * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.drop_position View documentation}
3564
2936
  */
3565
2937
  drop_position: Position
3566
- /**
3567
- * Where the inserter will pick up items from.
3568
- *
3569
- * **Note**: Inserters must have `allow_custom_vectors` set to true on their prototype to allow changing the pickup position.
3570
- *
3571
- * *Can only be used if this is Inserter*
3572
- *
3573
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.pickup_position View documentation}
3574
- */
3575
- pickup_position: Position
3576
2938
  /**
3577
2939
  * The entity this entity is putting its items to, or `nil` if there is no such entity. If there are multiple
3578
2940
  * possible entities at the drop-off point, writing to this attribute allows a mod to choose which one to drop off
@@ -3584,25 +2946,6 @@ interface LuaEntity extends LuaControl {
3584
2946
  * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.drop_target View documentation}
3585
2947
  */
3586
2948
  drop_target: LuaEntity | undefined
3587
- /**
3588
- * The entity this inserter will attempt to pick up items from, or `nil` if there is no such entity. If there are
3589
- * multiple possible entities at the pick-up point, writing to this attribute allows a mod to choose which one to
3590
- * pick up items from. The entity needs to collide with the tile box under the pick-up position.
3591
- *
3592
- * *Can only be used if this is Inserter*
3593
- *
3594
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.pickup_target View documentation}
3595
- */
3596
- pickup_target: LuaEntity | undefined
3597
- /**
3598
- * Index of the currently selected weapon slot of this character, car, or spidertron, or `nil` if the car/spidertron
3599
- * doesn't have guns.
3600
- *
3601
- * *Can only be used if this is Character or Car*
3602
- *
3603
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.selected_gun_index View documentation}
3604
- */
3605
- selected_gun_index: uint | undefined
3606
2949
  /**
3607
2950
  * Energy stored in the entity (heat in furnace, energy stored in electrical devices etc.). always 0 for entities
3608
2951
  * that don't have the concept of energy stored inside.
@@ -3622,30 +2965,6 @@ interface LuaEntity extends LuaControl {
3622
2965
  * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.temperature View documentation}
3623
2966
  */
3624
2967
  temperature: double | undefined
3625
- /**
3626
- * The previous recipe this furnace was using or nil if the furnace had no previous recipe.
3627
- *
3628
- * *Can only be used if this is Furnace*
3629
- *
3630
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.previous_recipe View documentation}
3631
- */
3632
- readonly previous_recipe: LuaRecipe | undefined
3633
- /**
3634
- * The item stack currently held in an inserter's hand.
3635
- *
3636
- * *Can only be used if this is Inserter*
3637
- *
3638
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.held_stack View documentation}
3639
- */
3640
- readonly held_stack: LuaItemStack
3641
- /**
3642
- * Current position of the inserter's "hand".
3643
- *
3644
- * *Can only be used if this is Inserter*
3645
- *
3646
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.held_stack_position View documentation}
3647
- */
3648
- readonly held_stack_position: PositionTable
3649
2968
  /**
3650
2969
  * The train this rolling stock belongs to or nil if not rolling stock.
3651
2970
  *
@@ -3664,17 +2983,6 @@ interface LuaEntity extends LuaControl {
3664
2983
  * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.neighbours View documentation}
3665
2984
  */
3666
2985
  readonly neighbours: Record<string, LuaEntity[]> | LuaEntity[][] | LuaEntity | undefined
3667
- /**
3668
- * The belt connectable neighbours of this belt connectable entity. Only entities that input to or are outputs of
3669
- * this entity. Does not contain the other end of an underground belt, see
3670
- * {@link LuaEntity.neighbours LuaEntity::neighbours} for that. This is a dictionary with `"inputs"`, `"outputs"`
3671
- * entries that are arrays of transport belt connectable entities, or empty tables if no entities.
3672
- *
3673
- * *Can only be used if this is TransportBeltConnectable*
3674
- *
3675
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.belt_neighbours View documentation}
3676
- */
3677
- readonly belt_neighbours: Record<string, LuaEntity[]>
3678
2986
  /**
3679
2987
  * Fluidboxes of this entity.
3680
2988
  *
@@ -3718,117 +3026,37 @@ interface LuaEntity extends LuaControl {
3718
3026
  */
3719
3027
  color: Color | undefined
3720
3028
  /**
3721
- * The text of this flying-text entity.
3029
+ * The productivity bonus of this entity.
3722
3030
  *
3723
- * *Can only be used if this is FlyingText*
3031
+ * **Note**: This includes force based bonuses as well as beacon/module bonuses.
3724
3032
  *
3725
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.text View documentation}
3033
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.productivity_bonus View documentation}
3726
3034
  */
3727
- text: LocalisedString
3035
+ readonly productivity_bonus: double
3728
3036
  /**
3729
- * The state of this rail signal.
3730
- *
3731
- * *Can only be used if this is RailSignal or RailChainSignal*
3037
+ * The pollution bonus of this entity.
3732
3038
  *
3733
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.signal_state View documentation}
3039
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.pollution_bonus View documentation}
3734
3040
  */
3735
- readonly signal_state: defines.signal_state
3041
+ readonly pollution_bonus: double
3736
3042
  /**
3737
- * The state of this chain signal.
3043
+ * The speed bonus of this entity.
3738
3044
  *
3739
- * *Can only be used if this is RailChainSignal*
3045
+ * **Note**: This includes force based bonuses as well as beacon/module bonuses.
3740
3046
  *
3741
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.chain_signal_state View documentation}
3047
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.speed_bonus View documentation}
3742
3048
  */
3743
- readonly chain_signal_state: defines.chain_signal_state
3049
+ readonly speed_bonus: double
3744
3050
  /**
3745
- * Will this entity be picked up automatically when the player walks over it?
3746
- *
3747
- * *Can only be used if this is ItemEntity*
3051
+ * The consumption bonus of this entity.
3748
3052
  *
3749
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.to_be_looted View documentation}
3053
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.consumption_bonus View documentation}
3750
3054
  */
3751
- to_be_looted: boolean
3055
+ readonly consumption_bonus: double
3752
3056
  /**
3753
- * The current crafting speed, including speed bonuses from modules and beacons.
3754
- *
3755
- * *Can only be used if this is CraftingMachine*
3057
+ * The logistic network this entity is a part of.
3756
3058
  *
3757
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.crafting_speed View documentation}
3758
- */
3759
- readonly crafting_speed: double
3760
- /**
3761
- * The current crafting progress, as a number in range [0, 1].
3762
- *
3763
- * *Can only be used if this is CraftingMachine*
3764
- *
3765
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.crafting_progress View documentation}
3766
- */
3767
- crafting_progress: float
3768
- /**
3769
- * The current productivity bonus progress, as a number in range [0, 1].
3770
- *
3771
- * *Can only be used if this is CraftingMachine*
3772
- *
3773
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.bonus_progress View documentation}
3774
- */
3775
- bonus_progress: double
3776
- /**
3777
- * The productivity bonus of this entity.
3778
- *
3779
- * **Note**: This includes force based bonuses as well as beacon/module bonuses.
3780
- *
3781
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.productivity_bonus View documentation}
3782
- */
3783
- readonly productivity_bonus: double
3784
- /**
3785
- * The pollution bonus of this entity.
3786
- *
3787
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.pollution_bonus View documentation}
3788
- */
3789
- readonly pollution_bonus: double
3790
- /**
3791
- * The speed bonus of this entity.
3792
- *
3793
- * **Note**: This includes force based bonuses as well as beacon/module bonuses.
3794
- *
3795
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.speed_bonus View documentation}
3796
- */
3797
- readonly speed_bonus: double
3798
- /**
3799
- * The consumption bonus of this entity.
3800
- *
3801
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.consumption_bonus View documentation}
3802
- */
3803
- readonly consumption_bonus: double
3804
- /**
3805
- * `"input"` or `"output"`, depending on whether this underground belt goes down or up.
3806
- *
3807
- * *Can only be used if this is TransportBeltToGround*
3808
- *
3809
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.belt_to_ground_type View documentation}
3810
- */
3811
- readonly belt_to_ground_type: "input" | "output"
3812
- /**
3813
- * `"input"` or `"output"`, depending on whether this loader puts to or gets from a container.
3814
- *
3815
- * *Can only be used if this is Loader*
3816
- *
3817
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.loader_type View documentation}
3818
- */
3819
- loader_type: "input" | "output"
3820
- /**
3821
- * Number of rocket parts in the silo.
3822
- *
3823
- * *Can only be used if this is RocketSilo*
3824
- *
3825
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.rocket_parts View documentation}
3826
- */
3827
- rocket_parts: uint
3828
- /**
3829
- * The logistic network this entity is a part of.
3830
- *
3831
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.logistic_network View documentation}
3059
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.logistic_network View documentation}
3832
3060
  */
3833
3061
  logistic_network: LuaLogisticNetwork
3834
3062
  /**
@@ -3844,48 +3072,6 @@ interface LuaEntity extends LuaControl {
3844
3072
  * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.item_requests View documentation}
3845
3073
  */
3846
3074
  item_requests: Record<string, uint>
3847
- /**
3848
- * The player connected to this character or `nil` if none.
3849
- *
3850
- * *Can only be used if this is Character*
3851
- *
3852
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.player View documentation}
3853
- */
3854
- readonly player: LuaPlayer | undefined
3855
- /**
3856
- * The unit group this unit is a member of, or `nil` if none.
3857
- *
3858
- * *Can only be used if this is Unit*
3859
- *
3860
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.unit_group View documentation}
3861
- */
3862
- readonly unit_group: LuaUnitGroup | undefined
3863
- /**
3864
- * The damage dealt by this turret, artillery turret, or artillery wagon.
3865
- *
3866
- * *Can only be used if this is Turret*
3867
- *
3868
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.damage_dealt View documentation}
3869
- */
3870
- damage_dealt: double
3871
- /**
3872
- * The number of units killed by this turret, artillery turret, or artillery wagon.
3873
- *
3874
- * *Can only be used if this is Turret*
3875
- *
3876
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.kills View documentation}
3877
- */
3878
- kills: uint
3879
- /**
3880
- * The last player that changed any setting on this entity. This includes building the entity, changing its color,
3881
- * or configuring its circuit network. Can be `nil` if the last user is not part of the save anymore. Mods can
3882
- * overwrite it if desired.
3883
- *
3884
- * *Can only be used if this is EntityWithOwner*
3885
- *
3886
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.last_user View documentation}
3887
- */
3888
- last_user: LuaPlayer | undefined
3889
3075
  /**
3890
3076
  * The buffer size for the electric energy source or nil if the entity doesn't have an electric energy source.
3891
3077
  *
@@ -3925,14 +3111,6 @@ interface LuaEntity extends LuaControl {
3925
3111
  * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.unit_number View documentation}
3926
3112
  */
3927
3113
  readonly unit_number: uint | undefined
3928
- /**
3929
- * The unit number of the entity contained in this ghost or nil if the entity doesn't have one.
3930
- *
3931
- * *Can only be used if this is EntityGhost*
3932
- *
3933
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.ghost_unit_number View documentation}
3934
- */
3935
- readonly ghost_unit_number: uint | undefined
3936
3114
  /**
3937
3115
  * The mining progress for this mining drill or `nil` if this isn't a mining drill. Is a number in range [0,
3938
3116
  * mining_target.prototype.mineable_properties.mining_time]
@@ -3947,22 +3125,6 @@ interface LuaEntity extends LuaControl {
3947
3125
  * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.bonus_mining_progress View documentation}
3948
3126
  */
3949
3127
  bonus_mining_progress: double | undefined
3950
- /**
3951
- * The power production specific to the ElectricEnergyInterface entity type.
3952
- *
3953
- * *Can only be used if this is ElectricEnergyInterface*
3954
- *
3955
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.power_production View documentation}
3956
- */
3957
- power_production: double
3958
- /**
3959
- * The power usage specific to the ElectricEnergyInterface entity type.
3960
- *
3961
- * *Can only be used if this is ElectricEnergyInterface*
3962
- *
3963
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.power_usage View documentation}
3964
- */
3965
- power_usage: double
3966
3128
  /**
3967
3129
  * {@link LuaEntityPrototype.collision_box LuaEntityPrototype::collision_box} around entity's given position and
3968
3130
  * respecting the current entity orientation.
@@ -3989,14 +3151,6 @@ interface LuaEntity extends LuaControl {
3989
3151
  * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.secondary_selection_box View documentation}
3990
3152
  */
3991
3153
  readonly secondary_selection_box: BoundingBoxTable | undefined
3992
- /**
3993
- * The mining target or `nil` if none
3994
- *
3995
- * *Can only be used if this is MiningDrill*
3996
- *
3997
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.mining_target View documentation}
3998
- */
3999
- readonly mining_target: LuaEntity | undefined
4000
3154
  /**
4001
3155
  * Entities that are directly connected to this entity via the circuit network.
4002
3156
  *
@@ -4027,15 +3181,6 @@ interface LuaEntity extends LuaControl {
4027
3181
  * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.filter_slot_count View documentation}
4028
3182
  */
4029
3183
  readonly filter_slot_count: uint
4030
- /**
4031
- * The container entity this loader is pointing at/pulling from depending on the
4032
- * {@link LuaEntity.loader_type LuaEntity::loader_type}.
4033
- *
4034
- * *Can only be used if this is Loader*
4035
- *
4036
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.loader_container View documentation}
4037
- */
4038
- readonly loader_container: LuaEntity
4039
3184
  /**
4040
3185
  * The equipment grid or `nil` if this entity doesn't have an equipment grid.
4041
3186
  *
@@ -4114,26 +3259,6 @@ interface LuaEntity extends LuaControl {
4114
3259
  * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.sticked_to View documentation}
4115
3260
  */
4116
3261
  readonly sticked_to: LuaEntity
4117
- /**
4118
- * *Can only be used if this is ProgrammableSpeaker*
4119
- *
4120
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.parameters View documentation}
4121
- */
4122
- parameters: ProgrammableSpeakerParameters
4123
- /**
4124
- * *Can only be used if this is ProgrammableSpeaker*
4125
- *
4126
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.alert_parameters View documentation}
4127
- */
4128
- alert_parameters: ProgrammableSpeakerAlertParameters
4129
- /**
4130
- * The electric network statistics for this electric pole.
4131
- *
4132
- * *Can only be used if this is ElectricPole*
4133
- *
4134
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.electric_network_statistics View documentation}
4135
- */
4136
- readonly electric_network_statistics: LuaFlowStatistics
4137
3262
  /**
4138
3263
  * Sets the stack size limit on this inserter. If the stack size is > than the force stack size limit the value is ignored.
4139
3264
  *
@@ -4142,14 +3267,6 @@ interface LuaEntity extends LuaControl {
4142
3267
  * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.inserter_stack_size_override View documentation}
4143
3268
  */
4144
3269
  inserter_stack_size_override: uint
4145
- /**
4146
- * The number of products this machine finished crafting in its lifetime.
4147
- *
4148
- * *Can only be used if this is CraftingMachine*
4149
- *
4150
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.products_finished View documentation}
4151
- */
4152
- products_finished: uint
4153
3270
  /**
4154
3271
  * The spawner associated with this unit entity or `nil` if the unit has no associated spawner.
4155
3272
  *
@@ -4175,166 +3292,189 @@ interface LuaEntity extends LuaControl {
4175
3292
  */
4176
3293
  readonly effects: ModuleEffects | undefined
4177
3294
  /**
4178
- * The filters for this infinity container.
4179
- *
4180
- * *Can only be used if this is InfinityContainer*
3295
+ * The status of this entity or `nil` if no status.
4181
3296
  *
4182
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.infinity_container_filters View documentation}
3297
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.status View documentation}
4183
3298
  */
4184
- infinity_container_filters: InfinityInventoryFilter[]
3299
+ readonly status: defines.entity_status | undefined
4185
3300
  /**
4186
- * If items not included in this infinity container filters should be removed from the container.
4187
- *
4188
- * *Can only be used if this is InfinityContainer*
3301
+ * The player that this `simple-entity-with-owner`, `simple-entity-with-force`, `flying-text`, or `highlight-box` is
3302
+ * visible to. `nil` means it is rendered for every player.
4189
3303
  *
4190
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.remove_unfiltered_items View documentation}
3304
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.render_player View documentation}
4191
3305
  */
4192
- remove_unfiltered_items: boolean
3306
+ render_player: LuaPlayer | undefined
4193
3307
  /**
4194
- * The player index associated with this character corpse.
4195
- *
4196
- * **Note**: The index is not guaranteed to be valid so it should always be checked first if a player with that
4197
- * index actually exists.
3308
+ * The forces that this `simple-entity-with-owner`, `simple-entity-with-force`, or `flying-text` is visible to.
3309
+ * `nil` or an empty array means it is rendered for every force.
4198
3310
  *
4199
- * *Can only be used if this is CharacterCorpse*
3311
+ * **Note**: Reading will always give an array of {@link LuaForce}
4200
3312
  *
4201
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.character_corpse_player_index View documentation}
3313
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.render_to_forces View documentation}
4202
3314
  */
4203
- character_corpse_player_index: uint
3315
+ render_to_forces: ForceIdentification[] | undefined
4204
3316
  /**
4205
- * The tick this character corpse died at.
4206
- *
4207
- * *Can only be used if this is CharacterCorpse*
3317
+ * Returns the id of the electric network that this entity is connected to or `nil`.
4208
3318
  *
4209
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.character_corpse_tick_of_death View documentation}
3319
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.electric_network_id View documentation}
4210
3320
  */
4211
- character_corpse_tick_of_death: uint
3321
+ readonly electric_network_id: uint | undefined
4212
3322
  /**
4213
- * The reason this character corpse character died (if any).
4214
- *
4215
- * *Can only be used if this is CharacterCorpse*
3323
+ * The storage filter for this logistic storage container.
4216
3324
  *
4217
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.character_corpse_death_cause View documentation}
3325
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.storage_filter View documentation}
4218
3326
  */
4219
- character_corpse_death_cause: LocalisedString
3327
+ storage_filter: LuaItemPrototype
4220
3328
  /**
4221
- * The player this character is associated with or `nil` if none. When the player logs off in multiplayer all of the
4222
- * associated characters will be logged off with him.
4223
- *
4224
- * **Note**: A character associated with a player is not directly controlled by any player.
4225
- *
4226
- * **Note**: Set to `nil` to clear. The player will be automatically disassociated when a controller is set on the character.
3329
+ * Whether this requester chest is set to also request from buffer chests.
4227
3330
  *
4228
- * *Can only be used if this is Character*
3331
+ * **Note**: Useable only on entities that have requester slots.
4229
3332
  *
4230
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.associated_player View documentation}
3333
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.request_from_buffers View documentation}
4231
3334
  */
4232
- associated_player: LuaPlayer | undefined
3335
+ request_from_buffers: boolean
4233
3336
  /**
4234
- * The last tick this character entity was attacked.
3337
+ * Whether this corpse will ever fade away.
4235
3338
  *
4236
- * *Can only be used if this is Character*
3339
+ * **Note**: Useable only on corpses.
4237
3340
  *
4238
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.tick_of_last_attack View documentation}
3341
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.corpse_expires View documentation}
4239
3342
  */
4240
- tick_of_last_attack: uint
3343
+ corpse_expires: boolean
4241
3344
  /**
4242
- * The last tick this character entity was damaged.
3345
+ * If true, corpse won't be destroyed when entities are placed over it. If false, whether corpse will be removed or
3346
+ * not depends on value of CorpsePrototype::remove_on_entity_placement.
4243
3347
  *
4244
- * *Can only be used if this is Character*
3348
+ * **Note**: Useable only on corpses.
4245
3349
  *
4246
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.tick_of_last_damage View documentation}
3350
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.corpse_immune_to_entity_placement View documentation}
4247
3351
  */
4248
- tick_of_last_damage: uint
3352
+ corpse_immune_to_entity_placement: boolean
4249
3353
  /**
4250
- * The filter for this splitter or `nil` if no filter is set.
4251
- *
4252
- * *Can only be used if this is Splitter*
3354
+ * The tags associated with this entity ghost or `nil` if not an entity ghost.
4253
3355
  *
4254
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.splitter_filter View documentation}
3356
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.tags View documentation}
4255
3357
  */
4256
- splitter_filter: LuaItemPrototype | undefined
3358
+ tags: Tags | undefined
4257
3359
  /**
4258
- * The filter mode for this filter inserter: "whitelist", "blacklist", or `nil` if this inserter doesn't use filters.
4259
- *
4260
- * *Can only be used if this is Inserter*
3360
+ * If this entity is EntityWithForce
4261
3361
  *
4262
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.inserter_filter_mode View documentation}
3362
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.is_entity_with_force View documentation}
4263
3363
  */
4264
- inserter_filter_mode: "whitelist" | "blacklist" | undefined
3364
+ readonly is_entity_with_force: boolean
4265
3365
  /**
4266
- * The input priority for this splitter : "left", "none", or "right".
3366
+ * If this entity is EntityWithOwner
4267
3367
  *
4268
- * *Can only be used if this is Splitter*
3368
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.is_entity_with_owner View documentation}
3369
+ */
3370
+ readonly is_entity_with_owner: boolean
3371
+ /**
3372
+ * If this entity is EntityWithHealth
4269
3373
  *
4270
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.splitter_input_priority View documentation}
3374
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.is_entity_with_health View documentation}
4271
3375
  */
4272
- splitter_input_priority: "left" | "none" | "right"
3376
+ readonly is_entity_with_health: boolean
4273
3377
  /**
4274
- * The output priority for this splitter : "left", "none", or "right".
3378
+ * The owner of this combat robot if any.
4275
3379
  *
4276
- * *Can only be used if this is Splitter*
3380
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.combat_robot_owner View documentation}
3381
+ */
3382
+ combat_robot_owner: LuaEntity
3383
+ /**
3384
+ * The link ID this linked container is using.
4277
3385
  *
4278
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.splitter_output_priority View documentation}
3386
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.link_id View documentation}
4279
3387
  */
4280
- splitter_output_priority: "left" | "none" | "right"
3388
+ link_id: uint
4281
3389
  /**
4282
- * If this land mine is armed.
3390
+ * Is this object valid? This Lua object holds a reference to an object within the game engine. It is possible that
3391
+ * the game-engine object is removed whilst a mod still holds the corresponding Lua object. If that happens, the
3392
+ * object becomes invalid, i.e. this attribute will be `false`. Mods are advised to check for object validity if any
3393
+ * change to the game state might have occurred between the creation of the Lua object and its access.
3394
+ */
3395
+ readonly valid: boolean
3396
+ /**
3397
+ * The class name of this object. Available even when `valid` is false. For LuaStruct objects it may also be
3398
+ * suffixed with a dotted path to a member of the struct.
3399
+ */
3400
+ readonly object_name: "LuaEntity"
3401
+ /** All methods and properties that this object supports. */
3402
+ help(): string
3403
+ }
3404
+
3405
+ /** @noSelf */
3406
+ interface EntityWithHealthEntity extends BaseEntity {
3407
+ /**
3408
+ * Damages the entity.
4283
3409
  *
4284
- * *Can only be used if this is LandMine*
3410
+ * *Can only be used if this is EntityWithHealth*
4285
3411
  *
4286
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.armed View documentation}
3412
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.damage View documentation}
3413
+ *
3414
+ * @param damage - The amount of damage to be done
3415
+ * @param force - The force that will be doing the damage.
3416
+ * @param type - The type of damage to be done, defaults to "impact".
3417
+ * @param dealer - The entity to consider as the damage dealer.
3418
+ * @returns The total damage actually applied after resistances.
4287
3419
  */
4288
- readonly armed: boolean
3420
+ damage(damage: float, force: ForceIdentification, type?: string, dealer?: LuaEntity): float
3421
+ }
3422
+
3423
+ /** @noSelf */
3424
+ interface UnitEntity extends BaseEntity {
4289
3425
  /**
4290
- * When locked; the recipe in this assembling machine can't be changed by the player.
3426
+ * Give the entity a command.
4291
3427
  *
4292
- * *Can only be used if this is AssemblingMachine*
3428
+ * *Can only be used if this is Unit*
4293
3429
  *
4294
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.recipe_locked View documentation}
3430
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.set_command View documentation}
3431
+ *
3432
+ * @param command
4295
3433
  */
4296
- recipe_locked: boolean
3434
+ set_command(command: Command): void
4297
3435
  /**
4298
- * The rail entity this train stop is connected to or `nil` if there is none.
3436
+ * Give the entity a distraction command.
4299
3437
  *
4300
- * *Can only be used if this is TrainStop*
3438
+ * *Can only be used if this is Unit*
4301
3439
  *
4302
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.connected_rail View documentation}
3440
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.set_distraction_command View documentation}
3441
+ *
3442
+ * @param command
4303
3443
  */
4304
- readonly connected_rail: LuaEntity | undefined
3444
+ set_distraction_command(command: Command): void
4305
3445
  /**
4306
- * Rail direction to which this train stop is binding. This returns a value even when no rails are present.
3446
+ * Has this unit been assigned a command?
4307
3447
  *
4308
- * *Can only be used if this is TrainStop*
3448
+ * *Can only be used if this is Unit*
4309
3449
  *
4310
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.connected_rail_direction View documentation}
3450
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.has_command View documentation}
4311
3451
  */
4312
- readonly connected_rail_direction: defines.rail_direction
3452
+ has_command(): boolean
4313
3453
  /**
4314
- * The number of trains in this rail block for this rail entity.
3454
+ * Release the unit from the spawner which spawned it. This allows the spawner to continue spawning additional units.
4315
3455
  *
4316
- * *Can only be used if this is Rail*
3456
+ * *Can only be used if this is Unit*
4317
3457
  *
4318
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.trains_in_block View documentation}
3458
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.release_from_spawner View documentation}
4319
3459
  */
4320
- readonly trains_in_block: uint
3460
+ release_from_spawner(): void
4321
3461
  /**
4322
- * The timeout that's left on this landmine in ticks. It describes the time between the landmine being placed and it
4323
- * being armed.
3462
+ * The current speed of this unit in tiles per tick, taking into account any walking speed modifier given by the
3463
+ * tile the unit is standing on.
4324
3464
  *
4325
- * *Can only be used if this is LandMine*
3465
+ * *Can only be used if this is Unit*
4326
3466
  *
4327
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.timeout View documentation}
3467
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.effective_speed View documentation}
4328
3468
  */
4329
- timeout: uint
3469
+ readonly effective_speed: float
4330
3470
  /**
4331
- * The current total neighbour bonus of this reactor.
3471
+ * The unit group this unit is a member of, or `nil` if none.
4332
3472
  *
4333
- * *Can only be used if this is Reactor*
3473
+ * *Can only be used if this is Unit*
4334
3474
  *
4335
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.neighbour_bonus View documentation}
3475
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.unit_group View documentation}
4336
3476
  */
4337
- readonly neighbour_bonus: double
3477
+ readonly unit_group: LuaUnitGroup | undefined
4338
3478
  /**
4339
3479
  * The ai settings of this unit.
4340
3480
  *
@@ -4344,312 +3484,1397 @@ interface LuaEntity extends LuaControl {
4344
3484
  */
4345
3485
  readonly ai_settings: LuaAISettings
4346
3486
  /**
4347
- * The hightlight box type of this highlight box entity.
3487
+ * Returns true if this unit is moving.
4348
3488
  *
4349
- * *Can only be used if this is HighlightBox*
3489
+ * *Can only be used if this is Unit*
4350
3490
  *
4351
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.highlight_box_type View documentation}
3491
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.moving View documentation}
4352
3492
  */
4353
- highlight_box_type: string
3493
+ readonly moving: boolean
4354
3494
  /**
4355
- * The blink interval of this highlight box entity. 0 indicates no blink.
3495
+ * The command given to this unit or `nil` is the unit has no command.
4356
3496
  *
4357
- * *Can only be used if this is HighlightBox*
3497
+ * *Can only be used if this is Unit*
4358
3498
  *
4359
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.highlight_box_blink_interval View documentation}
3499
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.command View documentation}
4360
3500
  */
4361
- highlight_box_blink_interval: uint
3501
+ readonly command: Command | undefined
4362
3502
  /**
4363
- * The status of this entity or `nil` if no status.
3503
+ * The distraction command given to this unit or `nil` is the unit currently isn't distracted.
4364
3504
  *
4365
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.status View documentation}
3505
+ * *Can only be used if this is Unit*
3506
+ *
3507
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.distraction_command View documentation}
4366
3508
  */
4367
- readonly status: defines.entity_status | undefined
3509
+ readonly distraction_command: Command | undefined
3510
+ }
3511
+
3512
+ /** @noSelf */
3513
+ interface EntityGhostEntity extends BaseEntity {
4368
3514
  /**
4369
- * If equipment grid logistics are enabled while this vehicle is moving.
3515
+ * Same as {@link LuaEntity.has_flag LuaEntity::has_flag}, but targets the inner entity on a entity ghost.
4370
3516
  *
4371
- * *Can only be used if this is Vehicle*
3517
+ * *Can only be used if this is EntityGhost*
4372
3518
  *
4373
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.enable_logistics_while_moving View documentation}
4374
- */
4375
- enable_logistics_while_moving: boolean
4376
- /**
4377
- * The player that this `simple-entity-with-owner`, `simple-entity-with-force`, `flying-text`, or `highlight-box` is
4378
- * visible to. `nil` means it is rendered for every player.
3519
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.ghost_has_flag View documentation}
4379
3520
  *
4380
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.render_player View documentation}
3521
+ * @param flag - The flag to test. See {@link EntityPrototypeFlags} for a list of flags.
3522
+ * @returns `true` if the entity has the given flag set.
4381
3523
  */
4382
- render_player: LuaPlayer | undefined
3524
+ ghost_has_flag(flag: string): boolean
4383
3525
  /**
4384
- * The forces that this `simple-entity-with-owner`, `simple-entity-with-force`, or `flying-text` is visible to.
4385
- * `nil` or an empty array means it is rendered for every force.
3526
+ * The unit number of the entity contained in this ghost or nil if the entity doesn't have one.
4386
3527
  *
4387
- * **Note**: Reading will always give an array of {@link LuaForce}
3528
+ * *Can only be used if this is EntityGhost*
4388
3529
  *
4389
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.render_to_forces View documentation}
3530
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.ghost_unit_number View documentation}
4390
3531
  */
4391
- render_to_forces: ForceIdentification[] | undefined
3532
+ readonly ghost_unit_number: uint | undefined
3533
+ }
3534
+
3535
+ /** @noSelf */
3536
+ interface MarketEntity extends BaseEntity {
4392
3537
  /**
4393
- * The rail target of this pump or `nil`.
3538
+ * Offer a thing on the market.
4394
3539
  *
4395
- * *Can only be used if this is Pump*
3540
+ * *Can only be used if this is Market*
4396
3541
  *
4397
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.pump_rail_target View documentation}
4398
- */
4399
- readonly pump_rail_target: LuaEntity | undefined
4400
- /**
4401
- * Returns true if this unit is moving.
3542
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.add_market_item View documentation}
4402
3543
  *
4403
- * *Can only be used if this is Unit*
3544
+ * @example
3545
+ * Adds market offer, 1 copper ore for 10 iron ore.
4404
3546
  *
4405
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.moving View documentation}
4406
- */
4407
- readonly moving: boolean
4408
- /**
4409
- * Returns the id of the electric network that this entity is connected to or `nil`.
3547
+ * ```lua
3548
+ * market.add_market_item{price={{"iron-ore", 10}}, offer={type="give-item", item="copper-ore"}}
3549
+ * ```
4410
3550
  *
4411
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.electric_network_id View documentation}
4412
- */
4413
- readonly electric_network_id: uint | undefined
4414
- /**
4415
- * Whether this character's personal roboports are allowed to dispatch robots.
3551
+ * @example
3552
+ * Adds market offer, 1 copper ore for 5 iron ore and 5 stone ore.
4416
3553
  *
4417
- * *Can only be used if this is Character*
3554
+ * ```lua
3555
+ * market.add_market_item{price={{"iron-ore", 5}, {"stone", 5}}, offer={type="give-item", item="copper-ore"}}
3556
+ * ```
4418
3557
  *
4419
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.allow_dispatching_robots View documentation}
3558
+ * @param offer
4420
3559
  */
4421
- allow_dispatching_robots: boolean
3560
+ add_market_item(offer: Offer): void
4422
3561
  /**
4423
- * Whether this rocket silo automatically launches the rocket when cargo is inserted.
3562
+ * Remove an offer from a market.
4424
3563
  *
4425
- * *Can only be used if this is RocketSilo*
3564
+ * **Note**: The other offers are moved down to fill the gap created by removing the offer, which decrements the
3565
+ * overall size of the offer array.
4426
3566
  *
4427
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.auto_launch View documentation}
4428
- */
4429
- auto_launch: boolean
4430
- /**
4431
- * How much energy this generator generated in the last tick.
3567
+ * *Can only be used if this is Market*
4432
3568
  *
4433
- * *Can only be used if this is Generator*
3569
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.remove_market_item View documentation}
4434
3570
  *
4435
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.energy_generated_last_tick View documentation}
3571
+ * @param offer - Index of offer to remove.
3572
+ * @returns `true` if the offer was successfully removed; `false` when the given index was not valid.
4436
3573
  */
4437
- readonly energy_generated_last_tick: double
3574
+ remove_market_item(offer: uint): boolean
4438
3575
  /**
4439
- * The storage filter for this logistic storage container.
3576
+ * Get all offers in a market as an array.
4440
3577
  *
4441
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.storage_filter View documentation}
3578
+ * *Can only be used if this is Market*
3579
+ *
3580
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_market_items View documentation}
4442
3581
  */
4443
- storage_filter: LuaItemPrototype
3582
+ get_market_items(): Offer[]
4444
3583
  /**
4445
- * Whether this requester chest is set to also request from buffer chests.
3584
+ * Removes all offers from a market.
4446
3585
  *
4447
- * **Note**: Useable only on entities that have requester slots.
3586
+ * *Can only be used if this is Market*
4448
3587
  *
4449
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.request_from_buffers View documentation}
3588
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.clear_market_items View documentation}
4450
3589
  */
4451
- request_from_buffers: boolean
3590
+ clear_market_items(): void
3591
+ }
3592
+
3593
+ /** @noSelf */
3594
+ interface CraftingMachineEntity extends BaseEntity {
4452
3595
  /**
4453
- * Whether this corpse will ever fade away.
3596
+ * Returns whether a craft is currently in process. It does not indicate whether progress is currently being made,
3597
+ * but whether any crafting action has made progress in this machine.
4454
3598
  *
4455
- * **Note**: Useable only on corpses.
3599
+ * *Can only be used if this is CraftingMachine*
4456
3600
  *
4457
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.corpse_expires View documentation}
3601
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.is_crafting View documentation}
4458
3602
  */
4459
- corpse_expires: boolean
3603
+ is_crafting(): void
4460
3604
  /**
4461
- * If true, corpse won't be destroyed when entities are placed over it. If false, whether corpse will be removed or
4462
- * not depends on value of CorpsePrototype::remove_on_entity_placement.
3605
+ * Current recipe being assembled by this machine or `nil` if no recipe is set.
4463
3606
  *
4464
- * **Note**: Useable only on corpses.
3607
+ * *Can only be used if this is CraftingMachine*
4465
3608
  *
4466
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.corpse_immune_to_entity_placement View documentation}
3609
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_recipe View documentation}
4467
3610
  */
4468
- corpse_immune_to_entity_placement: boolean
3611
+ get_recipe(): LuaRecipe | undefined
4469
3612
  /**
4470
- * The tags associated with this entity ghost or `nil` if not an entity ghost.
3613
+ * The current crafting speed, including speed bonuses from modules and beacons.
4471
3614
  *
4472
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.tags View documentation}
3615
+ * *Can only be used if this is CraftingMachine*
3616
+ *
3617
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.crafting_speed View documentation}
4473
3618
  */
4474
- tags: Tags | undefined
3619
+ readonly crafting_speed: double
4475
3620
  /**
4476
- * The command given to this unit or `nil` is the unit has no command.
3621
+ * The current crafting progress, as a number in range [0, 1].
4477
3622
  *
4478
- * *Can only be used if this is Unit*
3623
+ * *Can only be used if this is CraftingMachine*
4479
3624
  *
4480
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.command View documentation}
3625
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.crafting_progress View documentation}
4481
3626
  */
4482
- readonly command: Command | undefined
3627
+ crafting_progress: float
4483
3628
  /**
4484
- * The distraction command given to this unit or `nil` is the unit currently isn't distracted.
3629
+ * The current productivity bonus progress, as a number in range [0, 1].
4485
3630
  *
4486
- * *Can only be used if this is Unit*
3631
+ * *Can only be used if this is CraftingMachine*
4487
3632
  *
4488
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.distraction_command View documentation}
3633
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.bonus_progress View documentation}
4489
3634
  */
4490
- readonly distraction_command: Command | undefined
3635
+ bonus_progress: double
4491
3636
  /**
4492
- * The ticks until the next trigger effect of this smoke-with-trigger.
3637
+ * The number of products this machine finished crafting in its lifetime.
4493
3638
  *
4494
- * *Can only be used if this is SmokeWithTrigger*
3639
+ * *Can only be used if this is CraftingMachine*
4495
3640
  *
4496
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.time_to_next_effect View documentation}
3641
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.products_finished View documentation}
4497
3642
  */
4498
- time_to_next_effect: uint
3643
+ products_finished: uint
3644
+ }
3645
+
3646
+ /** @noSelf */
3647
+ interface GateEntity extends BaseEntity {
4499
3648
  /**
4500
- * Destination position of spidertron's autopilot. Returns `nil` if autopilot doesn't have destination set.
3649
+ * *Can only be used if this is Gate*
4501
3650
  *
4502
- * *Can only be used if this is SpiderVehicle*
3651
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.is_opened View documentation}
4503
3652
  *
4504
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.autopilot_destination View documentation}
3653
+ * @returns `true` if this gate is currently opened.
4505
3654
  */
4506
- autopilot_destination: MapPosition | undefined
3655
+ is_opened(): boolean
4507
3656
  /**
4508
- * The queued destination positions of spidertron's autopilot.
3657
+ * *Can only be used if this is Gate*
4509
3658
  *
4510
- * *Can only be used if this is SpiderVehicle*
3659
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.is_opening View documentation}
4511
3660
  *
4512
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.autopilot_destinations View documentation}
3661
+ * @returns `true` if this gate is currently opening.
4513
3662
  */
4514
- readonly autopilot_destinations: MapPosition[]
3663
+ is_opening(): boolean
4515
3664
  /**
4516
- * Amount of trains related to this particular train stop. Includes train stopped at this train stop (until it finds
4517
- * a path to next target) and trains having this train stop as goal or waypoint. Writing nil will disable the limit
4518
- * (will set a maximum possible value).
3665
+ * *Can only be used if this is Gate*
4519
3666
  *
4520
- * **Note**: Train may be included multiple times when braking distance covers this train stop multiple times
3667
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.is_closed View documentation}
4521
3668
  *
4522
- * **Note**: Value may be read even when train stop has no control behavior
3669
+ * @returns `true` if this gate is currently closed.
3670
+ */
3671
+ is_closed(): boolean
3672
+ /**
3673
+ * *Can only be used if this is Gate*
4523
3674
  *
4524
- * *Can only be used if this is TrainStop*
3675
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.is_closing View documentation}
4525
3676
  *
4526
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.trains_count View documentation}
3677
+ * @returns `true` if this gate is currently closing
4527
3678
  */
4528
- readonly trains_count: uint | undefined
3679
+ is_closing(): boolean
4529
3680
  /**
4530
- * Amount of trains above which no new trains will be sent to this train stop.
3681
+ * *Can only be used if this is Gate*
4531
3682
  *
4532
- * **Note**: When a train stop has a control behavior with wire connected and set_trains_limit enabled, this value
4533
- * will be overwritten by it
3683
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.request_to_open View documentation}
4534
3684
  *
4535
- * *Can only be used if this is TrainStop*
3685
+ * @param force - The force that requests the gate to be open.
3686
+ * @param extra_time - Extra ticks to stay open.
3687
+ */
3688
+ request_to_open(force: ForceIdentification, extra_time?: uint): void
3689
+ /**
3690
+ * *Can only be used if this is Gate*
4536
3691
  *
4537
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.trains_limit View documentation}
3692
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.request_to_close View documentation}
3693
+ *
3694
+ * @param force - The force that requests the gate to be closed.
4538
3695
  */
4539
- trains_limit: uint
3696
+ request_to_close(force: ForceIdentification): void
3697
+ }
3698
+
3699
+ /** @noSelf */
3700
+ interface TransportBeltConnectableEntity extends BaseEntity {
4540
3701
  /**
4541
- * If this entity is EntityWithForce
3702
+ * Get a transport line of a belt or belt connectable entity.
4542
3703
  *
4543
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.is_entity_with_force View documentation}
3704
+ * *Can only be used if this is TransportBeltConnectable*
3705
+ *
3706
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_transport_line View documentation}
3707
+ *
3708
+ * @param index - Index of the requested transport line. Transport lines are 1-indexed.
4544
3709
  */
4545
- readonly is_entity_with_force: boolean
3710
+ get_transport_line(index: uint): LuaTransportLine
4546
3711
  /**
4547
- * If this entity is EntityWithOwner
3712
+ * Get the maximum transport line index of a belt or belt connectable entity.
4548
3713
  *
4549
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.is_entity_with_owner View documentation}
3714
+ * *Can only be used if this is TransportBeltConnectable*
3715
+ *
3716
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_max_transport_line_index View documentation}
4550
3717
  */
4551
- readonly is_entity_with_owner: boolean
3718
+ get_max_transport_line_index(): uint
4552
3719
  /**
4553
- * If this entity is EntityWithHealth
3720
+ * The belt connectable neighbours of this belt connectable entity. Only entities that input to or are outputs of
3721
+ * this entity. Does not contain the other end of an underground belt, see
3722
+ * {@link LuaEntity.neighbours LuaEntity::neighbours} for that. This is a dictionary with `"inputs"`, `"outputs"`
3723
+ * entries that are arrays of transport belt connectable entities, or empty tables if no entities.
4554
3724
  *
4555
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.is_entity_with_health View documentation}
3725
+ * *Can only be used if this is TransportBeltConnectable*
3726
+ *
3727
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.belt_neighbours View documentation}
4556
3728
  */
4557
- readonly is_entity_with_health: boolean
3729
+ readonly belt_neighbours: Record<string, LuaEntity[]>
3730
+ }
3731
+
3732
+ /** @noSelf */
3733
+ interface RocketSiloEntity extends BaseEntity {
4558
3734
  /**
4559
- * The owner of this combat robot if any.
3735
+ * *Can only be used if this is RocketSilo*
4560
3736
  *
4561
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.combat_robot_owner View documentation}
3737
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.launch_rocket View documentation}
3738
+ *
3739
+ * @returns `true` if the rocket was successfully launched. Return value of `false` means the silo is not ready for launch.
4562
3740
  */
4563
- combat_robot_owner: LuaEntity
3741
+ launch_rocket(): boolean
4564
3742
  /**
4565
- * The link ID this linked container is using.
3743
+ * Number of rocket parts in the silo.
4566
3744
  *
4567
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.link_id View documentation}
3745
+ * *Can only be used if this is RocketSilo*
3746
+ *
3747
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.rocket_parts View documentation}
4568
3748
  */
4569
- link_id: uint
3749
+ rocket_parts: uint
4570
3750
  /**
4571
- * The follow target of this spidertron if any.
3751
+ * Whether this rocket silo automatically launches the rocket when cargo is inserted.
4572
3752
  *
4573
- * *Can only be used if this is SpiderVehicle*
3753
+ * *Can only be used if this is RocketSilo*
4574
3754
  *
4575
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.follow_target View documentation}
3755
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.auto_launch View documentation}
4576
3756
  */
4577
- follow_target: LuaEntity
3757
+ auto_launch: boolean
3758
+ }
3759
+
3760
+ /** @noSelf */
3761
+ interface RailEntity extends BaseEntity {
4578
3762
  /**
4579
- * The follow offset of this spidertron if any. If it is not following an entity this will be nil. This is
4580
- * randomized each time the follow entity is set.
3763
+ * *Can only be used if this is Rail*
4581
3764
  *
4582
- * *Can only be used if this is SpiderVehicle*
3765
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_connected_rail View documentation}
4583
3766
  *
4584
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.follow_offset View documentation}
3767
+ * @returns Rail connected in the specified manner to this one.
4585
3768
  */
4586
- follow_offset: Position | undefined
3769
+ get_connected_rail(params: {
3770
+ readonly rail_direction: defines.rail_direction
3771
+ readonly rail_connection_direction: defines.rail_connection_direction
3772
+ }): LuaEntity
4587
3773
  /**
4588
- * Type of linked belt: it is either `"input"` or `"output"`. Changing type will also flip direction so the belt is
4589
- * out of the same side
3774
+ * Get the rail signal or train stop at the start/end of the rail segment this rail is in, or `nil` if the rail
3775
+ * segment doesn't start/end with a signal nor a train stop.
4590
3776
  *
4591
- * **Note**: Can only be changed when linked belt is disconnected (has no neighbour set)
3777
+ * **Note**: A rail segment is a continuous section of rail with no branches, signals, nor train stops.
4592
3778
  *
4593
- * **Note**: Can also be used on entity ghost if it contains linked-belt
3779
+ * *Can only be used if this is Rail*
4594
3780
  *
4595
- * *Can only be used if this is LinkedBelt*
3781
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_rail_segment_entity View documentation}
4596
3782
  *
4597
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.linked_belt_type View documentation}
3783
+ * @param direction - The direction of travel relative to this rail.
3784
+ * @param in_else_out - If true, gets the entity at the entrance of the rail segment, otherwise gets the entity at
3785
+ * the exit of the rail segment.
4598
3786
  */
4599
- linked_belt_type: "input" | "output"
3787
+ get_rail_segment_entity(direction: defines.rail_direction, in_else_out: boolean): LuaEntity | undefined
4600
3788
  /**
4601
- * Neighbour to which this linked belt is connected to. Returns nil if not connected.
3789
+ * Get the rail at the end of the rail segment this rail is in.
4602
3790
  *
4603
- * **Note**: Can also be used on entity ghost if it contains linked-belt
3791
+ * **Note**: A rail segment is a continuous section of rail with no branches, signals, nor train stops.
4604
3792
  *
4605
- * **Note**: May return entity ghost which contains linked belt to which connection is made
3793
+ * **Note**: This function has a second return value. A {@link defines.rail_direction} that points out of the rail
3794
+ * segment from the end rail.
4606
3795
  *
4607
- * *Can only be used if this is LinkedBelt*
3796
+ * *Can only be used if this is Rail*
4608
3797
  *
4609
- * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.linked_belt_neighbour View documentation}
4610
- */
4611
- readonly linked_belt_neighbour: LuaEntity | undefined
4612
- /**
4613
- * Is this object valid? This Lua object holds a reference to an object within the game engine. It is possible that
4614
- * the game-engine object is removed whilst a mod still holds the corresponding Lua object. If that happens, the
4615
- * object becomes invalid, i.e. this attribute will be `false`. Mods are advised to check for object validity if any
4616
- * change to the game state might have occurred between the creation of the Lua object and its access.
4617
- */
4618
- readonly valid: boolean
4619
- /**
4620
- * The class name of this object. Available even when `valid` is false. For LuaStruct objects it may also be
4621
- * suffixed with a dotted path to a member of the struct.
3798
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_rail_segment_end View documentation}
3799
+ *
3800
+ * @param direction
4622
3801
  */
4623
- readonly object_name: "LuaEntity"
4624
- /** All methods and properties that this object supports. */
4625
- help(): string
4626
- }
4627
-
4628
- /**
4629
- * Prototype of an entity.
4630
- *
4631
- * {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html View documentation}
4632
- *
4633
- * @noSelf
4634
- */
4635
- interface LuaEntityPrototype {
3802
+ get_rail_segment_end(direction: defines.rail_direction): LuaMultiReturn<[LuaEntity, defines.rail_direction]>
4636
3803
  /**
4637
- * Test whether this entity prototype has a certain flag set.
3804
+ * Get the length of the rail segment this rail is in.
4638
3805
  *
4639
- * {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.has_flag View documentation}
3806
+ * **Note**: A rail segment is a continuous section of rail with no branches, signals, nor train stops.
4640
3807
  *
4641
- * @param flag - The flag to test. See {@link EntityPrototypeFlags} for a list of flags.
4642
- * @returns `true` if this prototype has the given flag set.
3808
+ * *Can only be used if this is Rail*
3809
+ *
3810
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_rail_segment_length View documentation}
4643
3811
  */
4644
- has_flag(flag: string): boolean
3812
+ get_rail_segment_length(): double
4645
3813
  /**
4646
- * Gets the base size of the given inventory on this entity or `nil` if the given inventory doesn't exist.
3814
+ * Get a rail from each rail segment that overlaps with this rail's rail segment.
4647
3815
  *
4648
- * {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.get_inventory_size View documentation}
3816
+ * **Note**: A rail segment is a continuous section of rail with no branches, signals, nor train stops.
4649
3817
  *
4650
- * @param index
4651
- */
4652
- get_inventory_size(index: defines.inventory): uint | undefined
3818
+ * *Can only be used if this is Rail*
3819
+ *
3820
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_rail_segment_overlaps View documentation}
3821
+ */
3822
+ get_rail_segment_overlaps(): LuaEntity[]
3823
+ /**
3824
+ * The number of trains in this rail block for this rail entity.
3825
+ *
3826
+ * *Can only be used if this is Rail*
3827
+ *
3828
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.trains_in_block View documentation}
3829
+ */
3830
+ readonly trains_in_block: uint
3831
+ }
3832
+
3833
+ /** @noSelf */
3834
+ interface RailSignalEntity extends BaseEntity {
3835
+ /**
3836
+ * Get the rails that this signal is connected to.
3837
+ *
3838
+ * *Can only be used if this is RailSignal or RailChainSignal*
3839
+ *
3840
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_connected_rails View documentation}
3841
+ */
3842
+ get_connected_rails(): LuaEntity[]
3843
+ /**
3844
+ * The state of this rail signal.
3845
+ *
3846
+ * *Can only be used if this is RailSignal or RailChainSignal*
3847
+ *
3848
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.signal_state View documentation}
3849
+ */
3850
+ readonly signal_state: defines.signal_state
3851
+ }
3852
+
3853
+ /** @noSelf */
3854
+ interface RailChainSignalEntity extends BaseEntity {
3855
+ /**
3856
+ * Get the rails that this signal is connected to.
3857
+ *
3858
+ * *Can only be used if this is RailSignal or RailChainSignal*
3859
+ *
3860
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_connected_rails View documentation}
3861
+ */
3862
+ get_connected_rails(): LuaEntity[]
3863
+ /**
3864
+ * The state of this rail signal.
3865
+ *
3866
+ * *Can only be used if this is RailSignal or RailChainSignal*
3867
+ *
3868
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.signal_state View documentation}
3869
+ */
3870
+ readonly signal_state: defines.signal_state
3871
+ /**
3872
+ * The state of this chain signal.
3873
+ *
3874
+ * *Can only be used if this is RailChainSignal*
3875
+ *
3876
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.chain_signal_state View documentation}
3877
+ */
3878
+ readonly chain_signal_state: defines.chain_signal_state
3879
+ }
3880
+
3881
+ /** @noSelf */
3882
+ interface InfinityContainerEntity extends BaseEntity {
3883
+ /**
3884
+ * Gets the filter for this infinity container at the given index or `nil` if the filter index doesn't exist or is empty.
3885
+ *
3886
+ * *Can only be used if this is InfinityContainer*
3887
+ *
3888
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_infinity_container_filter View documentation}
3889
+ *
3890
+ * @param index - The index to get.
3891
+ */
3892
+ get_infinity_container_filter(index: uint): InfinityInventoryFilter | undefined
3893
+ /**
3894
+ * Sets the filter for this infinity container at the given index.
3895
+ *
3896
+ * *Can only be used if this is InfinityContainer*
3897
+ *
3898
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.set_infinity_container_filter View documentation}
3899
+ *
3900
+ * @param index - The index to set.
3901
+ * @param filter - The new filter or `nil` to clear the filter.
3902
+ */
3903
+ set_infinity_container_filter(index: uint, filter: InfinityInventoryFilter | undefined): void
3904
+ /**
3905
+ * The filters for this infinity container.
3906
+ *
3907
+ * *Can only be used if this is InfinityContainer*
3908
+ *
3909
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.infinity_container_filters View documentation}
3910
+ */
3911
+ infinity_container_filters: InfinityInventoryFilter[]
3912
+ /**
3913
+ * If items not included in this infinity container filters should be removed from the container.
3914
+ *
3915
+ * *Can only be used if this is InfinityContainer*
3916
+ *
3917
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.remove_unfiltered_items View documentation}
3918
+ */
3919
+ remove_unfiltered_items: boolean
3920
+ }
3921
+
3922
+ /** @noSelf */
3923
+ interface InfinityPipeEntity extends BaseEntity {
3924
+ /**
3925
+ * Gets the filter for this infinity pipe or `nil` if the filter is empty.
3926
+ *
3927
+ * *Can only be used if this is InfinityPipe*
3928
+ *
3929
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_infinity_pipe_filter View documentation}
3930
+ */
3931
+ get_infinity_pipe_filter(): InfinityPipeFilter | undefined
3932
+ /**
3933
+ * Sets the filter for this infinity pipe.
3934
+ *
3935
+ * *Can only be used if this is InfinityPipe*
3936
+ *
3937
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.set_infinity_pipe_filter View documentation}
3938
+ *
3939
+ * @param filter - The new filter or `nil` to clear the filter.
3940
+ */
3941
+ set_infinity_pipe_filter(filter: InfinityPipeFilter | undefined): void
3942
+ }
3943
+
3944
+ /** @noSelf */
3945
+ interface HeatInterfaceEntity extends BaseEntity {
3946
+ /**
3947
+ * Gets the heat setting for this heat interface.
3948
+ *
3949
+ * *Can only be used if this is HeatInterface*
3950
+ *
3951
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_heat_setting View documentation}
3952
+ */
3953
+ get_heat_setting(): HeatSetting
3954
+ /**
3955
+ * Sets the heat setting for this heat interface.
3956
+ *
3957
+ * *Can only be used if this is HeatInterface*
3958
+ *
3959
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.set_heat_setting View documentation}
3960
+ *
3961
+ * @param filter - The new setting.
3962
+ */
3963
+ set_heat_setting(filter: HeatSetting): void
3964
+ }
3965
+
3966
+ /** @noSelf */
3967
+ interface ProgrammableSpeakerEntity extends BaseEntity {
3968
+ /**
3969
+ * Plays a note with the given instrument and note.
3970
+ *
3971
+ * *Can only be used if this is ProgrammableSpeaker*
3972
+ *
3973
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.play_note View documentation}
3974
+ *
3975
+ * @param instrument
3976
+ * @param note
3977
+ * @returns If the request is valid. The sound may or may not be played depending on polyphony settings.
3978
+ */
3979
+ play_note(instrument: uint, note: uint): boolean
3980
+ /**
3981
+ * *Can only be used if this is ProgrammableSpeaker*
3982
+ *
3983
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.parameters View documentation}
3984
+ */
3985
+ parameters: ProgrammableSpeakerParameters
3986
+ /**
3987
+ * *Can only be used if this is ProgrammableSpeaker*
3988
+ *
3989
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.alert_parameters View documentation}
3990
+ */
3991
+ alert_parameters: ProgrammableSpeakerAlertParameters
3992
+ }
3993
+
3994
+ /** @noSelf */
3995
+ interface AssemblingMachineEntity extends BaseEntity {
3996
+ /**
3997
+ * Sets the current recipe in this assembly machine.
3998
+ *
3999
+ * *Can only be used if this is AssemblingMachine*
4000
+ *
4001
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.set_recipe View documentation}
4002
+ *
4003
+ * @param recipe - The new recipe or `nil` to clear the recipe.
4004
+ * @returns Any items removed from this entity as a result of setting the recipe.
4005
+ */
4006
+ set_recipe(recipe: string | LuaRecipe | undefined): Record<string, uint>
4007
+ /**
4008
+ * When locked; the recipe in this assembling machine can't be changed by the player.
4009
+ *
4010
+ * *Can only be used if this is AssemblingMachine*
4011
+ *
4012
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.recipe_locked View documentation}
4013
+ */
4014
+ recipe_locked: boolean
4015
+ }
4016
+
4017
+ /** @noSelf */
4018
+ interface VehicleEntity extends BaseEntity {
4019
+ /**
4020
+ * Gets the driver of this vehicle if any.
4021
+ *
4022
+ * **Note**: May be `nil` if the vehicle contains no driver. To check if there's a passenger see
4023
+ * {@link LuaEntity.get_passenger LuaEntity::get_passenger}.
4024
+ *
4025
+ * *Can only be used if this is Vehicle*
4026
+ *
4027
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_driver View documentation}
4028
+ */
4029
+ get_driver(): LuaEntity | LuaPlayer | undefined
4030
+ /**
4031
+ * Sets the driver of this vehicle.
4032
+ *
4033
+ * **Note**: This differs over {@link LuaEntity.set_passenger LuaEntity::set_passenger} in that the passenger can't
4034
+ * drive the vehicle.
4035
+ *
4036
+ * *Can only be used if this is Vehicle*
4037
+ *
4038
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.set_driver View documentation}
4039
+ *
4040
+ * @param driver - The new driver or `nil` to eject the current driver if any.
4041
+ */
4042
+ set_driver(driver: LuaEntity | PlayerIdentification | undefined): void
4043
+ /**
4044
+ * Gets the passenger of this car or spidertron if any.
4045
+ *
4046
+ * **Note**: May be `nil` if the vehicle contains no passenger. To check if there's a driver see
4047
+ * {@link LuaEntity.get_driver LuaEntity::get_driver}.
4048
+ *
4049
+ * **Note**: This differs over {@link LuaEntity.get_driver LuaEntity::get_driver} in that the passenger can't drive the car.
4050
+ *
4051
+ * *Can only be used if this is Vehicle*
4052
+ *
4053
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_passenger View documentation}
4054
+ */
4055
+ get_passenger(): LuaEntity | LuaPlayer | undefined
4056
+ /**
4057
+ * Sets the passenger of this car or spidertron.
4058
+ *
4059
+ * **Note**: This differs over {@link LuaEntity.get_driver LuaEntity::get_driver} in that the passenger can't drive the car.
4060
+ *
4061
+ * *Can only be used if this is Vehicle*
4062
+ *
4063
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.set_passenger View documentation}
4064
+ *
4065
+ * @param passenger
4066
+ */
4067
+ set_passenger(passenger: LuaEntity | PlayerIdentification): void
4068
+ /**
4069
+ * If equipment grid logistics are enabled while this vehicle is moving.
4070
+ *
4071
+ * *Can only be used if this is Vehicle*
4072
+ *
4073
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.enable_logistics_while_moving View documentation}
4074
+ */
4075
+ enable_logistics_while_moving: boolean
4076
+ }
4077
+
4078
+ /** @noSelf */
4079
+ interface TrainStopEntity extends BaseEntity {
4080
+ /**
4081
+ * The trains scheduled to stop at this train stop.
4082
+ *
4083
+ * *Can only be used if this is TrainStop*
4084
+ *
4085
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_train_stop_trains View documentation}
4086
+ */
4087
+ get_train_stop_trains(): LuaTrain[]
4088
+ /**
4089
+ * The train currently stopped at this train stop or `nil` if none.
4090
+ *
4091
+ * *Can only be used if this is TrainStop*
4092
+ *
4093
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_stopped_train View documentation}
4094
+ */
4095
+ get_stopped_train(): LuaTrain | undefined
4096
+ /**
4097
+ * The rail entity this train stop is connected to or `nil` if there is none.
4098
+ *
4099
+ * *Can only be used if this is TrainStop*
4100
+ *
4101
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.connected_rail View documentation}
4102
+ */
4103
+ readonly connected_rail: LuaEntity | undefined
4104
+ /**
4105
+ * Rail direction to which this train stop is binding. This returns a value even when no rails are present.
4106
+ *
4107
+ * *Can only be used if this is TrainStop*
4108
+ *
4109
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.connected_rail_direction View documentation}
4110
+ */
4111
+ readonly connected_rail_direction: defines.rail_direction
4112
+ /**
4113
+ * Amount of trains related to this particular train stop. Includes train stopped at this train stop (until it finds
4114
+ * a path to next target) and trains having this train stop as goal or waypoint. Writing nil will disable the limit
4115
+ * (will set a maximum possible value).
4116
+ *
4117
+ * **Note**: Train may be included multiple times when braking distance covers this train stop multiple times
4118
+ *
4119
+ * **Note**: Value may be read even when train stop has no control behavior
4120
+ *
4121
+ * *Can only be used if this is TrainStop*
4122
+ *
4123
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.trains_count View documentation}
4124
+ */
4125
+ readonly trains_count: uint | undefined
4126
+ /**
4127
+ * Amount of trains above which no new trains will be sent to this train stop.
4128
+ *
4129
+ * **Note**: When a train stop has a control behavior with wire connected and set_trains_limit enabled, this value
4130
+ * will be overwritten by it
4131
+ *
4132
+ * *Can only be used if this is TrainStop*
4133
+ *
4134
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.trains_limit View documentation}
4135
+ */
4136
+ trains_limit: uint
4137
+ }
4138
+
4139
+ /** @noSelf */
4140
+ interface BeamEntity extends BaseEntity {
4141
+ /**
4142
+ * Get the source of this beam.
4143
+ *
4144
+ * *Can only be used if this is Beam*
4145
+ *
4146
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_beam_source View documentation}
4147
+ */
4148
+ get_beam_source(): BeamTarget
4149
+ /**
4150
+ * Set the source of this beam.
4151
+ *
4152
+ * *Can only be used if this is Beam*
4153
+ *
4154
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.set_beam_source View documentation}
4155
+ *
4156
+ * @param source
4157
+ */
4158
+ set_beam_source(source: LuaEntity | Position): void
4159
+ /**
4160
+ * Get the target of this beam.
4161
+ *
4162
+ * *Can only be used if this is Beam*
4163
+ *
4164
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_beam_target View documentation}
4165
+ */
4166
+ get_beam_target(): BeamTarget
4167
+ /**
4168
+ * Set the target of this beam.
4169
+ *
4170
+ * *Can only be used if this is Beam*
4171
+ *
4172
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.set_beam_target View documentation}
4173
+ *
4174
+ * @param target
4175
+ */
4176
+ set_beam_target(target: LuaEntity | Position): void
4177
+ }
4178
+
4179
+ /** @noSelf */
4180
+ interface ResourceEntity extends BaseEntity {
4181
+ /**
4182
+ * Depletes and destroys this resource entity.
4183
+ *
4184
+ * *Can only be used if this is ResourceEntity*
4185
+ *
4186
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.deplete View documentation}
4187
+ */
4188
+ deplete(): void
4189
+ /**
4190
+ * Count of resource units contained.
4191
+ *
4192
+ * *Can only be used if this is ResourceEntity*
4193
+ *
4194
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.amount View documentation}
4195
+ */
4196
+ amount: uint
4197
+ /**
4198
+ * Count of initial resource units contained.
4199
+ *
4200
+ * **Note**: If this is not an infinite resource reading will give `nil` and writing will give an error.
4201
+ *
4202
+ * *Can only be used if this is ResourceEntity*
4203
+ *
4204
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.initial_amount View documentation}
4205
+ */
4206
+ initial_amount: uint | undefined
4207
+ }
4208
+
4209
+ /** @noSelf */
4210
+ interface SpiderVehicleEntity extends BaseEntity {
4211
+ /**
4212
+ * Adds the given position to this spidertron's autopilot's queue of destinations.
4213
+ *
4214
+ * *Can only be used if this is SpiderVehicle*
4215
+ *
4216
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.add_autopilot_destination View documentation}
4217
+ *
4218
+ * @param position - The position the spidertron should move to.
4219
+ */
4220
+ add_autopilot_destination(position: MapPosition): void
4221
+ /**
4222
+ * The torso orientation of this spider vehicle.
4223
+ *
4224
+ * *Can only be used if this is SpiderVehicle*
4225
+ *
4226
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.torso_orientation View documentation}
4227
+ */
4228
+ torso_orientation: RealOrientation
4229
+ /**
4230
+ * Read when this spidertron auto-targets enemies
4231
+ *
4232
+ * *Can only be used if this is SpiderVehicle*
4233
+ *
4234
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.vehicle_automatic_targeting_parameters View documentation}
4235
+ */
4236
+ vehicle_automatic_targeting_parameters: VehicleAutomaticTargetingParameters
4237
+ /**
4238
+ * Destination position of spidertron's autopilot. Returns `nil` if autopilot doesn't have destination set.
4239
+ *
4240
+ * *Can only be used if this is SpiderVehicle*
4241
+ *
4242
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.autopilot_destination View documentation}
4243
+ */
4244
+ autopilot_destination: MapPosition | undefined
4245
+ /**
4246
+ * The queued destination positions of spidertron's autopilot.
4247
+ *
4248
+ * *Can only be used if this is SpiderVehicle*
4249
+ *
4250
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.autopilot_destinations View documentation}
4251
+ */
4252
+ readonly autopilot_destinations: MapPosition[]
4253
+ /**
4254
+ * The follow target of this spidertron if any.
4255
+ *
4256
+ * *Can only be used if this is SpiderVehicle*
4257
+ *
4258
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.follow_target View documentation}
4259
+ */
4260
+ follow_target: LuaEntity
4261
+ /**
4262
+ * The follow offset of this spidertron if any. If it is not following an entity this will be nil. This is
4263
+ * randomized each time the follow entity is set.
4264
+ *
4265
+ * *Can only be used if this is SpiderVehicle*
4266
+ *
4267
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.follow_offset View documentation}
4268
+ */
4269
+ follow_offset: Position | undefined
4270
+ }
4271
+
4272
+ /** @noSelf */
4273
+ interface LinkedBeltEntity extends BaseEntity {
4274
+ /**
4275
+ * Connects current linked belt with another one.
4276
+ *
4277
+ * Neighbours have to be of different type. If given linked belt is connected to something else it will be
4278
+ * disconnected first. If provided neighbour is connected to something else it will also be disconnected first.
4279
+ * Automatically updates neighbour to be connected back to this one.
4280
+ *
4281
+ * **Note**: Can also be used on entity ghost if it contains linked-belt
4282
+ *
4283
+ * *Can only be used if this is LinkedBelt*
4284
+ *
4285
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.connect_linked_belts View documentation}
4286
+ *
4287
+ * @param neighbour - Another linked belt or entity ghost containing linked belt to connect or nil to disconnect
4288
+ */
4289
+ connect_linked_belts(neighbour: LuaEntity | undefined): void
4290
+ /**
4291
+ * Disconnects linked belt from its neighbour.
4292
+ *
4293
+ * **Note**: Can also be used on entity ghost if it contains linked-belt
4294
+ *
4295
+ * *Can only be used if this is LinkedBelt*
4296
+ *
4297
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.disconnect_linked_belts View documentation}
4298
+ */
4299
+ disconnect_linked_belts(): void
4300
+ /**
4301
+ * Type of linked belt: it is either `"input"` or `"output"`. Changing type will also flip direction so the belt is
4302
+ * out of the same side
4303
+ *
4304
+ * **Note**: Can only be changed when linked belt is disconnected (has no neighbour set)
4305
+ *
4306
+ * **Note**: Can also be used on entity ghost if it contains linked-belt
4307
+ *
4308
+ * *Can only be used if this is LinkedBelt*
4309
+ *
4310
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.linked_belt_type View documentation}
4311
+ */
4312
+ linked_belt_type: "input" | "output"
4313
+ /**
4314
+ * Neighbour to which this linked belt is connected to. Returns nil if not connected.
4315
+ *
4316
+ * **Note**: Can also be used on entity ghost if it contains linked-belt
4317
+ *
4318
+ * **Note**: May return entity ghost which contains linked belt to which connection is made
4319
+ *
4320
+ * *Can only be used if this is LinkedBelt*
4321
+ *
4322
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.linked_belt_neighbour View documentation}
4323
+ */
4324
+ readonly linked_belt_neighbour: LuaEntity | undefined
4325
+ }
4326
+
4327
+ interface GhostEntity extends BaseEntity {
4328
+ /**
4329
+ * Name of the entity or tile contained in this ghost
4330
+ *
4331
+ * *Can only be used if this is Ghost*
4332
+ *
4333
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.ghost_name View documentation}
4334
+ */
4335
+ readonly ghost_name: string
4336
+ /**
4337
+ * Localised name of the entity or tile contained in this ghost.
4338
+ *
4339
+ * *Can only be used if this is Ghost*
4340
+ *
4341
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.ghost_localised_name View documentation}
4342
+ */
4343
+ readonly ghost_localised_name: LocalisedString
4344
+ /**
4345
+ * *Can only be used if this is Ghost*
4346
+ *
4347
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.ghost_localised_description View documentation}
4348
+ */
4349
+ readonly ghost_localised_description: LocalisedString
4350
+ /**
4351
+ * The prototype type of the entity or tile contained in this ghost.
4352
+ *
4353
+ * *Can only be used if this is Ghost*
4354
+ *
4355
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.ghost_type View documentation}
4356
+ */
4357
+ readonly ghost_type: string
4358
+ /**
4359
+ * The prototype of the entity or tile contained in this ghost.
4360
+ *
4361
+ * *Can only be used if this is Ghost*
4362
+ *
4363
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.ghost_prototype View documentation}
4364
+ */
4365
+ readonly ghost_prototype: LuaEntityPrototype | LuaTilePrototype
4366
+ }
4367
+
4368
+ interface CarEntity extends BaseEntity {
4369
+ /**
4370
+ * Multiplies the acceleration the vehicle can create for one unit of energy. By default is `1`.
4371
+ *
4372
+ * *Can only be used if this is Car*
4373
+ *
4374
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.effectivity_modifier View documentation}
4375
+ */
4376
+ effectivity_modifier: float
4377
+ /**
4378
+ * Multiplies the energy consumption.
4379
+ *
4380
+ * *Can only be used if this is Car*
4381
+ *
4382
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.consumption_modifier View documentation}
4383
+ */
4384
+ consumption_modifier: float
4385
+ /**
4386
+ * Multiplies the car friction rate.
4387
+ *
4388
+ * *Can only be used if this is Car*
4389
+ *
4390
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.friction_modifier View documentation}
4391
+ *
4392
+ * @example
4393
+ * This will allow the car to go much faster
4394
+ *
4395
+ * ```lua
4396
+ * game.player.vehicle.friction_modifier = 0.5
4397
+ * ```
4398
+ */
4399
+ friction_modifier: float
4400
+ /**
4401
+ * Index of the currently selected weapon slot of this character, car, or spidertron, or `nil` if the car/spidertron
4402
+ * doesn't have guns.
4403
+ *
4404
+ * *Can only be used if this is Character or Car*
4405
+ *
4406
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.selected_gun_index View documentation}
4407
+ */
4408
+ selected_gun_index: uint | undefined
4409
+ }
4410
+
4411
+ interface ItemEntity extends BaseEntity {
4412
+ /**
4413
+ * *Can only be used if this is ItemEntity*
4414
+ *
4415
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.stack View documentation}
4416
+ */
4417
+ readonly stack: LuaItemStack
4418
+ /**
4419
+ * Will this entity be picked up automatically when the player walks over it?
4420
+ *
4421
+ * *Can only be used if this is ItemEntity*
4422
+ *
4423
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.to_be_looted View documentation}
4424
+ */
4425
+ to_be_looted: boolean
4426
+ }
4427
+
4428
+ interface InserterEntity extends BaseEntity {
4429
+ /**
4430
+ * Where the inserter will pick up items from.
4431
+ *
4432
+ * **Note**: Inserters must have `allow_custom_vectors` set to true on their prototype to allow changing the pickup position.
4433
+ *
4434
+ * *Can only be used if this is Inserter*
4435
+ *
4436
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.pickup_position View documentation}
4437
+ */
4438
+ pickup_position: Position
4439
+ /**
4440
+ * The entity this inserter will attempt to pick up items from, or `nil` if there is no such entity. If there are
4441
+ * multiple possible entities at the pick-up point, writing to this attribute allows a mod to choose which one to
4442
+ * pick up items from. The entity needs to collide with the tile box under the pick-up position.
4443
+ *
4444
+ * *Can only be used if this is Inserter*
4445
+ *
4446
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.pickup_target View documentation}
4447
+ */
4448
+ pickup_target: LuaEntity | undefined
4449
+ /**
4450
+ * The item stack currently held in an inserter's hand.
4451
+ *
4452
+ * *Can only be used if this is Inserter*
4453
+ *
4454
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.held_stack View documentation}
4455
+ */
4456
+ readonly held_stack: LuaItemStack
4457
+ /**
4458
+ * Current position of the inserter's "hand".
4459
+ *
4460
+ * *Can only be used if this is Inserter*
4461
+ *
4462
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.held_stack_position View documentation}
4463
+ */
4464
+ readonly held_stack_position: PositionTable
4465
+ /**
4466
+ * The filter mode for this filter inserter: "whitelist", "blacklist", or `nil` if this inserter doesn't use filters.
4467
+ *
4468
+ * *Can only be used if this is Inserter*
4469
+ *
4470
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.inserter_filter_mode View documentation}
4471
+ */
4472
+ inserter_filter_mode: "whitelist" | "blacklist" | undefined
4473
+ }
4474
+
4475
+ interface CharacterEntity extends BaseEntity {
4476
+ /**
4477
+ * Index of the currently selected weapon slot of this character, car, or spidertron, or `nil` if the car/spidertron
4478
+ * doesn't have guns.
4479
+ *
4480
+ * *Can only be used if this is Character or Car*
4481
+ *
4482
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.selected_gun_index View documentation}
4483
+ */
4484
+ selected_gun_index: uint | undefined
4485
+ /**
4486
+ * The player connected to this character or `nil` if none.
4487
+ *
4488
+ * *Can only be used if this is Character*
4489
+ *
4490
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.player View documentation}
4491
+ */
4492
+ readonly player: LuaPlayer | undefined
4493
+ /**
4494
+ * The player this character is associated with or `nil` if none. When the player logs off in multiplayer all of the
4495
+ * associated characters will be logged off with him.
4496
+ *
4497
+ * **Note**: A character associated with a player is not directly controlled by any player.
4498
+ *
4499
+ * **Note**: Set to `nil` to clear. The player will be automatically disassociated when a controller is set on the character.
4500
+ *
4501
+ * *Can only be used if this is Character*
4502
+ *
4503
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.associated_player View documentation}
4504
+ */
4505
+ associated_player: LuaPlayer | undefined
4506
+ /**
4507
+ * The last tick this character entity was attacked.
4508
+ *
4509
+ * *Can only be used if this is Character*
4510
+ *
4511
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.tick_of_last_attack View documentation}
4512
+ */
4513
+ tick_of_last_attack: uint
4514
+ /**
4515
+ * The last tick this character entity was damaged.
4516
+ *
4517
+ * *Can only be used if this is Character*
4518
+ *
4519
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.tick_of_last_damage View documentation}
4520
+ */
4521
+ tick_of_last_damage: uint
4522
+ /**
4523
+ * Whether this character's personal roboports are allowed to dispatch robots.
4524
+ *
4525
+ * *Can only be used if this is Character*
4526
+ *
4527
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.allow_dispatching_robots View documentation}
4528
+ */
4529
+ allow_dispatching_robots: boolean
4530
+ }
4531
+
4532
+ interface FurnaceEntity extends BaseEntity {
4533
+ /**
4534
+ * The previous recipe this furnace was using or nil if the furnace had no previous recipe.
4535
+ *
4536
+ * *Can only be used if this is Furnace*
4537
+ *
4538
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.previous_recipe View documentation}
4539
+ */
4540
+ readonly previous_recipe: LuaRecipe | undefined
4541
+ }
4542
+
4543
+ interface FlyingTextEntity extends BaseEntity {
4544
+ /**
4545
+ * The text of this flying-text entity.
4546
+ *
4547
+ * *Can only be used if this is FlyingText*
4548
+ *
4549
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.text View documentation}
4550
+ */
4551
+ text: LocalisedString
4552
+ }
4553
+
4554
+ interface TransportBeltToGroundEntity extends BaseEntity {
4555
+ /**
4556
+ * `"input"` or `"output"`, depending on whether this underground belt goes down or up.
4557
+ *
4558
+ * *Can only be used if this is TransportBeltToGround*
4559
+ *
4560
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.belt_to_ground_type View documentation}
4561
+ */
4562
+ readonly belt_to_ground_type: "input" | "output"
4563
+ }
4564
+
4565
+ interface LoaderEntity extends BaseEntity {
4566
+ /**
4567
+ * `"input"` or `"output"`, depending on whether this loader puts to or gets from a container.
4568
+ *
4569
+ * *Can only be used if this is Loader*
4570
+ *
4571
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.loader_type View documentation}
4572
+ */
4573
+ loader_type: "input" | "output"
4574
+ /**
4575
+ * The container entity this loader is pointing at/pulling from depending on the
4576
+ * {@link LuaEntity.loader_type LuaEntity::loader_type}.
4577
+ *
4578
+ * *Can only be used if this is Loader*
4579
+ *
4580
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.loader_container View documentation}
4581
+ */
4582
+ readonly loader_container: LuaEntity
4583
+ }
4584
+
4585
+ interface TurretEntity extends BaseEntity {
4586
+ /**
4587
+ * The damage dealt by this turret, artillery turret, or artillery wagon.
4588
+ *
4589
+ * *Can only be used if this is Turret*
4590
+ *
4591
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.damage_dealt View documentation}
4592
+ */
4593
+ damage_dealt: double
4594
+ /**
4595
+ * The number of units killed by this turret, artillery turret, or artillery wagon.
4596
+ *
4597
+ * *Can only be used if this is Turret*
4598
+ *
4599
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.kills View documentation}
4600
+ */
4601
+ kills: uint
4602
+ }
4603
+
4604
+ interface EntityWithOwnerEntity extends BaseEntity {
4605
+ /**
4606
+ * The last player that changed any setting on this entity. This includes building the entity, changing its color,
4607
+ * or configuring its circuit network. Can be `nil` if the last user is not part of the save anymore. Mods can
4608
+ * overwrite it if desired.
4609
+ *
4610
+ * *Can only be used if this is EntityWithOwner*
4611
+ *
4612
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.last_user View documentation}
4613
+ */
4614
+ last_user: LuaPlayer | undefined
4615
+ }
4616
+
4617
+ interface ElectricEnergyInterfaceEntity extends BaseEntity {
4618
+ /**
4619
+ * The power production specific to the ElectricEnergyInterface entity type.
4620
+ *
4621
+ * *Can only be used if this is ElectricEnergyInterface*
4622
+ *
4623
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.power_production View documentation}
4624
+ */
4625
+ power_production: double
4626
+ /**
4627
+ * The power usage specific to the ElectricEnergyInterface entity type.
4628
+ *
4629
+ * *Can only be used if this is ElectricEnergyInterface*
4630
+ *
4631
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.power_usage View documentation}
4632
+ */
4633
+ power_usage: double
4634
+ }
4635
+
4636
+ interface MiningDrillEntity extends BaseEntity {
4637
+ /**
4638
+ * The mining target or `nil` if none
4639
+ *
4640
+ * *Can only be used if this is MiningDrill*
4641
+ *
4642
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.mining_target View documentation}
4643
+ */
4644
+ readonly mining_target: LuaEntity | undefined
4645
+ }
4646
+
4647
+ interface ElectricPoleEntity extends BaseEntity {
4648
+ /**
4649
+ * The electric network statistics for this electric pole.
4650
+ *
4651
+ * *Can only be used if this is ElectricPole*
4652
+ *
4653
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.electric_network_statistics View documentation}
4654
+ */
4655
+ readonly electric_network_statistics: LuaFlowStatistics
4656
+ }
4657
+
4658
+ interface CharacterCorpseEntity extends BaseEntity {
4659
+ /**
4660
+ * The player index associated with this character corpse.
4661
+ *
4662
+ * **Note**: The index is not guaranteed to be valid so it should always be checked first if a player with that
4663
+ * index actually exists.
4664
+ *
4665
+ * *Can only be used if this is CharacterCorpse*
4666
+ *
4667
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.character_corpse_player_index View documentation}
4668
+ */
4669
+ character_corpse_player_index: uint
4670
+ /**
4671
+ * The tick this character corpse died at.
4672
+ *
4673
+ * *Can only be used if this is CharacterCorpse*
4674
+ *
4675
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.character_corpse_tick_of_death View documentation}
4676
+ */
4677
+ character_corpse_tick_of_death: uint
4678
+ /**
4679
+ * The reason this character corpse character died (if any).
4680
+ *
4681
+ * *Can only be used if this is CharacterCorpse*
4682
+ *
4683
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.character_corpse_death_cause View documentation}
4684
+ */
4685
+ character_corpse_death_cause: LocalisedString
4686
+ }
4687
+
4688
+ interface SplitterEntity extends BaseEntity {
4689
+ /**
4690
+ * The filter for this splitter or `nil` if no filter is set.
4691
+ *
4692
+ * *Can only be used if this is Splitter*
4693
+ *
4694
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.splitter_filter View documentation}
4695
+ */
4696
+ splitter_filter: LuaItemPrototype | undefined
4697
+ /**
4698
+ * The input priority for this splitter : "left", "none", or "right".
4699
+ *
4700
+ * *Can only be used if this is Splitter*
4701
+ *
4702
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.splitter_input_priority View documentation}
4703
+ */
4704
+ splitter_input_priority: "left" | "none" | "right"
4705
+ /**
4706
+ * The output priority for this splitter : "left", "none", or "right".
4707
+ *
4708
+ * *Can only be used if this is Splitter*
4709
+ *
4710
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.splitter_output_priority View documentation}
4711
+ */
4712
+ splitter_output_priority: "left" | "none" | "right"
4713
+ }
4714
+
4715
+ interface LandMineEntity extends BaseEntity {
4716
+ /**
4717
+ * If this land mine is armed.
4718
+ *
4719
+ * *Can only be used if this is LandMine*
4720
+ *
4721
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.armed View documentation}
4722
+ */
4723
+ readonly armed: boolean
4724
+ /**
4725
+ * The timeout that's left on this landmine in ticks. It describes the time between the landmine being placed and it
4726
+ * being armed.
4727
+ *
4728
+ * *Can only be used if this is LandMine*
4729
+ *
4730
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.timeout View documentation}
4731
+ */
4732
+ timeout: uint
4733
+ }
4734
+
4735
+ interface ReactorEntity extends BaseEntity {
4736
+ /**
4737
+ * The current total neighbour bonus of this reactor.
4738
+ *
4739
+ * *Can only be used if this is Reactor*
4740
+ *
4741
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.neighbour_bonus View documentation}
4742
+ */
4743
+ readonly neighbour_bonus: double
4744
+ }
4745
+
4746
+ interface HighlightBoxEntity extends BaseEntity {
4747
+ /**
4748
+ * The hightlight box type of this highlight box entity.
4749
+ *
4750
+ * *Can only be used if this is HighlightBox*
4751
+ *
4752
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.highlight_box_type View documentation}
4753
+ */
4754
+ highlight_box_type: string
4755
+ /**
4756
+ * The blink interval of this highlight box entity. 0 indicates no blink.
4757
+ *
4758
+ * *Can only be used if this is HighlightBox*
4759
+ *
4760
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.highlight_box_blink_interval View documentation}
4761
+ */
4762
+ highlight_box_blink_interval: uint
4763
+ }
4764
+
4765
+ interface PumpEntity extends BaseEntity {
4766
+ /**
4767
+ * The rail target of this pump or `nil`.
4768
+ *
4769
+ * *Can only be used if this is Pump*
4770
+ *
4771
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.pump_rail_target View documentation}
4772
+ */
4773
+ readonly pump_rail_target: LuaEntity | undefined
4774
+ }
4775
+
4776
+ interface GeneratorEntity extends BaseEntity {
4777
+ /**
4778
+ * How much energy this generator generated in the last tick.
4779
+ *
4780
+ * *Can only be used if this is Generator*
4781
+ *
4782
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.energy_generated_last_tick View documentation}
4783
+ */
4784
+ readonly energy_generated_last_tick: double
4785
+ }
4786
+
4787
+ interface SmokeWithTriggerEntity extends BaseEntity {
4788
+ /**
4789
+ * The ticks until the next trigger effect of this smoke-with-trigger.
4790
+ *
4791
+ * *Can only be used if this is SmokeWithTrigger*
4792
+ *
4793
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.time_to_next_effect View documentation}
4794
+ */
4795
+ time_to_next_effect: uint
4796
+ }
4797
+
4798
+ /**
4799
+ * The primary interface for interacting with entities through the Lua API. Entities are everything that exists on the
4800
+ * map except for tiles (see {@link LuaTile}).
4801
+ *
4802
+ * Most functions on LuaEntity also work when the entity is contained in a ghost.
4803
+ *
4804
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html View documentation}
4805
+ */
4806
+ interface LuaEntity
4807
+ extends BaseEntity,
4808
+ EntityWithHealthEntity,
4809
+ UnitEntity,
4810
+ EntityGhostEntity,
4811
+ MarketEntity,
4812
+ CraftingMachineEntity,
4813
+ GateEntity,
4814
+ TransportBeltConnectableEntity,
4815
+ RocketSiloEntity,
4816
+ RailEntity,
4817
+ RailSignalEntity,
4818
+ RailChainSignalEntity,
4819
+ InfinityContainerEntity,
4820
+ InfinityPipeEntity,
4821
+ HeatInterfaceEntity,
4822
+ ProgrammableSpeakerEntity,
4823
+ AssemblingMachineEntity,
4824
+ VehicleEntity,
4825
+ TrainStopEntity,
4826
+ BeamEntity,
4827
+ ResourceEntity,
4828
+ SpiderVehicleEntity,
4829
+ LinkedBeltEntity,
4830
+ GhostEntity,
4831
+ CarEntity,
4832
+ ItemEntity,
4833
+ InserterEntity,
4834
+ CharacterEntity,
4835
+ FurnaceEntity,
4836
+ FlyingTextEntity,
4837
+ TransportBeltToGroundEntity,
4838
+ LoaderEntity,
4839
+ TurretEntity,
4840
+ EntityWithOwnerEntity,
4841
+ ElectricEnergyInterfaceEntity,
4842
+ MiningDrillEntity,
4843
+ ElectricPoleEntity,
4844
+ CharacterCorpseEntity,
4845
+ SplitterEntity,
4846
+ LandMineEntity,
4847
+ ReactorEntity,
4848
+ HighlightBoxEntity,
4849
+ PumpEntity,
4850
+ GeneratorEntity,
4851
+ SmokeWithTriggerEntity {}
4852
+
4853
+ /**
4854
+ * Prototype of an entity.
4855
+ *
4856
+ * {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html View documentation}
4857
+ *
4858
+ * @noSelf
4859
+ */
4860
+ interface LuaEntityPrototype {
4861
+ /**
4862
+ * Test whether this entity prototype has a certain flag set.
4863
+ *
4864
+ * {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.has_flag View documentation}
4865
+ *
4866
+ * @param flag - The flag to test. See {@link EntityPrototypeFlags} for a list of flags.
4867
+ * @returns `true` if this prototype has the given flag set.
4868
+ */
4869
+ has_flag(flag: string): boolean
4870
+ /**
4871
+ * Gets the base size of the given inventory on this entity or `nil` if the given inventory doesn't exist.
4872
+ *
4873
+ * {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.get_inventory_size View documentation}
4874
+ *
4875
+ * @param index
4876
+ */
4877
+ get_inventory_size(index: defines.inventory): uint | undefined
4653
4878
  /**
4654
4879
  * Type of this prototype.
4655
4880
  *
@@ -9250,7 +9475,7 @@ interface TableGuiSpec extends BaseGuiSpec {
9250
9475
  readonly vertical_centering?: boolean
9251
9476
  }
9252
9477
 
9253
- interface TextfieldGuiSpec extends BaseGuiSpec {
9478
+ interface TextFieldGuiSpec extends BaseGuiSpec {
9254
9479
  readonly type: "textfield"
9255
9480
  /** The initial text contained in the textfield. */
9256
9481
  readonly text?: string
@@ -9268,7 +9493,7 @@ interface TextfieldGuiSpec extends BaseGuiSpec {
9268
9493
  readonly clear_and_focus_on_right_click?: boolean
9269
9494
  }
9270
9495
 
9271
- interface ProgressbarGuiSpec extends BaseGuiSpec {
9496
+ interface ProgressBarGuiSpec extends BaseGuiSpec {
9272
9497
  readonly type: "progressbar"
9273
9498
  /** The initial value of the progressbar, in the range [0, 1]. Defaults to `0`. */
9274
9499
  readonly value?: double
@@ -9280,7 +9505,7 @@ interface CheckboxGuiSpec extends BaseGuiSpec {
9280
9505
  readonly state: boolean
9281
9506
  }
9282
9507
 
9283
- interface RadiobuttonGuiSpec extends BaseGuiSpec {
9508
+ interface RadioButtonGuiSpec extends BaseGuiSpec {
9284
9509
  readonly type: "radiobutton"
9285
9510
  /** The initial checked-state of the radiobutton. */
9286
9511
  readonly state: boolean
@@ -9560,10 +9785,10 @@ type GuiSpec =
9560
9785
  | FlowGuiSpec
9561
9786
  | FrameGuiSpec
9562
9787
  | TableGuiSpec
9563
- | TextfieldGuiSpec
9564
- | ProgressbarGuiSpec
9788
+ | TextFieldGuiSpec
9789
+ | ProgressBarGuiSpec
9565
9790
  | CheckboxGuiSpec
9566
- | RadiobuttonGuiSpec
9791
+ | RadioButtonGuiSpec
9567
9792
  | SpriteButtonGuiSpec
9568
9793
  | SpriteGuiSpec
9569
9794
  | ScrollPaneGuiSpec
@@ -9806,7 +10031,6 @@ interface BaseGuiElement {
9806
10031
  help(): string
9807
10032
  }
9808
10033
 
9809
- /** @noSelf */
9810
10034
  interface ChooseElemButtonGuiElementMembers extends BaseGuiElement {
9811
10035
  /**
9812
10036
  * The type of this GUI element.
@@ -9953,7 +10177,6 @@ interface DropDownGuiElementMembers extends BaseGuiElement {
9953
10177
 
9954
10178
  type DropDownGuiElement = DropDownGuiElementMembers & GuiElementIndex
9955
10179
 
9956
- /** @noSelf */
9957
10180
  interface EmptyWidgetGuiElementMembers extends BaseGuiElement {
9958
10181
  /**
9959
10182
  * The type of this GUI element.
@@ -9978,7 +10201,6 @@ interface EmptyWidgetGuiElementMembers extends BaseGuiElement {
9978
10201
 
9979
10202
  type EmptyWidgetGuiElement = EmptyWidgetGuiElementMembers & GuiElementIndex
9980
10203
 
9981
- /** @noSelf */
9982
10204
  interface EntityPreviewGuiElementMembers extends BaseGuiElement {
9983
10205
  /**
9984
10206
  * The type of this GUI element.
@@ -10146,7 +10368,6 @@ interface ScrollPaneGuiElementMembers extends BaseGuiElement {
10146
10368
 
10147
10369
  type ScrollPaneGuiElement = ScrollPaneGuiElementMembers & GuiElementIndex
10148
10370
 
10149
- /** @noSelf */
10150
10371
  interface SpriteButtonGuiElementMembers extends BaseGuiElement {
10151
10372
  /**
10152
10373
  * The type of this GUI element.
@@ -10367,7 +10588,6 @@ interface TextBoxGuiElementMembers extends BaseGuiElement {
10367
10588
 
10368
10589
  type TextBoxGuiElement = TextBoxGuiElementMembers & GuiElementIndex
10369
10590
 
10370
- /** @noSelf */
10371
10591
  interface ButtonGuiElementMembers extends BaseGuiElement {
10372
10592
  /**
10373
10593
  * The type of this GUI element.
@@ -10385,7 +10605,6 @@ interface ButtonGuiElementMembers extends BaseGuiElement {
10385
10605
 
10386
10606
  type ButtonGuiElement = ButtonGuiElementMembers & GuiElementIndex
10387
10607
 
10388
- /** @noSelf */
10389
10608
  interface CameraGuiElementMembers extends BaseGuiElement {
10390
10609
  /**
10391
10610
  * The type of this GUI element.
@@ -10421,7 +10640,6 @@ interface CameraGuiElementMembers extends BaseGuiElement {
10421
10640
 
10422
10641
  type CameraGuiElement = CameraGuiElementMembers & GuiElementIndex
10423
10642
 
10424
- /** @noSelf */
10425
10643
  interface CheckboxGuiElementMembers extends BaseGuiElement {
10426
10644
  /**
10427
10645
  * The type of this GUI element.
@@ -10441,7 +10659,6 @@ interface CheckboxGuiElementMembers extends BaseGuiElement {
10441
10659
 
10442
10660
  type CheckboxGuiElement = CheckboxGuiElementMembers & GuiElementIndex
10443
10661
 
10444
- /** @noSelf */
10445
10662
  interface FlowGuiElementMembers extends BaseGuiElement {
10446
10663
  /**
10447
10664
  * The type of this GUI element.
@@ -10523,7 +10740,6 @@ interface FrameGuiElementMembers extends BaseGuiElement {
10523
10740
 
10524
10741
  type FrameGuiElement = FrameGuiElementMembers & GuiElementIndex
10525
10742
 
10526
- /** @noSelf */
10527
10743
  interface LabelGuiElementMembers extends BaseGuiElement {
10528
10744
  /**
10529
10745
  * The type of this GUI element.
@@ -10548,7 +10764,6 @@ interface LabelGuiElementMembers extends BaseGuiElement {
10548
10764
 
10549
10765
  type LabelGuiElement = LabelGuiElementMembers & GuiElementIndex
10550
10766
 
10551
- /** @noSelf */
10552
10767
  interface LineGuiElementMembers extends BaseGuiElement {
10553
10768
  /**
10554
10769
  * The type of this GUI element.
@@ -10568,7 +10783,6 @@ interface LineGuiElementMembers extends BaseGuiElement {
10568
10783
 
10569
10784
  type LineGuiElement = LineGuiElementMembers & GuiElementIndex
10570
10785
 
10571
- /** @noSelf */
10572
10786
  interface MinimapGuiElementMembers extends BaseGuiElement {
10573
10787
  /**
10574
10788
  * The type of this GUI element.
@@ -10618,8 +10832,7 @@ interface MinimapGuiElementMembers extends BaseGuiElement {
10618
10832
 
10619
10833
  type MinimapGuiElement = MinimapGuiElementMembers & GuiElementIndex
10620
10834
 
10621
- /** @noSelf */
10622
- interface ProgressbarGuiElementMembers extends BaseGuiElement {
10835
+ interface ProgressBarGuiElementMembers extends BaseGuiElement {
10623
10836
  /**
10624
10837
  * The type of this GUI element.
10625
10838
  *
@@ -10636,10 +10849,9 @@ interface ProgressbarGuiElementMembers extends BaseGuiElement {
10636
10849
  value: double
10637
10850
  }
10638
10851
 
10639
- type ProgressbarGuiElement = ProgressbarGuiElementMembers & GuiElementIndex
10852
+ type ProgressBarGuiElement = ProgressBarGuiElementMembers & GuiElementIndex
10640
10853
 
10641
- /** @noSelf */
10642
- interface RadiobuttonGuiElementMembers extends BaseGuiElement {
10854
+ interface RadioButtonGuiElementMembers extends BaseGuiElement {
10643
10855
  /**
10644
10856
  * The type of this GUI element.
10645
10857
  *
@@ -10656,7 +10868,7 @@ interface RadiobuttonGuiElementMembers extends BaseGuiElement {
10656
10868
  state: boolean
10657
10869
  }
10658
10870
 
10659
- type RadiobuttonGuiElement = RadiobuttonGuiElementMembers & GuiElementIndex
10871
+ type RadioButtonGuiElement = RadioButtonGuiElementMembers & GuiElementIndex
10660
10872
 
10661
10873
  /** @noSelf */
10662
10874
  interface SliderGuiElementMembers extends BaseGuiElement {
@@ -10745,7 +10957,6 @@ interface SliderGuiElementMembers extends BaseGuiElement {
10745
10957
 
10746
10958
  type SliderGuiElement = SliderGuiElementMembers & GuiElementIndex
10747
10959
 
10748
- /** @noSelf */
10749
10960
  interface SpriteGuiElementMembers extends BaseGuiElement {
10750
10961
  /**
10751
10962
  * The type of this GUI element.
@@ -10769,7 +10980,6 @@ interface SpriteGuiElementMembers extends BaseGuiElement {
10769
10980
 
10770
10981
  type SpriteGuiElement = SpriteGuiElementMembers & GuiElementIndex
10771
10982
 
10772
- /** @noSelf */
10773
10983
  interface SwitchGuiElementMembers extends BaseGuiElement {
10774
10984
  /**
10775
10985
  * The type of this GUI element.
@@ -10833,7 +11043,6 @@ interface SwitchGuiElementMembers extends BaseGuiElement {
10833
11043
 
10834
11044
  type SwitchGuiElement = SwitchGuiElementMembers & GuiElementIndex
10835
11045
 
10836
- /** @noSelf */
10837
11046
  interface TabGuiElementMembers extends BaseGuiElement {
10838
11047
  /**
10839
11048
  * The type of this GUI element.
@@ -10853,7 +11062,6 @@ interface TabGuiElementMembers extends BaseGuiElement {
10853
11062
 
10854
11063
  type TabGuiElement = TabGuiElementMembers & GuiElementIndex
10855
11064
 
10856
- /** @noSelf */
10857
11065
  interface TableGuiElementMembers extends BaseGuiElement {
10858
11066
  /**
10859
11067
  * The type of this GUI element.
@@ -10920,7 +11128,7 @@ interface TableGuiElementMembers extends BaseGuiElement {
10920
11128
  type TableGuiElement = TableGuiElementMembers & GuiElementIndex
10921
11129
 
10922
11130
  /** @noSelf */
10923
- interface TextfieldGuiElementMembers extends BaseGuiElement {
11131
+ interface TextFieldGuiElementMembers extends BaseGuiElement {
10924
11132
  /**
10925
11133
  * The type of this GUI element.
10926
11134
  *
@@ -11018,7 +11226,7 @@ interface TextfieldGuiElementMembers extends BaseGuiElement {
11018
11226
  clear_and_focus_on_right_click: boolean
11019
11227
  }
11020
11228
 
11021
- type TextfieldGuiElement = TextfieldGuiElementMembers & GuiElementIndex
11229
+ type TextFieldGuiElement = TextFieldGuiElementMembers & GuiElementIndex
11022
11230
 
11023
11231
  type GuiElementMembers =
11024
11232
  | ChooseElemButtonGuiElementMembers
@@ -11038,14 +11246,14 @@ type GuiElementMembers =
11038
11246
  | LabelGuiElementMembers
11039
11247
  | LineGuiElementMembers
11040
11248
  | MinimapGuiElementMembers
11041
- | ProgressbarGuiElementMembers
11042
- | RadiobuttonGuiElementMembers
11249
+ | ProgressBarGuiElementMembers
11250
+ | RadioButtonGuiElementMembers
11043
11251
  | SliderGuiElementMembers
11044
11252
  | SpriteGuiElementMembers
11045
11253
  | SwitchGuiElementMembers
11046
11254
  | TabGuiElementMembers
11047
11255
  | TableGuiElementMembers
11048
- | TextfieldGuiElementMembers
11256
+ | TextFieldGuiElementMembers
11049
11257
 
11050
11258
  /**
11051
11259
  * An element of a custom GUI. This type is used to represent any kind of a GUI element - labels, buttons and frames are
@@ -12043,84 +12251,14 @@ interface LuaItemPrototype {
12043
12251
  help(): string
12044
12252
  }
12045
12253
 
12046
- /**
12047
- * A reference to an item and count owned by some external entity.
12048
- *
12049
- * **Note**: In most instances this is a simple reference as in: it points at a specific slot in an inventory and not
12050
- * the item in the slot.
12051
- *
12052
- * **Note**: In the instance this references an item on a {@link LuaTransportLine} the reference is only guaranteed to
12053
- * stay valid (and refer to the same item) as long as nothing changes the transport line.
12054
- *
12055
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html View documentation}
12056
- *
12057
- * @noSelf
12058
- */
12059
- interface LuaItemStack {
12254
+ /** @noSelf */
12255
+ interface BaseItemStack {
12060
12256
  /**
12061
12257
  * Is this blueprint item setup? I.e. is it a non-empty blueprint?
12062
12258
  *
12063
12259
  * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.is_blueprint_setup View documentation}
12064
12260
  */
12065
12261
  is_blueprint_setup(): boolean
12066
- /**
12067
- * The entities in this blueprint.
12068
- *
12069
- * *Can only be used if this is BlueprintItem*
12070
- *
12071
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.get_blueprint_entities View documentation}
12072
- */
12073
- get_blueprint_entities(): BlueprintEntity[]
12074
- /**
12075
- * Set new entities to be a part of this blueprint.
12076
- *
12077
- * *Can only be used if this is BlueprintItem*
12078
- *
12079
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.set_blueprint_entities View documentation}
12080
- *
12081
- * @param entities - The new blueprint entities.
12082
- */
12083
- set_blueprint_entities(entities: BlueprintEntity[]): void
12084
- /**
12085
- * Add ammo to this ammo item.
12086
- *
12087
- * *Can only be used if this is AmmoItem*
12088
- *
12089
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.add_ammo View documentation}
12090
- *
12091
- * @param amount - Amount of ammo to add.
12092
- */
12093
- add_ammo(amount: float): void
12094
- /**
12095
- * Remove ammo from this ammo item.
12096
- *
12097
- * *Can only be used if this is AmmoItem*
12098
- *
12099
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.drain_ammo View documentation}
12100
- *
12101
- * @param amount - Amount of ammo to remove.
12102
- */
12103
- drain_ammo(amount: float): void
12104
- /**
12105
- * Add durability to this tool item.
12106
- *
12107
- * *Can only be used if this is ToolItem*
12108
- *
12109
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.add_durability View documentation}
12110
- *
12111
- * @param amount - Amount of durability to add.
12112
- */
12113
- add_durability(amount: double): void
12114
- /**
12115
- * Remove durability from this tool item.
12116
- *
12117
- * *Can only be used if this is ToolItem*
12118
- *
12119
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.drain_durability View documentation}
12120
- *
12121
- * @param amount - Amount of durability to remove.
12122
- */
12123
- drain_durability(amount: double): void
12124
12262
  /**
12125
12263
  * Would a call to {@link LuaItemStack.set_stack LuaItemStack::set_stack} succeed?
12126
12264
  *
@@ -12180,24 +12318,6 @@ interface LuaItemStack {
12180
12318
  * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.clear View documentation}
12181
12319
  */
12182
12320
  clear(): void
12183
- /**
12184
- * A list of the tiles in this blueprint.
12185
- *
12186
- * *Can only be used if this is BlueprintItem*
12187
- *
12188
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.get_blueprint_tiles View documentation}
12189
- */
12190
- get_blueprint_tiles(): Tile[]
12191
- /**
12192
- * Set specific tiles in this blueprint.
12193
- *
12194
- * *Can only be used if this is BlueprintItem*
12195
- *
12196
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.set_blueprint_tiles View documentation}
12197
- *
12198
- * @param tiles - Tiles to be a part of the blueprint.
12199
- */
12200
- set_blueprint_tiles(tiles: Tile[]): void
12201
12321
  /**
12202
12322
  * Access the inner inventory of an item.
12203
12323
  *
@@ -12304,248 +12424,304 @@ interface LuaItemStack {
12304
12424
  readonly include_fuel?: boolean
12305
12425
  }): Record<uint, LuaEntity>
12306
12426
  /**
12307
- * Gets the tag with the given name or returns `nil` if it doesn't exist.
12308
- *
12309
- * *Can only be used if this is ItemWithTags*
12310
- *
12311
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.get_tag View documentation}
12427
+ * Is this valid for reading? Differs from the usual `valid` in that `valid` will be `true` even if the item stack
12428
+ * is blank but the entity that holds it is still valid.
12312
12429
  *
12313
- * @param tag_name
12430
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.valid_for_read View documentation}
12314
12431
  */
12315
- get_tag(tag_name: string): AnyBasic | undefined
12432
+ readonly valid_for_read: boolean
12316
12433
  /**
12317
- * Sets the tag with the given name and value.
12318
- *
12319
- * *Can only be used if this is ItemWithTags*
12434
+ * Prototype of the item held in this stack.
12320
12435
  *
12321
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.set_tag View documentation}
12436
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.prototype View documentation}
12437
+ */
12438
+ readonly prototype: LuaItemPrototype
12439
+ /**
12440
+ * Prototype name of the item held in this stack.
12322
12441
  *
12323
- * @param tag_name
12324
- * @param tag
12442
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.name View documentation}
12325
12443
  */
12326
- set_tag(tag_name: string, tag: AnyBasic): AnyBasic
12444
+ readonly name: string
12327
12445
  /**
12328
- * Removes a tag with the given name.
12446
+ * Type of the item prototype.
12329
12447
  *
12330
- * *Can only be used if this is ItemWithTags*
12448
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.type View documentation}
12449
+ */
12450
+ readonly type: string
12451
+ /**
12452
+ * Number of items in this stack.
12331
12453
  *
12332
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.remove_tag View documentation}
12454
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.count View documentation}
12455
+ */
12456
+ count: uint
12457
+ /**
12458
+ * The equipment grid of this item or `nil` if this item doesn't have a grid.
12333
12459
  *
12334
- * @param tag
12335
- * @returns If the tag existed and was removed.
12460
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.grid View documentation}
12336
12461
  */
12337
- remove_tag(tag: string): boolean
12462
+ readonly grid: LuaEquipmentGrid | undefined
12338
12463
  /**
12339
- * Clears this blueprint item.
12340
- *
12341
- * *Can only be used if this is BlueprintItem*
12464
+ * How much health the item has, as a number in range [0, 1].
12342
12465
  *
12343
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.clear_blueprint View documentation}
12466
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.health View documentation}
12344
12467
  */
12345
- clear_blueprint(): void
12468
+ health: float
12346
12469
  /**
12347
- * Gets the entity filter at the given index for this deconstruction item.
12348
- *
12349
- * *Can only be used if this is DeconstructionItem*
12470
+ * Durability of the contained item. Automatically capped at the item's maximum durability.
12350
12471
  *
12351
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.get_entity_filter View documentation}
12472
+ * **Note**: When used on a non-tool item, the value of this attribute is `nil`.
12352
12473
  *
12353
- * @param index
12474
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.durability View documentation}
12354
12475
  */
12355
- get_entity_filter(index: uint): string
12476
+ durability: double | undefined
12356
12477
  /**
12357
- * Sets the entity filter at the given index for this deconstruction item.
12358
- *
12359
- * *Can only be used if this is DeconstructionItem*
12360
- *
12361
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.set_entity_filter View documentation}
12478
+ * The custom description this item-with-tags. This is shown over the normal item description if this is set to a
12479
+ * non-empty value.
12362
12480
  *
12363
- * @param index
12364
- * @param filter - Setting to nil erases the filter.
12365
- * @returns If the new filter was set (was valid.)
12481
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.custom_description View documentation}
12366
12482
  */
12367
- set_entity_filter(index: uint, filter: string | LuaEntityPrototype | LuaEntity | undefined): boolean
12483
+ custom_description: LocalisedString
12368
12484
  /**
12369
- * Gets the tile filter at the given index for this deconstruction item.
12370
- *
12371
- * *Can only be used if this is DeconstructionItem*
12485
+ * The entity filters for this deconstruction item. The attribute is a sparse array with the keys representing the
12486
+ * index of the filter. All strings in this array must be entity prototype names that don't have the
12487
+ * `"not-deconstructable"` flag set and are either a `cliff` or marked as `minable`.
12372
12488
  *
12373
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.get_tile_filter View documentation}
12489
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.entity_filters View documentation}
12490
+ */
12491
+ entity_filters: string[]
12492
+ /**
12493
+ * The tile filters for this deconstruction item. The attribute is a sparse array with the keys representing the
12494
+ * index of the filter. All strings in this array must be tile prototype names.
12374
12495
  *
12375
- * @param index
12496
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.tile_filters View documentation}
12376
12497
  */
12377
- get_tile_filter(index: uint): string
12498
+ tile_filters: string[]
12378
12499
  /**
12379
- * Sets the tile filter at the given index for this deconstruction item.
12500
+ * The unique identifier for this item if it has one, `nil` otherwise. Note that this ID stays the same no matter
12501
+ * where the item is moved to.
12380
12502
  *
12381
- * *Can only be used if this is DeconstructionItem*
12503
+ * Only these types of items have unique IDs:
12382
12504
  *
12383
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.set_tile_filter View documentation}
12505
+ * - `"armor"`
12506
+ * - `"spidertron-remote"`
12507
+ * - `"selection-tool"`
12508
+ * - `"copy-paste-tool"`
12509
+ * - `"upgrade-item"`
12510
+ * - `"deconstruction-item"`
12511
+ * - `"blueprint"`
12512
+ * - `"blueprint-book"`
12513
+ * - `"item-with-entity-data"`
12514
+ * - `"item-with-inventory"`
12515
+ * - `"item-with-tags"`
12384
12516
  *
12385
- * @param index
12386
- * @param filter - Setting to nil erases the filter.
12387
- * @returns If the new filter was set (was valid.)
12517
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.item_number View documentation}
12388
12518
  */
12389
- set_tile_filter(index: uint, filter: string | LuaTilePrototype | LuaTile | undefined): boolean
12519
+ readonly item_number: uint | undefined
12390
12520
  /**
12391
- * Clears all settings/filters on this deconstruction item resetting it to default values.
12521
+ * If this item is a spidertron remote that has a spidertron bound to it, it returns the connected spider-vehicle
12522
+ * entity, `nil` otherwise.
12392
12523
  *
12393
- * *Can only be used if this is DeconstructionItem*
12524
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.connected_entity View documentation}
12525
+ */
12526
+ connected_entity: LuaEntity | undefined
12527
+ /**
12528
+ * If this is a blueprint item.
12394
12529
  *
12395
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.clear_deconstruction_item View documentation}
12530
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.is_blueprint View documentation}
12396
12531
  */
12397
- clear_deconstruction_item(): void
12532
+ readonly is_blueprint: boolean
12398
12533
  /**
12399
- * Clears all settings/filters on this upgrade item resetting it to default values.
12534
+ * If this is a blueprint book item.
12400
12535
  *
12401
- * *Can only be used if this is UpgradeItem*
12536
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.is_blueprint_book View documentation}
12537
+ */
12538
+ readonly is_blueprint_book: boolean
12539
+ /**
12540
+ * If this is a module item.
12402
12541
  *
12403
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.clear_upgrade_item View documentation}
12542
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.is_module View documentation}
12404
12543
  */
12405
- clear_upgrade_item(): void
12544
+ readonly is_module: boolean
12406
12545
  /**
12407
- * Gets the filter at the given index for this upgrade item.
12546
+ * If this is a tool item.
12408
12547
  *
12409
- * *Can only be used if this is UpgradeItem*
12548
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.is_tool View documentation}
12549
+ */
12550
+ readonly is_tool: boolean
12551
+ /**
12552
+ * If this is a mining tool item.
12410
12553
  *
12411
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.get_mapper View documentation}
12554
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.is_mining_tool View documentation}
12555
+ */
12556
+ readonly is_mining_tool: boolean
12557
+ /**
12558
+ * If this is an armor item.
12412
12559
  *
12413
- * @param index - The index of the mapper to read.
12414
- * @param type - 'from' or 'to'.
12560
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.is_armor View documentation}
12415
12561
  */
12416
- get_mapper(index: uint, type: "from" | "to"): UpgradeFilter
12562
+ readonly is_armor: boolean
12417
12563
  /**
12418
- * Sets the module filter at the given index for this upgrade item.
12564
+ * If this is a repair tool item.
12419
12565
  *
12420
- * *Can only be used if this is UpgradeItem*
12566
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.is_repair_tool View documentation}
12567
+ */
12568
+ readonly is_repair_tool: boolean
12569
+ /**
12570
+ * If this is an item with label item.
12421
12571
  *
12422
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.set_mapper View documentation}
12572
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.is_item_with_label View documentation}
12573
+ */
12574
+ readonly is_item_with_label: boolean
12575
+ /**
12576
+ * If this is an item with inventory item.
12423
12577
  *
12424
- * @param index - The index of the mapper to set.
12425
- * @param type - `from` or `to`.
12426
- * @param filter - The filter to set or `nil`
12578
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.is_item_with_inventory View documentation}
12427
12579
  */
12428
- set_mapper(index: uint, type: string, filter: UpgradeFilter | undefined): void
12580
+ readonly is_item_with_inventory: boolean
12429
12581
  /**
12430
- * Gets the number of entities in this blueprint item.
12582
+ * If this is an item with entity data item.
12431
12583
  *
12432
- * *Can only be used if this is BlueprintItem*
12584
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.is_item_with_entity_data View documentation}
12585
+ */
12586
+ readonly is_item_with_entity_data: boolean
12587
+ /**
12588
+ * If this is a selection tool item.
12433
12589
  *
12434
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.get_blueprint_entity_count View documentation}
12590
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.is_selection_tool View documentation}
12435
12591
  */
12436
- get_blueprint_entity_count(): uint
12592
+ readonly is_selection_tool: boolean
12437
12593
  /**
12438
- * Gets the tags for the given blueprint entity index in this blueprint item.
12594
+ * If this is an item with tags item.
12439
12595
  *
12440
- * *Can only be used if this is BlueprintItem*
12596
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.is_item_with_tags View documentation}
12597
+ */
12598
+ readonly is_item_with_tags: boolean
12599
+ /**
12600
+ * If this is a deconstruction tool item.
12441
12601
  *
12442
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.get_blueprint_entity_tags View documentation}
12602
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.is_deconstruction_item View documentation}
12603
+ */
12604
+ readonly is_deconstruction_item: boolean
12605
+ /**
12606
+ * If this is a upgrade item.
12443
12607
  *
12444
- * @param index
12608
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.is_upgrade_item View documentation}
12445
12609
  */
12446
- get_blueprint_entity_tags(index: uint): Tags
12610
+ readonly is_upgrade_item: boolean
12447
12611
  /**
12448
- * Sets the tags on the given blueprint entity index in this blueprint item.
12612
+ * Is this object valid? This Lua object holds a reference to an object within the game engine. It is possible that
12613
+ * the game-engine object is removed whilst a mod still holds the corresponding Lua object. If that happens, the
12614
+ * object becomes invalid, i.e. this attribute will be `false`. Mods are advised to check for object validity if any
12615
+ * change to the game state might have occurred between the creation of the Lua object and its access.
12616
+ */
12617
+ readonly valid: boolean
12618
+ /**
12619
+ * The class name of this object. Available even when `valid` is false. For LuaStruct objects it may also be
12620
+ * suffixed with a dotted path to a member of the struct.
12621
+ */
12622
+ readonly object_name: "LuaItemStack"
12623
+ /** All methods and properties that this object supports. */
12624
+ help(): string
12625
+ }
12626
+
12627
+ /** @noSelf */
12628
+ interface BlueprintItemStack extends BaseItemStack {
12629
+ /**
12630
+ * The entities in this blueprint.
12449
12631
  *
12450
12632
  * *Can only be used if this is BlueprintItem*
12451
12633
  *
12452
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.set_blueprint_entity_tags View documentation}
12453
- *
12454
- * @param index - The entity index
12455
- * @param tags
12634
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.get_blueprint_entities View documentation}
12456
12635
  */
12457
- set_blueprint_entity_tags(index: uint, tags: Tags): void
12636
+ get_blueprint_entities(): BlueprintEntity[]
12458
12637
  /**
12459
- * Gets the given tag on the given blueprint entity index in this blueprint item.
12638
+ * Set new entities to be a part of this blueprint.
12460
12639
  *
12461
12640
  * *Can only be used if this is BlueprintItem*
12462
12641
  *
12463
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.get_blueprint_entity_tag View documentation}
12642
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.set_blueprint_entities View documentation}
12464
12643
  *
12465
- * @param index - The entity index.
12466
- * @param tag - The tag to get.
12644
+ * @param entities - The new blueprint entities.
12467
12645
  */
12468
- get_blueprint_entity_tag(index: uint, tag: string): AnyBasic
12646
+ set_blueprint_entities(entities: BlueprintEntity[]): void
12469
12647
  /**
12470
- * Sets the given tag on the given blueprint entity index in this blueprint item.
12648
+ * A list of the tiles in this blueprint.
12471
12649
  *
12472
12650
  * *Can only be used if this is BlueprintItem*
12473
12651
  *
12474
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.set_blueprint_entity_tag View documentation}
12475
- *
12476
- * @param index - The entity index.
12477
- * @param tag - The tag to set.
12478
- * @param value - The tag value to set or `nil` to clear the tag.
12652
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.get_blueprint_tiles View documentation}
12479
12653
  */
12480
- set_blueprint_entity_tag(index: uint, tag: string, value: AnyBasic | undefined): void
12654
+ get_blueprint_tiles(): Tile[]
12481
12655
  /**
12482
- * Creates the equipment grid for this item if it doesn't exist and this is an item-with-entity-data that supports
12483
- * equipment grids.
12656
+ * Set specific tiles in this blueprint.
12484
12657
  *
12485
- * *Can only be used if this is ItemWithEntityData*
12658
+ * *Can only be used if this is BlueprintItem*
12486
12659
  *
12487
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.create_grid View documentation}
12488
- */
12489
- create_grid(): LuaEquipmentGrid
12490
- /**
12491
- * Is this valid for reading? Differs from the usual `valid` in that `valid` will be `true` even if the item stack
12492
- * is blank but the entity that holds it is still valid.
12660
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.set_blueprint_tiles View documentation}
12493
12661
  *
12494
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.valid_for_read View documentation}
12662
+ * @param tiles - Tiles to be a part of the blueprint.
12495
12663
  */
12496
- readonly valid_for_read: boolean
12664
+ set_blueprint_tiles(tiles: Tile[]): void
12497
12665
  /**
12498
- * Prototype of the item held in this stack.
12666
+ * Clears this blueprint item.
12499
12667
  *
12500
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.prototype View documentation}
12501
- */
12502
- readonly prototype: LuaItemPrototype
12503
- /**
12504
- * Prototype name of the item held in this stack.
12668
+ * *Can only be used if this is BlueprintItem*
12505
12669
  *
12506
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.name View documentation}
12670
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.clear_blueprint View documentation}
12507
12671
  */
12508
- readonly name: string
12672
+ clear_blueprint(): void
12509
12673
  /**
12510
- * Type of the item prototype.
12674
+ * Gets the number of entities in this blueprint item.
12511
12675
  *
12512
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.type View documentation}
12513
- */
12514
- readonly type: string
12515
- /**
12516
- * Number of items in this stack.
12676
+ * *Can only be used if this is BlueprintItem*
12517
12677
  *
12518
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.count View documentation}
12678
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.get_blueprint_entity_count View documentation}
12519
12679
  */
12520
- count: uint
12680
+ get_blueprint_entity_count(): uint
12521
12681
  /**
12522
- * The equipment grid of this item or `nil` if this item doesn't have a grid.
12682
+ * Gets the tags for the given blueprint entity index in this blueprint item.
12683
+ *
12684
+ * *Can only be used if this is BlueprintItem*
12523
12685
  *
12524
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.grid View documentation}
12686
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.get_blueprint_entity_tags View documentation}
12687
+ *
12688
+ * @param index
12525
12689
  */
12526
- readonly grid: LuaEquipmentGrid | undefined
12690
+ get_blueprint_entity_tags(index: uint): Tags
12527
12691
  /**
12528
- * How much health the item has, as a number in range [0, 1].
12692
+ * Sets the tags on the given blueprint entity index in this blueprint item.
12529
12693
  *
12530
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.health View documentation}
12694
+ * *Can only be used if this is BlueprintItem*
12695
+ *
12696
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.set_blueprint_entity_tags View documentation}
12697
+ *
12698
+ * @param index - The entity index
12699
+ * @param tags
12531
12700
  */
12532
- health: float
12701
+ set_blueprint_entity_tags(index: uint, tags: Tags): void
12533
12702
  /**
12534
- * Durability of the contained item. Automatically capped at the item's maximum durability.
12703
+ * Gets the given tag on the given blueprint entity index in this blueprint item.
12535
12704
  *
12536
- * **Note**: When used on a non-tool item, the value of this attribute is `nil`.
12705
+ * *Can only be used if this is BlueprintItem*
12537
12706
  *
12538
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.durability View documentation}
12707
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.get_blueprint_entity_tag View documentation}
12708
+ *
12709
+ * @param index - The entity index.
12710
+ * @param tag - The tag to get.
12539
12711
  */
12540
- durability: double | undefined
12712
+ get_blueprint_entity_tag(index: uint, tag: string): AnyBasic
12541
12713
  /**
12542
- * Number of bullets left in the magazine.
12714
+ * Sets the given tag on the given blueprint entity index in this blueprint item.
12543
12715
  *
12544
- * *Can only be used if this is AmmoItem*
12716
+ * *Can only be used if this is BlueprintItem*
12545
12717
  *
12546
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.ammo View documentation}
12718
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.set_blueprint_entity_tag View documentation}
12719
+ *
12720
+ * @param index - The entity index.
12721
+ * @param tag - The tag to set.
12722
+ * @param value - The tag value to set or `nil` to clear the tag.
12547
12723
  */
12548
- ammo: uint
12724
+ set_blueprint_entity_tag(index: uint, tag: string, value: AnyBasic | undefined): void
12549
12725
  /**
12550
12726
  * Icons of a blueprint item, blueprint book, deconstruction item or upgrade planner. An item that doesn't have
12551
12727
  * icons returns nil on read and throws error on write.
@@ -12580,276 +12756,357 @@ interface LuaItemStack {
12580
12756
  */
12581
12757
  blueprint_absolute_snapping: boolean
12582
12758
  /**
12583
- * The current label for this item. Nil when none.
12759
+ * Raw materials required to build this blueprint. Result is a dictionary mapping each item prototype name to the
12760
+ * required count.
12584
12761
  *
12585
- * *Can only be used if this is ItemWithLabel*
12762
+ * *Can only be used if this is BlueprintItem*
12586
12763
  *
12587
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.label View documentation}
12764
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.cost_to_build View documentation}
12588
12765
  */
12589
- label: string | undefined
12766
+ readonly cost_to_build: Record<string, uint>
12590
12767
  /**
12591
- * The current label color for this item. Nil when none.
12768
+ * The default icons for a blueprint item.
12592
12769
  *
12593
- * *Can only be used if this is ItemWithLabel*
12770
+ * *Can only be used if this is BlueprintItem*
12594
12771
  *
12595
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.label_color View documentation}
12772
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.default_icons View documentation}
12596
12773
  */
12597
- label_color: Color | undefined
12774
+ readonly default_icons: BlueprintItemIcon[]
12775
+ }
12776
+
12777
+ /** @noSelf */
12778
+ interface AmmoItemStack extends BaseItemStack {
12598
12779
  /**
12599
- * If the label for this item can be manually changed. When false the label can only be changed through the API.
12780
+ * Add ammo to this ammo item.
12600
12781
  *
12601
- * *Can only be used if this is ItemWithLabel*
12782
+ * *Can only be used if this is AmmoItem*
12602
12783
  *
12603
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.allow_manual_label_change View documentation}
12784
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.add_ammo View documentation}
12785
+ *
12786
+ * @param amount - Amount of ammo to add.
12604
12787
  */
12605
- allow_manual_label_change: boolean
12788
+ add_ammo(amount: float): void
12606
12789
  /**
12607
- * Raw materials required to build this blueprint. Result is a dictionary mapping each item prototype name to the
12608
- * required count.
12790
+ * Remove ammo from this ammo item.
12609
12791
  *
12610
- * *Can only be used if this is BlueprintItem*
12792
+ * *Can only be used if this is AmmoItem*
12611
12793
  *
12612
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.cost_to_build View documentation}
12794
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.drain_ammo View documentation}
12795
+ *
12796
+ * @param amount - Amount of ammo to remove.
12613
12797
  */
12614
- readonly cost_to_build: Record<string, uint>
12798
+ drain_ammo(amount: float): void
12615
12799
  /**
12616
- * If this item extends the inventory it resides in (provides its contents for counts, crafting, insertion). Only
12617
- * callable on items with inventories.
12800
+ * Number of bullets left in the magazine.
12618
12801
  *
12619
- * *Can only be used if this is ItemWithInventory*
12802
+ * *Can only be used if this is AmmoItem*
12620
12803
  *
12621
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.extends_inventory View documentation}
12804
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.ammo View documentation}
12622
12805
  */
12623
- extends_inventory: boolean
12806
+ ammo: uint
12807
+ }
12808
+
12809
+ /** @noSelf */
12810
+ interface ToolItemStack extends BaseItemStack {
12624
12811
  /**
12625
- * The insertion mode priority this ItemWithInventory uses when items are inserted into an inventory it resides in.
12626
- * Only callable on items with inventories.
12812
+ * Add durability to this tool item.
12627
12813
  *
12628
- * *Can only be used if this is ItemWithInventory*
12814
+ * *Can only be used if this is ToolItem*
12629
12815
  *
12630
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.prioritize_insertion_mode View documentation}
12816
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.add_durability View documentation}
12817
+ *
12818
+ * @param amount - Amount of durability to add.
12631
12819
  */
12632
- prioritize_insertion_mode: string
12820
+ add_durability(amount: double): void
12633
12821
  /**
12634
- * The default icons for a blueprint item.
12822
+ * Remove durability from this tool item.
12635
12823
  *
12636
- * *Can only be used if this is BlueprintItem*
12824
+ * *Can only be used if this is ToolItem*
12637
12825
  *
12638
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.default_icons View documentation}
12826
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.drain_durability View documentation}
12827
+ *
12828
+ * @param amount - Amount of durability to remove.
12639
12829
  */
12640
- readonly default_icons: BlueprintItemIcon[]
12830
+ drain_durability(amount: double): void
12831
+ }
12832
+
12833
+ /** @noSelf */
12834
+ interface ItemWithTagsItemStack extends BaseItemStack {
12641
12835
  /**
12836
+ * Gets the tag with the given name or returns `nil` if it doesn't exist.
12837
+ *
12642
12838
  * *Can only be used if this is ItemWithTags*
12643
12839
  *
12644
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.tags View documentation}
12645
- */
12646
- tags: Tags
12647
- /**
12648
- * The custom description this item-with-tags. This is shown over the normal item description if this is set to a
12649
- * non-empty value.
12840
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.get_tag View documentation}
12650
12841
  *
12651
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.custom_description View documentation}
12842
+ * @param tag_name
12652
12843
  */
12653
- custom_description: LocalisedString
12844
+ get_tag(tag_name: string): AnyBasic | undefined
12654
12845
  /**
12655
- * The entity filters for this deconstruction item. The attribute is a sparse array with the keys representing the
12656
- * index of the filter. All strings in this array must be entity prototype names that don't have the
12657
- * `"not-deconstructable"` flag set and are either a `cliff` or marked as `minable`.
12846
+ * Sets the tag with the given name and value.
12658
12847
  *
12659
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.entity_filters View documentation}
12660
- */
12661
- entity_filters: string[]
12662
- /**
12663
- * The tile filters for this deconstruction item. The attribute is a sparse array with the keys representing the
12664
- * index of the filter. All strings in this array must be tile prototype names.
12848
+ * *Can only be used if this is ItemWithTags*
12665
12849
  *
12666
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.tile_filters View documentation}
12850
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.set_tag View documentation}
12851
+ *
12852
+ * @param tag_name
12853
+ * @param tag
12667
12854
  */
12668
- tile_filters: string[]
12855
+ set_tag(tag_name: string, tag: AnyBasic): AnyBasic
12669
12856
  /**
12670
- * The blacklist/whitelist entity filter mode for this deconstruction item.
12857
+ * Removes a tag with the given name.
12671
12858
  *
12672
- * *Can only be used if this is DeconstructionItem*
12859
+ * *Can only be used if this is ItemWithTags*
12673
12860
  *
12674
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.entity_filter_mode View documentation}
12861
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.remove_tag View documentation}
12862
+ *
12863
+ * @param tag
12864
+ * @returns If the tag existed and was removed.
12675
12865
  */
12676
- entity_filter_mode: defines.deconstruction_item.entity_filter_mode
12866
+ remove_tag(tag: string): boolean
12677
12867
  /**
12678
- * The blacklist/whitelist tile filter mode for this deconstruction item.
12679
- *
12680
- * *Can only be used if this is DeconstructionItem*
12868
+ * *Can only be used if this is ItemWithTags*
12681
12869
  *
12682
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.tile_filter_mode View documentation}
12870
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.tags View documentation}
12683
12871
  */
12684
- tile_filter_mode: defines.deconstruction_item.tile_filter_mode
12872
+ tags: Tags
12873
+ }
12874
+
12875
+ /** @noSelf */
12876
+ interface DeconstructionItemStack extends BaseItemStack {
12685
12877
  /**
12686
- * The tile selection mode for this deconstruction item.
12878
+ * Gets the entity filter at the given index for this deconstruction item.
12687
12879
  *
12688
12880
  * *Can only be used if this is DeconstructionItem*
12689
12881
  *
12690
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.tile_selection_mode View documentation}
12882
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.get_entity_filter View documentation}
12883
+ *
12884
+ * @param index
12691
12885
  */
12692
- tile_selection_mode: defines.deconstruction_item.tile_selection_mode
12886
+ get_entity_filter(index: uint): string
12693
12887
  /**
12694
- * If this deconstruction item is set to allow trees and rocks only.
12888
+ * Sets the entity filter at the given index for this deconstruction item.
12695
12889
  *
12696
12890
  * *Can only be used if this is DeconstructionItem*
12697
12891
  *
12698
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.trees_and_rocks_only View documentation}
12892
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.set_entity_filter View documentation}
12893
+ *
12894
+ * @param index
12895
+ * @param filter - Setting to nil erases the filter.
12896
+ * @returns If the new filter was set (was valid.)
12699
12897
  */
12700
- trees_and_rocks_only: boolean
12898
+ set_entity_filter(index: uint, filter: string | LuaEntityPrototype | LuaEntity | undefined): boolean
12701
12899
  /**
12702
- * The number of entity filters this deconstruction item supports.
12900
+ * Gets the tile filter at the given index for this deconstruction item.
12703
12901
  *
12704
12902
  * *Can only be used if this is DeconstructionItem*
12705
12903
  *
12706
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.entity_filter_count View documentation}
12904
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.get_tile_filter View documentation}
12905
+ *
12906
+ * @param index
12707
12907
  */
12708
- readonly entity_filter_count: uint
12908
+ get_tile_filter(index: uint): string
12709
12909
  /**
12710
- * The number of tile filters this deconstruction item supports.
12910
+ * Sets the tile filter at the given index for this deconstruction item.
12711
12911
  *
12712
12912
  * *Can only be used if this is DeconstructionItem*
12713
12913
  *
12714
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.tile_filter_count View documentation}
12914
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.set_tile_filter View documentation}
12915
+ *
12916
+ * @param index
12917
+ * @param filter - Setting to nil erases the filter.
12918
+ * @returns If the new filter was set (was valid.)
12715
12919
  */
12716
- readonly tile_filter_count: uint
12920
+ set_tile_filter(index: uint, filter: string | LuaTilePrototype | LuaTile | undefined): boolean
12717
12921
  /**
12718
- * The active blueprint index for this blueprint book. May be `nil`.
12922
+ * Clears all settings/filters on this deconstruction item resetting it to default values.
12719
12923
  *
12720
- * *Can only be used if this is BlueprintBookItem*
12924
+ * *Can only be used if this is DeconstructionItem*
12721
12925
  *
12722
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.active_index View documentation}
12926
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.clear_deconstruction_item View documentation}
12723
12927
  */
12724
- active_index: uint | undefined
12928
+ clear_deconstruction_item(): void
12725
12929
  /**
12726
- * The unique identifier for this item if it has one, `nil` otherwise. Note that this ID stays the same no matter
12727
- * where the item is moved to.
12728
- *
12729
- * Only these types of items have unique IDs:
12930
+ * The blacklist/whitelist entity filter mode for this deconstruction item.
12730
12931
  *
12731
- * - `"armor"`
12732
- * - `"spidertron-remote"`
12733
- * - `"selection-tool"`
12734
- * - `"copy-paste-tool"`
12735
- * - `"upgrade-item"`
12736
- * - `"deconstruction-item"`
12737
- * - `"blueprint"`
12738
- * - `"blueprint-book"`
12739
- * - `"item-with-entity-data"`
12740
- * - `"item-with-inventory"`
12741
- * - `"item-with-tags"`
12932
+ * *Can only be used if this is DeconstructionItem*
12742
12933
  *
12743
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.item_number View documentation}
12934
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.entity_filter_mode View documentation}
12744
12935
  */
12745
- readonly item_number: uint | undefined
12936
+ entity_filter_mode: defines.deconstruction_item.entity_filter_mode
12746
12937
  /**
12747
- * If this item is a spidertron remote that has a spidertron bound to it, it returns the connected spider-vehicle
12748
- * entity, `nil` otherwise.
12938
+ * The blacklist/whitelist tile filter mode for this deconstruction item.
12749
12939
  *
12750
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.connected_entity View documentation}
12751
- */
12752
- connected_entity: LuaEntity | undefined
12753
- /**
12754
- * If this is a blueprint item.
12940
+ * *Can only be used if this is DeconstructionItem*
12755
12941
  *
12756
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.is_blueprint View documentation}
12942
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.tile_filter_mode View documentation}
12757
12943
  */
12758
- readonly is_blueprint: boolean
12944
+ tile_filter_mode: defines.deconstruction_item.tile_filter_mode
12759
12945
  /**
12760
- * If this is a blueprint book item.
12946
+ * The tile selection mode for this deconstruction item.
12761
12947
  *
12762
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.is_blueprint_book View documentation}
12763
- */
12764
- readonly is_blueprint_book: boolean
12765
- /**
12766
- * If this is a module item.
12948
+ * *Can only be used if this is DeconstructionItem*
12767
12949
  *
12768
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.is_module View documentation}
12950
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.tile_selection_mode View documentation}
12769
12951
  */
12770
- readonly is_module: boolean
12952
+ tile_selection_mode: defines.deconstruction_item.tile_selection_mode
12771
12953
  /**
12772
- * If this is a tool item.
12954
+ * If this deconstruction item is set to allow trees and rocks only.
12773
12955
  *
12774
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.is_tool View documentation}
12956
+ * *Can only be used if this is DeconstructionItem*
12957
+ *
12958
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.trees_and_rocks_only View documentation}
12775
12959
  */
12776
- readonly is_tool: boolean
12960
+ trees_and_rocks_only: boolean
12777
12961
  /**
12778
- * If this is a mining tool item.
12962
+ * The number of entity filters this deconstruction item supports.
12779
12963
  *
12780
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.is_mining_tool View documentation}
12964
+ * *Can only be used if this is DeconstructionItem*
12965
+ *
12966
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.entity_filter_count View documentation}
12781
12967
  */
12782
- readonly is_mining_tool: boolean
12968
+ readonly entity_filter_count: uint
12783
12969
  /**
12784
- * If this is an armor item.
12970
+ * The number of tile filters this deconstruction item supports.
12785
12971
  *
12786
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.is_armor View documentation}
12972
+ * *Can only be used if this is DeconstructionItem*
12973
+ *
12974
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.tile_filter_count View documentation}
12787
12975
  */
12788
- readonly is_armor: boolean
12976
+ readonly tile_filter_count: uint
12977
+ }
12978
+
12979
+ /** @noSelf */
12980
+ interface UpgradeItemStack extends BaseItemStack {
12789
12981
  /**
12790
- * If this is a repair tool item.
12982
+ * Clears all settings/filters on this upgrade item resetting it to default values.
12791
12983
  *
12792
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.is_repair_tool View documentation}
12984
+ * *Can only be used if this is UpgradeItem*
12985
+ *
12986
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.clear_upgrade_item View documentation}
12793
12987
  */
12794
- readonly is_repair_tool: boolean
12988
+ clear_upgrade_item(): void
12795
12989
  /**
12796
- * If this is an item with label item.
12990
+ * Gets the filter at the given index for this upgrade item.
12797
12991
  *
12798
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.is_item_with_label View documentation}
12992
+ * *Can only be used if this is UpgradeItem*
12993
+ *
12994
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.get_mapper View documentation}
12995
+ *
12996
+ * @param index - The index of the mapper to read.
12997
+ * @param type - 'from' or 'to'.
12799
12998
  */
12800
- readonly is_item_with_label: boolean
12999
+ get_mapper(index: uint, type: "from" | "to"): UpgradeFilter
12801
13000
  /**
12802
- * If this is an item with inventory item.
13001
+ * Sets the module filter at the given index for this upgrade item.
12803
13002
  *
12804
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.is_item_with_inventory View documentation}
13003
+ * *Can only be used if this is UpgradeItem*
13004
+ *
13005
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.set_mapper View documentation}
13006
+ *
13007
+ * @param index - The index of the mapper to set.
13008
+ * @param type - `from` or `to`.
13009
+ * @param filter - The filter to set or `nil`
12805
13010
  */
12806
- readonly is_item_with_inventory: boolean
13011
+ set_mapper(index: uint, type: string, filter: UpgradeFilter | undefined): void
13012
+ }
13013
+
13014
+ /** @noSelf */
13015
+ interface ItemWithEntityDataItemStack extends BaseItemStack {
12807
13016
  /**
12808
- * If this is an item with entity data item.
13017
+ * Creates the equipment grid for this item if it doesn't exist and this is an item-with-entity-data that supports
13018
+ * equipment grids.
12809
13019
  *
12810
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.is_item_with_entity_data View documentation}
13020
+ * *Can only be used if this is ItemWithEntityData*
13021
+ *
13022
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.create_grid View documentation}
12811
13023
  */
12812
- readonly is_item_with_entity_data: boolean
13024
+ create_grid(): LuaEquipmentGrid
13025
+ }
13026
+
13027
+ interface ItemWithLabelItemStack extends BaseItemStack {
12813
13028
  /**
12814
- * If this is a selection tool item.
13029
+ * The current label for this item. Nil when none.
12815
13030
  *
12816
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.is_selection_tool View documentation}
13031
+ * *Can only be used if this is ItemWithLabel*
13032
+ *
13033
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.label View documentation}
12817
13034
  */
12818
- readonly is_selection_tool: boolean
13035
+ label: string | undefined
12819
13036
  /**
12820
- * If this is an item with tags item.
13037
+ * The current label color for this item. Nil when none.
12821
13038
  *
12822
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.is_item_with_tags View documentation}
13039
+ * *Can only be used if this is ItemWithLabel*
13040
+ *
13041
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.label_color View documentation}
12823
13042
  */
12824
- readonly is_item_with_tags: boolean
13043
+ label_color: Color | undefined
12825
13044
  /**
12826
- * If this is a deconstruction tool item.
13045
+ * If the label for this item can be manually changed. When false the label can only be changed through the API.
12827
13046
  *
12828
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.is_deconstruction_item View documentation}
13047
+ * *Can only be used if this is ItemWithLabel*
13048
+ *
13049
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.allow_manual_label_change View documentation}
12829
13050
  */
12830
- readonly is_deconstruction_item: boolean
13051
+ allow_manual_label_change: boolean
13052
+ }
13053
+
13054
+ interface ItemWithInventoryItemStack extends BaseItemStack {
12831
13055
  /**
12832
- * If this is a upgrade item.
13056
+ * If this item extends the inventory it resides in (provides its contents for counts, crafting, insertion). Only
13057
+ * callable on items with inventories.
12833
13058
  *
12834
- * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.is_upgrade_item View documentation}
13059
+ * *Can only be used if this is ItemWithInventory*
13060
+ *
13061
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.extends_inventory View documentation}
12835
13062
  */
12836
- readonly is_upgrade_item: boolean
13063
+ extends_inventory: boolean
12837
13064
  /**
12838
- * Is this object valid? This Lua object holds a reference to an object within the game engine. It is possible that
12839
- * the game-engine object is removed whilst a mod still holds the corresponding Lua object. If that happens, the
12840
- * object becomes invalid, i.e. this attribute will be `false`. Mods are advised to check for object validity if any
12841
- * change to the game state might have occurred between the creation of the Lua object and its access.
13065
+ * The insertion mode priority this ItemWithInventory uses when items are inserted into an inventory it resides in.
13066
+ * Only callable on items with inventories.
13067
+ *
13068
+ * *Can only be used if this is ItemWithInventory*
13069
+ *
13070
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.prioritize_insertion_mode View documentation}
12842
13071
  */
12843
- readonly valid: boolean
13072
+ prioritize_insertion_mode: string
13073
+ }
13074
+
13075
+ interface BlueprintBookItemStack extends BaseItemStack {
12844
13076
  /**
12845
- * The class name of this object. Available even when `valid` is false. For LuaStruct objects it may also be
12846
- * suffixed with a dotted path to a member of the struct.
13077
+ * The active blueprint index for this blueprint book. May be `nil`.
13078
+ *
13079
+ * *Can only be used if this is BlueprintBookItem*
13080
+ *
13081
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.active_index View documentation}
12847
13082
  */
12848
- readonly object_name: "LuaItemStack"
12849
- /** All methods and properties that this object supports. */
12850
- help(): string
13083
+ active_index: uint | undefined
12851
13084
  }
12852
13085
 
13086
+ /**
13087
+ * A reference to an item and count owned by some external entity.
13088
+ *
13089
+ * **Note**: In most instances this is a simple reference as in: it points at a specific slot in an inventory and not
13090
+ * the item in the slot.
13091
+ *
13092
+ * **Note**: In the instance this references an item on a {@link LuaTransportLine} the reference is only guaranteed to
13093
+ * stay valid (and refer to the same item) as long as nothing changes the transport line.
13094
+ *
13095
+ * {@link https://lua-api.factorio.com/latest/LuaItemStack.html View documentation}
13096
+ */
13097
+ interface LuaItemStack
13098
+ extends BaseItemStack,
13099
+ BlueprintItemStack,
13100
+ AmmoItemStack,
13101
+ ToolItemStack,
13102
+ ItemWithTagsItemStack,
13103
+ DeconstructionItemStack,
13104
+ UpgradeItemStack,
13105
+ ItemWithEntityDataItemStack,
13106
+ ItemWithLabelItemStack,
13107
+ ItemWithInventoryItemStack,
13108
+ BlueprintBookItemStack {}
13109
+
12853
13110
  /**
12854
13111
  * Control behavior for lamps.
12855
13112
  *
@@ -17030,14 +17287,8 @@ interface LuaStorageTankControlBehavior extends LuaControlBehavior {
17030
17287
  help(): string
17031
17288
  }
17032
17289
 
17033
- /**
17034
- * Style of a GUI element. All of the attributes listed here may be `nil` if not available for a particular GUI element.
17035
- *
17036
- * {@link https://lua-api.factorio.com/latest/LuaStyle.html View documentation}
17037
- *
17038
- * @noSelf
17039
- */
17040
- interface LuaStyle {
17290
+ /** @noSelf */
17291
+ interface BaseStyle {
17041
17292
  /**
17042
17293
  * Gui of the {@link LuaGuiElement} of this style.
17043
17294
  *
@@ -17110,6 +17361,112 @@ interface LuaStyle {
17110
17361
  vertical_align: "top" | "center" | "bottom"
17111
17362
  font_color: Color
17112
17363
  font: string
17364
+ /**
17365
+ * If the GUI element stretches its size horizontally to other elements.
17366
+ *
17367
+ * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.horizontally_stretchable View documentation}
17368
+ */
17369
+ horizontally_stretchable: boolean
17370
+ /**
17371
+ * If the GUI element stretches its size vertically to other elements.
17372
+ *
17373
+ * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.vertically_stretchable View documentation}
17374
+ */
17375
+ vertically_stretchable: boolean
17376
+ /**
17377
+ * If the GUI element can be squashed (by maximal width of some parent element) horizontally. This is mainly meant
17378
+ * to be used for scroll-pane The default value is false.
17379
+ *
17380
+ * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.horizontally_squashable View documentation}
17381
+ */
17382
+ horizontally_squashable: boolean
17383
+ /**
17384
+ * If the GUI element can be squashed (by maximal height of some parent element) vertically. This is mainly meant to
17385
+ * be used for scroll-pane The default (parent) value for scroll pane is true, false otherwise.
17386
+ *
17387
+ * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.vertically_squashable View documentation}
17388
+ */
17389
+ vertically_squashable: boolean
17390
+ /**
17391
+ * Array containing the alignment for every column of this table element. Even though this property is marked as
17392
+ * read-only, the alignment can be changed by indexing the LuaCustomTable, like so:
17393
+ *
17394
+ * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.column_alignments View documentation}
17395
+ *
17396
+ * @example
17397
+ * ```lua
17398
+ * table_element.style.column_alignments[1] = "center"
17399
+ * ```
17400
+ */
17401
+ readonly column_alignments: LuaCustomTable<uint, Alignment>
17402
+ /**
17403
+ * Sets both minimal and maximal width to the given value.
17404
+ *
17405
+ * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.width View documentation}
17406
+ */
17407
+ set width(value: int)
17408
+ /**
17409
+ * Sets both minimal and maximal height to the given value.
17410
+ *
17411
+ * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.height View documentation}
17412
+ */
17413
+ set height(value: int)
17414
+ /**
17415
+ * Sets both width and height to the given value. Also accepts an array with two values, setting width to the first
17416
+ * and height to the second one.
17417
+ *
17418
+ * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.size View documentation}
17419
+ */
17420
+ set size(value: int | SizeArray)
17421
+ /**
17422
+ * Sets top/right/bottom/left paddings to this value. An array with two values sets top/bottom padding to the first
17423
+ * value and left/right padding to the second value. An array with four values sets top, right, bottom, left padding
17424
+ * respectively.
17425
+ *
17426
+ * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.padding View documentation}
17427
+ */
17428
+ set padding(value: int | StyleValuesArray)
17429
+ /**
17430
+ * Sets top/right/bottom/left margins to this value. An array with two values sets top/bottom margin to the first
17431
+ * value and left/right margin to the second value. An array with four values sets top, right, bottom, left margin
17432
+ * respectively.
17433
+ *
17434
+ * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.margin View documentation}
17435
+ */
17436
+ set margin(value: int | StyleValuesArray)
17437
+ /**
17438
+ * Sets extra_top/right/bottom/left_padding_when_actived to this value. An array with two values sets top/bottom
17439
+ * padding to the first value and left/right padding to the second value. An array with four values sets top, right,
17440
+ * bottom, left padding respectively.
17441
+ *
17442
+ * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.extra_padding_when_activated View documentation}
17443
+ */
17444
+ set extra_padding_when_activated(value: int | StyleValuesArray)
17445
+ /**
17446
+ * Sets extra_top/right/bottom/left_margin_when_activated to this value. An array with two values sets top/bottom
17447
+ * margin to the first value and left/right margin to the second value. An array with four values sets top, right,
17448
+ * bottom, left margin respectively.
17449
+ *
17450
+ * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.extra_margin_when_activated View documentation}
17451
+ */
17452
+ set extra_margin_when_activated(value: int | StyleValuesArray)
17453
+ /**
17454
+ * Is this object valid? This Lua object holds a reference to an object within the game engine. It is possible that
17455
+ * the game-engine object is removed whilst a mod still holds the corresponding Lua object. If that happens, the
17456
+ * object becomes invalid, i.e. this attribute will be `false`. Mods are advised to check for object validity if any
17457
+ * change to the game state might have occurred between the creation of the Lua object and its access.
17458
+ */
17459
+ readonly valid: boolean
17460
+ /**
17461
+ * The class name of this object. Available even when `valid` is false. For LuaStruct objects it may also be
17462
+ * suffixed with a dotted path to a member of the struct.
17463
+ */
17464
+ readonly object_name: "LuaStyle"
17465
+ /** All methods and properties that this object supports. */
17466
+ help(): string
17467
+ }
17468
+
17469
+ interface TableStyle extends BaseStyle {
17113
17470
  /**
17114
17471
  * Space between the table cell contents top and border.
17115
17472
  *
@@ -17143,31 +17500,60 @@ interface LuaStyle {
17143
17500
  */
17144
17501
  left_cell_padding: int
17145
17502
  /**
17146
- * If the GUI element stretches its size horizontally to other elements.
17503
+ * Horizontal space between individual cells.
17147
17504
  *
17148
- * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.horizontally_stretchable View documentation}
17505
+ * *Can only be used if this is LuaTableStyle, LuaFlowStyle or LuaHorizontalFlow*
17506
+ *
17507
+ * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.horizontal_spacing View documentation}
17149
17508
  */
17150
- horizontally_stretchable: boolean
17509
+ horizontal_spacing: int
17151
17510
  /**
17152
- * If the GUI element stretches its size vertically to other elements.
17511
+ * Vertical space between individual cells.
17153
17512
  *
17154
- * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.vertically_stretchable View documentation}
17513
+ * *Can only be used if this is LuaTableStyle, LuaFlowStyle, LuaVerticalFlowStyle or LuaTabbedPaneStyle*
17514
+ *
17515
+ * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.vertical_spacing View documentation}
17155
17516
  */
17156
- vertically_stretchable: boolean
17517
+ vertical_spacing: int
17157
17518
  /**
17158
- * If the GUI element can be squashed (by maximal width of some parent element) horizontally. This is mainly meant
17159
- * to be used for scroll-pane The default value is false.
17519
+ * Space between the table cell contents and border. Sets top/right/bottom/left cell paddings to this value.
17160
17520
  *
17161
- * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.horizontally_squashable View documentation}
17521
+ * *Can only be used if this is LuaTableStyle*
17522
+ *
17523
+ * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.cell_padding View documentation}
17162
17524
  */
17163
- horizontally_squashable: boolean
17525
+ set cell_padding(value: int)
17526
+ }
17527
+
17528
+ interface LabelStyle extends BaseStyle {
17164
17529
  /**
17165
- * If the GUI element can be squashed (by maximal height of some parent element) vertically. This is mainly meant to
17166
- * be used for scroll-pane The default (parent) value for scroll pane is true, false otherwise.
17530
+ * How this GUI element handles rich text.
17167
17531
  *
17168
- * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.vertically_squashable View documentation}
17532
+ * *Can only be used if this is LuaLabelStyle, LuaTextBoxStyle or LuaTextFieldStyle*
17533
+ *
17534
+ * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.rich_text_setting View documentation}
17169
17535
  */
17170
- vertically_squashable: boolean
17536
+ rich_text_setting: defines.rich_text_setting
17537
+ /**
17538
+ * *Can only be used if this is LabelStyle*
17539
+ *
17540
+ * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.single_line View documentation}
17541
+ */
17542
+ single_line: boolean
17543
+ }
17544
+
17545
+ interface TextBoxStyle extends BaseStyle {
17546
+ /**
17547
+ * How this GUI element handles rich text.
17548
+ *
17549
+ * *Can only be used if this is LuaLabelStyle, LuaTextBoxStyle or LuaTextFieldStyle*
17550
+ *
17551
+ * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.rich_text_setting View documentation}
17552
+ */
17553
+ rich_text_setting: defines.rich_text_setting
17554
+ }
17555
+
17556
+ interface TextFieldStyle extends BaseStyle {
17171
17557
  /**
17172
17558
  * How this GUI element handles rich text.
17173
17559
  *
@@ -17176,6 +17562,9 @@ interface LuaStyle {
17176
17562
  * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.rich_text_setting View documentation}
17177
17563
  */
17178
17564
  rich_text_setting: defines.rich_text_setting
17565
+ }
17566
+
17567
+ interface ButtonStyle extends BaseStyle {
17179
17568
  /**
17180
17569
  * *Can only be used if this is LuaButtonStyle*
17181
17570
  *
@@ -17230,6 +17619,48 @@ interface LuaStyle {
17230
17619
  * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.strikethrough_color View documentation}
17231
17620
  */
17232
17621
  strikethrough_color: Color
17622
+ }
17623
+
17624
+ interface TabStyle extends BaseStyle {
17625
+ /**
17626
+ * *Can only be used if this is LuaButtonStyle or LuaTabStyle*
17627
+ *
17628
+ * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.disabled_font_color View documentation}
17629
+ */
17630
+ disabled_font_color: Color
17631
+ /**
17632
+ * *Can only be used if this is TabStyle*
17633
+ *
17634
+ * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.badge_font View documentation}
17635
+ */
17636
+ badge_font: string
17637
+ /**
17638
+ * *Can only be used if this is TabStyle*
17639
+ *
17640
+ * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.badge_horizontal_spacing View documentation}
17641
+ */
17642
+ badge_horizontal_spacing: int
17643
+ /**
17644
+ * *Can only be used if this is TabStyle*
17645
+ *
17646
+ * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.default_badge_font_color View documentation}
17647
+ */
17648
+ default_badge_font_color: Color
17649
+ /**
17650
+ * *Can only be used if this is TabStyle*
17651
+ *
17652
+ * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.selected_badge_font_color View documentation}
17653
+ */
17654
+ selected_badge_font_color: Color
17655
+ /**
17656
+ * *Can only be used if this is TabStyle*
17657
+ *
17658
+ * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.disabled_badge_font_color View documentation}
17659
+ */
17660
+ disabled_badge_font_color: Color
17661
+ }
17662
+
17663
+ interface FlowStyle extends BaseStyle {
17233
17664
  /**
17234
17665
  * Horizontal space between individual cells.
17235
17666
  *
@@ -17246,12 +17677,51 @@ interface LuaStyle {
17246
17677
  * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.vertical_spacing View documentation}
17247
17678
  */
17248
17679
  vertical_spacing: int
17680
+ }
17681
+
17682
+ interface HorizontalFlowStyle extends BaseStyle {
17683
+ /**
17684
+ * Horizontal space between individual cells.
17685
+ *
17686
+ * *Can only be used if this is LuaTableStyle, LuaFlowStyle or LuaHorizontalFlow*
17687
+ *
17688
+ * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.horizontal_spacing View documentation}
17689
+ */
17690
+ horizontal_spacing: int
17691
+ }
17692
+
17693
+ interface VerticalFlowStyle extends BaseStyle {
17694
+ /**
17695
+ * Vertical space between individual cells.
17696
+ *
17697
+ * *Can only be used if this is LuaTableStyle, LuaFlowStyle, LuaVerticalFlowStyle or LuaTabbedPaneStyle*
17698
+ *
17699
+ * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.vertical_spacing View documentation}
17700
+ */
17701
+ vertical_spacing: int
17702
+ }
17703
+
17704
+ interface TabbedPaneStyle extends BaseStyle {
17705
+ /**
17706
+ * Vertical space between individual cells.
17707
+ *
17708
+ * *Can only be used if this is LuaTableStyle, LuaFlowStyle, LuaVerticalFlowStyle or LuaTabbedPaneStyle*
17709
+ *
17710
+ * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.vertical_spacing View documentation}
17711
+ */
17712
+ vertical_spacing: int
17713
+ }
17714
+
17715
+ interface FrameStyle extends BaseStyle {
17249
17716
  /**
17250
17717
  * *Can only be used if this is LuaFrameStyle*
17251
17718
  *
17252
17719
  * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.use_header_filler View documentation}
17253
17720
  */
17254
17721
  use_header_filler: boolean
17722
+ }
17723
+
17724
+ interface ProgressBarStyle extends BaseStyle {
17255
17725
  /**
17256
17726
  * *Can only be used if this is LuaProgressBarStyle*
17257
17727
  *
@@ -17264,24 +17734,9 @@ interface LuaStyle {
17264
17734
  * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.color View documentation}
17265
17735
  */
17266
17736
  color: Color
17267
- /**
17268
- * Array containing the alignment for every column of this table element. Even though this property is marked as
17269
- * read-only, the alignment can be changed by indexing the LuaCustomTable, like so:
17270
- *
17271
- * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.column_alignments View documentation}
17272
- *
17273
- * @example
17274
- * ```lua
17275
- * table_element.style.column_alignments[1] = "center"
17276
- * ```
17277
- */
17278
- readonly column_alignments: LuaCustomTable<uint, Alignment>
17279
- /**
17280
- * *Can only be used if this is LabelStyle*
17281
- *
17282
- * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.single_line View documentation}
17283
- */
17284
- single_line: boolean
17737
+ }
17738
+
17739
+ interface ScrollPaneStyle extends BaseStyle {
17285
17740
  /**
17286
17741
  * *Can only be used if this is ScrollPaneStyle*
17287
17742
  *
@@ -17330,117 +17785,39 @@ interface LuaStyle {
17330
17785
  * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.extra_right_margin_when_activated View documentation}
17331
17786
  */
17332
17787
  extra_right_margin_when_activated: int
17788
+ }
17789
+
17790
+ interface ImageStyle extends BaseStyle {
17333
17791
  /**
17334
17792
  * *Can only be used if this is ImageStyle*
17335
17793
  *
17336
17794
  * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.stretch_image_to_widget_size View documentation}
17337
17795
  */
17338
17796
  stretch_image_to_widget_size: boolean
17339
- /**
17340
- * *Can only be used if this is TabStyle*
17341
- *
17342
- * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.badge_font View documentation}
17343
- */
17344
- badge_font: string
17345
- /**
17346
- * *Can only be used if this is TabStyle*
17347
- *
17348
- * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.badge_horizontal_spacing View documentation}
17349
- */
17350
- badge_horizontal_spacing: int
17351
- /**
17352
- * *Can only be used if this is TabStyle*
17353
- *
17354
- * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.default_badge_font_color View documentation}
17355
- */
17356
- default_badge_font_color: Color
17357
- /**
17358
- * *Can only be used if this is TabStyle*
17359
- *
17360
- * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.selected_badge_font_color View documentation}
17361
- */
17362
- selected_badge_font_color: Color
17363
- /**
17364
- * *Can only be used if this is TabStyle*
17365
- *
17366
- * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.disabled_badge_font_color View documentation}
17367
- */
17368
- disabled_badge_font_color: Color
17369
- /**
17370
- * Sets both minimal and maximal width to the given value.
17371
- *
17372
- * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.width View documentation}
17373
- */
17374
- set width(value: int)
17375
- /**
17376
- * Sets both minimal and maximal height to the given value.
17377
- *
17378
- * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.height View documentation}
17379
- */
17380
- set height(value: int)
17381
- /**
17382
- * Sets both width and height to the given value. Also accepts an array with two values, setting width to the first
17383
- * and height to the second one.
17384
- *
17385
- * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.size View documentation}
17386
- */
17387
- set size(value: int | int[])
17388
- /**
17389
- * Sets top/right/bottom/left paddings to this value. An array with two values sets top/bottom padding to the first
17390
- * value and left/right padding to the second value. An array with four values sets top, right, bottom, left padding
17391
- * respectively.
17392
- *
17393
- * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.padding View documentation}
17394
- */
17395
- set padding(value: int | int[])
17396
- /**
17397
- * Sets top/right/bottom/left margins to this value. An array with two values sets top/bottom margin to the first
17398
- * value and left/right margin to the second value. An array with four values sets top, right, bottom, left margin
17399
- * respectively.
17400
- *
17401
- * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.margin View documentation}
17402
- */
17403
- set margin(value: int | int[])
17404
- /**
17405
- * Space between the table cell contents and border. Sets top/right/bottom/left cell paddings to this value.
17406
- *
17407
- * *Can only be used if this is LuaTableStyle*
17408
- *
17409
- * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.cell_padding View documentation}
17410
- */
17411
- set cell_padding(value: int)
17412
- /**
17413
- * Sets extra_top/right/bottom/left_padding_when_actived to this value. An array with two values sets top/bottom
17414
- * padding to the first value and left/right padding to the second value. An array with four values sets top, right,
17415
- * bottom, left padding respectively.
17416
- *
17417
- * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.extra_padding_when_activated View documentation}
17418
- */
17419
- set extra_padding_when_activated(value: int | int[])
17420
- /**
17421
- * Sets extra_top/right/bottom/left_margin_when_activated to this value. An array with two values sets top/bottom
17422
- * margin to the first value and left/right margin to the second value. An array with four values sets top, right,
17423
- * bottom, left margin respectively.
17424
- *
17425
- * {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.extra_margin_when_activated View documentation}
17426
- */
17427
- set extra_margin_when_activated(value: int | int[])
17428
- /**
17429
- * Is this object valid? This Lua object holds a reference to an object within the game engine. It is possible that
17430
- * the game-engine object is removed whilst a mod still holds the corresponding Lua object. If that happens, the
17431
- * object becomes invalid, i.e. this attribute will be `false`. Mods are advised to check for object validity if any
17432
- * change to the game state might have occurred between the creation of the Lua object and its access.
17433
- */
17434
- readonly valid: boolean
17435
- /**
17436
- * The class name of this object. Available even when `valid` is false. For LuaStruct objects it may also be
17437
- * suffixed with a dotted path to a member of the struct.
17438
- */
17439
- readonly object_name: "LuaStyle"
17440
- /** All methods and properties that this object supports. */
17441
- help(): string
17442
17797
  }
17443
17798
 
17799
+ /**
17800
+ * Style of a GUI element. All of the attributes listed here may be `nil` if not available for a particular GUI element.
17801
+ *
17802
+ * {@link https://lua-api.factorio.com/latest/LuaStyle.html View documentation}
17803
+ */
17804
+ interface LuaStyle
17805
+ extends BaseStyle,
17806
+ TableStyle,
17807
+ LabelStyle,
17808
+ TextBoxStyle,
17809
+ TextFieldStyle,
17810
+ ButtonStyle,
17811
+ TabStyle,
17812
+ FlowStyle,
17813
+ HorizontalFlowStyle,
17814
+ VerticalFlowStyle,
17815
+ TabbedPaneStyle,
17816
+ FrameStyle,
17817
+ ProgressBarStyle,
17818
+ ScrollPaneStyle,
17819
+ ImageStyle {}
17820
+
17444
17821
  interface BaseSurfaceCreateEntity {
17445
17822
  /** The entity prototype name to create. */
17446
17823
  readonly name: string