fix zone issues (#1343)

This commit is contained in:
NotSoToothless
2026-06-19 18:28:52 -07:00
committed by GitHub
parent 60e91fb4e9
commit e44a9c815c
+20 -8
View File
@@ -1127,13 +1127,22 @@ def _capture_areas_from_zone_geometry(zone_geometry: dict | None) -> list[dict]:
radius = float(zdata.get("radius", 0.0) or 0.0) radius = float(zdata.get("radius", 0.0) or 0.0)
except Exception: except Exception:
continue continue
tm = {
"a0": [radius, 0.0, 0.0],
"a2": [0.0, 0.0, radius],
"center": [cx, float(center[1]), cz],
} if radius > 0.0 else None
out.append({ out.append({
"name": f"replay_zone_{letter}", "name": f"replay_zone_{letter}",
"type": "Sphere", # Conquest/domination capture points are axis-aligned circles, so a
# synthesized circular tm reproduces the outline exactly from the
# replay's own center+radius — no mission .blk geometry required.
"type": "Cylinder",
"x": cx, "x": cx,
"z": cz, "z": cz,
"radius": radius, "radius": radius,
"tm": None, "zone_letter": letter,
"tm": tm,
}) })
return out return out
@@ -1445,6 +1454,9 @@ def _draw_capture_areas(img: Image.Image, capture_areas: list[dict],
def _capture_zone_letter(cap: dict, fallback_idx: int) -> str: def _capture_zone_letter(cap: dict, fallback_idx: int) -> str:
labels = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" labels = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
explicit = cap.get("zone_letter")
if isinstance(explicit, str) and explicit:
return explicit.upper()
name = str(cap.get("name") or "") name = str(cap.get("name") or "")
m = re.search(r"(?:^|_)([A-Za-z])$", name) m = re.search(r"(?:^|_)([A-Za-z])$", name)
if m: if m:
@@ -2993,9 +3005,9 @@ def _render_air_only_gob(
air_cols, air_trail_cols = assign_colors(air_active, team_won) air_cols, air_trail_cols = assign_colors(air_active, team_won)
shadow_color = np.array([0, 0, 0], dtype=np.uint8) shadow_color = np.array([0, 0, 0], dtype=np.uint8)
capture_areas = resolve_capture_areas(mission_def, mission_def_path, battle_type) capture_areas = _capture_areas_from_zone_geometry(d.get("ZoneGeometry"))
if not capture_areas: if not capture_areas:
capture_areas = _capture_areas_from_zone_geometry(d.get("ZoneGeometry")) capture_areas = resolve_capture_areas(mission_def, mission_def_path, battle_type)
if capture_areas: if capture_areas:
print("Capture : " + ", ".join( print("Capture : " + ", ".join(
f"{c['name']}({c['type']})" for c in capture_areas f"{c['name']}({c['type']})" for c in capture_areas
@@ -3225,9 +3237,9 @@ def render_gob(
tc0, tc1 = _expand_bounds_by_pixels(tc0, tc1, canvas=canvas, pad_px=MAP_PAD_PX) tc0, tc1 = _expand_bounds_by_pixels(tc0, tc1, canvas=canvas, pad_px=MAP_PAD_PX)
tc0, tc1 = _clamp_bounds_to_base(tc0, tc1, base_tc0, base_tc1) tc0, tc1 = _clamp_bounds_to_base(tc0, tc1, base_tc0, base_tc1)
print(f"ok ({coord_src}) X=[{tc0[0]}, {tc1[0]}] Z=[{tc0[1]}, {tc1[1]}]") print(f"ok ({coord_src}) X=[{tc0[0]}, {tc1[0]}] Z=[{tc0[1]}, {tc1[1]}]")
capture_areas = resolve_capture_areas(mission_def, mission_def_path, battle_type) capture_areas = _capture_areas_from_zone_geometry(d.get("ZoneGeometry"))
if not capture_areas: if not capture_areas:
capture_areas = _capture_areas_from_zone_geometry(d.get("ZoneGeometry")) capture_areas = resolve_capture_areas(mission_def, mission_def_path, battle_type)
if capture_areas: if capture_areas:
print("Capture : " + ", ".join( print("Capture : " + ", ".join(
f"{c['name']}({c['type']})" for c in capture_areas f"{c['name']}({c['type']})" for c in capture_areas
@@ -4123,9 +4135,9 @@ def export_replay_json(replay_path: Path) -> dict:
if e.get("PlayerID", 0) != 0 if e.get("PlayerID", 0) != 0
and e.get("ModelName", "").startswith("tankModels/") and e.get("ModelName", "").startswith("tankModels/")
and e.get("Path")] and e.get("Path")]
capture_areas = resolve_capture_areas(mission_def, mission_def_path, battle_type) capture_areas = _capture_areas_from_zone_geometry(d.get("ZoneGeometry"))
if not capture_areas: if not capture_areas:
capture_areas = _capture_areas_from_zone_geometry(d.get("ZoneGeometry")) capture_areas = resolve_capture_areas(mission_def, mission_def_path, battle_type)
if level_data: if level_data:
try: try:
base_c0, base_c1, _ = select_tank_coords(level_data, use_alt_map_coord) base_c0, base_c1, _ = select_tank_coords(level_data, use_alt_map_coord)