Merge branch 'split' into Archipelago_Main

# Conflicts:
#	Main.py
This commit is contained in:
Fabian Dill
2021-06-11 13:27:28 +02:00
5 changed files with 53 additions and 9 deletions

13
worlds/BaseWorld.py Normal file
View File

@@ -0,0 +1,13 @@
class AutoWorldRegister(type):
_world_types = {}
def __new__(cls, name, bases, dct):
new_class = super().__new__(cls, name, bases, dct)
AutoWorldRegister._world_types[name] = new_class
return new_class
class World(metaclass=AutoWorldRegister):
"""A World object encompasses a game's Items, Locations, Rules and additional data or functionality required.
A Game should have its own subclass of World in which it defines the required data structures."""
def __init__(self):
pass

View File

@@ -1,8 +1,26 @@
from ..BaseWorld import World
from BaseClasses import Region, Entrance, Location, MultiWorld, Item
from .Technologies import tech_table, recipe_sources, technology_table, advancement_technologies, \
all_ingredient_names, required_technologies, get_rocket_requirements, rocket_recipes
from .Shapes import get_shapes
class Factorio(World):
def generate_basic(self, world: MultiWorld, player: int):
static_nodes = world._static_nodes = {"automation", "logistics"} # turn dynamic/option?
for tech_name, tech_id in tech_table.items():
tech_item = Item(tech_name, tech_name in advancement_technologies, tech_id, player)
tech_item.game = "Factorio"
if tech_name in static_nodes:
loc = world.get_location(tech_name, player)
loc.item = tech_item
loc.locked = True
loc.event = tech_item.advancement
else:
world.itempool.append(tech_item)
world.custom_data[player]["custom_technologies"] = custom_technologies = set_custom_technologies(world, player)
set_rules(world, player, custom_technologies)
def gen_factorio(world: MultiWorld, player: int):
static_nodes = world._static_nodes = {"automation", "logistics"} # turn dynamic/option?

12
worlds/loader.py Normal file
View File

@@ -0,0 +1,12 @@
import importlib
import os
world_types = []
world_folder = os.path.dirname(__file__)
for entry in os.scandir(world_folder):
if entry.is_dir():
entryname = entry.name
if not entryname.startswith("_"):
world_module = importlib.import_module("."+entry.name, package="worlds")
world_types.append(world_module)
print(world_folder)
print(world_types)