Updated the tutorial world's lockfuncs to work correctly. Resolves #682.
This commit is contained in:
parent
d1c7111db1
commit
9ffba037f8
3 changed files with 23 additions and 3 deletions
|
|
@ -354,7 +354,7 @@ start
|
||||||
# Lock exit from view/traverse until we climbed that tree (which is
|
# Lock exit from view/traverse until we climbed that tree (which is
|
||||||
# when tutorial_climbed_tree Tag gets assigned to us).
|
# when tutorial_climbed_tree Tag gets assigned to us).
|
||||||
#
|
#
|
||||||
@lock north = view:tag(tutorial_climbed_tree) ; traverse:tag(tutorial_climbed_tree)
|
@lock north = view:tag(tutorial_climbed_tree, tutorial_world) ; traverse:tag(tutorial_climbed_tree, tutorial_world)
|
||||||
#
|
#
|
||||||
@desc north =
|
@desc north =
|
||||||
This is a hardly visible footpath leading off through the rain-beaten
|
This is a hardly visible footpath leading off through the rain-beaten
|
||||||
|
|
@ -364,7 +364,7 @@ start
|
||||||
@set north/tutorial_info =
|
@set north/tutorial_info =
|
||||||
This exit is locked with a lock string that looks like this:
|
This exit is locked with a lock string that looks like this:
|
||||||
|
|
||||||
view:tag(tutorial_climbed_tree) ; traverse:tag(tutorial_climbed_tree)
|
view:tag(tutorial_climbed_tree, tutorial_world) ; traverse:tag(tutorial_climbed_tree, tutorial_world)
|
||||||
|
|
||||||
This checks if Character has a Tag tutorial_climbed_tree set before it
|
This checks if Character has a Tag tutorial_climbed_tree set before it
|
||||||
allows itself to be displayed. This Tag is set by the tree object when
|
allows itself to be displayed. This Tag is set by the tree object when
|
||||||
|
|
|
||||||
|
|
@ -537,7 +537,7 @@ class CmdPressButton(Command):
|
||||||
# the Attribute button_exposed on the Wall object so that
|
# the Attribute button_exposed on the Wall object so that
|
||||||
# you can only push the button when the puzzle is solved. It also
|
# you can only push the button when the puzzle is solved. It also
|
||||||
# checks the is_lit Attribute on the location.
|
# checks the is_lit Attribute on the location.
|
||||||
locks = "cmd:objattr(button_exposed) and locattr(is_lit)"
|
locks = "cmd:objattr(button_exposed) and objlocattr(is_lit)"
|
||||||
help_category = "TutorialWorld"
|
help_category = "TutorialWorld"
|
||||||
|
|
||||||
def func(self):
|
def func(self):
|
||||||
|
|
|
||||||
|
|
@ -376,6 +376,25 @@ def locattr(accessing_obj, accessed_obj, *args, **kwargs):
|
||||||
if hasattr(accessing_obj, "location"):
|
if hasattr(accessing_obj, "location"):
|
||||||
return attr(accessing_obj.location, accessed_obj, *args, **kwargs)
|
return attr(accessing_obj.location, accessed_obj, *args, **kwargs)
|
||||||
|
|
||||||
|
def objlocattr(accessing_obj, accessed_obj, *args, **kwargs):
|
||||||
|
"""
|
||||||
|
Usage:
|
||||||
|
locattr(attrname)
|
||||||
|
locattr(attrname, value)
|
||||||
|
locattr(attrname, value, compare=type)
|
||||||
|
|
||||||
|
Works like attr, except it looks for an attribute on
|
||||||
|
accessed_obj.location, if such an entity exists.
|
||||||
|
|
||||||
|
if accessed_obj has a property ".obj" (such as is the case for a
|
||||||
|
Command), then accessing_obj.obj.location is used instead.
|
||||||
|
|
||||||
|
"""
|
||||||
|
if hasattr(accessed_obj, "obj"):
|
||||||
|
accessed_obj = accessed_obj.obj
|
||||||
|
if hasattr(accessed_obj, "location"):
|
||||||
|
return attr(accessed_obj.location, accessed_obj, *args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
def attr_eq(accessing_obj, accessed_obj, *args, **kwargs):
|
def attr_eq(accessing_obj, accessed_obj, *args, **kwargs):
|
||||||
"""
|
"""
|
||||||
|
|
@ -447,6 +466,7 @@ def tag(accessing_obj, accessed_obj, *args, **kwargs):
|
||||||
"""
|
"""
|
||||||
if hasattr(accessing_obj, "obj"):
|
if hasattr(accessing_obj, "obj"):
|
||||||
accessing_obj = accessing_obj = accessing_obj.obj
|
accessing_obj = accessing_obj = accessing_obj.obj
|
||||||
|
print "tag:", args, accessing_obj, accessing_obj.tags.get(*args)
|
||||||
return accessing_obj.tags.get(*args)
|
return accessing_obj.tags.get(*args)
|
||||||
|
|
||||||
def objtag(accessing_obj, accessed_obj, *args, **kwargs):
|
def objtag(accessing_obj, accessed_obj, *args, **kwargs):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue