Kryzeth Standard Library

data.entity

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.

Parameters
itemtable | string

Item name or prototype wrapper

countnil | integer

Number of items produced; defaults to 1

Returns
self
function Entity.set_minable_item(item: table | string, count: nil | integer) -> self
Parameters
itemtable | string

Item name or prototype wrapper

countnil | integer

Number of items produced; defaults to 1

Returns
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.

Parameters
namestring

Item name

addboolean

Add the input when true; remove it otherwise

Returns
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

Parameters
layer_namestring

The collision layer to check

Returns
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

Parameters
category_namestring

The crafting category to add

Returns
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

Parameters
category_namestring

The crafting category to remove

Returns
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

Parameters
category_listtable

The crafting categories to add

Returns
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

Parameters
category_listtable

The crafting categories to remove

Returns
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.

Parameters
coversSprite4Way
scalenumber

Scale factor

Returns
self
function Entity.rescale_graphics(graphics: table, scale: number) -> self

Rescales a nested graphical/spatial table in place.

Parameters
graphicstable

Graphics table to modify

scalenumber

Scale factor

Returns
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.

Parameters
scalenumber

Scale factor

squeaknil | boolean

Whether to shrink collision boxes

shrink_valuenil | number

Collision-box shrink factor; defaults to 0.75

Returns
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