Allow puppeting NPCs that stay put.
This commit is contained in:
parent
060abf846c
commit
568ff30b54
4 changed files with 175 additions and 108 deletions
|
|
@ -41,6 +41,8 @@ READ_LETTER = """You read a letter with an oddly familiar penmanship:
|
|||
- Get and read a book
|
||||
- Have some tea and scones
|
||||
|
||||
Oh, I also suggest |wWyldwood|n, a fabulous bar that doesn't open very often, but is quite fun when it does.
|
||||
|
||||
I'm here, so join me in a cup of tea and we can reconnect and reminisce of glorious days gone by, and the utter curiosity that surrounds us.
|
||||
|
||||
Your friend,
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ class NPC(Object):
|
|||
try:
|
||||
# message will be on the form `<Person> says, "say_text"`
|
||||
# we want to get only say_text without the quotes and any spaces
|
||||
message = message.split('says, ')[1].strip(' "')
|
||||
message = text.split('says, ')[1].strip(' "')
|
||||
shout, response = self.at_heard_say(message, from_obj,
|
||||
is_say, is_whisper)
|
||||
if response != None:
|
||||
|
|
|
|||
47
typeclasses/puppets.py
Executable file
47
typeclasses/puppets.py
Executable file
|
|
@ -0,0 +1,47 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from typeclasses.characters import Character
|
||||
from utils.word_list import routput
|
||||
|
||||
|
||||
class Puppet(Character):
|
||||
"""
|
||||
Special character that if not puppetable, stays put.
|
||||
Perhaps responding or logging information to the GM.
|
||||
"""
|
||||
def at_post_puppet(self, **kwargs):
|
||||
"""
|
||||
Called just after puppeting has been completed and all
|
||||
Account<->Object links have been established.
|
||||
|
||||
Args:
|
||||
**kwargs (dict): Arbitrary, optional arguments for users
|
||||
overriding the call (unused by default).
|
||||
Notes:
|
||||
|
||||
You can use `self.account` and `self.sessions.get()` to get
|
||||
account and sessions at this point; the last entry in the
|
||||
list from `self.sessions.get()` is the latest Session
|
||||
puppeting this Object.
|
||||
|
||||
"""
|
||||
self.msg("\nYou are puppeting |c{name}|n.\n".format(name=self.key))
|
||||
self.msg((self.at_look(self.location), {"type": "look"}), options=None)
|
||||
|
||||
def at_post_unpuppet(self, account=None, session=None, **kwargs):
|
||||
"""
|
||||
Make the character object remain in the room.
|
||||
|
||||
Args:
|
||||
account (DefaultAccount): The account object that just disconnected
|
||||
from this object.
|
||||
session (Session): Session controlling the connection that
|
||||
just disconnected.
|
||||
Keyword Args:
|
||||
reason (str): If given, adds a reason for the unpuppet. This
|
||||
is set when the user is auto-unpuppeted due to being link-dead.
|
||||
**kwargs: Arbitrary, optional arguments for users
|
||||
overriding the call (unused by default).
|
||||
|
||||
"""
|
||||
self.msg("\nNo longer puppeting |c{name}|n.\n".format(name=self.key))
|
||||
|
|
@ -2,113 +2,32 @@
|
|||
# # -*- mode:ruby; -*-says,
|
||||
# Shell:4 ends here
|
||||
|
||||
# Character: Dabble
|
||||
# Can I rename myself?
|
||||
# Create an Avatar
|
||||
# An avatar in the original sense of a housing for a god-like entity.
|
||||
|
||||
|
||||
# [[file:../../../projects/mud.org::*Character: Dabble][Character: Dabble:1]]
|
||||
@name self = Dabbler;gnome
|
||||
# Character: Dabble:1 ends here
|
||||
# [[file:../../../projects/mud.org::*Create an Avatar][Create an Avatar:1]]
|
||||
@name self = The Avatar;avatar
|
||||
# Create an Avatar:1 ends here
|
||||
|
||||
# [[file:../../../projects/mud.org::*Create an Avatar][Create an Avatar:2]]
|
||||
@setdesc A translucent being of light and energy. The surrounding world seems vivid and vibrant as it basks in the radience.
|
||||
# Create an Avatar:2 ends here
|
||||
|
||||
# [[file:../../../projects/mud.org::*Create an Avatar][Create an Avatar:3]]
|
||||
@sdesc glowing, angelic being
|
||||
# Create an Avatar:3 ends here
|
||||
|
||||
|
||||
|
||||
# Note that we give him a male gender:
|
||||
# And to pose:
|
||||
|
||||
|
||||
# [[file:../../../projects/mud.org::*Character: Dabble][Character: Dabble:2]]
|
||||
@gender male
|
||||
# Character: Dabble:2 ends here
|
||||
|
||||
|
||||
|
||||
# And a good description that I can rework:
|
||||
|
||||
|
||||
# [[file:../../../projects/mud.org::*Character: Dabble][Character: Dabble:3]]
|
||||
@desc self = A small, hunched old man with a gray vandyke and an eye twinkle.
|
||||
|
||||
Spectacles perched precariously on the end of his hooked nose, wobble with his head. A jaunty crimson cap contrasts with his dark brown cloak.
|
||||
# Character: Dabble:3 ends here
|
||||
|
||||
|
||||
|
||||
# And a short description:
|
||||
|
||||
|
||||
# [[file:../../../projects/mud.org::*Character: Dabble][Character: Dabble:4]]
|
||||
@sdesc old gnome
|
||||
# Character: Dabble:4 ends here
|
||||
|
||||
|
||||
|
||||
# And we create a couple of objects, like a cap:
|
||||
|
||||
|
||||
# [[file:../../../projects/mud.org::*Character: Dabble][Character: Dabble:5]]
|
||||
@create cap
|
||||
# [[file:../../../projects/mud.org::*Create an Avatar][Create an Avatar:4]]
|
||||
py self.db.pose = True
|
||||
#
|
||||
@desc cap = It's crimson. It's jaunty.
|
||||
# Character: Dabble:5 ends here
|
||||
|
||||
|
||||
|
||||
# And my staff:
|
||||
|
||||
|
||||
# [[file:../../../projects/mud.org::*Character: Dabble][Character: Dabble:6]]
|
||||
@create gnarled staff;stick;staff: typeclasses.things.Wand
|
||||
#
|
||||
@desc stick = An oaken staff with a sprig of two leaves next to a swirling ball of crystal embedded near the top.
|
||||
# Character: Dabble:6 ends here
|
||||
|
||||
|
||||
|
||||
# And his special teacup:
|
||||
|
||||
|
||||
# [[file:../../../projects/mud.org::*Character: Dabble][Character: Dabble:7]]
|
||||
@create teacup;cup : typeclasses.drinkables.TeaCup
|
||||
#
|
||||
@desc teacup = A rustic teacup crafted from clay etched with leaves and runes, with an olive green and brown glaze.
|
||||
# Character: Dabble:7 ends here
|
||||
|
||||
|
||||
|
||||
# And his spells:
|
||||
|
||||
|
||||
# [[file:../../../projects/mud.org::*Character: Dabble][Character: Dabble:8]]
|
||||
@set self/disappear_msg = "After a raspberry sound, the gnome, Dabbler, disappears in a wisp of smoke."
|
||||
#
|
||||
@set self/reappear_msg = "<<White ^ Light blue ^ Gray>> mist appears...along with the smell of sulphur... ;; When the smoke clears, an old gnome <<emerges ^ materializes ^ shows up, looking a bit confused>>."
|
||||
# Character: Dabble:8 ends here
|
||||
|
||||
|
||||
|
||||
# And help with the =fly= spell:
|
||||
|
||||
|
||||
# [[file:../../../projects/mud.org::*Character: Dabble][Character: Dabble:9]]
|
||||
# nick/object meadow = Frog Meadow
|
||||
nick meadow = ^fly Frog Meadow
|
||||
# Character: Dabble:9 ends here
|
||||
|
||||
# Pipe
|
||||
# The pipe is little more than messages to the smoker and everyone else in the room.
|
||||
|
||||
|
||||
# [[file:../../../projects/mud.org::*Pipe][Pipe:1]]
|
||||
@create pipe: typeclasses.things.Pipe
|
||||
# Pipe:1 ends here
|
||||
|
||||
|
||||
|
||||
# And a description:
|
||||
|
||||
|
||||
# [[file:../../../projects/mud.org::*Pipe][Pipe:2]]
|
||||
@desc pipe = As tall as its owner with etchings of birds, leaves and magical symbols.
|
||||
# Pipe:2 ends here
|
||||
pose looking awesome
|
||||
# Create an Avatar:4 ends here
|
||||
|
||||
# The Forest
|
||||
# Rename the Limbo (or starting place) with the name *Forest*. Note the term =mp01= as a global label that matches my map.
|
||||
|
|
@ -1435,6 +1354,113 @@ Looks good for being out in the weather.
|
|||
@set leave/traverse_msg = "You open the door and step outside..."
|
||||
# Inside:9 ends here
|
||||
|
||||
# Character: Dabbler
|
||||
# My characters should be NPCs, so they can stick around if I’m not logged in.
|
||||
|
||||
|
||||
# [[file:../../../projects/mud.org::*Character: Dabbler][Character: Dabbler:1]]
|
||||
@create/drop Dabbler;gnome;old gnome: typeclasses.puppets.Puppet
|
||||
# Character: Dabbler:1 ends here
|
||||
|
||||
|
||||
|
||||
# Note that we give him a male gender:
|
||||
|
||||
|
||||
# [[file:../../../projects/mud.org::*Character: Dabbler][Character: Dabbler:2]]
|
||||
py bt = self.search('gnome'); bt.db.gender = 'male'; bt.db._sdesc = 'old gnome'; bt.db.default_pose = 'sleeping soundly in a large chair'; bt.db.pose = 'smiling at you'
|
||||
# Character: Dabbler:2 ends here
|
||||
|
||||
|
||||
|
||||
# And a good description that I can rework:
|
||||
|
||||
|
||||
# [[file:../../../projects/mud.org::*Character: Dabbler][Character: Dabbler:3]]
|
||||
@desc gnome = A small, hunched old man with a gray vandyke and an eye twinkle.
|
||||
|
||||
Spectacles perched precariously on the end of his hooked nose, wobble with his head. A jaunty crimson cap contrasts with his dark brown cloak.
|
||||
# Character: Dabbler:3 ends here
|
||||
|
||||
|
||||
|
||||
# And we create a couple of objects, like a cap:
|
||||
|
||||
|
||||
# [[file:../../../projects/mud.org::*Character: Dabbler][Character: Dabbler:4]]
|
||||
@create cap
|
||||
#
|
||||
@desc cap = It's crimson. It's jaunty.
|
||||
#
|
||||
@give cap = gnome
|
||||
# Character: Dabbler:4 ends here
|
||||
|
||||
|
||||
|
||||
# And my staff:
|
||||
|
||||
|
||||
# [[file:../../../projects/mud.org::*Character: Dabbler][Character: Dabbler:5]]
|
||||
@create gnarled staff;staff: typeclasses.things.Wand
|
||||
#
|
||||
@desc staff = An oaken staff with a sprig of two leaves next to a swirling ball of crystal embedded near the top.
|
||||
#
|
||||
@give staff = gnome
|
||||
# Character: Dabbler:5 ends here
|
||||
|
||||
|
||||
|
||||
# And his special teacup:
|
||||
|
||||
|
||||
# [[file:../../../projects/mud.org::*Character: Dabbler][Character: Dabbler:6]]
|
||||
@create teacup;cup : typeclasses.drinkables.TeaCup
|
||||
#
|
||||
@desc teacup = A rustic teacup crafted from clay etched with leaves and runes, with an olive green and brown glaze.
|
||||
#
|
||||
@give teacup = gnome
|
||||
# Character: Dabbler:6 ends here
|
||||
|
||||
|
||||
|
||||
# And his spells:
|
||||
|
||||
|
||||
# [[file:../../../projects/mud.org::*Character: Dabbler][Character: Dabbler:7]]
|
||||
@set gnome/disappear_msg = "After a raspberry sound, the gnome, Dabbler, disappears in a wisp of smoke."
|
||||
#
|
||||
@set gnome/reappear_msg = "<<White ^ Light blue ^ Gray>> mist appears...along with the smell of sulphur... ;; When the smoke clears, an old gnome <<emerges ^ materializes ^ shows up, looking a bit confused>>."
|
||||
# Character: Dabbler:7 ends here
|
||||
|
||||
|
||||
|
||||
# And help with the =fly= spell:
|
||||
|
||||
|
||||
# [[file:../../../projects/mud.org::*Character: Dabbler][Character: Dabbler:8]]
|
||||
# nick/object meadow = Frog Meadow
|
||||
# nick meadow = ^fly Frog Meadow
|
||||
# Character: Dabbler:8 ends here
|
||||
|
||||
# Pipe
|
||||
# The pipe is little more than messages to the smoker and everyone else in the room.
|
||||
|
||||
|
||||
# [[file:../../../projects/mud.org::*Pipe][Pipe:1]]
|
||||
@create pipe: typeclasses.things.Pipe
|
||||
# Pipe:1 ends here
|
||||
|
||||
|
||||
|
||||
# And a description:
|
||||
|
||||
|
||||
# [[file:../../../projects/mud.org::*Pipe][Pipe:2]]
|
||||
@desc pipe = As tall as its owner with etchings of birds, leaves and magical symbols.
|
||||
#
|
||||
@give pipe = gnome
|
||||
# Pipe:2 ends here
|
||||
|
||||
# Fireplace
|
||||
# And a fire in the fireplace is a type of /pet/, since we can feed it:
|
||||
|
||||
|
|
@ -1686,11 +1712,3 @@ py here.search("trolley").do_bake()
|
|||
# [[file:../../../projects/mud.org::*Bugs][Bugs:2]]
|
||||
say I have finished this, the first version, of my creation.
|
||||
# Bugs:2 ends here
|
||||
|
||||
# Accounts
|
||||
# Can we fix the permissions for our friends:
|
||||
|
||||
|
||||
# [[file:../../../projects/mud.org::*Accounts][Accounts:1]]
|
||||
perm/account steve = Builders
|
||||
# Accounts:1 ends here
|
||||
|
|
|
|||
Loading…
Reference in a new issue