diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm
index 6ee1e073034..fc629db5b56 100644
--- a/code/__HELPERS/unsorted.dm
+++ b/code/__HELPERS/unsorted.dm
@@ -643,15 +643,7 @@ Turf and target are seperate in case you want to teleport some distance from a t
// called when a browser popup window is closed after registering with proc/onclose()
// if a valid atom reference is supplied, call the atom's Topic() with "close=1"
// otherwise, just reset the client mob's machine var.
-//
-//Will return the location of the turf an atom is ultimatly sitting on
-/proc/get_turf_loc(var/atom/movable/M) //gets the location of the turf that the atom is on, or what the atom is in is on, etc
- //in case they're in a closet or sleeper or something
- var/atom/loc = M.loc
- while(!istype(loc, /turf/))
- loc = loc.loc
- return loc
// returns the turf located at the map edge in the specified direction relative to A
// used for mass driver
@@ -1242,21 +1234,11 @@ proc/get_mob_with_client_list()
else return zone
-/proc/get_turf(const/atom/O)
- if (isnull(O) || isarea(O))
+/proc/get_turf(atom/A)
+ if (!istype(A))
return
-
- var/atom/A = O
-
- for (var/i = 0, ++i <= 20)
- if (isturf(A))
- return A
-
- switch (istype(A))
- if (1)
- A = A.loc
- if (0)
- return
+ for(A, A && !isturf(A), A=A.loc); //semicolon is for the empty statement
+ return A
//Finds the distance between two atoms, in pixels
//centered = 0 counts from turf edge to edge
diff --git a/code/game/machinery/computer/prisoner.dm b/code/game/machinery/computer/prisoner.dm
index 5bef2a94555..0e575139ede 100644
--- a/code/game/machinery/computer/prisoner.dm
+++ b/code/game/machinery/computer/prisoner.dm
@@ -64,7 +64,7 @@
var/loc_display = "Unknown"
var/mob/living/carbon/M = T.imp_in
if((M.z in config.station_levels) && !istype(M.loc, /turf/space))
- var/turf/mob_loc = get_turf_loc(M)
+ var/turf/mob_loc = get_turf(M)
loc_display = mob_loc.loc
if(T.malfunction)
loc_display = pick(teleportlocs)
diff --git a/code/game/objects/items/shooting_range.dm b/code/game/objects/items/shooting_range.dm
index dfd5777d9d0..a40cc5674d7 100644
--- a/code/game/objects/items/shooting_range.dm
+++ b/code/game/objects/items/shooting_range.dm
@@ -61,7 +61,7 @@
user.put_in_hands(src)
user << "You take the target out of the stake."
else
- src.loc = get_turf_loc(user)
+ src.loc = get_turf(user)
user << "You take the target out of the stake."
stake.pinned_target = null
diff --git a/code/game/objects/structures/target_stake.dm b/code/game/objects/structures/target_stake.dm
index 08bcc985611..bb7ab804d9c 100644
--- a/code/game/objects/structures/target_stake.dm
+++ b/code/game/objects/structures/target_stake.dm
@@ -46,7 +46,7 @@
user.put_in_hands(pinned_target)
user << "You take the target out of the stake."
else
- pinned_target.loc = get_turf_loc(user)
+ pinned_target.loc = get_turf(user)
user << "You take the target out of the stake."
pinned_target = null
\ No newline at end of file
diff --git a/code/modules/admin/player_panel.dm b/code/modules/admin/player_panel.dm
index bcec12aaac5..b46aa563f60 100644
--- a/code/modules/admin/player_panel.dm
+++ b/code/modules/admin/player_panel.dm
@@ -461,7 +461,7 @@
if(M)
dat += "
| [M.real_name][M.client ? "" : " (logged out)"][M.stat == 2 ? " (DEAD)" : ""] | "
dat += "PM | "
- var/turf/mob_loc = get_turf_loc(M)
+ var/turf/mob_loc = get_turf(M)
dat += "[mob_loc.loc] |
"
else
dat += "| Head not found! |
"
@@ -471,7 +471,7 @@
if(M)
dat += "| [M.real_name][M.client ? "" : " (logged out)"][M.stat == 2 ? " (DEAD)" : ""] | "
dat += "PM | "
- var/turf/mob_loc = get_turf_loc(M)
+ var/turf/mob_loc = get_turf(M)
dat += "[mob_loc.loc] |
"
else
dat += "| Head not found! |
"
diff --git a/code/modules/admin/verbs/playsound.dm b/code/modules/admin/verbs/playsound.dm
index 8f02ba18611..ab132d792ec 100644
--- a/code/modules/admin/verbs/playsound.dm
+++ b/code/modules/admin/verbs/playsound.dm
@@ -29,7 +29,7 @@ var/list/sounds_cache = list()
log_admin("[key_name(src)] played a local sound [S]")
message_admins("[key_name_admin(src)] played a local sound [S]", 1)
- playsound(get_turf_loc(src.mob), S, 50, 0, 0)
+ playsound(get_turf(src.mob), S, 50, 0, 0)
feedback_add_details("admin_verb","PLS") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/proc/play_server_sound()
diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm
index a6553a6f4fc..73db8fa8449 100644
--- a/code/modules/power/apc.dm
+++ b/code/modules/power/apc.dm
@@ -469,7 +469,7 @@
user << "You start adding cables to the APC frame..."
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
if(do_after(user, 20) && C.amount >= 10)
- var/turf/T = get_turf_loc(src)
+ var/turf/T = get_turf(src)
var/obj/structure/cable/N = T.get_cable_node()
if (prob(50) && electrocute_mob(usr, N, N))
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
diff --git a/code/modules/reagents/Chemistry-Recipes.dm b/code/modules/reagents/Chemistry-Recipes.dm
index 5a7b9c359fd..e293ee744ea 100644
--- a/code/modules/reagents/Chemistry-Recipes.dm
+++ b/code/modules/reagents/Chemistry-Recipes.dm
@@ -200,7 +200,7 @@ datum
on_reaction(var/datum/reagents/holder)
var/obj/item/stack/sheet/metal/M = new /obj/item/stack/sheet/mineral/plastic
M.amount = 10
- M.loc = get_turf_loc(holder.my_atom)
+ M.loc = get_turf(holder.my_atom)
return
virus_food
@@ -390,10 +390,10 @@ datum
if(!H) //H is not null.
return
if(H.mind && H.mind.changeling) //Checks if H, the blood donor is a ling.
- for(var/mob/M in viewers(get_turf_loc(holder.my_atom), null))
+ for(var/mob/M in viewers(get_turf(holder.my_atom), null))
M.show_message( "The blood writhes and wriggles and sizzles away from the container!", 1, "You hear bubbling and sizzling.", 2)
else
- for(var/mob/M in viewers(get_turf_loc(holder.my_atom), null))
+ for(var/mob/M in viewers(get_turf(holder.my_atom), null))
M.show_message( "The blood seems to break apart in the fuel.", 1)
holder.del_reagent("blood")
return
@@ -411,10 +411,10 @@ datum
required_container = /obj/item/slime_extract/grey
required_other = 1
on_reaction(var/datum/reagents/holder)
- for(var/mob/O in viewers(get_turf_loc(holder.my_atom), null))
+ for(var/mob/O in viewers(get_turf(holder.my_atom), null))
O.show_message(text("\red Infused with plasma, the core begins to quiver and grow, and soon a new baby slime emerges from it!"), 1)
var/mob/living/carbon/slime/S = new /mob/living/carbon/slime
- S.loc = get_turf_loc(holder.my_atom)
+ S.loc = get_turf(holder.my_atom)
slimeinaprov
@@ -440,7 +440,7 @@ datum
on_reaction(var/datum/reagents/holder)
for(var/i = 1, i <= 3, i++)
var /obj/item/weapon/reagent_containers/food/snacks/monkeycube/M = new /obj/item/weapon/reagent_containers/food/snacks/monkeycube
- M.loc = get_turf_loc(holder.my_atom)
+ M.loc = get_turf(holder.my_atom)
//Green
slimemutate
@@ -464,10 +464,10 @@ datum
on_reaction(var/datum/reagents/holder)
var/obj/item/stack/sheet/metal/M = new /obj/item/stack/sheet/metal
M.amount = 15
- M.loc = get_turf_loc(holder.my_atom)
+ M.loc = get_turf(holder.my_atom)
var/obj/item/stack/sheet/plasteel/P = new /obj/item/stack/sheet/plasteel
P.amount = 5
- P.loc = get_turf_loc(holder.my_atom)
+ P.loc = get_turf(holder.my_atom)
//Gold
slimecrit
@@ -484,9 +484,9 @@ datum
var/list/critters = typesof(/mob/living/simple_animal/hostile) - blocked // list of possible hostile mobs
- playsound(get_turf_loc(holder.my_atom), 'sound/effects/phasein.ogg', 100, 1)
+ playsound(get_turf(holder.my_atom), 'sound/effects/phasein.ogg', 100, 1)
- for(var/mob/living/carbon/human/M in viewers(get_turf_loc(holder.my_atom), null))
+ for(var/mob/living/carbon/human/M in viewers(get_turf(holder.my_atom), null))
if(M:eyecheck() <= 0)
flick("e_flash", M.flash)
@@ -494,11 +494,11 @@ datum
var/chosen = pick(critters)
var/mob/living/simple_animal/hostile/C = new chosen
C.faction |= "slimesummon"
- C.loc = get_turf_loc(holder.my_atom)
+ C.loc = get_turf(holder.my_atom)
if(prob(50))
for(var/j = 1, j <= rand(1, 3), j++)
step(C, pick(NORTH,SOUTH,EAST,WEST))
-// for(var/mob/O in viewers(get_turf_loc(holder.my_atom), null))
+// for(var/mob/O in viewers(get_turf(holder.my_atom), null))
// O.show_message(text("\red The slime core fizzles disappointingly,"), 1)
@@ -547,9 +547,9 @@ datum
var/list/borks = typesof(/obj/item/weapon/reagent_containers/food/snacks) - /obj/item/weapon/reagent_containers/food/snacks
// BORK BORK BORK
- playsound(get_turf_loc(holder.my_atom), 'sound/effects/phasein.ogg', 100, 1)
+ playsound(get_turf(holder.my_atom), 'sound/effects/phasein.ogg', 100, 1)
- for(var/mob/living/carbon/human/M in viewers(get_turf_loc(holder.my_atom), null))
+ for(var/mob/living/carbon/human/M in viewers(get_turf(holder.my_atom), null))
if(M:eyecheck() <= 0)
flick("e_flash", M.flash)
@@ -557,7 +557,7 @@ datum
var/chosen = pick(borks)
var/obj/B = new chosen
if(B)
- B.loc = get_turf_loc(holder.my_atom)
+ B.loc = get_turf(holder.my_atom)
if(prob(50))
for(var/j = 1, j <= rand(1, 3), j++)
step(B, pick(NORTH,SOUTH,EAST,WEST))
@@ -574,9 +574,9 @@ datum
var/list/borks = typesof(/obj/item/weapon/reagent_containers/food/drinks) - /obj/item/weapon/reagent_containers/food/drinks
// BORK BORK BORK
- playsound(get_turf_loc(holder.my_atom), 'sound/effects/phasein.ogg', 100, 1)
+ playsound(get_turf(holder.my_atom), 'sound/effects/phasein.ogg', 100, 1)
- for(var/mob/living/carbon/human/M in viewers(get_turf_loc(holder.my_atom), null))
+ for(var/mob/living/carbon/human/M in viewers(get_turf(holder.my_atom), null))
if(M:eyecheck() <= 0)
flick("e_flash", M.flash)
@@ -584,7 +584,7 @@ datum
var/chosen = pick(borks)
var/obj/B = new chosen
if(B)
- B.loc = get_turf_loc(holder.my_atom)
+ B.loc = get_turf(holder.my_atom)
if(prob(50))
for(var/j = 1, j <= rand(1, 3), j++)
step(B, pick(NORTH,SOUTH,EAST,WEST))
@@ -609,11 +609,11 @@ datum
required_container = /obj/item/slime_extract/darkblue
required_other = 1
on_reaction(var/datum/reagents/holder)
- for(var/mob/O in viewers(get_turf_loc(holder.my_atom), null))
+ for(var/mob/O in viewers(get_turf(holder.my_atom), null))
O.show_message(text("\red The slime extract begins to vibrate violently !"), 1)
sleep(50)
- playsound(get_turf_loc(holder.my_atom), 'sound/effects/phasein.ogg', 100, 1)
- for(var/mob/living/M in range (get_turf_loc(holder.my_atom), 7))
+ playsound(get_turf(holder.my_atom), 'sound/effects/phasein.ogg', 100, 1)
+ for(var/mob/living/M in range (get_turf(holder.my_atom), 7))
M.bodytemperature -= 140
M << "\blue You feel a chill!"
@@ -654,7 +654,7 @@ datum
required_container = /obj/item/slime_extract/yellow
required_other = 1
on_reaction(var/datum/reagents/holder, var/created_volume)
- empulse(get_turf_loc(holder.my_atom), 3, 7)
+ empulse(get_turf(holder.my_atom), 3, 7)
slimecell
@@ -667,7 +667,7 @@ datum
required_other = 1
on_reaction(var/datum/reagents/holder, var/created_volume)
var/obj/item/weapon/stock_parts/cell/slime/P = new /obj/item/weapon/stock_parts/cell/slime
- P.loc = get_turf_loc(holder.my_atom)
+ P.loc = get_turf(holder.my_atom)
slimeglow
name = "Slime Glow"
@@ -695,7 +695,7 @@ datum
required_other = 1
on_reaction(var/datum/reagents/holder)
var/obj/item/weapon/slimesteroid/P = new /obj/item/weapon/slimesteroid
- P.loc = get_turf_loc(holder.my_atom)
+ P.loc = get_turf(holder.my_atom)
@@ -721,7 +721,7 @@ datum
on_reaction(var/datum/reagents/holder)
var/obj/item/stack/sheet/mineral/plasma/P = new /obj/item/stack/sheet/mineral/plasma
P.amount = 10
- P.loc = get_turf_loc(holder.my_atom)
+ P.loc = get_turf(holder.my_atom)
//Red
slimeglycerol
@@ -745,7 +745,7 @@ datum
on_reaction(var/datum/reagents/holder)
for(var/mob/living/carbon/slime/slime in viewers(get_turf(holder.my_atom), null))
slime.rabid = 1
- for(var/mob/O in viewers(get_turf_loc(holder.my_atom), null))
+ for(var/mob/O in viewers(get_turf(holder.my_atom), null))
O.show_message(text("\red The [slime] is driven into a frenzy!."), 1)
//Pink
@@ -759,7 +759,7 @@ datum
required_other = 1
on_reaction(var/datum/reagents/holder)
var/obj/item/weapon/slimepotion/P = new /obj/item/weapon/slimepotion
- P.loc = get_turf_loc(holder.my_atom)
+ P.loc = get_turf(holder.my_atom)
//Black
@@ -782,10 +782,10 @@ datum
required_container = /obj/item/slime_extract/oil
required_other = 1
on_reaction(var/datum/reagents/holder)
- for(var/mob/O in viewers(get_turf_loc(holder.my_atom), null))
+ for(var/mob/O in viewers(get_turf(holder.my_atom), null))
O.show_message(text("\red The slime extract begins to vibrate violently !"), 1)
sleep(50)
- explosion(get_turf_loc(holder.my_atom), 1 ,3, 6)
+ explosion(get_turf(holder.my_atom), 1 ,3, 6)
//Light Pink
slimepotion2
name = "Slime Potion 2"
@@ -797,7 +797,7 @@ datum
required_other = 1
on_reaction(var/datum/reagents/holder)
var/obj/item/weapon/slimepotion2/P = new /obj/item/weapon/slimepotion2
- P.loc = get_turf_loc(holder.my_atom)
+ P.loc = get_turf(holder.my_atom)
//Adamantine
slimegolem
name = "Slime Golem"
@@ -1095,7 +1095,7 @@ datum
required_reagents = list("coffee" = 5, "sugar" = 5, "rum" = 5)
required_catalysts = list("enzyme" = 5)
result_amount = 5
-
+
kahluaVodka
name = "KahluaVodka"
id = "kahlauVodka"