Skip to content

Commit d0effd1

Browse files
committed
Prototyping for v1.1.1
1 parent dcc7e50 commit d0effd1

1 file changed

Lines changed: 21 additions & 5 deletions

File tree

spawn_zone_tool.py

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
from p3d_libmap.map_parser import MapParser
1313

14+
ZONE_FORMAT_VERSION = "1.1.0"
15+
1416

1517
# ---------------------------------------------------------------------------
1618
# Data Structures
@@ -29,6 +31,7 @@ class Zone:
2931
target: str
3032
fog: str = ""
3133
adjacent_zones: List[int] = field(default_factory=list)
34+
door_waypoint_targets: List[str] = field(default_factory=list)
3235
brushes: List[ZoneBrush] = field(default_factory=list)
3336

3437

@@ -69,7 +72,7 @@ def get_bounds_for_brush(brush, origin=(0.0, 0.0, 0.0)):
6972
def write_zones_to_file(zones: List[Zone], output_path: Path):
7073
"""Write all zones to an .nsz file."""
7174
with output_path.open("w") as f:
72-
f.write("zone_file_version: 1.0.0\n")
75+
f.write(f"zone_file_version: {ZONE_FORMAT_VERSION}\n")
7376
f.write(f"number_of_zones: {len(zones)}\n")
7477

7578
for zone in zones:
@@ -87,6 +90,10 @@ def write_zones_to_file(zones: List[Zone], output_path: Path):
8790
f.write(f"{b.mins[0]} {b.mins[1]} {b.mins[2]}\n")
8891
f.write(f"{b.maxs[0]} {b.maxs[1]} {b.maxs[2]}\n")
8992

93+
f.write(f"{len(zone.door_waypoint_targets)}\n")
94+
for d in zone.door_waypoint_targets:
95+
f.write(f"{d}\n")
96+
9097

9198
# ---------------------------------------------------------------------------
9299
# Main Processing Logic
@@ -115,9 +122,9 @@ def get_id_for_zone(name: str) -> int:
115122
zone_fog = ent.properties.get("zone_fog", "")
116123

117124
print(f"+ Found a spawn_zone entity:")
118-
print(f" - Name: {zone_name}")
119-
print(f" - Target: {zone_target}")
120-
print(f" - Fog: {zone_fog}")
125+
print(f" - Name: {zone_name}")
126+
print(f" - Target: {zone_target}")
127+
print(f" - Fog: [{zone_fog}]")
121128

122129
# Resolve adjacent zones
123130
adjacents = ent.properties.get("adjacent_zones", "")
@@ -127,7 +134,15 @@ def get_id_for_zone(name: str) -> int:
127134
if z.strip()
128135
]
129136

130-
print(f" - Adjacent: {adjacent_zones}")
137+
print(f" - Adjacent: {adjacent_zones}")
138+
139+
# Resolve door waypoint targets
140+
door_waypoints = ent.properties.get("door_way_targets", "")
141+
door_waypoint_targets = [
142+
z.strip() for z in door_waypoints.split(",") if z.strip()
143+
]
144+
145+
print(f" - Door Targets: {door_waypoint_targets}")
131146

132147
# Zone brushes
133148
brushes = []
@@ -145,6 +160,7 @@ def get_id_for_zone(name: str) -> int:
145160
target=zone_target,
146161
fog=zone_fog,
147162
adjacent_zones=adjacent_zones,
163+
door_waypoint_targets=door_waypoint_targets,
148164
brushes=brushes,
149165
)
150166
)

0 commit comments

Comments
 (0)