Timespinner: Make hidden options pickleables (#4050)

* Make timespinner hidden options pickleables

* Keep changes minimal

* Change line endings
This commit is contained in:
Jarno 2024-10-16 23:06:14 +02:00 committed by GitHub
parent 26577b16dc
commit c12ed316cf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 42 additions and 39 deletions

View File

@ -417,12 +417,15 @@ class HiddenTraps(Traps):
"""List of traps that may be in the item pool to find"""
visibility = Visibility.none
class OptionsHider:
@classmethod
def hidden(cls, option: Type[Option[Any]]) -> Type[Option]:
new_option = AssembleOptions(f"{option}Hidden", option.__bases__, vars(option).copy())
class HiddenDeathLink(DeathLink):
"""When you die, everyone who enabled death link dies. Of course, the reverse is true too."""
visibility = Visibility.none
def hidden(option: Type[Option[Any]]) -> Type[Option]:
new_option = AssembleOptions(f"{option.__name__}Hidden", option.__bases__, vars(option).copy())
new_option.visibility = Visibility.none
new_option.__doc__ = option.__doc__
globals()[f"{option.__name__}Hidden"] = new_option
return new_option
class HasReplacedCamelCase(Toggle):
@ -431,41 +434,41 @@ class HasReplacedCamelCase(Toggle):
@dataclass
class BackwardsCompatiableTimespinnerOptions(TimespinnerOptions):
StartWithJewelryBox: OptionsHider.hidden(StartWithJewelryBox) # type: ignore
DownloadableItems: OptionsHider.hidden(DownloadableItems) # type: ignore
EyeSpy: OptionsHider.hidden(EyeSpy) # type: ignore
StartWithMeyef: OptionsHider.hidden(StartWithMeyef) # type: ignore
QuickSeed: OptionsHider.hidden(QuickSeed) # type: ignore
SpecificKeycards: OptionsHider.hidden(SpecificKeycards) # type: ignore
Inverted: OptionsHider.hidden(Inverted) # type: ignore
GyreArchives: OptionsHider.hidden(GyreArchives) # type: ignore
Cantoran: OptionsHider.hidden(Cantoran) # type: ignore
LoreChecks: OptionsHider.hidden(LoreChecks) # type: ignore
BossRando: OptionsHider.hidden(BossRando) # type: ignore
DamageRando: OptionsHider.hidden(DamageRando) # type: ignore
StartWithJewelryBox: hidden(StartWithJewelryBox) # type: ignore
DownloadableItems: hidden(DownloadableItems) # type: ignore
EyeSpy: hidden(EyeSpy) # type: ignore
StartWithMeyef: hidden(StartWithMeyef) # type: ignore
QuickSeed: hidden(QuickSeed) # type: ignore
SpecificKeycards: hidden(SpecificKeycards) # type: ignore
Inverted: hidden(Inverted) # type: ignore
GyreArchives: hidden(GyreArchives) # type: ignore
Cantoran: hidden(Cantoran) # type: ignore
LoreChecks: hidden(LoreChecks) # type: ignore
BossRando: hidden(BossRando) # type: ignore
DamageRando: hidden(DamageRando) # type: ignore
DamageRandoOverrides: HiddenDamageRandoOverrides
HpCap: OptionsHider.hidden(HpCap) # type: ignore
LevelCap: OptionsHider.hidden(LevelCap) # type: ignore
ExtraEarringsXP: OptionsHider.hidden(ExtraEarringsXP) # type: ignore
BossHealing: OptionsHider.hidden(BossHealing) # type: ignore
ShopFill: OptionsHider.hidden(ShopFill) # type: ignore
ShopWarpShards: OptionsHider.hidden(ShopWarpShards) # type: ignore
ShopMultiplier: OptionsHider.hidden(ShopMultiplier) # type: ignore
LootPool: OptionsHider.hidden(LootPool) # type: ignore
DropRateCategory: OptionsHider.hidden(DropRateCategory) # type: ignore
FixedDropRate: OptionsHider.hidden(FixedDropRate) # type: ignore
LootTierDistro: OptionsHider.hidden(LootTierDistro) # type: ignore
ShowBestiary: OptionsHider.hidden(ShowBestiary) # type: ignore
ShowDrops: OptionsHider.hidden(ShowDrops) # type: ignore
EnterSandman: OptionsHider.hidden(EnterSandman) # type: ignore
DadPercent: OptionsHider.hidden(DadPercent) # type: ignore
RisingTides: OptionsHider.hidden(RisingTides) # type: ignore
HpCap: hidden(HpCap) # type: ignore
LevelCap: hidden(LevelCap) # type: ignore
ExtraEarringsXP: hidden(ExtraEarringsXP) # type: ignore
BossHealing: hidden(BossHealing) # type: ignore
ShopFill: hidden(ShopFill) # type: ignore
ShopWarpShards: hidden(ShopWarpShards) # type: ignore
ShopMultiplier: hidden(ShopMultiplier) # type: ignore
LootPool: hidden(LootPool) # type: ignore
DropRateCategory: hidden(DropRateCategory) # type: ignore
FixedDropRate: hidden(FixedDropRate) # type: ignore
LootTierDistro: hidden(LootTierDistro) # type: ignore
ShowBestiary: hidden(ShowBestiary) # type: ignore
ShowDrops: hidden(ShowDrops) # type: ignore
EnterSandman: hidden(EnterSandman) # type: ignore
DadPercent: hidden(DadPercent) # type: ignore
RisingTides: hidden(RisingTides) # type: ignore
RisingTidesOverrides: HiddenRisingTidesOverrides
UnchainedKeys: OptionsHider.hidden(UnchainedKeys) # type: ignore
PresentAccessWithWheelAndSpindle: OptionsHider.hidden(PresentAccessWithWheelAndSpindle) # type: ignore
TrapChance: OptionsHider.hidden(TrapChance) # type: ignore
UnchainedKeys: hidden(UnchainedKeys) # type: ignore
PresentAccessWithWheelAndSpindle: hidden(PresentAccessWithWheelAndSpindle) # type: ignore
TrapChance: hidden(TrapChance) # type: ignore
Traps: HiddenTraps # type: ignore
DeathLink: OptionsHider.hidden(DeathLink) # type: ignore
DeathLink: HiddenDeathLink # type: ignore
has_replaced_options: HasReplacedCamelCase
def handle_backward_compatibility(self) -> None: