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.
In the following code,
Posis a tag class addingtopandbottomtodirectionsand there is a mappingRotUpfromPostoPos. However, in the first rule, even ifPosis a tag class rule parameter and the rule is non-directional, the mappingRotUpis applied on the rule direction rather than on the value of the parameterPosas it should.The expansion of the first rule is:
Workaround:
It's possible to avoid the issue by renaming the tags in
Posso that they have different names than those indirections. 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.