#!/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())