(for now) only collect ER hint info for LttP

Optimize Entrance
This commit is contained in:
Fabian Dill
2021-07-16 12:23:05 +02:00
parent 3460c9f714
commit 20b173453d
4 changed files with 14 additions and 26 deletions

View File

@@ -24,11 +24,11 @@ class AutoWorldRegister(type):
class AutoLogicRegister(type):
def __new__(cls, name, bases, dct):
new_class = super().__new__(cls, name, bases, dct)
for function_name, function in dct.items():
if hasattr(function, "__call__"): # callable
if hasattr(CollectionState, function_name):
raise Exception(f"Name conflict on Logic Mixin {name} trying to overwrite {function_name}")
setattr(CollectionState, function_name, function)
for item_name, function in dct.items():
if not item_name.startswith("__"):
if hasattr(CollectionState, item_name):
raise Exception(f"Name conflict on Logic Mixin {name} trying to overwrite {item_name}")
setattr(CollectionState, item_name, function)
return new_class
def call_single(world: MultiWorld, method_name: str, player: int):
@@ -115,7 +115,8 @@ class World(metaclass=AutoWorldRegister):
Warning: this may be called with self.world = None, for example by MultiServer"""
raise NotImplementedError
# any methods attached to this can be used as part of CollectionState,
# please use a prefix as all of them get clobbered together
class LogicMixin(metaclass=AutoLogicRegister):
pass
pass