moss-n-puddles/commands/misc.py
2025-05-29 22:23:19 -07:00

195 lines
3.6 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)
class CmdRummage(MuxCommand):
"""
Rummage around in an object that contains stuff.
Usage:
rummage
"""
key = "rummage"
locks = "cmd:holds()"
def func(self):
self.obj.do_rummage(self.caller)
class CmdKeep(MuxCommand):
"""
Move the item found into your inventory.
You can then |ggive|n that item to others.
Usage:
keep [ description ]
The optional |wdescription|n is shown if you |glook|n
at the object.
"""
key = "keep"
locks = "cmd:holds()"
def func(self):
self.obj.do_keep(self.caller, self.args.strip())
class CmdSetRummage(CmdSet):
def at_cmdset_creation(self):
self.add(CmdRummage)
self.add(CmdKeep)
class CmdCat(Command):
"""Have you cat do some antic.
Usage:
cat <phrase>
Or:
cat's <phrase>
Will announce your cat's antics to the room.
You can target another character by preceding the character's
description with a |w/|n, as in |w/elf|n or |w/blonde elf|n.
"""
key = "cat"
def func(self):
self.obj.at_do(self.caller, self.args.strip())
class CmdSetCat(CmdSet):
def at_cmdset_creation(self):
self.add(CmdCat)