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