AutoWorld: ensure WebWorld is instantiated, preventing an easy mistake. (#404)
This commit is contained in:
parent
5392b32d5c
commit
215d5e9adf
|
@ -11,6 +11,8 @@ class AutoWorldRegister(type):
|
||||||
world_types: Dict[str, World] = {}
|
world_types: Dict[str, World] = {}
|
||||||
|
|
||||||
def __new__(cls, name: str, bases, dct: Dict[str, Any]):
|
def __new__(cls, name: str, bases, dct: Dict[str, Any]):
|
||||||
|
if "web" in dct:
|
||||||
|
assert isinstance(dct["web"], WebWorld), "WebWorld has to be instantiated."
|
||||||
# filter out any events
|
# filter out any events
|
||||||
dct["item_name_to_id"] = {name: id for name, id in dct["item_name_to_id"].items() if id}
|
dct["item_name_to_id"] = {name: id for name, id in dct["item_name_to_id"].items() if id}
|
||||||
dct["location_name_to_id"] = {name: id for name, id in dct["location_name_to_id"].items() if id}
|
dct["location_name_to_id"] = {name: id for name, id in dct["location_name_to_id"].items() if id}
|
||||||
|
|
Loading…
Reference in New Issue