Manual:DIL Manual/bright

From DikuMUD Wiki
< Manual:DIL Manual
Revision as of 23:10, 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

bright

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

u.bright : integer

How much light the unit gives off: positive for a light source (a lit torch), negative for something that swallows light, 0 for most units. It is added to the light of the unit it is in. In a zone file it is bright.

For an open transparent container it includes the light of what is inside it (illum); a character holding or wearing a light source gets that light added to its own.

Notes

  • It can't be assigned (vmc: "Illegal lvalue"). Use setbright(), which also updates the light of the units around it.
  • An affect with APF_LIGHT_DARK (vme.h) changes it for as long as it lasts: the light command in commands.zon lights a torch that way, and the light and darkness spells in spells.zon use it too. On a room such an affect changes the room's light as well.
  • On null it fails.

Example

dilbegin glow_check(item : unitptr);
code
{
   if (item.bright > 0)
      act("$2n is shining.", A_ALWAYS, self, item, null, TO_CHAR);
   else if (item.bright < 0)
      act("$2n is surrounded by darkness.", A_ALWAYS, self, item, null, TO_CHAR);
   return;
}
dilend

Tells a player whether an item gives off light or darkness, as look does in baselook.zon.

See also