StdLib.Data.Entity
Wrapper for Factorio entity prototypes.
Methods18
function Entity.get_minable_item() -> item StdLib.Data.Item
Gets the first item produced when this entity is mined.
function Entity.set_minable_result(item: table | string, count: nil | integer) -> self
Sets the single result produced when this entity is mined, replacing any existing mining results.
itemtable | stringItem name or prototype wrapper
countnil | integerNumber of items produced; defaults to 1
- self
function Entity.set_minable_item(item: table | string, count: nil | integer) -> self
itemtable | stringItem name or prototype wrapper
countnil | integerNumber of items produced; defaults to 1
- self
function Entity.set_minable_results(results: ItemProductPrototype[]) -> self
Sets the items produced when this entity is mined, replacing any existing single-item mining result.
function Entity.set_minable_items(results: ItemProductPrototype[]) -> self
function Entity.is_player_placeable() -> placeable boolean
Returns whether players can place this entity.
function Entity.change_lab_inputs(name: string, add: boolean) -> self
Adds or removes an item from this lab's inputs.
namestringItem name
addbooleanAdd the input when true; remove it otherwise
- self
function Entity.scale_energy(field: string, scalar: number) -> self
Multiplies a top-level energy-valued field.
function Entity.scale_energy_source(field: string, scalar: number) -> self
Multiplies an energy-valued field inside the entity's energy source.
function Entity.has_collision_layer(layer_name: string) -> boolean
Check if entity collision_mask.layers includes the given collision layer
layer_namestringThe collision layer to check
- boolean
function Entity.add_category(category_name: string) -> self
Add a crafting category to the list of crafting_categories Applies only to CraftingMachinePrototype: assembling-machine, rocket-silo, and furnace
category_namestringThe crafting category to add
- self
function Entity.remove_category(category_name: string) -> self
Remove a crafting category from the list of crafting_categories Applies only to CraftingMachinePrototype: assembling-machine, rocket-silo, and furnace
category_namestringThe crafting category to remove
- self
function Entity.add_categories(category_list: table) -> self
Add multiple recipe categories to the list of crafting_categories Applies only to CraftingMachinePrototype: assembling-machine, rocket-silo, and furnace
category_listtableThe crafting categories to add
- self
function Entity.remove_categories(category_list: table) -> self
Remove multiple recipe categories from the list of crafting_categories Applies only to CraftingMachinePrototype: assembling-machine, rocket-silo, and furnace
category_listtableThe crafting categories to remove
- self
function Entity.rescale_connection_covers(covers: Sprite4Way, scale: number) -> self
Rescales directional pipe/heat connection cover graphics. Also shifts each directional graphic to compensate for the change in scale.
coversSprite4WayscalenumberScale factor
- self
function Entity.rescale_graphics(graphics: table, scale: number) -> self
Rescales a nested graphical/spatial table in place.
graphicstableGraphics table to modify
scalenumberScale factor
- self
function Entity.rescale_entity(scale: number, squeak: nil | boolean, shrink_value: nil | number) -> self
Rescales this entity's graphical and spatial properties in place.
scalenumberScale factor
squeaknil | booleanWhether to shrink collision boxes
shrink_valuenil | numberCollision-box shrink factor; defaults to
0.75
- self
function Entity.get_dimensions() -> (width nil | integer, height nil | integer)
Returns the rounded-up width and height of the entity's collision box.
Fields10
Entity.minable : MinableProperties
(AssemblingMachinePrototype and many others)
Entity.inputs : StdLib.UniqueArray | nil
Entity.collision_mask : CollisionMaskConnector | nil
Entity.collision_box : BoundingBox | nil
Entity.energy_source : EnergySource | nil
Entity.Energy : StdLib.Data.Energy
Entity.__class: string = "Entity"
Entity.__index : unknown
Entity.__call : any
Entity.crafting_categories: table
if table does not exist, create an empty table, then add the new category