From 19e80c32c71b13a1255fc9bf054606163402b498 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Sat, 15 Jun 2024 05:17:39 +0200 Subject: [PATCH] [MIRROR] Tweaks some instances of get_safe_turf so things like the nuclear disk doesn't accidentally teleport to the Icebox Syndicate Base (#28184) * Tweaks some instances of get_safe_turf so things like the nuclear disk doesn't accidentally teleport to the Icebox Syndicate Base (#83012) Yes, I know preventing the nuke disk teleporting to the icebox syndicate base (or possibly the wendigo arena) is removing soul. Please don't kill me :( ## About The Pull Request Adds some missing variables to instances of get_safe_turf() so they will only teleport to the given z-level. Replaces some instances of get_safe_turf() with get_safe_random_station_turf(). ## Why It's Good For The Game First, the differences between get_safe_turf() and get_safe_random_station_turf(): ### get_safe_turf() - gets a random safe turf on a z-level (usually any of the staiton z-levels), not accounting for the /area/ - should be used if you don't care if it spawns on the station or not, or if you need to specifically teleport to a z-level - not very expensive performance wise ### get_safe_random_station_turf() - gets a random safe turf that will always be a station area, ignoring z-level. - should be used if you NEED the turf to be on a station's area - slightly more expensive performance wise than get_safe_turf, but still very cheap Some code was using get_safe_turf() when it should've been using get_safe_random_station_turf(), and some code that should be using get_safe_turf() were incorrectly using the zlevels arg instead of zlevel arg (Yes, there is a difference), or didn't include it at all. All the changes were made to my best judgement. If you're curious about a change, please ask and I will explain why I did it. ## Changelog :cl: BurgerBB fix: Tweaks some instances of get_safe_turf so things like the nuclear disk doesn't accidentally teleport to the Icebox Syndicate Base /:cl: --------- Co-authored-by: Jacquerel * Tweaks some instances of get_safe_turf so things like the nuclear disk doesn't accidentally teleport to the Icebox Syndicate Base --------- Co-authored-by: BurgerLUA <8602857+BurgerLUA@users.noreply.github.com> Co-authored-by: Jacquerel --- code/datums/components/stationloving.dm | 3 ++- code/modules/admin/fun_balloon.dm | 2 +- code/modules/antagonists/blob/overmind.dm | 2 +- code/modules/antagonists/heretic/items/heretic_blades.dm | 2 +- code/modules/antagonists/wizard/equipment/artefact.dm | 2 +- code/modules/awaymissions/signpost.dm | 2 +- code/modules/events/electrical_storm.dm | 2 +- .../simple_animal/hostile/megafauna/demonic_frost_miner.dm | 2 +- code/modules/projectiles/guns/magic/wand.dm | 2 +- code/modules/projectiles/projectile/magic.dm | 2 +- .../research/xenobiology/crossbreeding/_status_effects.dm | 2 +- 11 files changed, 12 insertions(+), 11 deletions(-) diff --git a/code/datums/components/stationloving.dm b/code/datums/components/stationloving.dm index 72481bed279..35f67d9cd02 100644 --- a/code/datums/components/stationloving.dm +++ b/code/datums/components/stationloving.dm @@ -51,7 +51,8 @@ /// Teleports parent to a safe turf on the station z-level. /datum/component/stationloving/proc/relocate() - var/target_turf = find_safe_turf() + + var/target_turf = length(GLOB.the_station_areas) ? get_safe_random_station_turf(GLOB.the_station_areas) : find_safe_turf() //Fallback. Mostly for debug maps. if(!target_turf) if(GLOB.blobstart.len > 0) diff --git a/code/modules/admin/fun_balloon.dm b/code/modules/admin/fun_balloon.dm index 19637e5e94f..04300582160 100644 --- a/code/modules/admin/fun_balloon.dm +++ b/code/modules/admin/fun_balloon.dm @@ -135,7 +135,7 @@ /obj/effect/fun_balloon/scatter/effect() for(var/mob/living/M in range(effect_range, get_turf(src))) - var/turf/T = find_safe_turf() + var/turf/T = find_safe_turf(zlevel = src.z) new /obj/effect/temp_visual/gravpush(get_turf(M)) M.forceMove(T) to_chat(M, span_notice("Pop!"), confidential = TRUE) diff --git a/code/modules/antagonists/blob/overmind.dm b/code/modules/antagonists/blob/overmind.dm index e4bba052423..ea6706f96e9 100644 --- a/code/modules/antagonists/blob/overmind.dm +++ b/code/modules/antagonists/blob/overmind.dm @@ -87,7 +87,7 @@ GLOBAL_LIST_EMPTY(blob_nodes) break else // no blob starts so look for an alternate for(var/i in 1 to 16) - var/turf/picked_safe = find_safe_turf() + var/turf/picked_safe = get_safe_random_station_turf() if(is_valid_turf(picked_safe)) T = picked_safe break diff --git a/code/modules/antagonists/heretic/items/heretic_blades.dm b/code/modules/antagonists/heretic/items/heretic_blades.dm index e8982c4c87c..675f5f87b0a 100644 --- a/code/modules/antagonists/heretic/items/heretic_blades.dm +++ b/code/modules/antagonists/heretic/items/heretic_blades.dm @@ -39,7 +39,7 @@ SEND_SIGNAL(user, COMSIG_HERETIC_BLADE_ATTACK, target, src) /obj/item/melee/sickly_blade/attack_self(mob/user) - var/turf/safe_turf = find_safe_turf(zlevels = z, extended_safety_checks = TRUE) + var/turf/safe_turf = find_safe_turf(zlevel = z, extended_safety_checks = TRUE) if(IS_HERETIC_OR_MONSTER(user)) if(do_teleport(user, safe_turf, channel = TELEPORT_CHANNEL_MAGIC)) to_chat(user, span_warning("As you shatter [src], you feel a gust of energy flow through your body. [after_use_message]")) diff --git a/code/modules/antagonists/wizard/equipment/artefact.dm b/code/modules/antagonists/wizard/equipment/artefact.dm index 2e4a438354d..9176558c7a1 100644 --- a/code/modules/antagonists/wizard/equipment/artefact.dm +++ b/code/modules/antagonists/wizard/equipment/artefact.dm @@ -378,7 +378,7 @@ addtimer(CALLBACK(src, PROC_REF(send_away)), 2 SECONDS) /obj/effect/temp_visual/teleporting_tornado/proc/send_away() - var/turf/ending_turfs = find_safe_turf() + var/turf/ending_turfs = get_safe_random_station_turf() for(var/mob/stored_mobs as anything in pickedup_mobs) do_teleport(stored_mobs, ending_turfs, channel = TELEPORT_CHANNEL_MAGIC) animate(stored_mobs, pixel_y = null, time = 1 SECONDS) diff --git a/code/modules/awaymissions/signpost.dm b/code/modules/awaymissions/signpost.dm index 864b4fa03f8..3c0fba87836 100644 --- a/code/modules/awaymissions/signpost.dm +++ b/code/modules/awaymissions/signpost.dm @@ -17,7 +17,7 @@ if(.) return if(tgui_alert(usr,question,name,list("Yes","No")) == "Yes" && Adjacent(user)) - var/turf/T = find_safe_turf(zlevels=zlevels) + var/turf/T = zlevels ? find_safe_turf(zlevels=zlevels) : get_safe_random_station_turf() if(T) var/atom/movable/AM = user.pulling diff --git a/code/modules/events/electrical_storm.dm b/code/modules/events/electrical_storm.dm index 84086260ea6..a51ab785bdd 100644 --- a/code/modules/events/electrical_storm.dm +++ b/code/modules/events/electrical_storm.dm @@ -22,7 +22,7 @@ var/list/epicentreList = list() for(var/i in 1 to lightsoutAmount) - var/turf/T = find_safe_turf() + var/turf/T = get_safe_random_station_turf() if(istype(T)) epicentreList += T diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/demonic_frost_miner.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/demonic_frost_miner.dm index 3415c45d12b..2af3018bed3 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/demonic_frost_miner.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/demonic_frost_miner.dm @@ -261,7 +261,7 @@ Difficulty: Extremely Hard clone.real_name = user.real_name INVOKE_ASYNC(user.dna, TYPE_PROC_REF(/datum/dna, transfer_identity), clone) clone.updateappearance(mutcolor_update=1) - var/turf/T = find_safe_turf() + var/turf/T = find_maintenance_spawn(atmos_sensitive = TRUE, require_darkness = TRUE) || find_safe_turf() user.forceMove(T) user.revive(ADMIN_HEAL_ALL) INVOKE_ASYNC(user, TYPE_PROC_REF(/mob/living/carbon, set_species), /datum/species/shadow) diff --git a/code/modules/projectiles/guns/magic/wand.dm b/code/modules/projectiles/guns/magic/wand.dm index db51944729f..e8f41ef0b48 100644 --- a/code/modules/projectiles/guns/magic/wand.dm +++ b/code/modules/projectiles/guns/magic/wand.dm @@ -191,7 +191,7 @@ /obj/item/gun/magic/wand/safety/zap_self(mob/living/user) var/turf/origin = get_turf(user) - var/turf/destination = find_safe_turf() + var/turf/destination = find_safe_turf(extended_safety_checks = TRUE) if(do_teleport(user, destination, channel=TELEPORT_CHANNEL_MAGIC)) for(var/t in list(origin, destination)) diff --git a/code/modules/projectiles/projectile/magic.dm b/code/modules/projectiles/projectile/magic.dm index 1a25f8e2370..23930f3cca7 100644 --- a/code/modules/projectiles/projectile/magic.dm +++ b/code/modules/projectiles/projectile/magic.dm @@ -110,7 +110,7 @@ return BULLET_ACT_HIT var/turf/origin_turf = get_turf(target) - var/turf/destination_turf = find_safe_turf() + var/turf/destination_turf = find_safe_turf(extended_safety_checks = TRUE) if(do_teleport(target, destination_turf, channel=TELEPORT_CHANNEL_MAGIC)) for(var/t in list(origin_turf, destination_turf)) diff --git a/code/modules/research/xenobiology/crossbreeding/_status_effects.dm b/code/modules/research/xenobiology/crossbreeding/_status_effects.dm index 4b4e6ce105c..658d0734f4e 100644 --- a/code/modules/research/xenobiology/crossbreeding/_status_effects.dm +++ b/code/modules/research/xenobiology/crossbreeding/_status_effects.dm @@ -706,7 +706,7 @@ if(healthcheck && (healthcheck - owner.health) > 5) owner.visible_message(span_warning("[linked_extract] notices the sudden change in [owner]'s physical health, and activates!")) do_sparks(5,FALSE,owner) - var/F = find_safe_turf(zlevels = owner.z, extended_safety_checks = TRUE) + var/F = find_safe_turf(zlevel = owner.z, extended_safety_checks = TRUE) var/range = 0 if(!F) F = get_turf(owner)