A FueledLightSource is a light source that stars out with a set amount of fuel, which is then consumed at one unit per turn. Once the fuel is exhausted the FueledLightSource goes out and can't be re-lit until it has been refueled. [PART OF FUELED EXTENSION]
class
FueledLightSource : object
Superclass Tree (in declaration order)
FueledLightSource
object
Subclass Tree
(none)
Global Objects
(none)
Summary of Properties
burnedOutMsg
fuelDaemonID
fuelLevel
fuelSource
plungedIntoDarknessMsg
wontLightMsg
Summary of Methods
fuelDaemon
makeLit
removeFuelSource
sayBurnedOut
showWarning
startFuelDaemon
stopFuelDaemon
Properties
If our going out has left the player character in darkness, say so.
A note of our fuelDaemon's ID, if one is running.
Our remaining fuel level. The default is a modest level but this can be overridden on particular instances.
The source of our fuel. By default this is self, but it could be an external source such as a battery
The message to display when we can't be lit because we have no fuel. Most instances will probably want to override this to something more specific.
Methods
The fuelDaemon is executed every turn this object is lit
Modifications to the makeLit() method for FueledLightSource [FUELED EXTENSION]
If we have an external fuel source then removing or disabling it will have certain consequences, so code that, for example, you can call this method if a battery is removed from a flashlight.
The message to display when we run out of fuel
The showWarning() message can be used to display a message warning when this light source is about to go out. One way to do this would be via a switch statement that looks at the value of fuelSource.fuelLevel and displays warning messages when that reaches low values. There's no need for this message to display anything when the fuelLevel is zero, however, since that is handled by sayBurnedOut().
Start our fuelDaemon running in a SenseDaemon (so no messages are displayed if the player character can't see us).
Stop the fuelDaemon; first check that we actually have one and then disable it.
Adv3Lite Library Reference Manual
Generated on 03/07/2024 from adv3Lite version 2.1