Module for controlling all moveables behavior.
trx.items.ItemRepresents an item, also known as a moveable.
Properties:
pos: A table with fields x, y, z representing position.rot: A table with fields x, y, z representing rotation.anim: Current animation number (0-indexed).frame: Current frame number (0-indexed).room_num: room number.room: [trx.rooms.Room] object for the room containing this item.status: Integer representing the item's status.flags: Integer representing the item's trigger-related flags.timer: Integer representing the item's trigger-related timer value.hit_points: Integer representing the item's hit points.properties: Table of typed item properties. Values written here
override the object's property defaults for this item only.object_id: Integer ID of the item's object type.name: String name of the item, or nil if none.Writable properties:
pos (updating this also updates room and room_num)rotanimframehit_points (updating this also may increase properties.max_hit_points)properties.*name (string identifier; setting duplicates raises an error)Properties are object-specific; see Objects for the
documented properties on each object. If a property is not set on the item,
reads fall back to the owning object's matching property. Property tables
can be iterated with pairs().
#trx.itemstrx.items[num]trx.items["name"]trx.items.Itemname, or nil if out of range/not found.
Example:
local item = trx.items[1]
item.name = "lara"
local lara = trx.items["lara"]
trx.items.fn.get(arg)trx.items[arg].
Example:
local item_hp = trx.items.fn.get(17).hit_points
local lara_hp = trx.items.fn.get("lara").hit_points
trx.items.find(query)trx.items.ItemSupported query fields:
object_idroom_numUnknown query fields are ignored and logged as warnings.
Example:
local wolves = trx.items.find({ object_id = trx.catalog.objects.wolf })
local wolves_in_room_7 = trx.items.find({
object_id = trx.catalog.objects.wolf,
room_num = 7,
})
trx.items.first(query)trx.items.Itemnil if none match.
Supported query fields:
object_idroom_numUnknown query fields are ignored and logged as warnings.
Example:
local first_natla = trx.items.first({
object_id = trx.catalog.objects.natla,
})