forked from increpare/PuzzleScript
-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
bugSomething isn't workingSomething isn't workingexpansionany expansion mechanismany expansion mechanismmappingsAnything that concerns mappingsAnything that concerns mappingssyntax/languageConcerns the language or its syntaxConcerns the language or its syntax
Description
In the following code, Pos is a tag class adding top and bottom to directions and there is a mapping RotUp from Pos to Pos. However, in the first rule, even if Pos is a tag class rule parameter and the rule is non-directional, the mapping RotUp is applied on the rule direction rather than on the value of the parameter Pos as it should.
Pos = top bottom left right up down
MAPPINGS
Pos => RotUp
top bottom left right up down -> up down left right bottom top
OBJECTS
Face:Pos
white
Background
lightgreen
Wall
brown
Player
blue
COLLISIONLAYERS
Background
Face:Pos
RULES
(This rule:)
up Pos [Face:Pos] -> [Face:RotUp]
(Should be equivalent to this block, but isn't:)
up [Face:top] -> [Face:up]
+ up [Face:bottom] -> [Face:down]
+ up [Face:left] -> [Face:left]
+ up [Face:right] -> [Face:right]
+ up [Face:up] -> [Face:bottom]
+ up [Face:down] -> [Face:top]
The expansion of the first rule is:
+ (30) UP POS=bottom [ face:bottom ] -> [ face:bottom ]
+ (30) UP POS=left [ face:left ] -> [ face:bottom ]
+ (30) UP POS=right [ face:right ] -> [ face:bottom ]
+ (30) UP POS=up [ face:up ] -> [ face:bottom ]
+ (30) UP POS=down [ face:down ] -> [ face:bottom ]
Workaround:
It's possible to avoid the issue by renaming the tags in Pos so that they have different names than those in directions. It would work fine in that example, but of course it would not work in the case where some rules would need to map on the rule's direction.
See also #43, possibly related.
Thanks to knexator for reporting the bug.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingexpansionany expansion mechanismany expansion mechanismmappingsAnything that concerns mappingsAnything that concerns mappingssyntax/languageConcerns the language or its syntaxConcerns the language or its syntax