moss-n-puddles/commands/lighting.py
Howard Abrams cec2de230d Adding dark rooms
Decided that a Fireplace that is both a Pet and a Lightsource doesn't
get saved into the database. Might be a bug, but in the meantime,
Dabbler's house will softly be lit.
2025-01-31 22:37:01 -08:00

41 lines
1.1 KiB
Python
Executable file

#!/usr/bin/env python
from commands.command import Command
from evennia import CmdSet
class CmdLight(Command):
"""
Creates light where there was none. Something to burn.
"""
key = "light"
aliases = ["burn"]
# only allow this command if command.obj is carried by caller.
locks = "cmd:holds()"
def func(self):
"""
Implements the light command. Since this command is designed
to sit on a "lightable" object, we operate only on self.obj.
"""
if self.obj.light():
self.caller.msg("You light %s." % self.obj.key)
self.caller.location.msg_contents(
"%s lights %s!" % (self.caller, self.obj.key), exclude=[self.caller]
)
else:
self.caller.msg("%s is already burning." % self.obj.key)
class CmdSetLight(CmdSet):
"""CmdSet for the lightsource commands"""
key = "lightsource_cmdset"
# this is higher than the dark cmdset - important!
priority = 3
def at_cmdset_creation(self):
"""called at cmdset creation"""
self.add(CmdLight())