LuaEntityPrototype

class LuaEntityPrototype
has_flag(flag) → boolean Does this prototype have a flag enabled?
valid :: boolean [R] Is this object valid?
type :: string [R] Type of this prototype.
name :: string [R] Name of this prototype.
localised_name :: LocalisedString [R]
max_health :: float [R] Max health of this entity.
infinite_resource :: boolean [R] Is this resource infinite?
minimum_resource_amount :: uint [R] Minimum amount of this resource.
resource_category :: string [R] Category of this resource.
mineable_properties [R]
items_to_place_this :: dictionary stringLuaItemPrototype [R] Items that when placed will produce this entity.
collision_box :: BoundingBox [R] The bounding box used for collision checking.
selection_box :: BoundingBox [R] The bounding box used for drawing selection.
order :: string [R] Order string of this prototype.
group :: LuaGroup [R] Group of this entity.
subgroup :: LuaGroup [R] Subgroup of this entity.
healing_per_tick :: uint [R] Amount this entity can heal per tick.
emissions_per_tick :: uint [R] Amount of pollution emissions per tick this entity will create.
corpses :: dictionary stringLuaEntityPrototype [R] Corpses used when this entity is destroyed.
selectable_in_game :: boolean [R] Is this entity selectable?
weight :: uint [R]
resistances :: Resistances [R]
fast_replaceable_group :: string [R] The group of mutually fast-replaceable entities.
loot :: Loot [R] Loot that will be dropped when this entity is killed.
repair_speed_modifier :: uint [R] Repair-speed modifier for this entity.
turret_range :: uint [R]
autoplace_specification :: AutoplaceSpecification [R] Autoplace specification for this entity prototype.

Prototype of an entity.

has_flag(flag) → boolean

Does this prototype have a flag enabled?

Parameters
flag :: string: The flag to check. Must be one of
  • "pushable"
  • "placeable-neutral"
  • "placeable-player"
  • "placeable-enemy"
  • "placeable-off-grid"
  • "player-creation"
  • "building-direction-8-way"
  • "filter-directions"
  • "fast-replaceable-no-build-while-moving"
  • "breaths-air"
  • "not-repairable"
  • "not-on-map"
valid :: boolean [Read-only]

Is this object valid? This Lua object holds a reference to an object within the game engine. It is possible that the game-engine object is removed whilst a mod still holds the corresponding Lua object. If that happens, the object becomes invalid, i.e. this attribute will be false. Mods are advised to check for object validity if any change to the game state might have occurred between the creation of the Lua object and its access.

type :: string [Read-only]

Type of this prototype.

name :: string [Read-only]

Name of this prototype.

localised_name :: LocalisedString [Read-only]

max_health :: float [Read-only]

Max health of this entity. Will be 0 if this is not an entity with health.

infinite_resource :: boolean [Read-only]

Is this resource infinite? Will be nil when used on a non-resource.

minimum_resource_amount :: uint [Read-only]

Minimum amount of this resource. Will be nil when used on a non-resource.

resource_category :: string [Read-only]

Category of this resource. "basic-solid", "basic-fluid" or nil (when not a resource).

mineable_properties [Read-only]

Table with the following fields:

  • minable :: boolean: Is this entity mineable at all?
  • hardness :: double: Mining hardness.
  • miningtime :: double: Energy required to mine an entity.
  • miningparticle :: string (optional): Prototype name of the particle produced when mining this entity. Will only be present if this entity produces any particle during mining.
  • products :: array of Product: Products obtained by mining this entity.

items_to_place_this :: dictionary stringLuaItemPrototype [Read-only]

Items that when placed will produce this entity. It is a dictionary indexed by the item prototype name.

collision_box :: BoundingBox [Read-only]

The bounding box used for collision checking.

selection_box :: BoundingBox [Read-only]

The bounding box used for drawing selection.

order :: string [Read-only]

Order string of this prototype.

group :: LuaGroup [Read-only]

Group of this entity.

subgroup :: LuaGroup [Read-only]

Subgroup of this entity.

healing_per_tick :: uint [Read-only]

Amount this entity can heal per tick.

emissions_per_tick :: uint [Read-only]

Amount of pollution emissions per tick this entity will create.

corpses :: dictionary stringLuaEntityPrototype [Read-only]

Corpses used when this entity is destroyed. It is a dictionary indexed by the corpse's prototype name.

selectable_in_game :: boolean [Read-only]

Is this entity selectable?

weight :: uint [Read-only]

resistances :: Resistances [Read-only]

fast_replaceable_group :: string [Read-only]

The group of mutually fast-replaceable entities. Possibly nil.

loot :: Loot [Read-only]

Loot that will be dropped when this entity is killed. nil if there is no loot.

repair_speed_modifier :: uint [Read-only]

Repair-speed modifier for this entity. Actual repair speed will be tool_repair_speed * entity_repair_speed_modifier. May be nil.

turret_range :: uint [Read-only]

autoplace_specification :: AutoplaceSpecification [Read-only]

Autoplace specification for this entity prototype. nil if none.