Skip to content

Commit

Permalink
(Aegis) various updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ahyangyi committed Oct 3, 2023
1 parent e166fe3 commit fe9bb04
Show file tree
Hide file tree
Showing 29 changed files with 61 additions and 30 deletions.
13 changes: 13 additions & 0 deletions industry/aegis_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down
3 changes: 2 additions & 1 deletion industry/docgen/economy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
6 changes: 3 additions & 3 deletions industry/docgen/industry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
2 changes: 1 addition & 1 deletion industry/industries/bank.py
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion industry/industries/clay_pit.py
Original file line number Diff line number Diff line change
@@ -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")
2 changes: 1 addition & 1 deletion industry/industries/coal_mine.py
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion industry/industries/copper_ore_mine.py
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion industry/industries/diamond_mine.py
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion industry/industries/factory.py
Original file line number Diff line number Diff line change
@@ -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)
1 change: 0 additions & 1 deletion industry/industries/farm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)]],
Expand Down
2 changes: 1 addition & 1 deletion industry/industries/food_processing_plant.py
Original file line number Diff line number Diff line change
@@ -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)
7 changes: 6 additions & 1 deletion industry/industries/forest.py
Original file line number Diff line number Diff line change
@@ -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)]],
)
1 change: 0 additions & 1 deletion industry/industries/fruit_plantation.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@


the_industry = AIndustry(
id=0x13,
name="Fruit Plantation",
substitute_type=0x13,
)
2 changes: 1 addition & 1 deletion industry/industries/gold_mine.py
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion industry/industries/iron_ore_mine.py
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion industry/industries/lumber_mill.py
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion industry/industries/oil_refinery.py
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion industry/industries/oil_rig.py
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion industry/industries/oil_wells.py
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion industry/industries/paper_mill.py
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion industry/industries/power_station.py
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion industry/industries/printing_works.py
Original file line number Diff line number Diff line change
@@ -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)
1 change: 0 additions & 1 deletion industry/industries/rubber_plantation.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@


the_industry = AIndustry(
id=0x14,
name="Rubber Plantation",
substitute_type=0x14,
)
2 changes: 1 addition & 1 deletion industry/industries/sawmill.py
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion industry/industries/steel_mill.py
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion industry/industries/towns.py
Original file line number Diff line number Diff line change
@@ -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")
6 changes: 6 additions & 0 deletions industry/lang/chinese.lng
Original file line number Diff line number Diff line change
Expand Up @@ -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:特大
Expand Down
6 changes: 6 additions & 0 deletions industry/lang/english-uk.lng
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions industry/lib/industry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 []

0 comments on commit fe9bb04

Please sign in to comment.