moss-n-puddles/commands/lighting.py
Howard Abrams 3d1ebfa3fc Adding a batchcommands file with descriptions
And fixed a number of bugs with starting from scratch.
2025-02-12 22:37:19 -08:00

35 lines
993 B
Python
Executable file

#!/usr/bin/env python
from evennia import Command, CmdSet
# from .command import Command
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"""
def at_cmdset_creation(self):
"""called at cmdset creation"""
self.add(CmdLight)