Fixes motion alarms (#20899)

Fixed motion alarms instantly triggering and de/un/re/triggering

The relevant changes are in motion.dm and ai_monitored.dm. 

Everything else is a replacement of /area/turret_protected -> /area/ai_monitored/turret_protected which is why this PR is a bitch
This commit is contained in:
Cyberboss
2016-10-12 15:52:49 +13:00
committed by oranges
parent 391567cdc6
commit a2a9dc7c60
12 changed files with 848 additions and 838 deletions
+2 -2
View File
@@ -102,8 +102,8 @@ var/datum/subsystem/events/SSevent
/datum/round_event/proc/findEventArea() //Here's a nice proc to use to find an area for your event to land in!
var/list/safe_areas = list(
/area/turret_protected/ai,
/area/turret_protected/ai_upload,
/area/ai_monitored/turret_protected/ai,
/area/ai_monitored/turret_protected/ai_upload,
/area/engine,
/area/solar,
/area/holodeck,
+1 -1
View File
@@ -132,7 +132,7 @@
end_message = "<span class='notice'>The air seems to be cooling off again.</span>"
area_type = /area
protected_areas = list(/area/maintenance, /area/turret_protected/ai_upload, /area/turret_protected/ai_upload_foyer, /area/turret_protected/ai)
protected_areas = list(/area/maintenance, /area/ai_monitored/turret_protected/ai_upload, /area/ai_monitored/turret_protected/ai_upload_foyer, /area/ai_monitored/turret_protected/ai)
target_z = ZLEVEL_STATION
immunity_type = "rad"
+21 -19
View File
@@ -83,7 +83,9 @@ var/list/teleportlocs = list()
/area/engine/
/area/turret_protected/
/area/ai_monitored //stub defined ai_monitored.dm
/area/ai_monitored/turret_protected/
/area/arrival
requires_power = 0
@@ -1231,22 +1233,22 @@ var/list/teleportlocs = list()
icon_state = "storage"
/area/turret_protected/
/area/ai_monitored/turret_protected/
ambientsounds = list('sound/ambience/ambimalf.ogg')
/area/turret_protected/ai_upload
/area/ai_monitored/turret_protected/ai_upload
name = "AI Upload Chamber"
icon_state = "ai_upload"
/area/turret_protected/ai_upload_foyer
/area/ai_monitored/turret_protected/ai_upload_foyer
name = "AI Upload Access"
icon_state = "ai_foyer"
/area/turret_protected/ai
/area/ai_monitored/turret_protected/ai
name = "AI Chamber"
icon_state = "ai_chamber"
/area/turret_protected/aisat
/area/ai_monitored/turret_protected/aisat
name = "AI Satellite"
icon_state = "ai"
@@ -1254,35 +1256,35 @@ var/list/teleportlocs = list()
name = "AI Satellite Exterior"
icon_state = "yellow"
/area/turret_protected/aisat_interior
/area/ai_monitored/turret_protected/aisat_interior
name = "AI Satellite Antechamber"
icon_state = "ai"
/area/turret_protected/AIsatextFP
/area/ai_monitored/turret_protected/AIsatextFP
name = "AI Sat Ext"
icon_state = "storage"
luminosity = 1
lighting_use_dynamic = DYNAMIC_LIGHTING_IFSTARLIGHT
/area/turret_protected/AIsatextFS
/area/ai_monitored/turret_protected/AIsatextFS
name = "AI Sat Ext"
icon_state = "storage"
luminosity = 1
lighting_use_dynamic = DYNAMIC_LIGHTING_IFSTARLIGHT
/area/turret_protected/AIsatextAS
/area/ai_monitored/turret_protected/AIsatextAS
name = "AI Sat Ext"
icon_state = "storage"
luminosity = 1
lighting_use_dynamic = DYNAMIC_LIGHTING_IFSTARLIGHT
/area/turret_protected/AIsatextAP
/area/ai_monitored/turret_protected/AIsatextAP
name = "AI Sat Ext"
icon_state = "storage"
luminosity = 1
lighting_use_dynamic = DYNAMIC_LIGHTING_IFSTARLIGHT
/area/turret_protected/NewAIMain
/area/ai_monitored/turret_protected/NewAIMain
name = "AI Main New"
icon_state = "storage"
@@ -1327,22 +1329,22 @@ var/list/teleportlocs = list()
name = "Abandoned Satellite"
icon_state = "tcomsatcham"
/area/turret_protected/tcomsat
/area/ai_monitored/turret_protected/tcomsat
name = "Telecoms Satellite"
icon_state = "tcomsatlob"
ambientsounds = list('sound/ambience/ambisin2.ogg', 'sound/ambience/signal.ogg', 'sound/ambience/signal.ogg', 'sound/ambience/ambigen10.ogg')
/area/turret_protected/tcomfoyer
/area/ai_monitored/turret_protected/tcomfoyer
name = "Telecoms Foyer"
icon_state = "tcomsatentrance"
ambientsounds = list('sound/ambience/ambisin2.ogg', 'sound/ambience/signal.ogg', 'sound/ambience/signal.ogg', 'sound/ambience/ambigen10.ogg')
/area/turret_protected/tcomwest
/area/ai_monitored/turret_protected/tcomwest
name = "Telecommunications Satellite West Wing"
icon_state = "tcomsatwest"
ambientsounds = list('sound/ambience/ambisin2.ogg', 'sound/ambience/signal.ogg', 'sound/ambience/signal.ogg', 'sound/ambience/ambigen10.ogg')
/area/turret_protected/tcomeast
/area/ai_monitored/turret_protected/tcomeast
name = "Telecommunications Satellite East Wing"
icon_state = "tcomsateast"
ambientsounds = list('sound/ambience/ambisin2.ogg', 'sound/ambience/signal.ogg', 'sound/ambience/signal.ogg', 'sound/ambience/ambigen10.ogg')
@@ -1641,7 +1643,7 @@ var/list/the_station_areas = list (
/area/ai_monitored/storage/eva, //do not try to simplify to "/area/ai_monitored" --rastaf0
// /area/ai_monitored/storage/secure, //not present on map
// /area/ai_monitored/storage/emergency, //not present on map
/area/turret_protected/ai_upload, //do not try to simplify to "/area/turret_protected" --rastaf0
/area/turret_protected/ai_upload_foyer,
/area/turret_protected/ai,
/area/ai_monitored/turret_protected/ai_upload, //do not try to simplify to "/area/ai_monitored/turret_protected" --rastaf0
/area/ai_monitored/turret_protected/ai_upload_foyer,
/area/ai_monitored/turret_protected/ai,
)
+20 -15
View File
@@ -1,24 +1,29 @@
/area/ai_monitored
name = "AI Monitored Area"
var/obj/machinery/camera/motioncamera = null
var/list/obj/machinery/camera/motioncameras = list()
var/list/motionTargets = list()
/area/ai_monitored/New()
/area/ai_monitored/initialize()
..()
// locate and store the motioncamera
spawn (20) // spawn on a delay to let turfs/objs load
for (var/obj/machinery/camera/M in src)
if(M.isMotion())
motioncamera = M
M.area_motion = src
for (var/obj/machinery/camera/M in src)
if(M.isMotion())
motioncameras.Add(M)
M.area_motion = src
//Only need to use one camera
/area/ai_monitored/Entered(atom/movable/O)
..()
if (ismob(O) && motioncamera)
motioncamera.newTarget(O)
if (ismob(O) && motioncameras.len)
for(var/X in motioncameras)
var/obj/machinery/camera/cam = X
cam.newTarget(O)
return
/area/ai_monitored/Exited(atom/movable/O)
if (ismob(O) && motioncamera)
motioncamera.lostTarget(O)
..()
if (ismob(O) && motioncameras.len)
for(var/X in motioncameras)
var/obj/machinery/camera/cam = X
cam.lostTarget(O)
return
+2 -2
View File
@@ -1,7 +1,7 @@
/proc/power_failure()
priority_announce("Abnormal activity detected in [station_name()]'s powernet. As a precautionary measure, the station's power will be shut off for an indeterminate duration.", "Critical Power Failure", 'sound/AI/poweroff.ogg')
for(var/obj/machinery/power/smes/S in machines)
if(istype(get_area(S), /area/turret_protected) || S.z != ZLEVEL_STATION)
if(istype(get_area(S), /area/ai_monitored/turret_protected) || S.z != ZLEVEL_STATION)
continue
S.charge = 0
S.output_level = 0
@@ -9,7 +9,7 @@
S.update_icon()
S.power_change()
var/list/skipped_areas = list(/area/engine/engineering, /area/turret_protected/ai)
var/list/skipped_areas = list(/area/engine/engineering, /area/ai_monitored/turret_protected/ai)
for(var/area/A in world)
if( !A.requires_power || A.always_unpowered )
+17 -14
View File
@@ -1,6 +1,6 @@
/obj/machinery/camera
var/list/motionTargets = list()
var/list/localMotionTargets = list()
var/detectTime = 0
var/area/ai_monitored/area_motion = null
var/alarm_delay = 30 // Don't forget, there's another 3 seconds in queueAlarm()
@@ -15,28 +15,31 @@
if (elapsed > alarm_delay)
triggerAlarm()
else if (detectTime == -1)
for (var/mob/target in motionTargets)
if (target.stat == 2) lostTarget(target)
// If not detecting with motion camera...
if (!area_motion)
// See if the camera is still in range
if(!in_range(src, target))
// If they aren't in range, lose the target.
lostTarget(target)
for (var/mob/target in getTargetList())
if (target.stat == DEAD || (!area_motion && !in_range(src, target)))
//If not part of a monitored area and the camera is not in range or the target is dead
lostTarget(target)
/obj/machinery/camera/proc/getTargetList()
if(area_motion)
return area_motion.motionTargets
return localMotionTargets
/obj/machinery/camera/proc/newTarget(mob/target)
if(isAI(target))
return 0
if (detectTime == 0)
detectTime = world.time // start the clock
if (!(target in motionTargets))
motionTargets += target
var/list/targets = getTargetList()
if (!(target in targets))
targets += target
return 1
/obj/machinery/camera/proc/lostTarget(mob/target)
if (target in motionTargets)
motionTargets -= target
if (motionTargets.len == 0)
var/list/targets = getTargetList()
if (target in targets)
targets -= target
if (targets.len == 0)
cancelAlarm()
/obj/machinery/camera/proc/cancelAlarm()
+1 -1
View File
@@ -95,7 +95,7 @@
if(prob(75)) //low dirt - 1/60
return
if(istype(A, /area/turret_protected) || istype(A, /area/security)) //chance of incident
if(istype(A, /area/ai_monitored/turret_protected) || istype(A, /area/security)) //chance of incident
if(prob(20))
if(prob(5))
new /obj/effect/decal/cleanable/blood/gibs/old(src)