Core: Add settings API ("auto settings") for host.yaml (#1871)

* Add settings API ("auto settings") for host.yaml

* settings: no BOM when saving

* settings: fix saving / groups resetting themselves

* settings: fix AutoWorldRegister import

Co-authored-by: el-u <109771707+el-u@users.noreply.github.com>

* Lufia2: settings: clean up imports

* settings: more consistent class naming

* Docs: update world api for settings api refactor

* settings: fix access from World instance

* settings: update migration timeline

* Docs: Apply suggestions from code review

Co-authored-by: Zach Parks <zach@alliware.com>

* Settings: correctly resolve .exe in UserPath and LocalPath

---------

Co-authored-by: el-u <109771707+el-u@users.noreply.github.com>
Co-authored-by: Zach Parks <zach@alliware.com>
This commit is contained in:
black-sliver
2023-07-05 22:39:35 +02:00
committed by GitHub
parent d8a8997684
commit 827444f5a4
34 changed files with 1455 additions and 412 deletions

View File

@@ -2,8 +2,11 @@ import binascii
import bsdiff4
import os
import pkgutil
import settings
import typing
import tempfile
from BaseClasses import Entrance, Item, ItemClassification, Location, Tutorial
from Fill import fill_restrictive
from worlds.AutoWorld import WebWorld, World
@@ -29,6 +32,16 @@ from .Rom import LADXDeltaPatch
DEVELOPER_MODE = False
class LinksAwakeningSettings(settings.Group):
class RomFile(settings.UserFilePath):
"""File name of the Link's Awakening DX rom"""
copy_to = "Legend of Zelda, The - Link's Awakening DX (USA, Europe) (SGB Enhanced).gbc"
description = "LADX ROM File"
md5s = [LADXDeltaPatch.hash]
rom_file: RomFile = RomFile(RomFile.copy_to)
class LinksAwakeningWebWorld(WebWorld):
tutorials = [Tutorial(
"Multiworld Setup Guide",
@@ -40,6 +53,7 @@ class LinksAwakeningWebWorld(WebWorld):
)]
theme = "dirt"
class LinksAwakeningWorld(World):
"""
After a previous adventure, Link is stranded on Koholint Island, full of mystery and familiar faces.
@@ -49,6 +63,7 @@ class LinksAwakeningWorld(World):
web = LinksAwakeningWebWorld()
option_definitions = links_awakening_options # options the player can set
settings: typing.ClassVar[LinksAwakeningSettings]
topology_present = True # show path to required location checks in spoiler
# data_version is used to signal that items, locations or their names