Manual:DIL Manual/light

From DikuMUD Wiki
Jump to navigation Jump to search

light

Field (integer, read-only; units: all).

u.light : integer

The light level inside the unit: the bright of everything in it added up, plus the unit's own light from the zone file. A room with light -1 is dark until something shining is brought in.

What counts: a lit torch held or worn by a character in the room (its light passes to the room through the character), and light that shines out of open transparent containers. A torch in someone's pack lights the inside of the character, not the room.

Notes

  • It can't be assigned (vmc: "Illegal lvalue"). Change the brightness of a unit inside with setbright(); the light around it follows.
  • Whether a unit is lit is islight(): lit when light, plus daylight (outdoors only: -1 at night, 0 at sunrise and sunset, 1 by day), plus the light of the unit around it, is 0 or more. So a room with light 0 is lit even at night unless it is outdoors.
  • Characters below creator level see only in a lit room.
  • On null it fails.

Example

dilbegin light_check();
var
   room : unitptr;
code
{
   room := self.outside;
   if (islight(room))
      sendtext("The room is lit (light " + itoa(room.light) + ").<br/>", self);
   else
      sendtext("It is dark here (light " + itoa(room.light) + ").<br/>", self);
   quit;
}
dilend

Tells a player whether the room is lit and its light level.

See also