Skip to content

Commit

Permalink
(Aegis) revert last commit and add other styling
Browse files Browse the repository at this point in the history
  • Loading branch information
ahyangyi committed Nov 19, 2023
1 parent 698b8a7 commit 3ee38b6
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
29 changes: 20 additions & 9 deletions industry/docgen/economy.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,30 @@ def gen_economy_doc(all_economies, string_manager):
---
# Flowchart
{{% mermaid %}}
flowchart LR;
classDef cargo fill:none""",
flowchart LR;""",
file=f,
)
collapsed_cargos = economy.collapsed_cargos
for industry in economy.industries:
print(f"INDUSTRY_{industry.translation_name}[{industry.name(string_manager)}];", file=f)
extra_desc = []
for cargo in flow.accepts:
if cargo in collapsed_cargos:
extra_desc.append(f"Accepts {cargo.name(string_manager)}")
for cargo in flow.produces:
if cargo in collapsed_cargos:
extra_desc.append(f"Produces {cargo.name(string_manager)}")
desc = "\n".join([industry.name(string_manager)] + extra_desc)
print(f'INDUSTRY_{industry.translation_name}["`{desc}`"];', file=f)
for cargo in economy.cargos:
print(f"CARGO_{cargo.label.decode()}:::cargo(({cargo.name(string_manager)}));", file=f)
if cargo not in collapsed_cargos:
print(f"CARGO_{cargo.label.decode()}(({cargo.name(string_manager)}));", file=f)
for industry, flow in economy.graph.items():
for cargo in flow.accepts:
print(f"CARGO_{cargo.label.decode()} --> INDUSTRY_{industry.translation_name};", file=f)
if cargo not in collapsed_cargos:
print(f"CARGO_{cargo.label.decode()} --> INDUSTRY_{industry.translation_name};", file=f)
for cargo in flow.produces:
print(f"INDUSTRY_{industry.translation_name} --> CARGO_{cargo.label.decode()};", file=f)
if cargo not in collapsed_cargos:
print(f"INDUSTRY_{industry.translation_name} --> CARGO_{cargo.label.decode()};", file=f)

# Industries
print(
Expand All @@ -72,8 +83,8 @@ def gen_economy_doc(all_economies, string_manager):
"""
# Cargos
| Cargo | Class | Capacity Multiplier | Weight | Penalty1 | Penalty2 | Base Price |
|-------|-------|---------------------|--------|----------|----------|------------|""",
| Cargo | Class | Capacity Multiplier | Weight | Price |
|-------|-------|---------------------|--------|-------|""",
file=f,
)
for cargo in economy.cargos:
Expand All @@ -82,7 +93,7 @@ def gen_economy_doc(all_economies, string_manager):
cargolink = lambda x: f"[{x.name(string_manager)}](../cargos/{x.label.decode()}.html)"

print(
f"| {cargolink(cargo)} | {cargo_class(cargo.cargo_class)} | {cargo.capacity_multiplier / 0x100} | {cargo.weight / 16} | {cargo.penalty1} | {cargo.penalty2} | {cargo.base_price} |",
f"| {cargolink(cargo)} | {cargo_class(cargo.cargo_class)} | {cargo.capacity_multiplier / 0x100} | {cargo.weight / 16} | {cargo.base_price} \\| {cargo.penalty1} \\| {cargo.penalty2} | |",
file=f,
)

Expand Down
5 changes: 5 additions & 0 deletions industry/lib/economy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from agrf.strings import get_translation
from industry.cargos import engineering_supplies, farm_supplies, tired_workers, workers


def make_tuple(x):
Expand Down Expand Up @@ -140,6 +141,10 @@ def parameter_desc(self):

return parameter_choices.desc(self.parameters)

@property
def collapsed_cargos(self):
return [x for x in [engineering_supplies, farm_supplies, workers, tired_workers] if x in self.cargos]


class MetaEconomy:
def __init__(self, translation_name):
Expand Down

0 comments on commit 3ee38b6

Please sign in to comment.