Factorio: implement decent option display names for Spoiler
This commit is contained in:
parent
40044ac5a6
commit
d2add54cd6
|
@ -1104,7 +1104,7 @@ class Item():
|
||||||
return self.world.get_name_string_for_object(self) if self.world else f'{self.name} (Player {self.player})'
|
return self.world.get_name_string_for_object(self) if self.world else f'{self.name} (Player {self.player})'
|
||||||
|
|
||||||
|
|
||||||
class Spoiler(object):
|
class Spoiler():
|
||||||
world: MultiWorld
|
world: MultiWorld
|
||||||
|
|
||||||
def __init__(self, world):
|
def __init__(self, world):
|
||||||
|
@ -1295,9 +1295,10 @@ class Spoiler(object):
|
||||||
outfile.write('Accessibility: %s\n' % self.metadata['accessibility'][player])
|
outfile.write('Accessibility: %s\n' % self.metadata['accessibility'][player])
|
||||||
options = self.world.worlds[player].options
|
options = self.world.worlds[player].options
|
||||||
if options:
|
if options:
|
||||||
for f_option in options:
|
for f_option, option in options.items():
|
||||||
res = getattr(self.world, f_option)[player]
|
res = getattr(self.world, f_option)[player]
|
||||||
outfile.write(f'{f_option+":":33}{bool_to_text(res) if type(res) == Options.Toggle else res.get_option_name()}\n')
|
displayname = getattr(option, "displayname", f_option)
|
||||||
|
outfile.write(f'{displayname+":":33}{bool_to_text(res) if type(res) == Options.Toggle else res.get_option_name()}\n')
|
||||||
|
|
||||||
if player in self.world.get_game_players("A Link to the Past"):
|
if player in self.world.get_game_players("A Link to the Past"):
|
||||||
for team in range(self.world.teams):
|
for team in range(self.world.teams):
|
||||||
|
|
|
@ -754,5 +754,7 @@ def roll_alttp_settings(ret: argparse.Namespace, weights, plando_options):
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
import atexit
|
import atexit
|
||||||
atexit.register(input, "Press enter to close.")
|
confirmation = atexit.register(input, "Press enter to close.")
|
||||||
main()
|
main()
|
||||||
|
# in case of error-free exit should not need confirmation
|
||||||
|
atexit.unregister(confirmation)
|
|
@ -11,6 +11,7 @@ LuaBool = Or(bool, And(int, lambda n: n in (0, 1)))
|
||||||
|
|
||||||
class MaxSciencePack(Choice):
|
class MaxSciencePack(Choice):
|
||||||
"""Maximum level of science pack required to complete the game."""
|
"""Maximum level of science pack required to complete the game."""
|
||||||
|
displayname = "Maximum Required Science Pack"
|
||||||
option_automation_science_pack = 0
|
option_automation_science_pack = 0
|
||||||
option_logistic_science_pack = 1
|
option_logistic_science_pack = 1
|
||||||
option_military_science_pack = 2
|
option_military_science_pack = 2
|
||||||
|
@ -34,6 +35,7 @@ class MaxSciencePack(Choice):
|
||||||
|
|
||||||
class TechCost(Choice):
|
class TechCost(Choice):
|
||||||
"""How expensive are the technologies."""
|
"""How expensive are the technologies."""
|
||||||
|
displayname = "Technology Cost Scale"
|
||||||
option_very_easy = 0
|
option_very_easy = 0
|
||||||
option_easy = 1
|
option_easy = 1
|
||||||
option_kind = 2
|
option_kind = 2
|
||||||
|
@ -46,6 +48,7 @@ class TechCost(Choice):
|
||||||
|
|
||||||
class Silo(Choice):
|
class Silo(Choice):
|
||||||
"""Ingredients to craft rocket silo or auto-place if set to spawn."""
|
"""Ingredients to craft rocket silo or auto-place if set to spawn."""
|
||||||
|
displayname = "Rocket Silo"
|
||||||
option_vanilla = 0
|
option_vanilla = 0
|
||||||
option_randomize_recipe = 1
|
option_randomize_recipe = 1
|
||||||
option_spawn = 2
|
option_spawn = 2
|
||||||
|
@ -54,6 +57,7 @@ class Silo(Choice):
|
||||||
|
|
||||||
class FreeSamples(Choice):
|
class FreeSamples(Choice):
|
||||||
"""Get free items with your technologies."""
|
"""Get free items with your technologies."""
|
||||||
|
displayname = "Free Samples"
|
||||||
option_none = 0
|
option_none = 0
|
||||||
option_single_craft = 1
|
option_single_craft = 1
|
||||||
option_half_stack = 2
|
option_half_stack = 2
|
||||||
|
@ -63,6 +67,7 @@ class FreeSamples(Choice):
|
||||||
|
|
||||||
class TechTreeLayout(Choice):
|
class TechTreeLayout(Choice):
|
||||||
"""Selects how the tech tree nodes are interwoven."""
|
"""Selects how the tech tree nodes are interwoven."""
|
||||||
|
displayname = "Technology Tree Layout"
|
||||||
option_single = 0
|
option_single = 0
|
||||||
option_small_diamonds = 1
|
option_small_diamonds = 1
|
||||||
option_medium_diamonds = 2
|
option_medium_diamonds = 2
|
||||||
|
@ -78,6 +83,7 @@ class TechTreeLayout(Choice):
|
||||||
|
|
||||||
class TechTreeInformation(Choice):
|
class TechTreeInformation(Choice):
|
||||||
"""How much information should be displayed in the tech tree."""
|
"""How much information should be displayed in the tech tree."""
|
||||||
|
displayname = "Technology Tree Information"
|
||||||
option_none = 0
|
option_none = 0
|
||||||
option_advancement = 1
|
option_advancement = 1
|
||||||
option_full = 2
|
option_full = 2
|
||||||
|
@ -86,6 +92,7 @@ class TechTreeInformation(Choice):
|
||||||
|
|
||||||
class RecipeTime(Choice):
|
class RecipeTime(Choice):
|
||||||
"""randomize the time it takes for any recipe to craft, this includes smelting, chemical lab, hand crafting etc."""
|
"""randomize the time it takes for any recipe to craft, this includes smelting, chemical lab, hand crafting etc."""
|
||||||
|
displayname = "Recipe Time"
|
||||||
option_vanilla = 0
|
option_vanilla = 0
|
||||||
option_fast = 1
|
option_fast = 1
|
||||||
option_normal = 2
|
option_normal = 2
|
||||||
|
@ -106,15 +113,18 @@ class Progressive(Choice):
|
||||||
|
|
||||||
class RecipeIngredients(Choice):
|
class RecipeIngredients(Choice):
|
||||||
"""Select if rocket, or rocket + science pack ingredients should be random."""
|
"""Select if rocket, or rocket + science pack ingredients should be random."""
|
||||||
|
displayname = "Random Recipe Ingredients Level"
|
||||||
option_rocket = 0
|
option_rocket = 0
|
||||||
option_science_pack = 1
|
option_science_pack = 1
|
||||||
|
|
||||||
|
|
||||||
class FactorioStartItems(OptionDict):
|
class FactorioStartItems(OptionDict):
|
||||||
|
displayname = "Starting Items"
|
||||||
default = {"burner-mining-drill": 19, "stone-furnace": 19}
|
default = {"burner-mining-drill": 19, "stone-furnace": 19}
|
||||||
|
|
||||||
|
|
||||||
class FactorioWorldGen(OptionDict):
|
class FactorioWorldGen(OptionDict):
|
||||||
|
displayname = "World Generation"
|
||||||
# FIXME: do we want default be a rando-optimized default or in-game DS?
|
# FIXME: do we want default be a rando-optimized default or in-game DS?
|
||||||
value: typing.Dict[str, typing.Dict[str, typing.Any]]
|
value: typing.Dict[str, typing.Dict[str, typing.Any]]
|
||||||
default = {
|
default = {
|
||||||
|
@ -245,6 +255,11 @@ class FactorioWorldGen(OptionDict):
|
||||||
else:
|
else:
|
||||||
raise NotImplementedError(f"Cannot Convert from non-dictionary, got {type(data)}")
|
raise NotImplementedError(f"Cannot Convert from non-dictionary, got {type(data)}")
|
||||||
|
|
||||||
|
class ImportedBlueprint(DefaultOnToggle):
|
||||||
|
displayname = "Blueprints"
|
||||||
|
|
||||||
|
class ProgressiveToggle(DefaultOnToggle):
|
||||||
|
displayname = "Progressive Technologies"
|
||||||
|
|
||||||
factorio_options: typing.Dict[str, type(Option)] = {
|
factorio_options: typing.Dict[str, type(Option)] = {
|
||||||
"max_science_pack": MaxSciencePack,
|
"max_science_pack": MaxSciencePack,
|
||||||
|
@ -256,7 +271,7 @@ factorio_options: typing.Dict[str, type(Option)] = {
|
||||||
"starting_items": FactorioStartItems,
|
"starting_items": FactorioStartItems,
|
||||||
"recipe_time": RecipeTime,
|
"recipe_time": RecipeTime,
|
||||||
"recipe_ingredients": RecipeIngredients,
|
"recipe_ingredients": RecipeIngredients,
|
||||||
"imported_blueprints": DefaultOnToggle,
|
"imported_blueprints": ImportedBlueprint,
|
||||||
"world_gen": FactorioWorldGen,
|
"world_gen": FactorioWorldGen,
|
||||||
"progressive": DefaultOnToggle
|
"progressive": ProgressiveToggle
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue