mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
(for now) only collect ER hint info for LttP
Optimize Entrance
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user