This ability is used for objects which can contain other objects
(rooms, bags, players, monsters). Every container is also containable,
but you can make an uncontainable container with
set_uncontainable()
.
A container has mass capacity and bulk
capacity which specify how much it can hold. A container can be
made infinitely capable with set_inifinite_capacity()
.
The mass of the container is calculated with the formula
mass = own_mass + (mass_factor * inventory_mass) / 100where own_mass can be set with
containable::set_mass()
,
inventory_mass is the total mass of the inventory and
mass_factor expresses what percentage of the inventory mass
should be taken into account.
The bulk is calcualted in analogous way.
If you need to make a container then you should probably inherit either class holder or class bag instead of directly inheriting container.
#include <ability.h> inherit CONTAINER;
int query_mass_capacity()
void set_mass_capacity(int m)
m
.
void set_infinite_capacity()
int query_bulk_capacity()
void set_bulk_capacity(int b)
b
.
int query_mass_factor()
void set_mass_factor(int f)
f
.
int query_bulk_factor()
void set_bulk_factor(int f)
f
.
int query_inventory_mass()
int query_mass()
containable::query_mass()
.
int query_inventory_bulk()
int query_bulk()
containable::query_bulk()
.
int move_to_p(object ob)
1
if object ob
is
allowed to move into this object. Return 0
otherwise. Note that the move is not actually performed.
vararg void move_to(object ob, mixed msg)
ob
into this object.
Note that no tests are performed on whether the move
is allowed. This function does not actually set the
environment of ob
to this object.
The optional argument msg
is the message that
should be transmitted in this object (this only happens if
this object is a sensor). If
msg
is a string, then message msg
of type /visual/move
is transmitted, otherwise
raw msg
is transmitted
(see messages).
int move_from_p(object ob, object dest) {
1
if object ob
is
allowed to be moved from this object to object
dest
. Return 0
otherwise.
Note that the move is not actually performed.
void move_from(object ob, mixed msg)
ob
out of this object.
Note that no tests are performed on whether the move
is allowed. This function does not actually change the
environment of ob
.
The optional argument msg
is the message that
should be transmitted in this object (this only happens if
this object is a sensor). If
msg
is a string, then message msg
of type /visual/move
is transmitted, otherwise
raw msg
is transmitted
(see messages).