diff --git a/code/controllers/subsystem/shuttles/assault_pod.dm b/code/controllers/subsystem/shuttles/assault_pod.dm index 9811fafff5b..b2b75d2827b 100644 --- a/code/controllers/subsystem/shuttles/assault_pod.dm +++ b/code/controllers/subsystem/shuttles/assault_pod.dm @@ -37,8 +37,9 @@ if(!src || qdeleted(src)) return - var/turf/T = pick(get_area_turfs(picked_area)) - + var/turf/T = safepick(get_area_turfs(picked_area)) + if(!T) + return var/obj/docking_port/stationary/landing_zone = new /obj/docking_port/stationary(T) landing_zone.id = "assault_pod(\ref[src])" landing_zone.name = "Landing Zone" diff --git a/code/game/area/Space Station 13 areas.dm b/code/game/area/Space Station 13 areas.dm index 1846247a260..9d3164275e0 100644 --- a/code/game/area/Space Station 13 areas.dm +++ b/code/game/area/Space Station 13 areas.dm @@ -67,8 +67,8 @@ var/list/teleportlocs = list() for(var/area/AR in world) if(istype(AR, /area/shuttle) || istype(AR, /area/wizard_station)) continue if(teleportlocs.Find(AR.name)) continue - var/turf/picked = pick(get_area_turfs(AR.type)) - if (picked.z == ZLEVEL_STATION) + var/turf/picked = safepick(get_area_turfs(AR.type)) + if (picked && (picked.z == ZLEVEL_STATION)) teleportlocs += AR.name teleportlocs[AR.name] = AR diff --git a/code/modules/admin/verbs/adminjump.dm b/code/modules/admin/verbs/adminjump.dm index 44a59ede8c3..f4f2a795adc 100644 --- a/code/modules/admin/verbs/adminjump.dm +++ b/code/modules/admin/verbs/adminjump.dm @@ -16,7 +16,7 @@ continue turfs.Add(T) - var/turf/T = pick_n_take(turfs) + var/turf/T = safepick(turfs) if(!T) src << "Nowhere to jump to!" return @@ -143,18 +143,23 @@ return var/area/A = input(usr, "Pick an area.", "Pick an area") in sortedAreas|null if(A && istype(A)) - admin_forcemove(M, pick(get_area_turfs(A))) feedback_add_details("admin_verb","SMOB") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! - log_admin("[key_name(usr)] teleported [key_name(M)] to [A]") - message_admins("[key_name_admin(usr)] teleported [key_name_admin(M)] to [A]") + if(admin_forcemove(M, safepick(get_area_turfs(A)))) + log_admin("[key_name(usr)] teleported [key_name(M)] to [A]") + message_admins("[key_name_admin(usr)] teleported [key_name_admin(M)] to [A]") + else + src << "Failed to move mob to a valid location." /proc/admin_forcemove(mob/mover, atom/newloc) + if(!newloc) + return 0 if(mover.buckled) mover.buckled.unbuckle_mob() if(mover.buckled_mob) mover.unbuckle_mob(force=1) mover.loc = newloc mover.on_forcemove(newloc) + return 1 /mob/proc/on_forcemove(atom/newloc) return diff --git a/code/modules/events/anomaly.dm b/code/modules/events/anomaly.dm index 510c94bda0e..547618e63de 100644 --- a/code/modules/events/anomaly.dm +++ b/code/modules/events/anomaly.dm @@ -26,7 +26,7 @@ priority_announce("Localized energetic flux wave detected on long range scanners. Expected location of impact: [impact_area.name].", "Anomaly Alert") /datum/round_event/anomaly/start() - var/turf/T = pick(get_area_turfs(impact_area)) + var/turf/T = safepick(get_area_turfs(impact_area)) if(T) newAnomaly = new /obj/effect/anomaly/flux(T) diff --git a/code/modules/events/anomaly_bluespace.dm b/code/modules/events/anomaly_bluespace.dm index 3ebaa6ba03a..df4d6ffd8d3 100644 --- a/code/modules/events/anomaly_bluespace.dm +++ b/code/modules/events/anomaly_bluespace.dm @@ -15,14 +15,14 @@ /datum/round_event/anomaly/anomaly_bluespace/start() - var/turf/T = pick(get_area_turfs(impact_area)) + var/turf/T = safepick(get_area_turfs(impact_area)) if(T) newAnomaly = new /obj/effect/anomaly/bluespace(T) /datum/round_event/anomaly/anomaly_bluespace/end() if(newAnomaly.loc)//If it hasn't been neutralized, it's time to warp half the station away jeez - var/turf/T = pick(get_area_turfs(impact_area)) + var/turf/T = safepick(get_area_turfs(impact_area)) if(T) // Calculate new position (searches through beacons in world) var/obj/item/device/radio/beacon/chosen diff --git a/code/modules/events/anomaly_flux.dm b/code/modules/events/anomaly_flux.dm index 5400832b5e5..7d8da5021df 100644 --- a/code/modules/events/anomaly_flux.dm +++ b/code/modules/events/anomaly_flux.dm @@ -15,7 +15,7 @@ /datum/round_event/anomaly/anomaly_flux/start() - var/turf/T = pick(get_area_turfs(impact_area)) + var/turf/T = safepick(get_area_turfs(impact_area)) if(T) newAnomaly = new /obj/effect/anomaly/flux(T) diff --git a/code/modules/events/anomaly_grav.dm b/code/modules/events/anomaly_grav.dm index 6f503170c4e..5c52df0a061 100644 --- a/code/modules/events/anomaly_grav.dm +++ b/code/modules/events/anomaly_grav.dm @@ -14,6 +14,6 @@ priority_announce("Gravitational anomaly detected on long range scanners. Expected location: [impact_area.name].", "Anomaly Alert") /datum/round_event/anomaly/anomaly_grav/start() - var/turf/T = pick(get_area_turfs(impact_area)) + var/turf/T = safepick(get_area_turfs(impact_area)) if(T) newAnomaly = new /obj/effect/anomaly/grav(T) \ No newline at end of file diff --git a/code/modules/events/anomaly_pyro.dm b/code/modules/events/anomaly_pyro.dm index 1d93cd37b44..f0d0ea10fd6 100644 --- a/code/modules/events/anomaly_pyro.dm +++ b/code/modules/events/anomaly_pyro.dm @@ -14,7 +14,7 @@ priority_announce("Pyroclastic anomaly detected on long range scanners. Expected location: [impact_area.name].", "Anomaly Alert") /datum/round_event/anomaly/anomaly_pyro/start() - var/turf/T = pick(get_area_turfs(impact_area)) + var/turf/T = safepick(get_area_turfs(impact_area)) if(T) newAnomaly = new /obj/effect/anomaly/pyro(T) diff --git a/code/modules/events/anomaly_vortex.dm b/code/modules/events/anomaly_vortex.dm index bfd8038ab01..72684b1a8bd 100644 --- a/code/modules/events/anomaly_vortex.dm +++ b/code/modules/events/anomaly_vortex.dm @@ -14,6 +14,6 @@ priority_announce("Localized high-intensity vortex anomaly detected on long range scanners. Expected location: [impact_area.name]", "Anomaly Alert") /datum/round_event/anomaly/anomaly_vortex/start() - var/turf/T = pick(get_area_turfs(impact_area)) + var/turf/T = safepick(get_area_turfs(impact_area)) if(T) newAnomaly = new /obj/effect/anomaly/bhole(T) \ No newline at end of file diff --git a/code/modules/mob/interactive.dm b/code/modules/mob/interactive.dm index 44ecafca878..b4e99618555 100644 --- a/code/modules/mob/interactive.dm +++ b/code/modules/mob/interactive.dm @@ -407,7 +407,7 @@ if(prob((FUZZY_CHANCE_LOW+FUZZY_CHANCE_HIGH)/2)) TARGET = pick(target_filter(ultra_range(MIN_RANGE_FIND,src,1))) else - TARGET = pick(get_area_turfs(job2area(myjob))) + TARGET = safepick(get_area_turfs(job2area(myjob))) tryWalk(TARGET) LAST_TARGET = TARGET @@ -424,6 +424,8 @@ /mob/living/carbon/human/interactive/proc/walk2derpless(target) set background = 1 + if(!target) + return 0 var/turf/T = get_turf(target) var/turf/D = get_step(src,dir) if(D)