From ff7fb307835432f25c5cf4533473c4bda7589c19 Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 3 Oct 2024 18:25:09 -0500 Subject: [PATCH] Automatically link maps multi-z up/down traits (#87029) ## About The Pull Request This autoloads the up/down traits for every map instead of having to manually add those traits to the JSON. ## Why It's Good For The Game More automation good. Also let's people experiment with larger maps like a multi-z lavaland. ## Changelog :cl: code: Automatically link maps multi-z up/down traits /:cl: --- _maps/icebox.json | 4 ---- _maps/multiz_debug.json | 4 ---- _maps/northstar.json | 6 ------ _maps/tramstation.json | 2 -- _maps/wawastation.json | 2 -- code/controllers/subsystem/mapping.dm | 14 ++++++++++++-- 6 files changed, 12 insertions(+), 20 deletions(-) diff --git a/_maps/icebox.json b/_maps/icebox.json index caa2c41d936..ea24dd33604 100644 --- a/_maps/icebox.json +++ b/_maps/icebox.json @@ -14,7 +14,6 @@ }, "traits": [ { - "Up": true, "Mining": true, "Linkage": null, "Gravity": true, @@ -23,8 +22,6 @@ "No Parallax": true }, { - "Down": true, - "Up": true, "Mining": true, "Linkage": null, "Gravity": true, @@ -33,7 +30,6 @@ "No Parallax": true }, { - "Down": true, "Mining": true, "Linkage": null, "Gravity": true, diff --git a/_maps/multiz_debug.json b/_maps/multiz_debug.json index e83101d74d7..af3ffa35212 100644 --- a/_maps/multiz_debug.json +++ b/_maps/multiz_debug.json @@ -11,17 +11,13 @@ ], "traits": [ { - "Up": true, "Linkage": "Cross" }, { - "Up": true, - "Down": true, "Baseturf": "/turf/open/openspace", "Linkage": "Cross" }, { - "Down": true, "Baseturf": "/turf/open/openspace", "Linkage": "Cross" } diff --git a/_maps/northstar.json b/_maps/northstar.json index bd1a53c5622..fdae8ac42f3 100644 --- a/_maps/northstar.json +++ b/_maps/northstar.json @@ -14,23 +14,17 @@ "space_empty_levels": 2, "traits": [ { - "Up": true, "Linkage": "Cross" }, { - "Up": true, - "Down": true, "Baseturf": "/turf/open/openspace", "Linkage": "Cross" }, { - "Up": true, - "Down": true, "Baseturf": "/turf/open/openspace", "Linkage": "Cross" }, { - "Down": true, "Baseturf": "/turf/open/openspace", "Linkage": "Cross" } diff --git a/_maps/tramstation.json b/_maps/tramstation.json index 7336decb3d7..5f5825dce68 100644 --- a/_maps/tramstation.json +++ b/_maps/tramstation.json @@ -11,12 +11,10 @@ }, "traits": [ { - "Up": true, "Baseturf": "/turf/open/misc/asteroid/airless", "Linkage": "Cross" }, { - "Down": true, "Baseturf": "/turf/open/openspace", "Linkage": "Cross" } diff --git a/_maps/wawastation.json b/_maps/wawastation.json index 71d716a56e0..71c818bc6bd 100644 --- a/_maps/wawastation.json +++ b/_maps/wawastation.json @@ -11,12 +11,10 @@ }, "traits": [ { - "Up": true, "Baseturf": "/turf/open/misc/asteroid/airless", "Linkage": "Cross" }, { - "Down": true, "Baseturf": "/turf/open/openspace", "Linkage": "Cross" } diff --git a/code/controllers/subsystem/mapping.dm b/code/controllers/subsystem/mapping.dm index 05f0746690b..742073efca9 100644 --- a/code/controllers/subsystem/mapping.dm +++ b/code/controllers/subsystem/mapping.dm @@ -386,13 +386,23 @@ Used by the AI doomsday and the self-destruct nuke. if (!length(traits)) // null or empty - default for (var/i in 1 to total_z) - traits += list(default_traits) + traits += list(default_traits.Copy()) else if (total_z != traits.len) // mismatch INIT_ANNOUNCE("WARNING: [traits.len] trait sets specified for [total_z] z-levels in [path]!") if (total_z < traits.len) // ignore extra traits traits.Cut(total_z + 1) while (total_z > traits.len) // fall back to defaults on extra levels - traits += list(default_traits) + traits += list(default_traits.Copy()) + + if(total_z > 1) // it's a multi z map + for(var/z in 1 to total_z) + if(z == 1) // bottom z-level + traits[z]["Up"] = TRUE + else if(z == total_z) // top z-level + traits[z]["Down"] = TRUE + else + traits[z]["Down"] = TRUE + traits[z]["Up"] = TRUE // preload the relevant space_level datums var/start_z = world.maxz + 1