ClementSparrow / Pattern-Script

Open Source HTML5 Game Engine based on PuzzleScript
20 stars 2 forks source link

Tag mappings in rules work when there is no corresponding tag expansion #31

Open ClementSparrow opened 2 years ago

ClementSparrow commented 2 years ago

With a mapping defined like that:

TAGS

Tg = A B

MAPPINGS

Tg => Mp
A B -> B A

OBJECTS

Obj:Tg
blue

It's possible to write a rule like that:

[ > Obj:Tg ] -> [ > Obj:Mp ]

And it will be interpreted as:

[ > Obj:Tg ] -> [ > Obj:Tg ]

While this is an interesting feature I think this kind of rule more likely reflects a problem with the mapping – either a mapping parameter that is missing in the rule or the use of a wrong mapping with a start set that is not one of the rule parameters – and should thus trigger an error.

ClementSparrow commented 2 years ago

OK, that's actually a bad example because in that case it would be the application of the mapping during property expansion, as a property mapping induced by the tag mapping. A better example would be:

[ > Obj:Tg | ] -> [ > Obj:Tg | Obj:Mp ]