From 19eaf7fc6f140ee0b54f3673ebd2ba1631966c8f Mon Sep 17 00:00:00 2001 From: Lucy Date: Sun, 23 Jun 2024 00:52:21 -0400 Subject: [PATCH] Mechcomp teleporter now work across floors on multi-z maps --- code/__HELPERS/~monkestation-helpers/mapping.dm | 6 ++++++ monkestation/code/modules/mech_comp/objects/teleporter.dm | 2 +- tgstation.dme | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 code/__HELPERS/~monkestation-helpers/mapping.dm diff --git a/code/__HELPERS/~monkestation-helpers/mapping.dm b/code/__HELPERS/~monkestation-helpers/mapping.dm new file mode 100644 index 000000000000..62d6f30564da --- /dev/null +++ b/code/__HELPERS/~monkestation-helpers/mapping.dm @@ -0,0 +1,6 @@ +/proc/are_zs_connected(atom/a, atom/b) + a = get_turf(a) + b = get_turf(b) + if(a.z == b.z) + return TRUE + return (b.z in SSmapping.get_connected_levels(a)) diff --git a/monkestation/code/modules/mech_comp/objects/teleporter.dm b/monkestation/code/modules/mech_comp/objects/teleporter.dm index 307bac142aaa..bcf50af2be3b 100644 --- a/monkestation/code/modules/mech_comp/objects/teleporter.dm +++ b/monkestation/code/modules/mech_comp/objects/teleporter.dm @@ -59,7 +59,7 @@ GLOBAL_LIST_INIT(live_teleporters, list()) continue if(!live_teleporter.anchored) continue - if((live_teleporter.teleID != teleID) || (live_teleporter.z != src.z) || live_teleporter.send_only) + if((live_teleporter.teleID != teleID) || live_teleporter.send_only || !are_zs_connected(src, live_teleporter)) continue if(!COOLDOWN_FINISHED(live_teleporter, teleporter_cooldown)) continue diff --git a/tgstation.dme b/tgstation.dme index dcefdb7d4606..86d1803b041b 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -561,6 +561,7 @@ #include "code\__HELPERS\~monkestation-helpers\clients.dm" #include "code\__HELPERS\~monkestation-helpers\cmp.dm" #include "code\__HELPERS\~monkestation-helpers\icon_smoothing.dm" +#include "code\__HELPERS\~monkestation-helpers\mapping.dm" #include "code\__HELPERS\~monkestation-helpers\roundend.dm" #include "code\__HELPERS\~monkestation-helpers\time.dm" #include "code\__HELPERS\~monkestation-helpers\virology.dm"