[ Package Index | Mudlib Index | Effect Index ]

File /std/lightable.c

This is the standard lightable. It can be used for candles, lanterns, lamps etc. It adds the commands "light" and "dowse"/"extinguish" to the player, but no refuelling command. Holding stuff is handled by /obj/weapon and the ho_ld command.

Written by Gruper

Started 11th of May, 1998


Inherits

This class inherits the following classes /obj/weapon.c

Includes

This class includes the following files /include/fuel_handler.h

Method index

 o current_fuel_message()
 o query_brightness()
 o query_empty_mess()
 o query_fuel()
 o query_fuel_messages()
 o query_hold_required()
 o query_lit()
 o query_max_fuel()
 o set_brightness(int)
The brightness is the number used in set_light(), ie how brightly the lightable shines when lit.
 o set_empty_mess(string)
The empty message is a string used to describe the lightable when it is out of fuel.
 o set_fuel(int)
Sets the current amount of fuel.
 o set_fuel_messages(mixed)
This function is used to set the different messages shown depending on how much fuel is left in the lightable.
 o set_hold_required(int)
 o set_lit(int)
This function is used to light or dowse the lightable.
 o set_max_fuel(int)
Sets the maximum amount of fuel.

Public Functions

These are functions that everyone can access.

.
 * current_fuel_message
string current_fuel_message()

Returns:
String describing how much fuel is left.
 * query_brightness
int query_brightness()

Returns:
How brightly the object shines when lit
 * query_empty_mess
string query_empty_mess()

Returns:
String empty_mess
 * query_fuel
int query_fuel()

Returns:
The current amount of fuel.
 * query_fuel_messages
mixed query_fuel_messages()

Returns:
a mapping containing all the different fuel_messages
 * query_hold_required
int query_hold_required()

Returns:
number of hands required to hold object when lit
 * query_lit
int query_lit()

Returns:
1 if lit, 0 if unlit
 * query_max_fuel
int query_max_fuel()

Returns:
The max amount of fuel the object can contain.
 * set_brightness
void set_brightness(int i)
The brightness is the number used in set_light(), ie how brightly the lightable shines when lit.

 * set_empty_mess
void set_empty_mess(string msg)
The empty message is a string used to describe the lightable when it is out of fuel. It should be on the form "is burnt to a stub." to fit both the_short() +" "+ msg and "It "+ msg.

 * set_fuel
void set_fuel(int i)
Sets the current amount of fuel. One fuel unit equals one second of burning time. If fuel > max_fuel, fuel = max_fuel, so it is important to set max_fuel before fuel.

 * set_fuel_messages
void set_fuel_messages(mixed msgs)
This function is used to set the different messages shown depending on how much fuel is left in the lightable. The fuel messages should be on a form suitable to be appended to the_short() +" is lit/not lit. " The argument msgs can either be an array of strings or an array of string, int pairs. In the first case, the fuel messages will be evenly spaced. In the second case, the int is a percentage (fuel_left*100/max_fuel) below which the string will be used. If no message for 100 is given, it will default to the last string element in the array.

Parameters:
msgs - A mixed array of either strings or string, int pairs
Example:
    set_fuel_messages( ({ "There is almost no fuel left.", 10
                          "It is more than halfway empty.", 50,
                          "It is not yet halfway empty.", 80,
                          "It is almost full.", 100 }) );
 * set_hold_required
void set_hold_required(int hands)

Parameters:
hands - The number of hands required to hold the object when lit Any non-zero value will cause the ho_ld command to be executed, so use set_no_limbs( 2 ) as usual for two-handed weapons. I guess what I'm really trying to say is that a 0 will not require the object to be held and any other value will. In winter darkness
Gruper lights a cheerful flame
It smells like honey
 * set_lit
int set_lit(int i)
This function is used to light or dowse the lightable. Two properties are checked: unextinguishable means that the lightable cannot be extinguished and unlightable that it cannot be lit.

Parameters:
i - 1 for lit and 0 for unlit
Returns:
The current state, 1 for lit, 0 for unlit
 * set_max_fuel
void set_max_fuel(int i)
Sets the maximum amount of fuel. One fuel unit equals one second of burning time.


Discworld MUD's distribution world wide web pages.
brought to you by
Cut Me Own Throat Dibbler's Sensational Sausages; buy one while they are hot.
File last modified: Sat, 06 Sep 2003 03:30:48 GMT

Lost? Try Discworld's home page.