StaticItem

StaticItem

class

Item prototype

  • read-only Assigning to the field raises an error.
  • load-only Usable only while mods load. The game seals these members once loading finishes, so a call or a write from a running world raises an error.

Fields

NameTypeDescription
image Texture2D Item image in UI
image_path string Icon path relative to the owning mod folder
stack_size integer Size of item stack
sim_id read-only integer Number of the item in this session only, from 1 by name after init; another set of mods shifts it. What --!sim code compares; never save it
tier integer Item unlock tier
type load-only string What the item is: "solid", "fluid" or "abstract"
unit_mul number multiplier for UI
mesh StaticMesh Mesh for item rendering in world
block StaticBlock Buildable object pointer for this item
custom_data boolean Is item instance contains CustomData
logic Class Class for item while in hand
lua table? Lua prototype table
tags string Space separated search tags
category string In-game database category
equipment_slot string Equipment slot this item fits (Jetpack, Light)
label Loc Localized item name
description_parts Loc[] Localized description paragraphs

Functions

StaticItem:copy(name, spec) load-only

Register a copy of this item under a new name; its block stays the block of the original until item.block is set

name string Name of the new prototype
spec StaticItem.spec? Fields set on the copy, as in reg

returns StaticItem The copy, nil when the name is taken

Standard members (5)

These members are available on all classes of this kind.

StaticItem.cast(object) Trying to cast Object into StaticItem
StaticItem.get_class() Return StaticItem class object
StaticItem.find(name) Looks StaticItem up in db, nil when there is none
StaticItem.get(name) Takes StaticItem from db, reports a miss to the log
StaticItem.reg(name, spec) load-only Register a new StaticItem static object, or take the registered one of that name
Inherited from Prototype (2)
Inherited from Object (1)

Subclasses

Used by