Skip to content

Commit

Permalink
Merge branch 'main' of github.com:ahyangyi/openttd-newgrfs
Browse files Browse the repository at this point in the history
  • Loading branch information
ahyangyi committed Oct 16, 2023
2 parents 0edf613 + 595ae91 commit 5f8e53b
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 3 deletions.
13 changes: 10 additions & 3 deletions industry/economies/firs_arctic.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
trading_centre,
water_supply,
water_tower,
wharf,
worker_yard,
)

Expand Down Expand Up @@ -85,12 +86,16 @@ def get_economy(self, parameters):
)
if parameters["POLICY"] == "SELF_SUFFICIENT":
ret.graph[port] = SecondaryIndustry(timber, china_clay)
ret.graph[wharf] = SecondaryIndustry(timber, ammonia)
elif parameters["POLICY"] in ("FREE_TRADE", "EXPORT"):
ret.graph[port] = SecondaryIndustry(timber, china_clay)
ret.graph[wharf] = SecondaryIndustry(timber, ammonia)
del ret.graph[ammonia_plant]
del ret.graph[clay_pit]

if parameters["BOOSTER"] == "UNIVERSAL":
ret.graph[ammonia_plant].booster = engineering_supplies
if ammonia_plant in ret.graph:
ret.graph[ammonia_plant].booster = engineering_supplies
if clay_pit in ret.graph:
ret.graph[clay_pit].booster = engineering_supplies
ret.graph[peatlands].booster = engineering_supplies
Expand All @@ -104,7 +109,8 @@ def get_economy(self, parameters):

ret.graph[paper_mill].produces += (engineering_supplies,)
elif parameters["BOOSTER"] == "GENERIC":
ret.graph[ammonia_plant].booster = engineering_supplies
if ammonia_plant in ret.graph:
ret.graph[ammonia_plant].booster = engineering_supplies
if clay_pit in ret.graph:
ret.graph[clay_pit].booster = engineering_supplies
ret.graph[peatlands].booster = engineering_supplies
Expand All @@ -119,7 +125,8 @@ def get_economy(self, parameters):
ret.graph[paper_mill].produces += (engineering_supplies,)
ret.graph[chemical_plant].produces += (farm_supplies,)
elif parameters["BOOSTER"] == "GENERIC_PASSENGERS":
ret.graph[ammonia_plant].booster = engineering_supplies
if ammonia_plant in ret.graph:
ret.graph[ammonia_plant].booster = engineering_supplies
if clay_pit in ret.graph:
ret.graph[clay_pit].booster = engineering_supplies
ret.graph[peatlands].booster = engineering_supplies
Expand Down
7 changes: 7 additions & 0 deletions industry/economies/vanilla_subtropical.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
water,
farm_supplies,
engineering_supplies,
workers,
)
from industry.industries import (
bank,
Expand All @@ -30,6 +31,7 @@
towns,
water_supply,
water_tower,
worker_yard,
)


Expand Down Expand Up @@ -73,6 +75,11 @@ def get_economy(self, parameters):
ret.graph[factory].produces += (engineering_supplies,)
ret.graph[oil_refinery].produces += (farm_supplies,)

if parameters["WORKER"].startswith("YETI"):
ret.graph[worker_yard] = PrimaryIndustry(workers)
# FIXME
ret.graph[diamond_mine].booster = workers

if parameters["TOWN_GOODS"] in ("ORGANIC", "SUBTROPICAL"):
ret.graph[water_supply] = PrimaryIndustry(water)
ret.graph[water_tower] = TertiaryIndustry(water)
Expand Down
7 changes: 7 additions & 0 deletions industry/economies/vanilla_temperate.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
engineering_supplies,
food,
water,
workers,
)
from industry.industries import (
bank,
Expand All @@ -33,6 +34,7 @@
food_processing_plant,
water_supply,
water_tower,
worker_yard,
)


Expand Down Expand Up @@ -79,6 +81,11 @@ def get_economy(self, parameters):
ret.graph[factory].produces += (engineering_supplies,)
ret.graph[oil_refinery].produces += (farm_supplies,)

if parameters["WORKER"].startswith("YETI"):
ret.graph[worker_yard] = PrimaryIndustry(workers)
# FIXME
ret.graph[coal_mine].booster = workers

if parameters["TOWN_GOODS"] in ("SUBARCTIC", "SUBTROPICAL"):
ret.graph[food_processing_plant] = SecondaryIndustry(
(
Expand Down
4 changes: 4 additions & 0 deletions industry/industries/wharf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from industry.lib.industry import AIndustry


the_industry = AIndustry(id=0x37, name="Wharf")
2 changes: 2 additions & 0 deletions industry/lib/validator/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from .reachability import check_reachability
from .climate_supplies import check_climate_supplies
from .yeti import check_yeti


def validate(economy):
check_reachability(economy)
check_climate_supplies(economy)
check_yeti(economy)
3 changes: 3 additions & 0 deletions industry/lib/validator/yeti.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
def check_yeti(economy):
if economy.parameters["WORKER"] in ("YETI", "YETI_PASSENGERS", "YETI_MAIL", "YETI_TIRED_WORKER"):
assert any(x.name == "Worker Yard" for x in economy.industries)

0 comments on commit 5f8e53b

Please sign in to comment.