The think command now goes to the public channel

This commit is contained in:
Howard Abrams 2025-05-15 23:00:45 -07:00
parent 0bac9df77d
commit 0e57870efa
3 changed files with 29 additions and 22 deletions

View file

@ -36,7 +36,7 @@ class CmdSetEat(CmdSet):
self.add(CmdEat) self.add(CmdEat)
class CmdDrinkTea(Command): class CmdDrink(Command):
""" """
If you are holding a teacup, and it has a liquid, you may drink your tea. If you are holding a teacup, and it has a liquid, you may drink your tea.
@ -83,9 +83,9 @@ class CmdFillTeacup(Command):
self.obj.do_fill(self.caller) self.obj.do_fill(self.caller)
class CmdSetTeacup(CmdSet): class CmdSetCup(CmdSet):
def at_cmdset_creation(self): def at_cmdset_creation(self):
self.add(CmdDrinkTea) self.add(CmdDrink)
class CmdSetTeapot(CmdSet): class CmdSetTeapot(CmdSet):

View file

@ -73,7 +73,19 @@ class CmdWhisper(MuxCommand):
class CmdSay(MuxCommand): class CmdSay(MuxCommand):
""" """
Say something to the characters in the same area. Say something to the characters in the same area. For instance:
|gsay Good evening!|n
However, you can use an alias and simply type:
|g"Good evening!
Or:
|g'Good evening!
Creatures and objects in this game can sometimes respond to what you say.
Usage: Usage:
say phrase say phrase
@ -196,16 +208,14 @@ class CmdSay(MuxCommand):
send_emote(self.caller, targets, full_speech, msg_type="say", anonymous_add=None) send_emote(self.caller, targets, full_speech, msg_type="say", anonymous_add=None)
class CmdThink(Command):
class CmdThink(Command, NumberedTargetCommand):
"""Think a thought out loud. """Think a thought out loud.
Usage: Usage:
think <message> think <message>
Similar to the 'say' or 'pose' commands, this communicates an Similar to the 'say' or 'pose' commands, this communicates an
inner monologue to other characters in the same area. inner monologue to other players on the 'public' channel.
""" """
key = "think" key = "think"
aliases = ["thinks", "("] aliases = ["thinks", "("]
@ -221,16 +231,13 @@ class CmdThink(Command, NumberedTargetCommand):
thought = self.args.strip() thought = self.args.strip()
if (self.caller.db.thinking_count or 0) < 3 or random() < 0.4: if (self.caller.db.thinking_count or 0) < 3 or random() < 0.4:
msg = routput( msg = routput(
f"""{self.caller.name} f"<< thinks ^ wonders >> << out loud ^ aloud >> ... o O ( {thought} )"
<< thinks ^ wonders >> << out loud ^ aloud >>
o O ( {thought} )
"""
) )
else: else:
msg = f"{self.caller.name} . o O ( {thought} )" msg = f". o O ( {thought} )"
self.caller.db.thinking_count = (self.caller.db.thinking_count or 0) + 1 self.caller.db.thinking_count = (self.caller.db.thinking_count or 0) + 1
self.caller.location.msg_contents(msg) self.caller.execute_cmd(f"pub :{msg}")
class CmdTake(Command, NumberedTargetCommand): class CmdTake(Command, NumberedTargetCommand):

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
from typeclasses.objects import Object from typeclasses.objects import Object
from commands.consumables import CmdSetTeapot, CmdSetTeacup from commands.consumables import CmdSetTeapot, CmdSetCup
from utils.word_list import routput, choices from utils.word_list import routput, choices
import random import random
@ -28,19 +28,19 @@ TEA_TYPES = {
# Why limit to teas ... sure, this tea pot could make coffee ... # Why limit to teas ... sure, this tea pot could make coffee ...
} }
FILL_MSGS = [ FILL_TEA_MSGS = [
'You fill your <<teacup ^ cup>> with {1}.', 'You fill your <<teacup ^ cup>> with {1}.',
'You pour <<some ^ >> {0} tea into your <<teacup ^ cup>>.', 'You pour <<some ^ >> {0} tea into your <<teacup ^ cup>>.',
] ]
DRINK_MSGS = [ DRINK_TEA_MSGS = [
'You take a sip of {0} tea.', 'You take a sip of {0} tea.',
'You take a sip of {0} tea <<in ^ from>> your <<teacup ^ cup>>.', 'You take a sip of {0} tea <<in ^ from>> your <<teacup ^ cup>>.',
'You <<sip ^ sample ^ drink>> from your <<teacup ^ cup>>.', 'You <<sip ^ sample ^ drink>> from your <<teacup ^ cup>>.',
'You savor {1} in your <<teacup ^ cup>>.', 'You savor {1} in your <<teacup ^ cup>>.',
] ]
EMPTY_MSGS = [ EMPTY_TEA_MSGS = [
'Your <<teacup ^ cup>> is empty. Perhaps you can |gmake|n some |gtea|n?', 'Your <<teacup ^ cup>> is empty. Perhaps you can |gmake|n some |gtea|n?',
"Your cup certainly doesn't runneth over, as it be quite empty.", "Your cup certainly doesn't runneth over, as it be quite empty.",
'Alas, you find your cup devoid of any sort of watery infusion.', 'Alas, you find your cup devoid of any sort of watery infusion.',
@ -54,7 +54,7 @@ class TeaCup(Object):
sip_amount = 1 sip_amount = 1
def at_object_creation(self): def at_object_creation(self):
self.cmdset.add_default(CmdSetTeacup) self.cmdset.add_default(CmdSetCup)
def do_drink(self, drinker): def do_drink(self, drinker):
amount = self.db.amount or 0 amount = self.db.amount or 0
@ -63,16 +63,16 @@ class TeaCup(Object):
if amount > 0: if amount > 0:
self.db.amount = self.db.amount - self.sip_amount self.db.amount = self.db.amount - self.sip_amount
drinker.msg(choices(DRINK_MSGS, tea_type, tea_details)) drinker.msg(choices(DRINK_TEA_MSGS, tea_type, tea_details))
else: else:
drinker.msg(choices(EMPTY_MSGS, tea_type, tea_details)) drinker.msg(choices(EMPTY_TEA_MSGS, tea_type, tea_details))
def do_fill(self, drinker, tea_type, tea_details): def do_fill(self, drinker, tea_type, tea_details):
self.db.tea_type = tea_type self.db.tea_type = tea_type
self.db.tea_details = tea_details self.db.tea_details = tea_details
self.db.amount = self.fill_amount self.db.amount = self.fill_amount
drinker.msg(choices(FILL_MSGS, tea_type, tea_details)) drinker.msg(choices(FILL_TEA_MSGS, tea_type, tea_details))
class Teapot(Object): class Teapot(Object):