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.max_hit_points: Integer representing the item's hit points.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 max_hit_points)max_hit_pointsname (string identifier; setting duplicates raises an error)#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,
})