Only apply logic for allowed science pack
This commit is contained in:
parent
ceea55e3c6
commit
2355f9c8d3
|
@ -24,12 +24,12 @@ class Technology(): # maybe make subclass of Location?
|
||||||
factorio_id += 1
|
factorio_id += 1
|
||||||
self.ingredients = ingredients
|
self.ingredients = ingredients
|
||||||
|
|
||||||
def build_rule(self, player: int):
|
def build_rule(self, allowed_packs, player: int):
|
||||||
logging.debug(f"Building rules for {self.name}")
|
logging.debug(f"Building rules for {self.name}")
|
||||||
ingredient_rules = []
|
ingredient_rules = []
|
||||||
for ingredient in self.ingredients:
|
for ingredient in self.ingredients:
|
||||||
|
if ingredient in allowed_packs:
|
||||||
logging.debug(f"Building rules for ingredient {ingredient}")
|
logging.debug(f"Building rules for ingredient {ingredient}")
|
||||||
if ingredient in required_technologies:
|
|
||||||
technologies = required_technologies[ingredient] # technologies that unlock the recipes
|
technologies = required_technologies[ingredient] # technologies that unlock the recipes
|
||||||
if technologies:
|
if technologies:
|
||||||
logging.debug(f"Required Technologies: {technologies}")
|
logging.debug(f"Required Technologies: {technologies}")
|
||||||
|
|
|
@ -39,10 +39,11 @@ def factorio_create_regions(world: MultiWorld, player: int):
|
||||||
def set_rules(world: MultiWorld, player: int):
|
def set_rules(world: MultiWorld, player: int):
|
||||||
if world.logic[player] != 'nologic':
|
if world.logic[player] != 'nologic':
|
||||||
from worlds.generic import Rules
|
from worlds.generic import Rules
|
||||||
|
allowed_packs = world.max_science_pack[player].get_allowed_packs()
|
||||||
for tech_name, technology in technology_table.items():
|
for tech_name, technology in technology_table.items():
|
||||||
# loose nodes
|
# loose nodes
|
||||||
location = world.get_location(tech_name, player)
|
location = world.get_location(tech_name, player)
|
||||||
Rules.set_rule(location, technology.build_rule(player))
|
Rules.set_rule(location, technology.build_rule(allowed_packs, player))
|
||||||
|
|
||||||
# get all technologies
|
# get all technologies
|
||||||
world.completion_condition[player] = lambda state: all(state.has(technology, player)
|
world.completion_condition[player] = lambda state: all(state.has(technology, player)
|
||||||
|
|
Loading…
Reference in New Issue