diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 9c3b69676e3..30b7b3774e7 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -549,14 +549,6 @@ Turf and target are seperate in case you want to teleport some distance from a t return key_name(whom, 1, include_name) -//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 /proc/get_edge_target_turf(var/atom/A, var/direction) @@ -1167,8 +1159,9 @@ proc/get_mob_with_client_list() else if (zone == "r_foot") return "right foot" else return zone - -/proc/get_turf(turf/location) +//gets the turf the atom is located in (or itself, if it is a turf). +//returns null if the atom is not in a turf. +/proc/get_turf(atom/location) while(location) if(isturf(location)) return location diff --git a/code/game/machinery/alarm.dm b/code/game/machinery/alarm.dm index 33d9cb5523e..beced0067b1 100644 --- a/code/game/machinery/alarm.dm +++ b/code/game/machinery/alarm.dm @@ -1248,7 +1248,7 @@ Code shamelessly copied from apc_frame if (!(ndir in cardinal)) return - var/turf/loc = get_turf_loc(usr) + var/turf/loc = get_turf(usr) var/area/A = loc.loc if (!istype(loc, /turf/simulated/floor)) usr << "\red Air Alarm cannot be placed on this spot." @@ -1576,7 +1576,7 @@ Code shamelessly copied from apc_frame if (!(ndir in cardinal)) return - var/turf/loc = get_turf_loc(usr) + var/turf/loc = get_turf(usr) var/area/A = loc.loc if (!istype(loc, /turf/simulated/floor)) usr << "\red Fire Alarm cannot be placed on this spot." diff --git a/code/game/machinery/computer/prisoner.dm b/code/game/machinery/computer/prisoner.dm index ca0512e2cbd..cb3e0f8f11b 100644 --- a/code/game/machinery/computer/prisoner.dm +++ b/code/game/machinery/computer/prisoner.dm @@ -50,7 +50,7 @@ var/loc_display = "Unknown" var/mob/living/carbon/M = T.imp_in if(M.z == 1 && !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/blueprints.dm b/code/game/objects/items/blueprints.dm index 5c5b1b6fd81..ff1a1fb14e6 100644 --- a/code/game/objects/items/blueprints.dm +++ b/code/game/objects/items/blueprints.dm @@ -74,7 +74,7 @@ move an amendment to the drawing.

/obj/item/blueprints/proc/get_area() - var/turf/T = get_turf_loc(usr) + var/turf/T = get_turf(usr) var/area/A = T.loc A = A.master return A @@ -101,7 +101,7 @@ move an amendment to the drawing.

