Implement random progressive techs.
This commit is contained in:
parent
41037ce599
commit
dfc56a3272
|
@ -106,6 +106,7 @@ Factorio:
|
|||
progressive:
|
||||
on: 1
|
||||
off: 0
|
||||
random: 0
|
||||
tech_tree_information:
|
||||
none: 0
|
||||
advancement: 0 # show which items are a logical advancement
|
||||
|
|
|
@ -100,11 +100,13 @@ class RecipeTime(Choice):
|
|||
option_chaos = 5
|
||||
|
||||
|
||||
# TODO: implement random
|
||||
class Progressive(Choice):
|
||||
displayname = "Progressive Technologies"
|
||||
option_off = 0
|
||||
option_random = 1
|
||||
option_on = 2
|
||||
alias_false = 0
|
||||
alias_true = 2
|
||||
default = 2
|
||||
|
||||
def want_progressives(self, random):
|
||||
|
@ -258,9 +260,6 @@ class FactorioWorldGen(OptionDict):
|
|||
class ImportedBlueprint(DefaultOnToggle):
|
||||
displayname = "Blueprints"
|
||||
|
||||
class ProgressiveToggle(DefaultOnToggle):
|
||||
displayname = "Progressive Technologies"
|
||||
|
||||
factorio_options: typing.Dict[str, type(Option)] = {
|
||||
"max_science_pack": MaxSciencePack,
|
||||
"tech_tree_layout": TechTreeLayout,
|
||||
|
@ -273,5 +272,5 @@ factorio_options: typing.Dict[str, type(Option)] = {
|
|||
"recipe_ingredients": RecipeIngredients,
|
||||
"imported_blueprints": ImportedBlueprint,
|
||||
"world_gen": FactorioWorldGen,
|
||||
"progressive": ProgressiveToggle
|
||||
"progressive": Progressive
|
||||
}
|
||||
|
|
|
@ -28,14 +28,15 @@ class Factorio(World):
|
|||
data_version = 3
|
||||
|
||||
def generate_basic(self):
|
||||
want_progressives = {}
|
||||
skip_silo = self.world.silo[self.player].value == Silo.option_spawn
|
||||
for tech_name in base_tech_table:
|
||||
if skip_silo and tech_name == "rocket-silo":
|
||||
continue
|
||||
if self.world.progressive[self.player]:
|
||||
item_name = tech_to_progressive_lookup.get(tech_name, tech_name)
|
||||
else:
|
||||
item_name = tech_name
|
||||
progressive_item_name = tech_to_progressive_lookup.get(tech_name, tech_name)
|
||||
want_progressive = want_progressives.setdefault(progressive_item_name,
|
||||
self.world.progressive[self.player].want_progressives(self.world.random))
|
||||
item_name = progressive_item_name if want_progressive else tech_name
|
||||
tech_item = self.create_item(item_name)
|
||||
if tech_name in self.static_nodes:
|
||||
self.world.get_location(tech_name, self.player).place_locked_item(tech_item)
|
||||
|
|
Loading…
Reference in New Issue