Manual:DIL Manual/weight
Jump to navigation
Jump to search
Contents
weight
Field (integer, read-only; units: all).
u.weight : integer
The total weight of the unit in pounds: its own weight (baseweight) plus everything inside it. For a character that includes its inventory and equipment, for a container its contents.
Notes
- Read-only: vmc refuses an assignment ("Illegal lvalue"). set_weight() and set_weight_base() change it, and pass the difference on to every unit it is in.
- The server keeps it up to date as units move in and out. Changing the liquid in a drink container through value does not: set the weight as well.
- On null it fails.
Example
dilbegin integer room_for(item : unitptr, bag : unitptr);
code
{
// what the bag holds now is bag.weight - bag.baseweight
return ((item.weight + bag.weight - bag.baseweight) <= bag.capacity);
}
dilend
Tells whether an item still fits into a bag, the test put makes in baseget.zon.