mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-01-26 01:03:06 +00:00
* SDQL2 update * fix that verb * cl * fix that * toworld * this is pointless * update info * siiiiick.. * vv edit update * fix that * fix editing vars * fix VV * Port the /TG/ globals controller. * part 1 * part 2 * oops * part 3 * Hollow Purple * sadas * bsbsdb * muda na agaki ta * ids 1-15 * 16-31 * 41-75 * bring me back to how things used to be before i lost it all * the strength of mayhem * final touches * cl * protect some vars * update sdql2 to use glob * stuff? * forgot that is not defined there * whoops * observ * but it never gets better * a --------- Co-authored-by: Matt Atlas <liermattia@gmail.com>
39 lines
1.1 KiB
Plaintext
39 lines
1.1 KiB
Plaintext
/datum/event/camera_damage/start()
|
|
var/obj/machinery/camera/C = acquire_random_camera()
|
|
if(!C)
|
|
return
|
|
|
|
var/severity_range = 0
|
|
switch(severity)
|
|
if(EVENT_LEVEL_MUNDANE)
|
|
severity_range = 0
|
|
if(EVENT_LEVEL_MODERATE)
|
|
severity_range = 7
|
|
if(EVENT_LEVEL_MAJOR)
|
|
severity_range = 15
|
|
|
|
for(var/obj/machinery/camera/cam in range(severity_range,C))
|
|
if(is_valid_camera(cam))
|
|
if(prob(2*severity))
|
|
cam.destroy()
|
|
else
|
|
cam.wires.cut(WIRE_POWER, src)
|
|
if(prob(5*severity))
|
|
cam.wires.cut(WIRE_ALARM, src)
|
|
|
|
/datum/event/camera_damage/proc/acquire_random_camera(var/remaining_attempts = 5)
|
|
if(!GLOB.cameranet.cameras.len)
|
|
return
|
|
if(!remaining_attempts)
|
|
return
|
|
|
|
var/obj/machinery/camera/C = pick(GLOB.cameranet.cameras)
|
|
if(is_valid_camera(C))
|
|
return C
|
|
return acquire_random_camera(remaining_attempts-1)
|
|
|
|
/datum/event/camera_damage/proc/is_valid_camera(var/obj/machinery/camera/C)
|
|
// Only return a functional camera, not installed in a silicon, and that exists somewhere players have access
|
|
var/turf/T = get_turf(C)
|
|
return T && C.can_use() && !istype(C.loc, /mob/living/silicon) && isStationLevel(T.z)
|