Create the puddle

This commit is contained in:
Howard Abrams 2025-02-17 14:25:19 -08:00
parent 8fe6d6b8fa
commit f2b8ae4478
5 changed files with 92 additions and 5 deletions

20
commands/misc.py Executable file
View file

@ -0,0 +1,20 @@
#!/usr/bin/env python
from .command import Command
from evennia import CmdSet
class CmdJump(Command):
"""
Jump or play in or around puddles.
"""
key = "jump"
aliases = ["play"]
def func(self):
self.obj.do_jump(self.caller)
class CmdSetPuddle(CmdSet):
def at_cmdset_creation(self):
self.add(CmdJump)

View file

@ -136,7 +136,8 @@ class Fish(CarriableNPC):
elif self.db.spoken == 803:
self.at_say("Sorry for all the puns. I feel so GILL-ty.")
elif self.db.spoken > 1000 and self.db.spoken % (24 * 60 * 60 / self.fish_tick):
# Let's attempt to tell a bad joke once a day:
elif self.db.spoken > 1000 and self.db.spoken % (24 * 60 * 60 / self.fish_tick) == 0:
self.at_say(get_joke())
self.db.spoken += 1

View file

@ -71,6 +71,7 @@ class CmdLookBook(Command):
"""
Respond with a new book to look at.
"""
priority = 3
key = "look book"
aliases = "l book"
@ -92,8 +93,6 @@ class CmdReadBook(Command):
Return the inside contents of the book.
"""
key = "read"
aliases = "open book"
def func(self):
self.obj.do_read(self.caller)
@ -119,7 +118,6 @@ class CmdDropBook(Command):
class CmdSetBook(CmdSet):
# mergetype = "Replace"
priority = 2
def at_cmdset_creation(self):
@ -153,6 +151,17 @@ class Readable(Object):
"called when 'read'."
reader.msg(self.db.inside)
def do_burn(self, reader, drop=True):
"""
Throwing and burning books and signs.
Leave (ie. drop) or destroy?
"""
if drop:
super().at_drop(reader)
else:
reader.msg("The {self.name} is gone.")
self.delete()
class Letter(Readable):
"""

View file

@ -26,6 +26,8 @@ class Unhider(Object):
The idea is .... ugh.
@set thing/
"""
pass
class Returnable(Object):
"""
This object can't go far from one or two locations.
@ -33,6 +35,34 @@ class Returnable(Object):
"""
pass
class Puddle(Object):
def at_object_creation(self):
self.cmdset.add_default(CmdSetPuddle)
def do_jump(self, player):
player.db.jumped_times = (player.db.jumped_times or 0) + 1
if player.db.jumped_times == 1:
player.msg("You jump in the puddle! "
"This is great fun. You feel childish.")
else:
player.msg(routput(choice([
"You don't care [how muddy|who notices], you jump in again!",
"Mud? Whatever. You [splash|jump] in[| again].",
"You splash around in the puddle.",
"You jump in the puddle again.",
"This time you dance a little as you kick up your heels.",
]) + " You feel " + choice([
"[so much|] better.",
"carefree.",
"child-like and free.",
"irresponsible.",
"happy.",
"great.",
])))
self.location.msg_contents(f"{player.name} jumps in the puddle.",
exclude=player)
class Knocker(Object):
"""
Special object that listens to what is said in the room, and
@ -220,7 +250,6 @@ class Knocker(Object):
def get_display_things(self, looker):
return ""
def msg(self, text=None, from_obj=None, **kwargs):
"Custom msg() method reacting to say."
if from_obj != self:

View file

@ -133,6 +133,34 @@ And now, assume that character by typing:
# The Forest:5 ends here
# With my name, I need to have an object to go with it.
# [[file:../../../projects/mud.org::*Puddles][Puddles:1]]
@create/drop puddle : typeclasses.things.Puddle
# Puddles:1 ends here
# And an elusive description:
# [[file:../../../projects/mud.org::*Puddles][Puddles:2]]
@desc puddle = A large puddle formed from a recent rainshower, invites you to shed your years and jump in and splash around to reconnect with your youth.
# Puddles:2 ends here
# And keep it locked down:
# [[file:../../../projects/mud.org::*Puddles][Puddles:3]]
@lock puddle = get:false()
#
@set puddle/get_err_msg = "As the water slips through your fingers, you realize the apt metaphor of attempting to grasp at your youth.
# Puddles:3 ends here
# More details about the room that describes aspects of the boulder in the =desc= above. First, the symbol:
# [[file:../../../projects/mud.org::*Boulder][Boulder:1]]