Magically create sticks for throwing to the BHB

This commit is contained in:
Howard Abrams 2025-04-26 09:32:14 -07:00
parent 6b8a9e946b
commit ddddfe4b7b
4 changed files with 154 additions and 39 deletions

View file

@ -8,6 +8,7 @@ Use the ObjectParent class to implement common features for *all* entities
with a location in the game world (like Characters, Rooms, Exits). with a location in the game world (like Characters, Rooms, Exits).
""" """
# from evennia.objects.objects import DefaultObject
from evennia.contrib.rpg.rpsystem.rpsystem import ContribRPObject from evennia.contrib.rpg.rpsystem.rpsystem import ContribRPObject
from evennia.utils import delay from evennia.utils import delay
# from evennia.utils import delay, logger, search # from evennia.utils import delay, logger, search
@ -27,6 +28,7 @@ class ObjectParent:
return "\n" return "\n"
# class Object(ObjectParent, DefaultObject):
class Object(ObjectParent, ContribRPObject): class Object(ObjectParent, ContribRPObject):
""" """
This is the root Object typeclass, representing all entities that This is the root Object typeclass, representing all entities that

View file

@ -11,10 +11,11 @@ Rather, each script tends to inherit from the base Script class and
just overloads its hooks to have it perform its function. just overloads its hooks to have it perform its function.
""" """
from evennia.scripts.scripts import DefaultScript from enum import Enum
from evennia.utils import logger
from typeclasses.characters import Character from evennia.scripts.scripts import DefaultScript
from evennia.prototypes.spawner import spawn
from evennia.utils import logger
class Script(DefaultScript): class Script(DefaultScript):
@ -107,7 +108,7 @@ class KnockScript(Script):
""" """
A script to wake the dead. A script to wake the dead.
""" """
def at_start(self): def at_start(self, **kwargs):
knocker = self.attributes.get("knocker") knocker = self.attributes.get("knocker")
if knocker: if knocker:
room = knocker.global_search(self.attributes.get("room")) room = knocker.global_search(self.attributes.get("room"))
@ -118,8 +119,29 @@ class KnockScript(Script):
if god: if god:
god.msg(f"With your seer stone, you see the knocker is {knocker.key}.") god.msg(f"With your seer stone, you see the knocker is {knocker.key}.")
def at_repeat(self): def at_repeat(self, **kwargs):
waker = self.attributes.get("waker") waker = self.attributes.get("waker")
if waker: if waker:
waker.knocked_timed_out() waker.knocked_timed_out()
self.stop() self.stop()
class CreateSticks(Script):
"""
Script to create sticks.
"""
def at_repeat(self, **kwargs):
woods = self.attributes.get("destination")
results = woods.search('stick')
if results and len(results) > 0 and results[0].location == woods:
pass
else:
stick = spawn({
"typeclass": "typeclasses.things.Stick",
"key": "stick",
"desc": """Its brown and sticky.
Well, by sticky, we mean, wizardly-sticky...an absolutely amazing looking stick...definitely a wizardly stick.""",
})[0]
stick.location = woods

View file

