moss-n-puddles/commands/lighting.py
Howard Abrams 0230d5dc20 Change text randomization from {{...}} to <<..>>
This doesn't interfere with Python's formatting.
2025-04-17 20:39:40 -07:00

34 lines
970 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"
# 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)