Made Events work with @requirement and RB bugfixes - #201
Conversation
|
Actuallly im putting this PR on pause until the rule builder one is merged (link here once its created) |
|
#203 is the rule builder PR |
|
with pr #203 merged ill adapt this PR to the new code, |
…into rules.py-misc-changes
I didnt mean to lie when I said that, I just got inspired when doing the preparatory merge from main to fix the conflicts |
| for exitRegion in multiworld.get_region(region, player).entrances: | ||
| extra = extra_entrance_rules.get(exitRegion.name, {}) | ||
| rb_rule = construct_rule_from_string(regionMap[region]) | ||
| area = regionMap[region] |
There was a problem hiding this comment.
If we're reassigning ["name"], this should probably be a .copy()
There was a problem hiding this comment.
its what we did before RB, I just moved it here so errors after this part of the code have a name and are detected as a region.
one thing we could do instead is move that code to be in regions.py so that they use the exact region name instead of region A to B thing they have currently (if i remember correctly)
There was a problem hiding this comment.
Yeah, I'm aware that it's something we're already doing, that's why I approved regardless.
But when you moved it it brought it to my attention as a thing we probably shouldn't be doing.
|
Found out recently while doing a Manual with all of my PRs that with RB there are no call to construct_logic_error for unbalanced parentheses (which causes an exception in the code) idk If I should include the fix for it here or in another PR after this one |
The reason I wonder if I should do it in another PR is that while fixing this I found other issues with the way Manual react when there's an invalid item/function with a number in it A require of
the fix for this I have locally is to make def infix_to_postfix(expr: str, location: dict) -> str:
...
elif c == ")":
while stack and stack[-1] != "(":
postfix += stack.pop()
stack.pop()
else:
# added this here since '|Chun-Li| or {YamlCompare(Example_Choice == 1)' is valid because of the 1 at the end
raise ValueError(f"Invalid Character '{c}' in expression '{expr}', it should be either a number or a parentheses")
while stack:
postfix += stack.pop()
except ValueError as ex:
text = str(ex)
if "'{'" in text or ")}" in text:
raise construct_logic_error(location, LogicErrorSource.EVALUATE_STACK_SIZE)
raise construct_logic_error(location, LogicErrorSource.EVALUATE_POSTFIX)
except Exception:
... |
I got inspired by what I said on discord in manual-core-dev channel and I went and really looked at the rules.py file
things included in this PR so far:
@category,:half/:allthat last point can be reverted/modified if we still want it to raise an exception instead