/obj/item/blueprints/proc/create_area() //world << "DEBUG: create_area" - var/res = detect_room(get_turf_loc(usr)) + var/res = detect_room(get_turf(usr)) if(!istype(res,/list)) switch(res) if(ROOM_ERR_SPACE) diff --git a/code/game/objects/items/shooting_range.dm b/code/game/objects/items/shooting_range.dm index 556f3a52220..54c159d8db7 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 1e9ac37a558..2a8d7719b2a 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 21c1b6344c7..933683d1f28 100644 --- a/code/modules/admin/player_panel.dm +++ b/code/modules/admin/player_panel.dm @@ -439,7 +439,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 20a3862300f..6ff66c46476 100644 --- a/code/modules/admin/verbs/playsound.dm +++ b/code/modules/admin/verbs/playsound.dm @@ -22,7 +22,7 @@ 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! diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index 63d48df7580..bb1e49ebc37 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -507,7 +507,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/power/lighting.dm b/code/modules/power/lighting.dm index 24465bc08fe..74d2a476f02 100644 --- a/code/modules/power/lighting.dm +++ b/code/modules/power/lighting.dm @@ -34,7 +34,7 @@ var/ndir = get_dir(usr,on_wall) if (!(ndir in cardinal)) return - var/turf/loc = get_turf_loc(usr) + var/turf/loc = get_turf(usr) if (!istype(loc, /turf/simulated/floor)) usr << "\red [src.name] cannot be placed on this spot." return diff --git a/code/modules/reagents/Chemistry-Recipes.dm b/code/modules/reagents/Chemistry-Recipes.dm index 7ac41196307..fbc3488d918 100644 --- a/code/modules/reagents/Chemistry-Recipes.dm +++ b/code/modules/reagents/Chemistry-Recipes.dm @@ -841,8 +841,8 @@ datum if(chosen) // Calculate previous position for transition - var/turf/FROM = get_turf_loc(holder.my_atom) // the turf of origin we're travelling FROM - var/turf/TO = get_turf_loc(chosen) // the turf of origin we're travelling TO + var/turf/FROM = get_turf(holder.my_atom) // the turf of origin we're travelling FROM + var/turf/TO = get_turf(chosen) // the turf of origin we're travelling TO playsound(TO, 'sound/effects/phasein.ogg', 100, 1) @@ -903,16 +903,16 @@ datum )//exclusion list for things you don't want the reaction to create. 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) for(var/i = 1, i <= created_volume, i++) var/chosen = pick(critters) var/mob/living/simple_animal/hostile/C = new chosen - 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)) @@ -929,9 +929,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) @@ -939,7 +939,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)) @@ -1009,10 +1009,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 phoron, 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) slimemonkey @@ -1026,7 +1026,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 @@ -1050,10 +1050,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 @@ -1085,9 +1085,9 @@ datum )//exclusion list for things you don't want the reaction to create. 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) @@ -1095,11 +1095,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) //Silver @@ -1116,9 +1116,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) @@ -1126,7 +1126,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)) @@ -1151,11 +1151,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!" @@ -1178,7 +1178,7 @@ datum required_container = /obj/item/slime_extract/orange 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) var/turf/location = get_turf(holder.my_atom.loc) @@ -1202,7 +1202,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 @@ -1215,7 +1215,7 @@ datum required_other = 1 on_reaction(var/datum/reagents/holder, var/created_volume) var/obj/item/weapon/cell/slime/P = new /obj/item/weapon/cell/slime - P.loc = get_turf_loc(holder.my_atom) + P.loc = get_turf(holder.my_atom) slimeglow name = "Slime Glow" @@ -1226,7 +1226,7 @@ datum required_container = /obj/item/slime_extract/yellow 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 contents of the slime core harden and begin to emit a warm, bright light."), 1) var/obj/item/device/flashlight/slime/F = new /obj/item/device/flashlight/slime F.loc = get_turf(holder.my_atom) @@ -1243,7 +1243,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) @@ -1269,7 +1269,7 @@ datum on_reaction(var/datum/reagents/holder) var/obj/item/stack/sheet/mineral/phoron/P = new /obj/item/stack/sheet/mineral/phoron P.amount = 10 - P.loc = get_turf_loc(holder.my_atom) + P.loc = get_turf(holder.my_atom) //Red slimeglycerol @@ -1291,10 +1291,10 @@ datum required_container = /obj/item/slime_extract/red required_other = 1 on_reaction(var/datum/reagents/holder) - for(var/mob/living/carbon/slime/slime in viewers(get_turf_loc(holder.my_atom), null)) + for(var/mob/living/carbon/slime/slime in viewers(get_turf(holder.my_atom), null)) slime.tame = 0 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 @@ -1308,7 +1308,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 @@ -1331,10 +1331,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" @@ -1346,7 +1346,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" @@ -1358,7 +1358,7 @@ datum required_other = 1 on_reaction(var/datum/reagents/holder) var/obj/effect/golemrune/Z = new /obj/effect/golemrune - Z.loc = get_turf_loc(holder.my_atom) + Z.loc = get_turf(holder.my_atom) Z.announce_to_ghosts() //////////////////////////////////////////FOOD MIXTURES//////////////////////////////////// diff --git a/code/modules/recycling/sortingmachinery.dm b/code/modules/recycling/sortingmachinery.dm index ebd243da9db..c985d00372f 100755 --- a/code/modules/recycling/sortingmachinery.dm +++ b/code/modules/recycling/sortingmachinery.dm @@ -53,7 +53,7 @@ if(ishuman(user)) user.put_in_hands(wrapped) else - wrapped.loc = get_turf_loc(src) + wrapped.loc = get_turf(src) del(src) return