Skip to content

Commit

Permalink
(Aegis) Implement secondary-industry-workers (for vanilla economies)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahyangyi committed Nov 21, 2023
1 parent 0d59970 commit dadbb4d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
10 changes: 8 additions & 2 deletions industry/economies/vanilla_subarctic.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,22 @@ def get_economy(self, parameters):
elif parameters["WORKFORCE"] == "YETI_TIRED":
ret.graph[worker_yard] = WorkerYard(workers, boosters=(goods, gold, tired_workers))

# FIXME: remove PRESET; support SECONDARY
# FIXME: remove PRESET
if parameters["WORKER_PARTICIPATION"] in ("PRESET", "NONE"):
ret.graph[coal_mine].boosters = workers
if parameters["WORKFORCE"] == "YETI_TIRED":
ret.graph[coal_mine].produces += (tired_workers,)
if parameters["WORKER_PARTICIPATION"] in ("PRIMARY_INDUSTRY", "SECONDARY_INDUSTRY", "BOTH"):
if parameters["WORKER_PARTICIPATION"] in ("PRIMARY_INDUSTRY", "BOTH"):
for i in [coal_mine, oil_wells, gold_mine, farm, forest]:
ret.graph[i] = ret.graph[i].to_secondary(workers)
if parameters["WORKFORCE"] == "YETI_TIRED":
ret.graph[i].produces += (tired_workers,)
if parameters["WORKER_PARTICIPATION"] in ("SECONDARY_INDUSTRY", "BOTH"):
for i in [food_processing_plant, paper_mill, oil_refinery, printing_works]:
if i in ret.graph:
ret.graph[i].boosters += (workers,)
if parameters["WORKFORCE"] == "YETI_TIRED":
ret.graph[i].produces += (tired_workers,)

if port in ret.graph:
if parameters["SEA_INDUSTRY"] == "LAND_ONLY":
Expand Down
7 changes: 6 additions & 1 deletion industry/economies/vanilla_subtropical.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,16 @@ def get_economy(self, parameters):
ret.graph[diamond_mine].boosters = workers
if parameters["WORKFORCE"] == "YETI_TIRED":
ret.graph[diamond_mine].produces += (tired_workers,)
if parameters["WORKER_PARTICIPATION"] in ("PRIMARY_INDUSTRY", "SECONDARY_INDUSTRY", "BOTH"):
if parameters["WORKER_PARTICIPATION"] in ("SECONDARY_INDUSTRY", "BOTH"):
for i in [diamond_mine, oil_wells, copper_ore_mine, farm, lumber_mill]:
ret.graph[i] = ret.graph[i].to_secondary(workers)
if parameters["WORKFORCE"] == "YETI_TIRED":
ret.graph[i].produces += (tired_workers,)
if parameters["WORKER_PARTICIPATION"] in ("PRIMARY_INDUSTRY", "BOTH"):
for i in [food_processing_plant, oil_refinery, factory]:
ret.graph[i].boosters += (workers,)
if parameters["WORKFORCE"] == "YETI_TIRED":
ret.graph[i].produces += (tired_workers,)

if parameters["TOWN_GOODS"] in ("ORGANIC", "FOOD_AND_WATER"):
ret.graph[water_supply] = PrimaryIndustry(water)
Expand Down
9 changes: 7 additions & 2 deletions industry/economies/vanilla_temperate.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,21 @@ def get_economy(self, parameters):
elif parameters["WORKFORCE"] == "YETI_TIRED":
ret.graph[worker_yard] = WorkerYard(workers, boosters=(goods, valuables, tired_workers))

# FIXME: remove PRESET; support SECONDARY
# FIXME: remove PRESET
if parameters["WORKER_PARTICIPATION"] in ("PRESET", "NONE"):
ret.graph[coal_mine].boosters = workers
if parameters["WORKFORCE"] == "YETI_TIRED":
ret.graph[coal_mine].produces += (tired_workers,)
if parameters["WORKER_PARTICIPATION"] in ("PRIMARY_INDUSTRY", "SECONDARY_INDUSTRY", "BOTH"):
if parameters["WORKER_PARTICIPATION"] in ("PRIMARY_INDUSTRY", "BOTH"):
for i in [coal_mine, oil_wells, oil_rig, iron_ore_mine, farm, forest]:
ret.graph[i] = ret.graph[i].to_secondary(workers)
if parameters["WORKFORCE"] == "YETI_TIRED":
ret.graph[i].produces += (tired_workers,)
if parameters["WORKER_PARTICIPATION"] in ("SECONDARY_INDUSTRY", "BOTH"):
for i in [factory, oil_refinery, sawmill, steel_mill]:
ret.graph[i].boosters += (workers,)
if parameters["WORKFORCE"] == "YETI_TIRED":
ret.graph[i].produces += (tired_workers,)

if parameters["TOWN_GOODS"] in ("FOOD", "FOOD_AND_WATER"):
ret.graph[food_processing_plant] = SecondaryIndustry(
Expand Down
2 changes: 1 addition & 1 deletion industry/lib/economy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def __init__(self, consumes=(), produces=(), extra_accepts=(), boosters=()):
self.boosters = make_tuple(boosters)

def copy(self):
return SecondaryIndustry(self.consumes, self.produces, self.extra_accepts)
return SecondaryIndustry(self.consumes, self.produces, self.extra_accepts, self.boosters)

@property
def accepts(self):
Expand Down

0 comments on commit dadbb4d

Please sign in to comment.