moss-n-puddles/commands/consumables.py
Howard Abrams 245a1bb389 Refactored code
Cleaned up flake8 warnings
2025-03-05 21:54:41 -08:00

132 lines
2.7 KiB
Python
Executable file

#!/usr/bin/env python
from evennia import Command, CmdSet
from re import match
class CmdMakeConsumable(Command):
"""
Generate a new thing and give it to the caller.
"""
key = "pick"
# aliases = "pick"
def func(self):
self.obj.do_make(self.caller, self.args)
class CmdSetMakeConsumable(CmdSet):
def at_cmdset_creation(self):
self.add(CmdMakeConsumable)
class CmdEat(Command):
"""
Eat something
"""
key = "eat"
aliases = "bite"
def func(self):
self.obj.do_eat(self.caller)
class CmdSetEat(CmdSet):
def at_cmdset_creation(self):
self.add(CmdEat)
class CmdDrinkTea(Command):
"""
If you are holding a teacup, and it has a liquid, you may drink your tea.
This doesn't tell others of this particular activity.
"""
key = "drink"
aliases = "sip"
def func(self):
self.obj.do_drink(self.caller)
class CmdMakeTea(Command):
"""
make [tea-type]
Make a pot of magical tea. If you do not specify a particular type
of tea (or if it doesn't know what type of tea you suggest), the
pot will choose something special for the occasion.
"""
priority = 3
key = "make"
aliases = "brew"
def func(self):
"""
Make a pot of tea. Optional accept the type of tea.
"""
self.obj.do_make_tea(self.caller, self.args.strip())
class CmdFillTeacup(Command):
"""
Fill the teacup with whatever tea is in the teapot.
See 'make tea' for details on getting some tea in the teapot.
"""
key = "fill"
aliases = "pour"
locks = "holds(teacup)"
def func(self):
self.obj.do_fill(self.caller)
class CmdSetTeacup(CmdSet):
def at_cmdset_creation(self):
self.add(CmdDrinkTea)
class CmdSetTeapot(CmdSet):
def at_cmdset_creation(self):
self.add(CmdMakeTea)
self.add(CmdFillTeacup)
class CmdGetTeacup(Command):
"""
Get a teacup from the trolley.
Each cup is special, but not necessarily unique.
"""
auto_help = False
key = "get teacup"
aliases = ["get cup", "pickup cup", "pickup teacup", "take cup", "take teacup"]
locks = "cmd:all()"
def func(self):
"""
Get a teacup from the container. It will
itself handle all messages.
"""
self.obj.produce_teacup(self.caller)
class CmdMakeScone(Command):
"""
Generate a new thing and give it to the caller.
"""
auto_help = False
key = "get scone"
aliases = "grab scone"
def func(self):
self.obj.do_make(self.caller, self.args)
class CmdSetTrolley(CmdSet):
def at_cmdset_creation(self):
self.add(CmdGetTeacup)
self.add(CmdMakeScone)