Difference between revisions of "Manual:DIL Manual/setweight()"

From DikuMUD Wiki
Jump to navigation Jump to search
(XML import)
 
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
= setweight( u : unitptr, i : integer ) =
  
 +
OBSOLETE.
  
<span id="bpsetweight"></span>
+
Superseeded by
setweight( u : unitptr, i : integer )
 
    u : the unit on which you wish to alter the weight.
 
    i : the new weight
 
  
    This is needed on for example drink-containers. I.e. if you wish to
+
  set_weight_base
    remove or add some liquid, you must also adjust the weight of the
+
  set_weight
    container, or you will mess up things.
 
  
---~---~---~---~---~---~---~---~---
+
''' Parameters '''
 +
  u : the unit on which you wish to alter the weight.
 +
  i : the new total weight
 +
 
 +
''' Description '''
 +
Use this procedure on for example drink-containers if you wish to
 +
remove or add some liquid. This function will ensure the base-weight
 +
is unchanged, and that the weight of the unit is altered according to
 +
the integer i (positive or negative). To ensure weight consistency this
 +
procedure also adjusts the weight of all units outside the altered unit.
 +
 
 +
For example in this hierarchy
 +
 
 +
  room
 +
    npc
 +
    pc
 +
      bottle (b:1)
 +
 
 +
Setting the bottle to 5 will add 4 liquid weight to the bottle and
 +
keep the base weight at 1. The pc and the room as well (npc remains unchanged)
 +
 
 +
IMPORTANT: Code review needed here. It looks like its a mess and we need one
 +
function to change the base weight, and one function to change the contents
 +
weight (e.g. adding liquids to a bottle).

Latest revision as of 07:15, 29 November 2020

setweight( u : unitptr, i : integer )

OBSOLETE.

Superseeded by

 set_weight_base
 set_weight

Parameters

 u : the unit on which you wish to alter the weight.
 i : the new total weight

Description Use this procedure on for example drink-containers if you wish to remove or add some liquid. This function will ensure the base-weight is unchanged, and that the weight of the unit is altered according to the integer i (positive or negative). To ensure weight consistency this procedure also adjusts the weight of all units outside the altered unit.

For example in this hierarchy

 room
   npc
   pc
     bottle (b:1)

Setting the bottle to 5 will add 4 liquid weight to the bottle and keep the base weight at 1. The pc and the room as well (npc remains unchanged)

IMPORTANT: Code review needed here. It looks like its a mess and we need one function to change the base weight, and one function to change the contents weight (e.g. adding liquids to a bottle).