Module Entity
[Control Stage] LuaEntity manipulation.
Module Status: Work in progress.
Compatibility: Factorio Runtime.
Usage:
local Entity = require('__eradicators-library__/erlib/factorio/Entity')()
-
find_unit_number(unit_number)
-
Brute force searches through all surfaces to find an entity.
The holy grail of de-optimizing your mods performance.
Parameters:
- unit_number
uint
The LuaEntity.unit_number of the target entity.
Returns:
LuaEntity or nil
Should be self-explanatory.
-
is_vehicle(entity)
-
car or spider-vehicle.
Parameters:
Returns:
boolean
-
get_vehicle_driver_player(vehicle)
-
Parameters:
Returns:
LuaPlayer or nil
-
is_real_car(entity)
-
Filter out fake cars.
"Car" type entities are often used as mod hacks, such as frame stepped
animations or letting the player enter buildings.
This checks if a car is actually movable and rotatable by the player.
Parameters:
Returns:
boolean
-
destroy([entity])
-
Destroys an entity or does nothing.
Parameters:
-
get_item_contents(entity)
-
Scans all inventories.
Like LuaEntity.get_fluid_contents but for items.
Parameters:
Returns:
dictionary[string → number]
-
is_blueprintable(prototype)
-
Parameters:
Returns:
boolean