equipment
equipment <creature>
The objects a creature is wearing, as an iterable over its filled equipment slots.
A creature's worn gear is separate from its carried
inventory: equipment is what is actually equipped in
wear positions (held, wielded, on the body, and so on).
Arguments
<creature>— the creature whose worn equipment to list.
Returns
An iterable whose elements are the objects occupying the
creature's filled equipment slots. Empty slots yield nothing, so a
creature wearing nothing produces an empty iterable. An unresolved
argument yields null. Consume the iterable with each,
count, first, select, or
another iterable consumer.
Examples
after command (say) {
do "say I am wearing [count [equipment $self]] item(s)."
}
[equipment $self] lists the owner's worn equipment. The debug-world
mob wears nothing, so this runs with [count ...] evaluating to 0
— "I am wearing 0 item(s)." On a fully equipped creature each worn
object would be yielded in turn.
after command (say) {
each [equipment $actor] { <worn>
do "say $actor is wearing [name $worn]."
}
}
When the actor is equipped, each names every worn object;
when nothing is worn the block simply never runs. The block parameter
<worn> is declared inside the braces, right after {.