From d0effd1cdbbcc724929724131f6419883ad42346 Mon Sep 17 00:00:00 2001 From: MotoLegacy Date: Fri, 28 Nov 2025 10:32:12 -0800 Subject: [PATCH 1/2] Prototyping for v1.1.1 --- spawn_zone_tool.py | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/spawn_zone_tool.py b/spawn_zone_tool.py index a86aa31..160eb63 100644 --- a/spawn_zone_tool.py +++ b/spawn_zone_tool.py @@ -11,6 +11,8 @@ from p3d_libmap.map_parser import MapParser +ZONE_FORMAT_VERSION = "1.1.0" + # --------------------------------------------------------------------------- # Data Structures @@ -29,6 +31,7 @@ class Zone: target: str fog: str = "" adjacent_zones: List[int] = field(default_factory=list) + door_waypoint_targets: List[str] = field(default_factory=list) brushes: List[ZoneBrush] = field(default_factory=list) @@ -69,7 +72,7 @@ def get_bounds_for_brush(brush, origin=(0.0, 0.0, 0.0)): def write_zones_to_file(zones: List[Zone], output_path: Path): """Write all zones to an .nsz file.""" with output_path.open("w") as f: - f.write("zone_file_version: 1.0.0\n") + f.write(f"zone_file_version: {ZONE_FORMAT_VERSION}\n") f.write(f"number_of_zones: {len(zones)}\n") for zone in zones: @@ -87,6 +90,10 @@ def write_zones_to_file(zones: List[Zone], output_path: Path): f.write(f"{b.mins[0]} {b.mins[1]} {b.mins[2]}\n") f.write(f"{b.maxs[0]} {b.maxs[1]} {b.maxs[2]}\n") + f.write(f"{len(zone.door_waypoint_targets)}\n") + for d in zone.door_waypoint_targets: + f.write(f"{d}\n") + # --------------------------------------------------------------------------- # Main Processing Logic @@ -115,9 +122,9 @@ def get_id_for_zone(name: str) -> int: zone_fog = ent.properties.get("zone_fog", "") print(f"+ Found a spawn_zone entity:") - print(f" - Name: {zone_name}") - print(f" - Target: {zone_target}") - print(f" - Fog: {zone_fog}") + print(f" - Name: {zone_name}") + print(f" - Target: {zone_target}") + print(f" - Fog: [{zone_fog}]") # Resolve adjacent zones adjacents = ent.properties.get("adjacent_zones", "") @@ -127,7 +134,15 @@ def get_id_for_zone(name: str) -> int: if z.strip() ] - print(f" - Adjacent: {adjacent_zones}") + print(f" - Adjacent: {adjacent_zones}") + + # Resolve door waypoint targets + door_waypoints = ent.properties.get("door_way_targets", "") + door_waypoint_targets = [ + z.strip() for z in door_waypoints.split(",") if z.strip() + ] + + print(f" - Door Targets: {door_waypoint_targets}") # Zone brushes brushes = [] @@ -145,6 +160,7 @@ def get_id_for_zone(name: str) -> int: target=zone_target, fog=zone_fog, adjacent_zones=adjacent_zones, + door_waypoint_targets=door_waypoint_targets, brushes=brushes, ) ) From c06425841ff44b7615659215144d0962e313739c Mon Sep 17 00:00:00 2001 From: cypress Date: Tue, 23 Dec 2025 15:45:48 -0800 Subject: [PATCH 2/2] Update test outputs --- tests/nszs/nzp_warehouse2.nsz | 11 ++++++++++- tests/nszs/nzp_zone_test.nsz | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/tests/nszs/nzp_warehouse2.nsz b/tests/nszs/nzp_warehouse2.nsz index 39f7163..938a4ba 100644 --- a/tests/nszs/nzp_warehouse2.nsz +++ b/tests/nszs/nzp_warehouse2.nsz @@ -1,4 +1,4 @@ -zone_file_version: 1.0.0 +zone_file_version: 1.1.0 number_of_zones: 9 spawn_zone 2 @@ -9,6 +9,7 @@ z1 1 -1104.0 -852.0 304.0 -4.0 -348.0 440.0 +0 spawn_zone_up 1 z9 @@ -18,6 +19,7 @@ z9 1 -1108.0 -852.0 440.0 -4.0 -348.0 576.0 +0 trench_zone 4 z5 @@ -27,6 +29,7 @@ z5 1 -2220.0 -852.0 304.0 -1120.0 -348.0 440.0 +0 trench_zone_up 3 z11 @@ -36,6 +39,7 @@ z11 1 -2220.0 -852.0 440.0 -1116.0 -348.0 576.0 +0 outdoor_zone 6 z6 @@ -46,6 +50,7 @@ z6 1 -2224.0 -332.0 304.0 -1124.0 172.0 440.0 +0 mule_zone 5 z7 @@ -56,6 +61,7 @@ z7 1 -1104.0 -324.0 304.0 -4.0 180.0 576.0 +0 big_zone_left 9 z8 @@ -67,6 +73,7 @@ z8 1 12.0 -888.0 208.0 1436.0 -192.0 568.0 +0 big_zone_right 7 z12 @@ -78,6 +85,7 @@ z12 1 12.0 -192.0 208.0 1436.0 504.0 568.0 +0 box_zone 8 z10 @@ -88,3 +96,4 @@ z10 1 1452.0 -336.0 208.0 1996.0 828.0 476.0 +0 diff --git a/tests/nszs/nzp_zone_test.nsz b/tests/nszs/nzp_zone_test.nsz index 7d97c1e..ac90be3 100644 --- a/tests/nszs/nzp_zone_test.nsz +++ b/tests/nszs/nzp_zone_test.nsz @@ -1,4 +1,4 @@ -zone_file_version: 1.0.0 +zone_file_version: 1.1.0 number_of_zones: 9 number_1 4 @@ -15,6 +15,7 @@ activate_zombs_1 -12.0 64.0 144.0 -12.0 -96.0 -0.0 44.0 64.0 144.0 +0 number_2 3 activate_zombs_2 @@ -32,6 +33,7 @@ activate_zombs_2 148.0 64.0 144.0 148.0 -96.0 -0.0 204.0 64.0 144.0 +0 number_3 6 activate_zombs_3 @@ -47,6 +49,7 @@ activate_zombs_3 308.0 64.0 144.0 308.0 -96.0 -0.0 364.0 64.0 144.0 +0 number_4 1 activate_zombs_4 @@ -64,6 +67,7 @@ activate_zombs_4 -12.0 -96.0 144.0 -12.0 -256.0 -0.0 44.0 -96.0 144.0 +0 number_5 2 activate_zombs_5 @@ -84,6 +88,7 @@ activate_zombs_5 148.0 -96.0 144.0 148.0 -256.0 -0.0 204.0 -96.0 144.0 +0 number_6 5 activate_zombs_6 @@ -101,6 +106,7 @@ activate_zombs_6 308.0 -96.0 144.0 308.0 -256.0 -0.0 364.0 -96.0 144.0 +0 number_7 7 activate_zombs_7 @@ -116,6 +122,7 @@ activate_zombs_7 -12.0 -256.0 144.0 -12.0 -416.0 -0.0 44.0 -256.0 144.0 +0 number_8 8 activate_zombs_8 @@ -133,6 +140,7 @@ activate_zombs_8 148.0 -256.0 144.0 148.0 -416.0 -0.0 204.0 -256.0 144.0 +0 number_9 9 activate_zombs_9 @@ -148,3 +156,4 @@ activate_zombs_9 308.0 -256.0 144.0 308.0 -416.0 -0.0 364.0 -256.0 144.0 +0