Add editable export workflow and new map sources

This commit is contained in:
lucio committed 2026-08-09 17:04:36 -07:00
1 parent b079009d74
commit 234dc32c86
33 files changed
+1976 -112

No files matched your search

+41 -5
View File
@@ -53,6 +53,7 @@ LABEL_CORRECTIONS = {
}
MAP_CATEGORY_OVERRIDES = {
("reserve", "sewer manhole"): "extract-pmc",
("ground-zero", "emercom checkpoint"): "extract-pmc",
}
EXTRACT_CATEGORIES = {
"extract-pmc", "extract-scav", "extract-neutral", "extract-hidden", "transit",
@@ -71,6 +72,8 @@ EXTRACT_LABEL_PATHS = (
"overlay captions", "extract name text / extract text pmc",
"extract name text / extract text scav", "extract name text / extract text neutral",
"extract name text / transit text", "onmap exfil names / text",
"onmap exfil names", "on map exfil names", "on-map extract names", "on map extract names",
"extract names smaller",
"new onmap / exfil names", "on map extract text", "extract names / pmc",
"extract names / scav", "extract names / neutral", "extract names / transit",
"on map overlay / extracts / text",
@@ -82,6 +85,9 @@ EXTRACT_LABEL_NOISE = (
EXTRACT_ANCHOR_PATHS = (
"overlay pmc extracts", "overlay scav extracts", "overlay neutral",
"overlay transit", "overlay hidden", "extract dots", "onmap exfil icons",
"onmap extracts", "on map extracts", "pmc extract icons", "scav extract icons",
"transit / on map icons", "transit / on map letters",
"hidden / on map", "hidden / onmap",
"map markers / pmc extracts", "map markers / scav extracts",
"map markers / neutral extracts", "running man markers", "hidden exfil onmap",
"transit onmap", "on map overlay / extracts / pmc",
@@ -122,7 +128,9 @@ def display_label(category: str, value: str) -> str:
def category_for(path: tuple[str, ...]) -> str | None:
text = " / ".join(path).lower().replace("_", " ")
# Normalize camel-case PSD group names (OnMapLetters, ExfilNames, etc.)
# before matching. Newer re3mr files use these spellings extensively.
text = normalized_path(path)
excluded = [term for term in EXCLUDED if term != "legend" and not (
term in {"only for bw", "onlyforbw"} and "extractmarkersforbw" in text.replace(" ", "")
)]
@@ -200,7 +208,9 @@ def is_extract_label_path(path: tuple[str, ...], label: str) -> bool:
def explicit_extract_category(path: tuple[str, ...], label: str) -> str | None:
lower_label = label.lower()
if ("smuggler" in lower_label and "basement" in lower_label) \
or "passage by the lake" in lower_label:
or "passage by the lake" in lower_label \
or "ariadne’s path" in lower_label \
or "ariadne's path" in lower_label:
return "extract-hidden"
label_category = None
if any(term in lower_label for term in ("co-op", "coop")) \
@@ -236,10 +246,12 @@ def explicit_extract_category(path: tuple[str, ...], label: str) -> str | None:
def semantic_path_label(path: tuple[str, ...], category: str) -> str:
ignored = {
"icons", "main", "letters", "text", "pmc", "scav", "neutral", "hidden",
"all", "icons", "main", "letters", "text", "pmc", "scav", "neutral", "hidden",
"transit", "extracts", "extract dots", "extract dot pmc", "extract dots scav",
"extract dots neutral", "transit dots", "onmap", "overlay", "overlays",
"markers", "running man markers", "on map extract information",
"markers", "map overlay", "running man markers", "on map extracts",
"on map extract information",
"pmc small markers", "scav small markers", "pmc extract icons", "scav extract icons",
"neutral extracts", "pmc extracts", "scav extracts",
"transit letters", "transit onmap", "hidden+transit", "re3mr.com",
}
@@ -374,7 +386,10 @@ def extract_map(m: dict, source_root: Path | None) -> list[dict]:
if not (left <= cx <= right and top <= cy <= bottom):
continue
# Very large leaves are region overlays or artwork, not point data.
if x1 - x0 > width * 0.16 or y1 - y0 > height * 0.16:
# Text labels can legitimately be wider on tightly cropped maps
# (Ground Zero's extract names take up roughly a quarter-width).
max_width = width * (0.32 if layer.kind == "type" else 0.16)
if x1 - x0 > max_width or y1 - y0 > height * 0.16:
continue
label = layer_text(layer)
if label in {"☠", "☢"}:
@@ -468,9 +483,30 @@ def extract_map(m: dict, source_root: Path | None) -> list[dict]:
for label_index in sorted(unmatched_labels):
extracts.append(extract_labels[label_index])
# A shared gate can carry overlapping PMC and Scav icons. Once its label
# is paired, fold any nearly coincident unused icon into that record and
# apply the configured extract priority instead of emitting a duplicate.
# Explicit co-op extracts remain neutral/yellow by design.
for anchor_index, anchor in enumerate(anchors):
if anchor_index in used_anchors:
continue
nearby = next((record for record in extracts
if record["category"] != "extract-neutral"
and (record["x"] - anchor["x"]) ** 2
+ (record["y"] - anchor["y"]) ** 2 < 0.02 ** 2), None)
if nearby is None:
continue
nearby["category"] = highest_priority_extract_category(
nearby["category"], anchor["category"],
) or nearby["category"]
used_anchors.add(anchor_index)
unmatched = [anchor for index, anchor in enumerate(anchors) if index not in used_anchors]
unmatched_by_name: dict[tuple[str, str], dict] = {}
for anchor in unmatched:
if m["id"] == "factory" and anchor["category"] == "extract-hidden":
anchor["label"] = "SMUGGLER’S PASSAGE"
if anchor["label"] == CATEGORY_LABELS[anchor["category"]]:
continue
if any(anchor_matches_label(anchor["label"], label["label"])