Skip to content

Commit

Permalink
(Aegis) FakePrimaryIndustry
Browse files Browse the repository at this point in the history
  • Loading branch information
ahyangyi committed Nov 18, 2023
1 parent 459c0dd commit e19f39a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
8 changes: 6 additions & 2 deletions industry/economies/vanilla_subarctic.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def get_economy(self, parameters):
ret.graph[printing_works].produces += (engineering_supplies,)
ret.graph[oil_refinery].produces += (farm_supplies,)

if parameters["WORKFORCE"].startswith("YETI"):
if parameters["WORKFORCE"].startswith("YETI") and parameters["WORKER_PARTICIPATION"] != "NONE":
ret.graph[worker_yard] = WorkerYard(workers, boosters=(goods, gold))
if parameters["WORKFORCE"] == "YETI":
ret.graph[worker_yard] = WorkerYard(workers, boosters=(goods, gold))
Expand All @@ -118,10 +118,14 @@ def get_economy(self, parameters):
ret.graph[worker_yard] = WorkerYard(workers, boosters=(goods, gold, mail))
elif parameters["WORKFORCE"] == "YETI_TIRED":
ret.graph[worker_yard] = WorkerYard(workers, boosters=(goods, gold, tired_workers))
ret.graph[coal_mine].produces += (tired_workers,)

# FIXME
ret.graph[coal_mine].boosters = workers
if parameters["WORKER_PARTICIPATION"] == "PRIMARY_INDUSTRY":
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 port in ret.graph:
if parameters["SEA_INDUSTRY"] == "LAND_ONLY":
Expand Down
16 changes: 13 additions & 3 deletions industry/lib/economy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ def boosters(self):
def boosters(self, new_boosters):
self._boosters = make_tuple(new_boosters)

def to_secondary(self, consumes):
return FakePrimaryIndustry(consumes, self.produces, self.extra_accepts, self.boosters)


class WorkerYard(PrimaryIndustry):
def __init__(self, produces=(), extra_accepts=(), boosters=()):
Expand All @@ -60,16 +63,23 @@ def __init__(self, boosters=(), produces=(), extra_accepts=()):


class SecondaryIndustry(Industry):
def __init__(self, consumes=(), produces=()):
def __init__(self, consumes=(), produces=(), extra_accepts=(), boosters=()):
self.consumes = make_tuple(consumes)
self.produces = make_tuple(produces)
self.extra_accepts = make_tuple(extra_accepts)
self.boosters = make_tuple(boosters)

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

@property
def accepts(self):
return self.consumes
return self.consumes + self.extra_accepts + self.boosters


class FakePrimaryIndustry(SecondaryIndustry):
def __init__(self, consumes=(), produces=(), extra_accepts=(), boosters=()):
super().__init__(consumes, produces, extra_accepts, boosters)


class TertiaryIndustry(Industry):
Expand Down
4 changes: 2 additions & 2 deletions industry/lib/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@
"SPECIFIC_SUPPLIES",
],
)
docs_parameter_choices.update_params("WORKFORCE", ["ABSTRACT", "PROFESSIONAL", "YETI"])
docs_parameter_choices.update_params("WORKFORCE", ["ABSTRACT", "PROFESSIONAL", "YETI_TIRED"])
docs_parameter_choices.update_params("WORKER_PARTICIPATION", ["NONE", "PRIMARY_INDUSTRY", "SECONDARY_INDUSTRY"])
docs_parameter_choices.update_params("SEA_INDUSTRY", ["ORGANIC"])
docs_parameter_choices.update_params("TOWN_GOODS", ["ORGANIC"])
Expand All @@ -267,7 +267,7 @@
"YETI": {
"POLICY": "AUTARKY",
"PRIMARY_INDUSTRY_GROWTH": "UNIVERSAL_SUPPLIES",
"WORKFORCE": "YETI",
"WORKFORCE": "YETI_TIRED",
"WORKER_PARTICIPATION": "PRIMARY_INDUSTRY",
"SEA_INDUSTRY": "ORGANIC",
"TOWN_GOODS": "ORGANIC",
Expand Down

0 comments on commit e19f39a

Please sign in to comment.