mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
The Witness: Rules Optimisation (#3617)
* Attempt at optimizing rules * docstrings * Python 3.8 * Lasers optimisation * Simplify conversion code and make it even faster * mypy * ruff * Neat * Add redirect to the other two modes * Update WitnessLogic.txt * Update WitnessLogicExpert.txt * Update WitnessLogicVanilla.txt * Use NamedTuple * Ruff * mypy thing * Mypy stuff * Move Redirect Event to Desert Region so it has a better name
This commit is contained in:
@@ -3,7 +3,7 @@ Defines Region for The Witness, assigns locations to them,
|
||||
and connects them with the proper requirements
|
||||
"""
|
||||
from collections import defaultdict
|
||||
from typing import TYPE_CHECKING, Dict, List, Set, Tuple
|
||||
from typing import TYPE_CHECKING, Dict, List, Optional, Set, Tuple
|
||||
|
||||
from BaseClasses import Entrance, Region
|
||||
|
||||
@@ -38,7 +38,7 @@ class WitnessPlayerRegions:
|
||||
self.created_region_names: Set[str] = set()
|
||||
|
||||
@staticmethod
|
||||
def make_lambda(item_requirement: WitnessRule, world: "WitnessWorld") -> CollectionRule:
|
||||
def make_lambda(item_requirement: WitnessRule, world: "WitnessWorld") -> Optional[CollectionRule]:
|
||||
from .rules import _meets_item_requirements
|
||||
|
||||
"""
|
||||
@@ -79,7 +79,9 @@ class WitnessPlayerRegions:
|
||||
source_region
|
||||
)
|
||||
|
||||
connection.access_rule = self.make_lambda(final_requirement, world)
|
||||
rule = self.make_lambda(final_requirement, world)
|
||||
if rule is not None:
|
||||
connection.access_rule = rule
|
||||
|
||||
source_region.exits.append(connection)
|
||||
connection.connect(target_region)
|
||||
|
Reference in New Issue
Block a user