mirror of
https://github.com/evennia/evennia.git
synced 2026-03-22 07:46:30 +01:00
Add abort command to tutorial-world and some bugfixes
This commit is contained in:
parent
72e7c6732a
commit
f0e5cbca66
3 changed files with 50 additions and 22 deletions
|
|
@ -104,16 +104,8 @@ tutorial
|
|||
# ... and describe it.
|
||||
#
|
||||
@desc
|
||||
|gWelcome to the Evennia tutorial!|n
|
||||
|
||||
|
||||
The following tutorial consists of a small single-player quest
|
||||
area. The various rooms are designed to show off some of the power
|
||||
and possibilities of the Evennia mud creation system. At any time
|
||||
during this tutorial you can use the |wtutorial|n (or |wtut|n)
|
||||
command to get some background info about the room or certain objects
|
||||
to see what is going on "behind the scenes".
|
||||
|
||||
|gWelcome to the Evennia tutorial-world!|n
|
||||
This small quest shows some examples of Evennia usage.
|
||||
|
||||
To get into the mood of this miniature quest, imagine you are an
|
||||
adventurer out to find fame and fortune. You have heard rumours of an
|
||||
|
|
@ -126,14 +118,17 @@ tutorial
|
|||
and rain screaming in your face you stand where the moor meet the sea
|
||||
along a high, rocky coast ...
|
||||
|
||||
Try 'tutorial' to get behind-the-scenes help anywhere, and 'give up'
|
||||
if you want to abort.
|
||||
|
||||
|gwrite 'begin' to start your quest!|n
|
||||
|
||||
|
||||
|g(write 'start' or 'begin' to start the tutorial. Try 'tutorial'
|
||||
to get behind-the-scenes help anywhere.)|n
|
||||
#
|
||||
# Show that the tutorial command works ...
|
||||
#
|
||||
@set here/tutorial_info =
|
||||
You just tried the tutorial command. Use it in various rooms to see
|
||||
You just tried the |wtutorial|G command. Use it in various rooms to see
|
||||
what's technically going on and what you could try in each room. The
|
||||
intro room assigns some properties to your character, like a simple
|
||||
"health" property used when fighting. Other rooms and puzzles might do
|
||||
|
|
|
|||
|
|
@ -69,12 +69,14 @@ class CmdTutorial(Command):
|
|||
target = caller.search(self.args.strip())
|
||||
if not target:
|
||||
return
|
||||
helptext = target.db.tutorial_info
|
||||
if helptext:
|
||||
caller.msg("|G%s|n" % helptext)
|
||||
else:
|
||||
caller.msg("|RSorry, there is no tutorial help available here.|n")
|
||||
helptext = target.db.tutorial_info or ""
|
||||
|
||||
if helptext:
|
||||
helptext = f" |G{helptext}|n"
|
||||
else:
|
||||
helptext = " |RSorry, there is no tutorial help available here.|n"
|
||||
helptext += "\n\n (Write 'give up' if you want to abandon your quest.)"
|
||||
caller.msg(helptext)
|
||||
|
||||
# for the @detail command we inherit from MuxCommand, since
|
||||
# we want to make use of MuxCommand's pre-parsing of '=' in the
|
||||
|
|
@ -200,6 +202,26 @@ class CmdTutorialLook(default_cmds.CmdLook):
|
|||
looking_at_obj.at_desc(looker=caller)
|
||||
return
|
||||
|
||||
class CmdTutorialGiveUp(default_cmds.MuxCommand):
|
||||
"""
|
||||
Give up the tutorial-world quest and return to Limbo, the start room of the
|
||||
server.
|
||||
|
||||
"""
|
||||
key = "give up"
|
||||
aliases = ['abort']
|
||||
|
||||
def func(self):
|
||||
outro_room = OutroRoom.objects.all()
|
||||
if outro_room:
|
||||
outro_room = outro_room[0]
|
||||
else:
|
||||
self.caller.msg("That didn't work (seems like a bug). "
|
||||
"Try to use the |wteleport|n command instead.")
|
||||
return
|
||||
|
||||
self.caller.move_to(outro_room)
|
||||
|
||||
|
||||
class TutorialRoomCmdSet(CmdSet):
|
||||
"""
|
||||
|
|
@ -216,6 +238,7 @@ class TutorialRoomCmdSet(CmdSet):
|
|||
self.add(CmdTutorial())
|
||||
self.add(CmdTutorialSetDetail())
|
||||
self.add(CmdTutorialLook())
|
||||
self.add(CmdTutorialGiveUp())
|
||||
|
||||
|
||||
class TutorialRoom(DefaultRoom):
|
||||
|
|
@ -396,7 +419,12 @@ class IntroRoom(TutorialRoom):
|
|||
|
||||
if character.is_superuser:
|
||||
string = "-" * 78 + SUPERUSER_WARNING + "-" * 78
|
||||
character.msg("|r%s|n" % string.format(name=character.key, quell="|w@quell|r"))
|
||||
character.msg("|r%s|n" % string.format(name=character.key, quell="|wquell|r"))
|
||||
else:
|
||||
# quell user
|
||||
if character.account:
|
||||
character.account.execute_cmd("quell")
|
||||
character.msg("(Auto-quelling while in tutorial-world)")
|
||||
|
||||
|
||||
# -------------------------------------------------------------
|
||||
|
|
@ -617,7 +645,7 @@ class BridgeCmdSet(CmdSet):
|
|||
"""This groups the bridge commands. We will store it on the room."""
|
||||
|
||||
key = "Bridge commands"
|
||||
priority = 1 # this gives it precedence over the normal look/help commands.
|
||||
priority = 2 # this gives it precedence over the normal look/help commands.
|
||||
|
||||
def at_cmdset_creation(self):
|
||||
"""Called at first cmdset creation"""
|
||||
|
|
@ -679,7 +707,7 @@ class BridgeRoom(WeatherRoom):
|
|||
self.db.east_exit = "gate"
|
||||
self.db.fall_exit = "cliffledge"
|
||||
# add the cmdset on the room.
|
||||
self.cmdset.add_default(BridgeCmdSet)
|
||||
self.cmdset.add(BridgeCmdSet, permanent=True)
|
||||
# since the default Character's at_look() will access the room's
|
||||
# return_description (this skips the cmdset) when
|
||||
# first entering it, we need to explicitly turn off the room
|
||||
|
|
@ -1108,3 +1136,8 @@ class OutroRoom(TutorialRoom):
|
|||
if obj.typeclass_path.startswith("evennia.contrib.tutorial_world"):
|
||||
obj.delete()
|
||||
character.tags.clear(category="tutorial_world")
|
||||
|
||||
def at_object_leave(self, character, destination):
|
||||
if character.account:
|
||||
character.account.execute_cmd("unquell")
|
||||
|
||||
|
|
|
|||
|
|
@ -321,7 +321,7 @@ class EvMenuCmdSet(CmdSet):
|
|||
# -------------------------------------------------------------
|
||||
|
||||
|
||||
class EvMenu(object):
|
||||
class EvMenu:
|
||||
"""
|
||||
This object represents an operational menu. It is initialized from
|
||||
a menufile.py instruction.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue