diff --git a/industry/aegis_gen.py b/industry/aegis_gen.py index f99323b1..95613401 100644 --- a/industry/aegis_gen.py +++ b/industry/aegis_gen.py @@ -144,6 +144,19 @@ def gen(): }, ) + # Parameter 5 + g.add_int_parameter( + name=s["STR_PARAM_PRIMARY_INDUSTRY_ZONING"], + description=s["STR_PARAM_PRIMARY_INDUSTRY_ZONING_DESC"], + default=0, + limits=(0, 2), + enum={ + 0: s["STR_PARAM_PRIMARY_INDUSTRY_ZONING_PRESET"], + 1: s["STR_PARAM_PRIMARY_INDUSTRY_ZONING_DISABLED"], + 2: s["STR_PARAM_PRIMARY_INDUSTRY_ZONING_ENABLED"], + }, + ) + # Parameter 5 g.add_int_parameter( name=s["STR_PARAM_INDUSTRY_SIZE"], diff --git a/industry/docgen/economy.py b/industry/docgen/economy.py index c23dd77d..9cfad054 100644 --- a/industry/docgen/economy.py +++ b/industry/docgen/economy.py @@ -23,7 +23,8 @@ def gen_economy_doc(all_economies, string_manager): header = f"""--- layout: default title: {meta_economy.name} -nav_exclude: true""" +nav_exclude: true +search_exclude: true""" with open(os.path.join(prefix, f"{meta_economy.name}_{variation_desc}.md"), "w") as f: print( f"""{header} diff --git a/industry/docgen/industry.py b/industry/docgen/industry.py index 251a625d..ab171db6 100644 --- a/industry/docgen/industry.py +++ b/industry/docgen/industry.py @@ -3,12 +3,12 @@ def gen_industry_doc(all_industries, string_manager): prefix = "docs/industry/industries" - for i, entry in enumerate(all_industries): - with open(os.path.join(prefix, f"{entry.name}.md"), "w") as f: + for i, industry in enumerate(all_industries): + with open(os.path.join(prefix, f"{industry.name}.md"), "w") as f: print( f"""--- layout: default -title: {entry.name} +title: {industry.name} parent: Industries grand_parent: Ahyangyi's Extended Generic Industry Set (AEGIS) nav_order: {i+1} diff --git a/industry/industries/bank.py b/industry/industries/bank.py index ef0e8a80..25332b07 100644 --- a/industry/industries/bank.py +++ b/industry/industries/bank.py @@ -1,4 +1,4 @@ from industry.lib.industry import AIndustry -the_industry = AIndustry(id=0x26, name="Bank", substitute_type=0x0C) +the_industry = AIndustry(name="Bank", substitute_type=0x0C) diff --git a/industry/industries/clay_pit.py b/industry/industries/clay_pit.py index c2434030..29757b5b 100644 --- a/industry/industries/clay_pit.py +++ b/industry/industries/clay_pit.py @@ -1,4 +1,4 @@ from industry.lib.industry import AIndustry -the_industry = AIndustry(id=0x25, name="Clay Pit", substitute_type=0x0) +the_industry = AIndustry(id=0x25, name="Clay Pit") diff --git a/industry/industries/coal_mine.py b/industry/industries/coal_mine.py index d8ce9697..5cb7347b 100644 --- a/industry/industries/coal_mine.py +++ b/industry/industries/coal_mine.py @@ -1,4 +1,4 @@ from industry.lib.industry import AIndustry -the_industry = AIndustry(id=0x27, name="Coal Mine", substitute_type=0x00) +the_industry = AIndustry(name="Coal Mine", substitute_type=0x00) diff --git a/industry/industries/copper_ore_mine.py b/industry/industries/copper_ore_mine.py index f5f054d4..96de92c4 100644 --- a/industry/industries/copper_ore_mine.py +++ b/industry/industries/copper_ore_mine.py @@ -1,4 +1,4 @@ from industry.lib.industry import AIndustry -the_industry = AIndustry(id=0x0A, name="Copper Ore Mine", substitute_type=0x0A) +the_industry = AIndustry(name="Copper Ore Mine", substitute_type=0x0A) diff --git a/industry/industries/diamond_mine.py b/industry/industries/diamond_mine.py index d712d5fa..f09d5144 100644 --- a/industry/industries/diamond_mine.py +++ b/industry/industries/diamond_mine.py @@ -1,4 +1,4 @@ from industry.lib.industry import AIndustry -the_industry = AIndustry(id=0x11, name="Diamond Mine", substitute_type=0x11) +the_industry = AIndustry(name="Diamond Mine", substitute_type=0x11) diff --git a/industry/industries/factory.py b/industry/industries/factory.py index 7ef3954d..463a1322 100644 --- a/industry/industries/factory.py +++ b/industry/industries/factory.py @@ -1,4 +1,4 @@ from industry.lib.industry import AIndustry -the_industry = AIndustry(id=0x30, name="Factory", substitute_type=0x06) +the_industry = AIndustry(name="Factory", substitute_type=0x06) diff --git a/industry/industries/farm.py b/industry/industries/farm.py index 35730afa..724f0d6b 100644 --- a/industry/industries/farm.py +++ b/industry/industries/farm.py @@ -3,7 +3,6 @@ the_industry = AIndustry( - id=0x28, name="Farm", substitute_type=0x09, layouts=[[{"xofs": i, "yofs": j, "gfx": grf.NewIndustryTileID(0x23)} for i in range(4) for j in range(4)]], diff --git a/industry/industries/food_processing_plant.py b/industry/industries/food_processing_plant.py index 0d8fca6a..0e50b17c 100644 --- a/industry/industries/food_processing_plant.py +++ b/industry/industries/food_processing_plant.py @@ -1,4 +1,4 @@ from industry.lib.industry import AIndustry -the_industry = AIndustry(id=0x27, name="Food Processing Plant", substitute_type=0x0D) +the_industry = AIndustry(name="Food Processing Plant", substitute_type=0x0D) diff --git a/industry/industries/forest.py b/industry/industries/forest.py index c6da07f6..79ecc93a 100644 --- a/industry/industries/forest.py +++ b/industry/industries/forest.py @@ -1,4 +1,9 @@ +import grf from industry.lib.industry import AIndustry -the_industry = AIndustry(id=0x29, name="Forest", substitute_type=0x03) +the_industry = AIndustry( + name="Forest", + substitute_type=0x03, + layouts=[[{"xofs": i, "yofs": j, "gfx": grf.OldIndustryTileID(0x10)} for i in range(4) for j in range(4)]], +) diff --git a/industry/industries/fruit_plantation.py b/industry/industries/fruit_plantation.py index d0273631..5f749b3b 100644 --- a/industry/industries/fruit_plantation.py +++ b/industry/industries/fruit_plantation.py @@ -3,7 +3,6 @@ the_industry = AIndustry( - id=0x13, name="Fruit Plantation", substitute_type=0x13, ) diff --git a/industry/industries/gold_mine.py b/industry/industries/gold_mine.py index de6fad12..0273dd7b 100644 --- a/industry/industries/gold_mine.py +++ b/industry/industries/gold_mine.py @@ -1,4 +1,4 @@ from industry.lib.industry import AIndustry -the_industry = AIndustry(id=0x2F, name="Gold Mine", substitute_type=0x0F) +the_industry = AIndustry(name="Gold Mine", substitute_type=0x0F) diff --git a/industry/industries/iron_ore_mine.py b/industry/industries/iron_ore_mine.py index 1647c4fd..c7f01cb9 100644 --- a/industry/industries/iron_ore_mine.py +++ b/industry/industries/iron_ore_mine.py @@ -1,4 +1,4 @@ from industry.lib.industry import AIndustry -the_industry = AIndustry(id=0x31, name="Iron Ore Mine", substitute_type=0x12) +the_industry = AIndustry(name="Iron Ore Mine", substitute_type=0x12) diff --git a/industry/industries/lumber_mill.py b/industry/industries/lumber_mill.py index e24df0e4..0763b15d 100644 --- a/industry/industries/lumber_mill.py +++ b/industry/industries/lumber_mill.py @@ -1,4 +1,4 @@ from industry.lib.industry import AIndustry -the_industry = AIndustry(id=0x19, name="Lumber Mill", substitute_type=0x19) +the_industry = AIndustry(name="Lumber Mill", substitute_type=0x19) diff --git a/industry/industries/oil_refinery.py b/industry/industries/oil_refinery.py index 31aa1ff3..e1d0e6d2 100644 --- a/industry/industries/oil_refinery.py +++ b/industry/industries/oil_refinery.py @@ -1,4 +1,4 @@ from industry.lib.industry import AIndustry -the_industry = AIndustry(id=0x2B, name="Oil Refinery", substitute_type=0x04) +the_industry = AIndustry(name="Oil Refinery", substitute_type=0x04) diff --git a/industry/industries/oil_rig.py b/industry/industries/oil_rig.py index 3d68427d..73caf4fe 100644 --- a/industry/industries/oil_rig.py +++ b/industry/industries/oil_rig.py @@ -1,4 +1,4 @@ from industry.lib.industry import AIndustry -the_industry = AIndustry(id=0x32, name="Oil Rig", substitute_type=0x05) +the_industry = AIndustry(name="Oil Rig", substitute_type=0x05) diff --git a/industry/industries/oil_wells.py b/industry/industries/oil_wells.py index 923087a3..76ec6f08 100644 --- a/industry/industries/oil_wells.py +++ b/industry/industries/oil_wells.py @@ -1,4 +1,4 @@ from industry.lib.industry import AIndustry -the_industry = AIndustry(id=0x2D, name="Oil Wells", substitute_type=0x0B) +the_industry = AIndustry(name="Oil Wells", substitute_type=0x0B) diff --git a/industry/industries/paper_mill.py b/industry/industries/paper_mill.py index 23438b1a..bb8da5d3 100644 --- a/industry/industries/paper_mill.py +++ b/industry/industries/paper_mill.py @@ -1,4 +1,4 @@ from industry.lib.industry import AIndustry -the_industry = AIndustry(id=0x2A, name="Paper Mill", substitute_type=0x0E) +the_industry = AIndustry(name="Paper Mill", substitute_type=0x0E) diff --git a/industry/industries/power_station.py b/industry/industries/power_station.py index b2b5957f..2136be57 100644 --- a/industry/industries/power_station.py +++ b/industry/industries/power_station.py @@ -1,4 +1,4 @@ from industry.lib.industry import AIndustry -the_industry = AIndustry(id=0x2E, name="Power Station", substitute_type=0x01) +the_industry = AIndustry(name="Power Station", substitute_type=0x01) diff --git a/industry/industries/printing_works.py b/industry/industries/printing_works.py index f58ac436..0cda5ba4 100644 --- a/industry/industries/printing_works.py +++ b/industry/industries/printing_works.py @@ -1,4 +1,4 @@ from industry.lib.industry import AIndustry -the_industry = AIndustry(id=0x2C, name="Printing Works", substitute_type=0x07) +the_industry = AIndustry(name="Printing Works", substitute_type=0x07) diff --git a/industry/industries/rubber_plantation.py b/industry/industries/rubber_plantation.py index a4b632b9..18d09958 100644 --- a/industry/industries/rubber_plantation.py +++ b/industry/industries/rubber_plantation.py @@ -3,7 +3,6 @@ the_industry = AIndustry( - id=0x14, name="Rubber Plantation", substitute_type=0x14, ) diff --git a/industry/industries/sawmill.py b/industry/industries/sawmill.py index 374dc0f9..a0789b75 100644 --- a/industry/industries/sawmill.py +++ b/industry/industries/sawmill.py @@ -1,4 +1,4 @@ from industry.lib.industry import AIndustry -the_industry = AIndustry(id=0x33, name="Sawmill", substitute_type=0x02) +the_industry = AIndustry(name="Sawmill", substitute_type=0x02) diff --git a/industry/industries/steel_mill.py b/industry/industries/steel_mill.py index 29b2dd79..0926002d 100644 --- a/industry/industries/steel_mill.py +++ b/industry/industries/steel_mill.py @@ -1,4 +1,4 @@ from industry.lib.industry import AIndustry -the_industry = AIndustry(id=0x08, name="Steel Mill", substitute_type=0x08) +the_industry = AIndustry(name="Steel Mill", substitute_type=0x08) diff --git a/industry/industries/towns.py b/industry/industries/towns.py index 849d7245..a26f74b0 100644 --- a/industry/industries/towns.py +++ b/industry/industries/towns.py @@ -1,4 +1,4 @@ from industry.lib.industry import ADummyIndustry -the_industry = ADummyIndustry(id=0xFF, name="Towns", substitute_type=0xFF) +the_industry = ADummyIndustry(name="Towns") diff --git a/industry/lang/chinese.lng b/industry/lang/chinese.lng index 52aec97e..061e5fd8 100644 --- a/industry/lang/chinese.lng +++ b/industry/lang/chinese.lng @@ -53,6 +53,12 @@ STR_PARAM_PRIMARY_INDUSTRY_GROWTH_WORKERS :工人 STR_PARAM_PRIMARY_INDUSTRY_GROWTH_DISCRETE :离散 STR_PARAM_PRIMARY_INDUSTRY_GROWTH_CONTINUOUS :连续 +STR_PARAM_PRIMARY_INDUSTRY_ZONING :第一产业 - 分区 +STR_PARAM_PRIMARY_INDUSTRY_ZONING_DESC :选择是否限制每种第一产业到地图的某个区域内。 +STR_PARAM_PRIMARY_INDUSTRY_ZONING_PRESET :预设 +STR_PARAM_PRIMARY_INDUSTRY_ZONING_DISABLED :否 +STR_PARAM_PRIMARY_INDUSTRY_ZONING_ENABLED :是 + STR_PARAM_INDUSTRY_SIZE :画面 - 工业大小 STR_PARAM_INDUSTRY_SIZE_DESC :选择工业的占地大小 STR_PARAM_INDUSTRY_SIZE_EXTRA_LARGE:特大 diff --git a/industry/lang/english-uk.lng b/industry/lang/english-uk.lng index 5843c712..876d7f0a 100644 --- a/industry/lang/english-uk.lng +++ b/industry/lang/english-uk.lng @@ -59,6 +59,12 @@ STR_PARAM_PRIMARY_INDUSTRY_CLOSURE_PRESET :Preset STR_PARAM_PRIMARY_INDUSTRY_CLOSURE_DISABLED :Disabled STR_PARAM_PRIMARY_INDUSTRY_CLOSURE_ENABLED :Enabled +STR_PARAM_PRIMARY_INDUSTRY_ZONING :Primary Industry - Zoning +STR_PARAM_PRIMARY_INDUSTRY_ZONING_DESC :Choose whether limit primary industries to particular zones of the world +STR_PARAM_PRIMARY_INDUSTRY_ZONING_PRESET :Preset +STR_PARAM_PRIMARY_INDUSTRY_ZONING_DISABLED :Disabled +STR_PARAM_PRIMARY_INDUSTRY_ZONING_ENABLED :Enabled + STR_PARAM_INDUSTRY_SIZE :Graphics - Industry Size STR_PARAM_INDUSTRY_SIZE_DESC :Choose the visual size of the industries STR_PARAM_INDUSTRY_SIZE_EXTRA_LARGE:Extra Large diff --git a/industry/lib/industry.py b/industry/lib/industry.py index 81051c73..b0e2d1e3 100644 --- a/industry/lib/industry.py +++ b/industry/lib/industry.py @@ -2,8 +2,11 @@ class AIndustry(grf.SpriteGenerator): - def __init__(self, *, id, name, callbacks={}, **props): + def __init__(self, *, name, id=None, callbacks={}, **props): super().__init__() + if "substitute_type" in props: + assert id is None + id = props["substitute_type"] self.id = id self.name = name self._props = props @@ -20,8 +23,8 @@ def get_sprites(self, g): class ADummyIndustry(AIndustry): - def __init__(self, *, id, name, callbacks={}, **props): - super().__init__(id=id, name=name, callbacks=callbacks, **props) + def __init__(self, *, name): + super().__init__(id=0xFF, name=name, callbacks={}) def get_sprites(self, g): return []