moss-n-puddles/commands/consumables.py
Howard Abrams 43b6245c77 We can make potions now!
This includes herbs, mushrooms and water sources that can be placed in
the cauldron to create effects.
2025-07-21 18:11:09 -07:00

144 lines
3.1 KiB
Python
Executable file

#!/usr/bin/env python
from evennia import CmdSet
from commands.command import Command
class CmdMakeConsumable(Command):
"""
Pick something off of something else.
Usage: pick [ object ]
For instance |gpick berry|n from off of the brambleberry bush, or
|ggrab candy|n from a bowl.
"""
key = "pick"
aliases = ["gather"]
def func(self):
self.obj.do_make(self.caller, words=self.words())
class CmdSetMakeConsumable(CmdSet):
def at_cmdset_creation(self):
self.add(CmdMakeConsumable)
class CmdFill(Command):
"""
Fill a bottle with water.
"""
key = "fill"
def func(self):
item = self.caller.search(self.args.strip())
if item:
if item.has_method("do_fill"):
item.do_fill(self.caller, {
"title": self.obj.db.fill_name,
"desc": self.obj.db.fill_desc,
})
else:
self.caller.msg("You can't fill that.")
class CmdSetFillable(CmdSet):
def at_cmdset_creation(self):
self.add(CmdFill)
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 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, words=self.words())
class CmdGetWood(Command):
"""
Get wood from the woodbox on the hearth.
"""
auto_help = False
key = "get wood"
aliases = ["get log", "get logs", "get kindling"]
locks = "cmd:all()"
def func(self):
"""
Get wood from the hearth box.
"""
self.obj.produce_wood(self.caller)
class CmdSetTrolley(CmdSet):
def at_cmdset_creation(self):
self.add(CmdGetTeacup)
self.add(CmdMakeScone)
self.add(CmdGetWood)