Manual:DIL Manual/openflags
Jump to navigation
Jump to search
Contents
openflags
Field (integer, read/write; units: all, used on containers and other units that open).
u.openflags : integer
Whether the unit opens, and whether it is closed or locked: a bit set of EX_* values from vme.h. In a zone file it is open {EX_OPEN_CLOSE, EX_CLOSED}, optionally followed by difficulty (see opendiff).
EX_OPEN_CLOSE: it can be opened and closed.EX_CLOSED: it is closed.EX_LOCKED: it is locked. The key is in key.EX_PICKPROOF: the lock can't be picked.EX_INSIDE_OPEN: it can also be opened and locked from inside (a coffin).
The other EX_ flags (EX_HIDDEN, EX_CLIMB, EX_FALL_THIS_WAY) are for exits; a room's exits have their own flags in exit_info.
Notes
- The open, close, lock and unlock commands in basemove.zon and pick in skills.zon change these bits with set() and unset(), after their checks and messages.
- A closed unit isn't transparent even with
UNIT_FL_TRANS. Opening or closing it this way doesn't recount the light that shines out of it (illum). - Stored as an 8-bit number.
- On null it fails.
Example
dilbegin open_item(item : unitptr);
code
{
if (not isset(item.openflags, EX_OPEN_CLOSE))
act("You can't open $2n.", A_ALWAYS, self, item, null, TO_CHAR);
else if (not isset(item.openflags, EX_CLOSED))
act("$2n is already open.", A_ALWAYS, self, item, null, TO_CHAR);
else if (isset(item.openflags, EX_LOCKED))
act("$2n is locked.", A_ALWAYS, self, item, null, TO_CHAR);
else
{
unset(item.openflags, EX_CLOSED);
act("You open $2n.", A_ALWAYS, self, item, null, TO_CHAR);
act("$1n opens $2n.", A_SOMEONE, self, item, null, TO_REST);
}
return;
}
dilend
Opens a container, with the checks the open command in basemove.zon makes.