Scope various unscoped locate() calls (#42195)

* Scope locate calls which are immediately checked against a list

* Remove silly use of locate from bible Topic

* Scope various locate calls (needs testing)

* More WIP

* Buff up lightswitches while we're here

* Tidy record browsing code

* Scope a few more locates

These have caused problems in the past (#41917, #39303). Continues #29349.

Also cleans up lightswitch code while I was already touching it.

I recommend a testmerge.
This commit is contained in:
Tad Hardesty
2019-01-06 20:39:27 +13:00
committed by oranges
parent 380bbad300
commit 3b2c0e27f7
22 changed files with 78 additions and 87 deletions
@@ -330,7 +330,8 @@
return
switch(action)
if("swap")
var/mob/living/carbon/human/selected = locate(params["ref"])
var/datum/species/jelly/slime/SS = H.dna.species
var/mob/living/carbon/human/selected = locate(params["ref"]) in SS.bodies
if(!can_swap(selected))
return
SStgui.close_uis(src)
+3 -3
View File
@@ -349,7 +349,7 @@
unset_machine()
src << browse(null, t1)
if (href_list["switchcamera"])
switchCamera(locate(href_list["switchcamera"])) in GLOB.cameranet.cameras
switchCamera(locate(href_list["switchcamera"]) in GLOB.cameranet.cameras)
if (href_list["showalerts"])
ai_alerts()
#ifdef AI_VOX
@@ -362,7 +362,7 @@
src << browse(last_paper_seen, "window=show_paper")
//Carn: holopad requests
if(href_list["jumptoholopad"])
var/obj/machinery/holopad/H = locate(href_list["jumptoholopad"])
var/obj/machinery/holopad/H = locate(href_list["jumptoholopad"]) in GLOB.machines
if(H)
H.attack_ai(src) //may as well recycle
else
@@ -404,7 +404,7 @@
return
if (href_list["ai_take_control"]) //Mech domination
var/obj/mecha/M = locate(href_list["ai_take_control"])
var/obj/mecha/M = locate(href_list["ai_take_control"]) in GLOB.mechas_list
if (!M)
return
@@ -214,7 +214,7 @@
if(silent)
return alert("Communications circuits remain uninitialized.")
var/target = locate(href_list["target"])
var/target = locate(href_list["target"]) in GLOB.PDAs
pda.create_message(src, target)
// Accessing medical records