mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 12:11:33 -06:00
Start implementing object oriented scaffold for world types
(There's still a lot of work ahead, such as: registering locations and items to the World, as well as methods to create_item_from_name() many more method names for various stages embedding Options into the world type and many more...)
This commit is contained in:
31
Options.py
31
Options.py
@@ -22,6 +22,37 @@ class AssembleOptions(type):
|
||||
return super(AssembleOptions, mcs).__new__(mcs, name, bases, attrs)
|
||||
|
||||
|
||||
class AssembleCategoryPath(type):
|
||||
def __new__(mcs, name, bases, attrs):
|
||||
path = []
|
||||
for base in bases:
|
||||
if hasattr(base, "segment"):
|
||||
path += base.segment
|
||||
path += attrs["segment"]
|
||||
attrs["path"] = path
|
||||
return super(AssembleCategoryPath, mcs).__new__(mcs, name, bases, attrs)
|
||||
|
||||
|
||||
class RootCategory(metaclass=AssembleCategoryPath):
|
||||
segment = []
|
||||
|
||||
|
||||
class LttPCategory(RootCategory):
|
||||
segment = ["A Link to the Past"]
|
||||
|
||||
|
||||
class LttPRomCategory(LttPCategory):
|
||||
segment = ["rom"]
|
||||
|
||||
|
||||
class FactorioCategory(RootCategory):
|
||||
segment = ["Factorio"]
|
||||
|
||||
|
||||
class MinecraftCategory(RootCategory):
|
||||
segment = ["Minecraft"]
|
||||
|
||||
|
||||
class Option(metaclass=AssembleOptions):
|
||||
value: int
|
||||
name_lookup: typing.Dict[int, str]
|
||||
|
Reference in New Issue
Block a user