Factorio: support new colors in-game

Various: cleanup and comments
This commit is contained in:
Fabian Dill
2022-01-18 06:16:16 +01:00
parent c9fa49d40f
commit 028207022a
7 changed files with 39 additions and 38 deletions

View File

@@ -333,12 +333,8 @@ class FactorioJSONtoTextParser(JSONtoTextParser):
def _handle_color(self, node: JSONMessagePart):
colors = node["color"].split(";")
for color in colors:
if color in {"red", "green", "blue", "orange", "yellow", "pink", "purple", "white", "black", "gray",
"brown", "cyan", "acid"}:
node["text"] = f"[color={color}]{node['text']}[/color]"
return self._handle_text(node)
elif color == "magenta":
node["text"] = f"[color=pink]{node['text']}[/color]"
if color in self.color_codes:
node["text"] = f"[color=#{self.color_codes[color]}]{node['text']}[/color]"
return self._handle_text(node)
return self._handle_text(node)