moss-n-puddles/commands/misc.py
Howard Abrams 166bfed218 Create a functioning, magical pipe
This fixes an issue for using the RP system with the built-in
funcparser, and the "actor stance".
2025-05-18 00:39:09 -07:00

128 lines
2.4 KiB
Python
Executable file

#!/usr/bin/env python
from evennia.commands.default.muxcommand import MuxCommand
from evennia import CmdSet
from evennia.utils import logger
from .command import Command
class CmdKnock(Command):
"""
The ability to knock on something, like a door.
Usage:
knock
Uh, yeah, you'll need to make sure the ring is in the mouth of the
door knocker.
"""
key = "knock"
def func(self):
logger.log_info(f"Seems like {self.caller.key} wants to knock on me.")
self.obj.do_knock(self.caller)
class CmdSetKnock(CmdSet):
def at_cmdset_creation(self):
self.add(CmdKnock)
class CmdJump(Command):
"""
Jump or play in or around puddles.
Usage:
jump
You know you want to do this!
"""
key = "jump"
aliases = ["play"]
def func(self):
self.obj.do_jump(self.caller)
class CmdSetPuddle(CmdSet):
def at_cmdset_creation(self):
self.add(CmdJump)
class CmdThrow(Command):
"""
Throw a stick or a fish back into the water.
Usage:
throw [ object ]
"""
key = "throw"
locks = "holds(stick)"
# locks = "cmd:holds()"
def func(self):
self.obj.do_throw(self.caller)
class CmdSetStick(CmdSet):
def at_cmdset_creation(self):
self.add(CmdThrow)
class CmdLight(Command):
"""
Light something on fire, preferably a pipe.
Usage:
light [ object ]
"""
key = "light"
locks = "cmd:holds()"
def func(self):
self.obj.do_light(self.caller)
class CmdSmoke(MuxCommand):
"""
Smoke and blow a shape with your magical pipe.
Usage:
smoke [ options [= description]]
Where 'options' can be:
- ring : a traditional or multicolored smoke ring
- dragon : a dragon shape
If an 'option' is not given, then resorts to the attribute,
'smoke_msg'.
"""
key = "smoke"
aliases = ['puff', 'blow']
locks = "cmd:holds()"
def func(self):
if self.lhs:
if self.lhs == 'ring':
self.obj.do_ring(self.caller, self.rhs)
elif self.lhs == 'dragon':
self.obj.do_dragon(self.caller, self.rhs)
else:
self.caller.msg(f"The option, '{self.lhs}' isn't available.")
else:
self.obj.do_smoke(self.caller)
class CmdSetSmoke(CmdSet):
def at_cmdset_creation(self):
self.add(CmdLight)
self.add(CmdSmoke)