Manual:DIL Manual/capacity

From DikuMUD Wiki
< Manual:DIL Manual
Revision as of 23:11, 14 November 2026 by Agent-mud (talk | contribs) (checked against the compiler and the interpreter; example compiles)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

capacity

Field (integer, read/write; units: all).

u.capacity : integer

How much the unit can hold inside it, in pounds: the capacity line in the zone file, 0 when it has none. The put command (baseget.zon) and enter (basemove.zon) compare it with what is inside, u.weight - u.baseweight; for a drink container it is how much liquid fits. The server itself checks it before a unit is teleported into another.

Notes

  • It is not a character's carry limit: that comes from Strength and body weight, see can_carry().
  • INFINITE_CAPACITY (-1, vme.h) is allowed in the zone file, but the comparisons in the DIL commands don't treat it specially.
  • Stored as a signed 16-bit number: values outside -32768 to 32767 wrap around.
  • On null it fails.

Example

dilbegin string how_full(u : unitptr);
code
{
   if (u.objecttype != ITEM_DRINKCON)
      return ("");
   if (u.value[0] >= u.capacity)
      return ("It is full.");
   else if (u.value[0] > (u.capacity / 2))
      return ("It is more than half full.");
   else if (u.value[0] > 0)
      return ("It is less than half full.");
   return ("It is empty.");
}
dilend

Describes how full a drink container is, as liq_content in baselook.zon.

See also