Skip to content

Commit

Permalink
(Aegis) start adding a fourth economy
Browse files Browse the repository at this point in the history
  • Loading branch information
ahyangyi committed Oct 6, 2023
1 parent 0755701 commit 13ef0e0
Show file tree
Hide file tree
Showing 7 changed files with 144 additions and 2 deletions.
4 changes: 2 additions & 2 deletions industry/aegis_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
import grf
import struct
import argparse
from industry.economies import vanilla_temperate, vanilla_subarctic, vanilla_subtropical
from industry.economies import vanilla_temperate, vanilla_subarctic, vanilla_subtropical, firs_arctic
from industry.lib.parameters import iterate_variations
from industry.lib.validator import validate


all_economies = [vanilla_temperate, vanilla_subarctic, vanilla_subtropical]
all_economies = [vanilla_temperate, vanilla_subarctic, vanilla_subtropical, firs_arctic]
all_industries = []
all_cargos = []
# FIXME: need to collect industry/cargo information in better ways
Expand Down
4 changes: 4 additions & 0 deletions industry/cargos/ammonia.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import grf
from industry.lib.cargo import ACargo

the_cargo = ACargo(b"NH3_", grf.CargoClass.LIQUID | grf.CargoClass.HAZARDOUS)
4 changes: 4 additions & 0 deletions industry/cargos/peat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import grf
from industry.lib.cargo import ACargo

the_cargo = ACargo(b"PEAT", grf.CargoClass.BULK)
4 changes: 4 additions & 0 deletions industry/cargos/pyrite_ore.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import grf
from industry.lib.cargo import ACargo

the_cargo = ACargo(b"PORE", grf.CargoClass.BULK)
123 changes: 123 additions & 0 deletions industry/economies/firs_arctic.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
from industry.lib.economy import Economy, PrimaryIndustry, SecondaryIndustry, TertiaryIndustry, Town
from industry.cargos import (
ammonia,
pyrite_ore,
peat,
coal,
food,
goods,
gold,
livestock,
mail,
oil,
paper,
passengers,
wheat,
wood,
farm_supplies,
engineering_supplies,
water,
workers,
)
from industry.industries import (
peatlands,
bank,
coal_mine,
food_processing_plant,
farm,
forest,
paper_mill,
oil_refinery,
printing_works,
oil_wells,
power_station,
gold_mine,
towns,
port,
trading_centre,
water_supply,
water_tower,
worker_yard,
)


class TheEconomy:
def __init__(self):
self.name = "FIRS Arctic"

def get_economy(self, parameters):
ret = Economy(
{
coal_mine: PrimaryIndustry(coal),
farm: PrimaryIndustry((livestock, wheat)),
forest: PrimaryIndustry(wood),
oil_wells: PrimaryIndustry(oil),
gold_mine: PrimaryIndustry(gold),
peatlands: PrimaryIndustry(peat),
food_processing_plant: SecondaryIndustry(
(
livestock,
wheat,
),
food,
),
paper_mill: SecondaryIndustry(wood, paper),
oil_refinery: SecondaryIndustry(oil, goods),
printing_works: SecondaryIndustry(paper, goods),
power_station: TertiaryIndustry(coal),
bank: TertiaryIndustry(gold),
towns: Town(passengers, mail, food, goods),
},
parameters,
)
if parameters["POLICY"] == "SELF_SUFFICIENT":
ret.graph[port] = SecondaryIndustry(wood, paper)
elif parameters["POLICY"] in ("FREE_TRADE", "EXPORT"):
ret.graph[port] = SecondaryIndustry(wood, paper)
del ret.graph[paper_mill]

if parameters["BOOSTER"] == "UNIVERSAL":
ret.graph[coal_mine].booster = engineering_supplies
ret.graph[oil_wells].booster = engineering_supplies
ret.graph[gold_mine].booster = engineering_supplies
ret.graph[farm].booster = engineering_supplies
ret.graph[forest].booster = engineering_supplies

ret.graph[printing_works].produces += (engineering_supplies,)
elif parameters["BOOSTER"] == "GENERIC":
ret.graph[coal_mine].booster = engineering_supplies
ret.graph[oil_wells].booster = engineering_supplies
ret.graph[gold_mine].booster = engineering_supplies
ret.graph[farm].booster = farm_supplies
ret.graph[forest].booster = farm_supplies

ret.graph[printing_works].produces += (engineering_supplies,)
ret.graph[oil_refinery].produces += (farm_supplies,)
elif parameters["BOOSTER"] == "GENERIC_PASSENGERS":
ret.graph[coal_mine].booster = engineering_supplies
ret.graph[oil_wells].booster = passengers
ret.graph[gold_mine].booster = engineering_supplies
ret.graph[farm].booster = farm_supplies
ret.graph[forest].booster = farm_supplies

ret.graph[printing_works].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 port in ret.graph:
if parameters["LAND_PORTS"] == "LAND_ONLY":
ret.graph[trading_centre] = ret.graph[port]
del ret.graph[port]
elif parameters["LAND_PORTS"] == "BOTH":
ret.graph[trading_centre] = ret.graph[port]

if parameters["TOWN_GOODS"] == "SUBTROPICAL":
ret.graph[water_supply] = PrimaryIndustry(water)
ret.graph[water_tower] = TertiaryIndustry(water)

return ret
6 changes: 6 additions & 0 deletions industry/industries/peatlands.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from industry.lib.industry import AIndustry

the_industry = AIndustry(
name="Peatlands",
substitute_type=0x26,
)
1 change: 1 addition & 0 deletions industry/lang/english-uk.lng
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,4 @@ STR_CARGO_FMSP :Farm Supplies
STR_CARGO_ENSP :Engineering Supplies
STR_CARGO_WATR :Water
STR_CARGO_OTI1 :Workers
STR_CARGO_PORE :Pyrite Ore

0 comments on commit 13ef0e0

Please sign in to comment.