@ -32,7 +32,7 @@ MSGS = {
"\"You can also |glook trees|n, |glook moss|n, or … well, you get the idea,\" it says.", "\"You can also |glook trees|n, |glook moss|n, or … well, you get the idea,\" it says.",
], ],
"LOOKAT": [ "LOOKAT": [
"\"You seem to be getting the hang of this game,\" chirps the bird. \"When you typed |glook|n before, you noticed exits. These are directions or places you can go. For instance, if you type |gsouth|n (or just |gs|n as a shortcut), you can check out our pond where you can catch obnoxious fish.\"", "\"You seem to be getting the hang of this game,\" chirps the bird. \"When you typed |glook|n before, you noticed exits. These are directions or places you can go. For instance, if you type |gsouth|n (or just |gs|n as a shortcut), you can check out the sea where you can catch obnoxious fish.\"",
"\"The path to the |geast|n is the meadow of the BHB, the Big Hairy Beast,\" the little bird on your shoulder says. \"It's adorable if you can find it. The path to the |gwest|n leads to Dabbler's place.\"", "\"The path to the |geast|n is the meadow of the BHB, the Big Hairy Beast,\" the little bird on your shoulder says. \"It's adorable if you can find it. The path to the |gwest|n leads to Dabbler's place.\"",
"\"Yes, I could fly myself,\" warbles the little bird, \"but I'm trying to help you get around.\"", "\"Yes, I could fly myself,\" warbles the little bird, \"but I'm trying to help you get around.\"",
"The bird looks at you expectantly.", "The bird looks at you expectantly.",

View file

@ -124,7 +124,7 @@ nick meadow = ^fly Frog Meadow
# [[file:../../../projects/mud.org::*The Forest][The Forest:2]] # [[file:../../../projects/mud.org::*The Forest][The Forest:2]]
@desc here = A giant, moss-covered boulder stands among immense trees that etch the sky and slice the clouds in the <evening>darkening twilight</evening><morning>awakening dawn</morning><afternoon>lazy afternoon</afternoon><night>night sky</night>. Since it is <morning>morning, you can hear the dawn chorus of birds</morning><afternoon>afternoon, you can hear the buzzing of insects around giant colorful flowers</afternoon><evening>evening, you can hear much as most of the forest creatures are settling down for the night</evening><night>night, you can hear crickets and an occassional owl</night>. A footpath winds around the giant, moss-covered tree roots to the East and West. To the south, a dock lounges on a large pond. @desc here = A giant, moss-covered boulder stands among immense trees that etch the sky and slice the clouds in the <evening>darkening twilight</evening><morning>awakening dawn</morning><afternoon>lazy afternoon</afternoon><night>night sky</night>. As <morning>morning, you can hear the dawn chorus of birds</morning><afternoon>afternoon, you can hear the buzzing of insects around giant colorful flowers</afternoon><evening>evening, you can't hear much as most of the forest creatures are settling down for the night</evening><night>night, you can hear crickets and an occassional owl</night>. A footpath winds around the giant, moss-covered tree roots to the East and West. To the south, a dock juts into a lavender sea.
# The Forest:2 ends here # The Forest:2 ends here
@ -167,7 +167,7 @@ nick meadow = ^fly Frog Meadow
# [[file:../../../projects/mud.org::*Puddles][Puddles:2]] # [[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. @desc puddle = A large puddle, formed from a recent rain shower, invites you to shed your years and jump in and splash around to reconnect with your youth.
# Puddles:2 ends here # Puddles:2 ends here
@ -186,22 +186,14 @@ nick meadow = ^fly Frog Meadow
# [[file:../../../projects/mud.org::*Sticks][Sticks:1]] # [[file:../../../projects/mud.org::*Sticks][Sticks:1]]
@create/drop stick : typeclasses.things.Stick py timed_script = evennia.create_script(key="Create Sticks",
typeclass='typeclasses.scripts.CreateSticks',
interval=86800, # more than a day
start_delay=False, # wait interval before first call
autostart=True,
attributes=[("destination", here)] )
# Sticks:1 ends here # Sticks:1 ends here
# And the description … perhaps this could change for every stick?
# [[file:../../../projects/mud.org::*Sticks][Sticks:2]]
@desc stick = Its brown and sticky.
Well, by sticky, we mean, stick-like.
Maybe, by sticky, we mean, wizardly-sticky...an absolutely amazing looking stick...definitely a wizardly stick.
# Sticks:2 ends here
# Boulder # Boulder
# More details about the room that describes aspects of the boulder in the =desc= above. First, the symbol: # More details about the room that describes aspects of the boulder in the =desc= above. First, the symbol:
@ -393,7 +385,7 @@ Wait! You notice a foot hold, and then another. You can |gclimb|n this boulder!
# [[file:../../../projects/mud.org::*Field][Field:6]] # [[file:../../../projects/mud.org::*Field][Field:6]]
@desc here = A large waterfall cascades on the far side of this meadow creating a stream that meanders through the tall grass and large yellow flowers. They nod their heads to you as you pass by in the <evening>darkening twilight</evening><morning>awakening dawn</morning><afternoon>lazy afternoon</afternoon><night>night sky</night>. A gap in the trees show how you can return to the footpath in the forest. @desc here = A large waterfall cascades on the far side of this meadow creating a stream that meanders through the tall grass and large yellow flowers. They nod their <night>sleepy</night> heads to you as you pass by in the <evening>darkening twilight</evening><morning>awakening dawn</morning><afternoon>lazy afternoon</afternoon><night>dark night</night>. A gap in the trees show how you can return to the footpath in the forest.
# Field:6 ends here # Field:6 ends here
@ -427,7 +419,7 @@ Wait! You notice a foot hold, and then another. You can |gclimb|n this boulder!
# [[file:../../../projects/mud.org::*Field][Field:10]] # [[file:../../../projects/mud.org::*Field][Field:10]]
@detail frog;frogs = Cute little guys with their big black eyes. Too quick to catch. @detail frog;frogs = Cute little guys with their big black eyes and tiny gold crowns. Too quick to catch.
# Field:10 ends here # Field:10 ends here
# Waterfall # Waterfall
@ -457,6 +449,10 @@ Wait! Is there a large cave entrance hidden behind the water?
@set waterfall/hidden_tag = "hidden_cave" @set waterfall/hidden_tag = "hidden_cave"
# Waterfall:3 ends here # Waterfall:3 ends here
# [[file:../../../projects/mud.org::*Waterfall][Waterfall:4]]
@detail pool = A pool of cool, clear water.
# Waterfall:4 ends here
# The Lair of the Beast # The Lair of the Beast
# To create a place for our big, hairy beast to sleep, first jump to the Meadow: # To create a place for our big, hairy beast to sleep, first jump to the Meadow:
@ -742,16 +738,13 @@ Nope. Too tall, and just as well. It does not smell very good.
# #
@set beast/pet_interested_response = "It keeps its distance, but seems curious about <you>." @set beast/pet_interested_response = "It keeps its distance, but seems curious about <you>."
# #
@set beast/pet_friendly_response = " @set beast/pet_friendly_response = "The << big, ^ huge, ^ large, ^ tremendous, ^ >> << hairy ^ slobbery ^ horned ^ clawed ^ >> << brute ^ beast ^ monster>> << flops ^ rolls >> over << in the grass ^>> as <(you ^ {0} )> <( give ^ gives )> it belly rubs.. ;; The << big, ^ huge, ^ large, ^ tremendous, ^ >> << hairy ^ slobbery ^ horned ^ clawed ^ >> << brute ^ beast ^ monster>> << flops ^ rolls >> over << in the grass ^>> as <(you ^ {0} )> <( rub ^ rubs )> its belly.. ;; <(You ^ {0} )> <( pet ^ pets )> the << big, ^ huge, ^ large, ^ tremendous, ^ >> << hairy ^ slobbery ^ horned ^ clawed ^ >> << brute ^ beast ^ monster>> .. ;; <(You ^ {0} )> <( scratch ^ scratches )> the << nose ^ ears >> of the << big, ^ huge, ^ large, ^ tremendous, ^ >> << hairy ^ slobbery ^ horned ^ clawed ^ >> << brute ^ beast ^ monster>> .. ;; The << big, ^ huge, ^ large, ^ tremendous, ^ >> << hairy ^ slobbery ^ horned ^ clawed ^ >> << brute ^ beast ^ monster>> leans forward as <(you ^ {0} )> <( scratch ^ scratches )> its nose.."
<You> pet the << big, hairy ^ >> beast.
"
# #
@set beast/pet_scared_response = " @set beast/pet_ecstatic_response = "While << excited ^ ecstatic ^ squirmy >>, the << big, ^ huge, ^ large, ^ tremendous, ^ >> << hairy ^ slobbery ^ horned ^ clawed ^ >> << brute ^ beast ^ monster>> << lays ^ gets >> down so you can << pet ^ scratch >> << the top of its head ^ the back of its neck ^ its nose ^ the sides of its face >>. It closes its eyes and purrs.. ;; << The squirmy little devil. ^ >> <( You ^ {0} )> << can ^ >> << barely ^ hardly >> scratch the << nose ^ ears ^ neck ^ top of the head >> of the << big, ^ huge, ^ large, ^ tremendous, ^ >> << hairy ^ slobbery ^ horned ^ clawed ^ >> << brute ^ beast ^ monster>> as it << squirms around ^ wriggles it backend >>. It << can hardly ^ can't >> contain its excitement. ;; The << big, ^ huge, ^ large, ^ tremendous, ^ >> << hairy ^ slobbery ^ horned ^ clawed ^ >> << brute ^ beast ^ monster>> wriggles around before << flopping ^ rolling >> over << in the grass ^>> as <(you ^ {0} )> <( give ^ gives )> it belly rubs. ;; The << big, ^ huge, ^ large, ^ tremendous, ^ >> << hairy ^ slobbery ^ horned ^ clawed ^ >> << brute ^ beast ^ monster>> wriggles and squirms excitedly before it << flops ^ rolls >> over << in the grass ^>> as <(you ^ {0} )> <( rub ^ rubs )> its belly."
"
# Beast:21 ends here # Beast:21 ends here
# The Dock # The Dock
# The dock leads out into the large pond. The break in the trees lets you see the sky. Looks like a nice place to relax. # The dock leads out into a strange sea. The break in the trees lets you see the sky. Looks like a nice place to relax.
# Return to the Forest: # Return to the Forest:
@ -760,13 +753,15 @@ Nope. Too tall, and just as well. It does not smell very good.
# The Dock:1 ends here # The Dock:1 ends here
# And tunnel to the pond:
# And tunnel to the dock:
# [[file:../../../projects/mud.org::*The Dock][The Dock:2]] # [[file:../../../projects/mud.org::*The Dock][The Dock:2]]
@dig Lazy Dock;mp06 :typeclasses.rooms_weather.TimeWeatherRoom = south;s,north,n,footpath @dig Lazy Dock;mp06 :typeclasses.rooms_weather.TimeWeatherRoom = south;s,north,n,footpath
# The Dock:2 ends here # The Dock:2 ends here
# With a mesage about leaving the trees so that I dont have to repeat that in the room description: # With a mesage about leaving the trees so that I dont have to repeat that in the room description:
# [[file:../../../projects/mud.org::*The Dock][The Dock:3]] # [[file:../../../projects/mud.org::*The Dock][The Dock:3]]
@ -777,7 +772,7 @@ Nope. Too tall, and just as well. It does not smell very good.
# And a description: # And a description:
# [[file:../../../projects/mud.org::*The Dock][The Dock:4]] # [[file:../../../projects/mud.org::*The Dock][The Dock:4]]
@desc south = You see a dock on a large pond... Is that a comfortable-looking chair you can |gsit|n on? @desc south = You see a dock on a lavender sea... Is that a comfortable-looking chair you can |gsit|n on?
# The Dock:4 ends here # The Dock:4 ends here
@ -793,15 +788,21 @@ Nope. Too tall, and just as well. It does not smell very good.
# And describe this. # And describe this.
# [[file:../../../projects/mud.org::*The Dock][The Dock:6]] # [[file:../../../projects/mud.org::*The Dock][The Dock:6]]
@desc here = The dock you stand on juts into an immense pond. Someone has set a nice chair for viewing. @desc here = The dock you stand on juts into a bay of water the color of lavender flowers. Mesmorizing and calming the way the sound of the waves lap along the shore.
Someone has set a nice chair for viewing.
# The Dock:6 ends here # The Dock:6 ends here
# Since we use the =tunnel= command, we need to update the weather system: # And details?
# [[file:../../../projects/mud.org::*The Dock][The Dock:7]] # [[file:../../../projects/mud.org::*The Dock][The Dock:7]]
@update here = typeclasses.rooms_weather.TimeWeatherRoom @detail water;waves = Despite the inclement weather, the waves ripple softly against the shore. Seems nice for fishing.
#
@detail lavender;flowers;flower = The water is the |wcolor|n of lavender, not actually lavender. Hrm. Could it possibly be |wlavender tea|n?
#
@detail shore = The roots of trees make most of the bay's shoreline.
# The Dock:7 ends here # The Dock:7 ends here
@ -813,6 +814,7 @@ Nope. Too tall, and just as well. It does not smell very good.
# The Dock:8 ends here # The Dock:8 ends here
# And a description: # And a description:
# [[file:../../../projects/mud.org::*The Dock][The Dock:9]] # [[file:../../../projects/mud.org::*The Dock][The Dock:9]]
@ -879,10 +881,6 @@ Looks good for being out in the weather.
# [[file:../../../projects/mud.org::*Fishing Pole][Fishing Pole:4]] # [[file:../../../projects/mud.org::*Fishing Pole][Fishing Pole:4]]
@detail hook;bait = One of those shiny lures, made from gold coins. Curiouser. Seems you don't need to bait this hook. @detail hook;bait = One of those shiny lures, made from gold coins. Curiouser. Seems you don't need to bait this hook.
#
@detail water;waves = Despite the weather, the water looks nice...well, nice for fishing.
#
# @detail dock = Sturdy and well made. Bobs a little with the waves.
# Fishing Pole:4 ends here # Fishing Pole:4 ends here
@ -920,6 +918,99 @@ Looks good for being out in the weather.
@set sign/get_err_msg = "This granny knot holding the sign to the chair is serious. You can't take it." @set sign/get_err_msg = "This granny knot holding the sign to the chair is serious. You can't take it."
# Fishing Pole:8 ends here # Fishing Pole:8 ends here
# The Boat
# A boat on the sea is a separate room.
# [[file:../../../projects/mud.org::*The Boat][The Boat:1]]
@dig/teleport Leaf Boat;mp08:typeclasses.rooms_weather.TimeWeatherRoom
# The Boat:1 ends here
# And describe sailing on it.:
# [[file:../../../projects/mud.org::*The Boat][The Boat:2]]
@desc here = The lavender sea is tranquil as the giant leaf floats along an invisible current.
<morning>The morning sun peaks above the collosal trees and the snowcapped mountains beyond.</morning>
<afternoon>The afternoon sun peaks out briefly from misty clouds.</afternoon>
<evening>The evening sun begins to set on a watery horizon.</evening>
<night>The moon peaks out from behind wispy clouds.</night>
# The Boat:2 ends here
# The Island
# The boat should land on a distant island.
# [[file:../../../projects/mud.org::*The Island][The Island:1]]
@dig/teleport Lonely Island;mp09:typeclasses.rooms_weather.TimeWeatherRoom
# The Island:1 ends here
# And describe it:
# [[file:../../../projects/mud.org::*The Island][The Island:2]]
@teleport mp09
#
@desc here = Vibrant green moss covers the island's gray rock. Wandering around the conifers you encounter giant statues of armored knights surrounding a huge, empty throne. An inscription at the base reads, ᚦ ᚮ ᚱ
# The Island:2 ends here
# Connecting
# Create an exit for getting /into/ the boat:
# [[file:../../../projects/mud.org::*Connecting][Connecting:1]]
@teleport mp06
#
@open leaf-like boat;leaf boat;boat;leaf = mp08
# Connecting:1 ends here
# And describe the boat first:
# [[file:../../../projects/mud.org::*Connecting][Connecting:2]]
@desc boat = A giant leaf, tipped on all sides look like it could be a boat. Doesn't seem to be an oar, or even a rudder, but...
# Connecting:2 ends here
# [[file:../../../projects/mud.org::*Connecting][Connecting:3]]
@set boat/traverse_msg = "You step into the large leaf shaped like a boat, and push off from the shore into the sea..."
# Connecting:3 ends here
# Now jump into the boat,
# [[file:../../../projects/mud.org::*Connecting][Connecting:4]]
@teleport mp08
#
@open shore;island;dock = mp09
# Connecting:4 ends here
# And exiting the boat:
# [[file:../../../projects/mud.org::*Connecting][Connecting:5]]
@set shore/traverse_msg = "When the boat stops, you step off..."
# Connecting:5 ends here
# Are they going to look before getting off?
# [[file:../../../projects/mud.org::*Connecting][Connecting:6]]
@desc shore = You seem to have arrived at some island.
# Connecting:6 ends here
# Forest Path # Forest Path
# Return to the forest: # Return to the forest: