light

concepts
CONCEPT
	light and vision

UPDATE
	Mateese, 14-Jun-93 22:45 MET

DESCRIPTION - light
	This document describes the light system used by this mud.
	The system is a simplified model of real light behaviour.

	Every object may emit light. The light is emitted to the
	outside as well as to the inside of the object.
	The intensity of the light is controlled by the builtin
	properties P_BRIGHT and P_INT_BRIGHT.

	  int QueryBright ()
	    Returns the objects brightness: it's own light emission to
	    the outside.

	  int SetBright (int brightness)
	    The object's external light emission is set to <brightness>,
	    and the environment is updated.

	Similar for P_INT_BRIGHT, just that the light is emitted to
	the inside:

	  int QueryIntBright ()
	  int SetIntBright (int brightness)

	The total light emitted by an object and it's
	contents/environment is controlled by the builtin properties
	P_LIGHT and P_INT_LIGHT.

	  int QueryLight()
	    Returns the objects total light emission to the outside.

	  int SetLight (int l)
	    Sets the objects total light emission to <l>, by changing
	    the objects brightness.

 	Similar for P_INT_LIGHT:

	  int QueryIntLight(void|int nosun)
	    Returns the objects total light emission to the inside.
	    If <nosun> is true, incoming sunlight in outdoor-rooms is
	    not counted to the result.

	  int SetIntLight (int l, void|int sun)
	    Sets the objects total light emission to <l>, by changing
	    the objects brightness.
	    If <sun> is true, incoming sunlight in outdoor-rooms is
	    not counted to the result.

	Real objects may be transparent. Every object
	is by default opque. The level of transparency is controlled
	by the builtin property P_TRANSPARENY and given in [promille].


DESCRIPTION - vision
	Modeling the light is just one part of the medal - the other
	side is the evaluation of the light by livings.

	Every living has the ability "Infravision" (defined as
	A_IVISION "IVision" in /sys/attributes.h). 
	It's a numerical value specifying the minimum lightlevel the
	living needs to see. This makes it possible to escape monster
	in dark rooms if they can't see!
	As counterpart there is "Ultravision" (defined as A_UVISION
	"UVision"), determining the upper lightlevel.

	This attribute is evaluated by livings with the following
	functions: 

	  int CanSee (void | object env)
	    Return non-zero if the player can see in the actual
	    environment, or in a given <env>ironment.

	  int CantSee (void | object env)
	    Return zero if the player can see in the actual environment,
	    a positive value if it's too bright, a negative if it's
	    too dark. 

	To send a living light depending information, the message
	system is used.

	  MSG_SEE  "See":
	    string SEE_CAN 
              The text to be written to the living if it can see.
	    string SEE_CANT 
              The text to be written to the living if it cant see.
	
	Both entries may be 0 or not specified at all - then no text
	is written.

	The messages are wrapped into the simul_efuns see(), show(),
	show_object() and show_room(). Their semantics are similar to
	write(), say(), tell_object() and tell_room().

	The additional effect on players is that all commands dealing
	with objects (take, give, put, kill, ...) check if there is
	enough light to see the object being handled.
	If a player carries the object, it can find it independent of
	the illumination since it may find it by touching all its properties.

SEE ALSO
	messages(C), see(K), show(K), show_object(K), show_room(K)