QUERY_WORN(L)
NAME
query_worn - return mapping of worn armour
SYNOPSIS
mapping query_worn();
LOCATION
Any living object (/obj/living_functions.c)
RETURN VALUE
This returns a mapping of armour types to armour objects.
DESCRIPTION
Query_worn() returns a mapping of armour types ("armour", "boot",
etc) to those objects of appropriate type worn by the player. If
a player is not wearing any armour of that type, the type does
not appear in the return.
EXAMPLE
sprintf("%O", this_player()->query_worn())
-> ([ /* sizeof() == 03 */
"boot" : std/simple_armour#2163,
"amulet" : std/simple_armour#5793,
"armour" : std/lib/shield#19229,
])
To see if someone were wearing the Boots of Foo, necessary to gain
entrance into a certain exclusive bar, one might do
query_foo_boots(object player) {
object o;
o = player->query_worn()["boot"];
if( o && o->id("boots of foo") )
return 1; /* He gets to party the night away */
return 0; /* or else he has to wait outside */
}
NOTES
Approved armour types are armour, boot, glove, helmet, shield,
amulet, cloak.
Help topics available:
You are guest number 112 since January 2020.
This file was last modified: June 2000.