diff --git a/code/game/area/areas.dm b/code/game/area/areas.dm
index 8279cde6a4..e90ca9e096 100644
--- a/code/game/area/areas.dm
+++ b/code/game/area/areas.dm
@@ -65,7 +65,7 @@
//Check all the alarms before lowering atmosalm. Raising is perfectly fine.
for (var/area/RA in related)
for (var/obj/machinery/alarm/AA in RA)
- if ( !(AA.stat & (NOPOWER|BROKEN)) && !AA.shorted)
+ if (!(AA.stat & (NOPOWER|BROKEN)) && !AA.shorted && AA.report_danger_level)
danger_level = max(danger_level, AA.danger_level)
if(danger_level != atmosalm)
diff --git a/code/game/machinery/alarm.dm b/code/game/machinery/alarm.dm
index cf329992c6..c74f03db43 100644
--- a/code/game/machinery/alarm.dm
+++ b/code/game/machinery/alarm.dm
@@ -78,13 +78,11 @@
var/temperature_dangerlevel = 0
var/other_dangerlevel = 0
- var/apply_danger_level = 1
- var/post_alert = 1
+ var/report_danger_level = 1
/obj/machinery/alarm/monitor
- apply_danger_level = 0
+ report_danger_level = 0
breach_detection = 0
- post_alert = 0
/obj/machinery/alarm/server/New()
..()
@@ -432,15 +430,12 @@
send_signal(device_id, list("power"= 0) )
/obj/machinery/alarm/proc/apply_danger_level(var/new_danger_level)
- if (apply_danger_level && alarm_area.atmosalert(new_danger_level))
+ if (report_danger_level && alarm_area.atmosalert(new_danger_level))
post_alert(new_danger_level)
update_icon()
/obj/machinery/alarm/proc/post_alert(alert_level)
- if(!post_alert)
- return
-
var/datum/radio_frequency/frequency = radio_controller.return_frequency(alarm_frequency)
if(!frequency)
return
diff --git a/code/game/machinery/portable_turret.dm b/code/game/machinery/portable_turret.dm
index 94dbd8b611..692d4da481 100644
--- a/code/game/machinery/portable_turret.dm
+++ b/code/game/machinery/portable_turret.dm
@@ -54,6 +54,10 @@
var/datum/effect/effect/system/spark_spread/spark_system //the spark system, used for generating... sparks?
+/obj/machinery/porta_turret/stationary
+ lethal = 1
+ installation = /obj/item/weapon/gun/energy/laser
+
/obj/machinery/porta_turret/New()
..()
icon_state = "grey_target_prism"
@@ -141,18 +145,25 @@
del(cover) // qdel
..()
+/obj/machinery/porta_turret/proc/can_use(mob/user)
+ if(ailock && issilicon(user))
+ user << "There seems to be a firewall preventing you from accessing this device."
+ return 0
+
+ if(locked && !issilicon(user))
+ user << "Access denied."
+ return 0
+
+ return 1
/obj/machinery/porta_turret/attack_ai(mob/user)
- if(!ailock)
- return attack_hand(user)
- else
- user << "There seems to be a firewall preventing you from accessing this device."
-
+ return attack_hand(user)
/obj/machinery/porta_turret/attack_hand(mob/user)
- . = ..()
- if(.)
- return
+ if(..())
+ return 1
+ if(!can_use(user))
+ return 1
interact(user)
/obj/machinery/porta_turret/interact(mob/user)
@@ -165,13 +176,17 @@
if(!locked || issilicon(user))
dat += text({"
- Neutralize All Non-Synthetics: []
- Check for Weapon Authorization: []
+ Lethal Mode: []
+ Neutralize All Non-Synthetics: []
"},
+
+ "[lethal ? "Enabled" : "Disabled"]",
+ "[ai ? "Yes" : "No"]")
+ if(!ai)
+ dat += text({"Check for Weapon Authorization: []
Check Security Records: []
Neutralize All Non-Authorized Personnel: []
Neutralize All Unidentified Life Signs: []
"},
- "[ai ? "Yes" : "No"]",
"[auth_weapons ? "Yes" : "No"]",
"[check_records ? "Yes" : "No"]",
"[stun_all ? "Yes" : "No"]",
@@ -181,14 +196,23 @@
onclose(user, "autosec")
return
+/obj/machinery/porta_turret/proc/HasController()
+ var/area/A = get_area(src)
+ return A && A.turret_controls.len > 0
+
/obj/machinery/porta_turret/Topic(href, href_list)
if(..())
- return
+ return 1
+ if(!can_use(usr))
+ return 1
+
usr.set_machine(src)
- add_fingerprint(usr)
- if(href_list["power"] && (!locked || issilicon(usr)))
+ if(href_list["power"])
if(anchored) //you can't turn a turret on/off if it's not anchored/secured
- on = !on //toggle on/off
+ if(HasController())
+ usr << "Turrets can only be [on ? "disabled" : "enabled"] using the assigned turret controller."
+ else
+ on = !on //toggle on/off
else
usr << "It has to be secured first!"
@@ -196,6 +220,12 @@
return
switch(href_list["operation"]) //toggles customizable behavioural protocols
+ if("togglelethal")
+ if(!controllock)
+ if(HasController())
+ usr << "Weapon mode can only be altered using the assigned turret controller."
+ else
+ lethal = !lethal
if("toggleai")
ai = !ai
if("authweapon")
@@ -204,6 +234,8 @@
check_records = !check_records
if("shootall")
stun_all = !stun_all
+ if("checkxenos")
+ check_anomalies = !check_anomalies
updateUsrDialog()
@@ -252,20 +284,24 @@
else if((istype(I, /obj/item/weapon/wrench)) && (!on))
if(raised) return
- //This code handles moving the turret around. After all, it's a portable turret!
- if(!anchored && !isinspace())
- anchored = 1
- invisibility = INVISIBILITY_LEVEL_TWO
- update_icon()
- user << "You secure the exterior bolts on the turret."
- cover = new /obj/machinery/porta_turret_cover(loc) //create a new turret. While this is handled in process(), this is to workaround a bug where the turret becomes invisible for a split second
- cover.Parent_Turret = src //make the cover's parent src
- else if(anchored)
- anchored = 0
- user << "You unsecure the exterior bolts on the turret."
- invisibility = 0
- update_icon()
- del(cover) //deletes the cover, and the turret instance itself becomes its own cover. - qdel
+
+ if(do_after(user, 50))
+ //This code handles moving the turret around. After all, it's a portable turret!
+ if(!anchored && !isinspace())
+ playsound(loc, 'sound/items/Ratchet.ogg', 100, 1)
+ anchored = 1
+ invisibility = INVISIBILITY_LEVEL_TWO
+ update_icon()
+ user << "You secure the exterior bolts on the turret."
+ cover = new /obj/machinery/porta_turret_cover(loc) //create a new turret. While this is handled in process(), this is to workaround a bug where the turret becomes invisible for a split second
+ cover.Parent_Turret = src //make the cover's parent src
+ else if(anchored)
+ playsound(loc, 'sound/items/Ratchet.ogg', 100, 1)
+ anchored = 0
+ user << "You unsecure the exterior bolts on the turret."
+ invisibility = 0
+ update_icon()
+ del(cover) //deletes the cover, and the turret instance itself becomes its own cover. - qdel
else if(istype(I, /obj/item/weapon/card/id)||istype(I, /obj/item/device/pda))
//Behavior lock/unlock mangement
@@ -703,6 +739,7 @@
Turret.name = finish_name
Turret.installation = installation
Turret.gun_charge = gun_charge
+ Turret.on = 0
Turret.setup()
// Turret.cover=new/obj/machinery/porta_turret_cover(loc)
@@ -772,137 +809,14 @@
//I'm not fixing it because i'm fucking bored of this code already, but someone should just reroute these to the parent turret's procs.
/obj/machinery/porta_turret_cover/attack_ai(mob/user)
- if(!Parent_Turret.ailock)
- return attack_hand(user)
- else
- user << "There seems to be a firewall preventing you from accessing this device."
+ return attack_hand(user)
/obj/machinery/porta_turret_cover/attack_hand(mob/user)
- . = ..()
- if(.)
- return
- var/dat
- if(!istype(Parent_Turret, /obj/machinery/porta_turret/tag))
- dat += text({"
- Automatic Portable Turret Installation
- Status: []
- Behaviour controls are [Parent_Turret.locked ? "locked" : "unlocked"]"},
-
- "[Parent_Turret.on ? "On" : "Off"]" )
-
- if(!src.Parent_Turret.locked || issilicon(user))
- dat += text({"
- Neutralize All Non-Synthetics: []
- Check for Weapon Authorization: []
- Check Security Records: []
- Neutralize All Non-Authorized Personnel: []
- Neutralize All Unidentified Life Signs: []
"},
-
- "[Parent_Turret.ai ? "Yes" : "No"]",
- "[Parent_Turret.auth_weapons ? "Yes" : "No"]",
- "[Parent_Turret.check_records ? "Yes" : "No"]",
- "[Parent_Turret.stun_all ? "Yes" : "No"]" ,
- "[Parent_Turret.check_anomalies ? "Yes" : "No"]" )
- else
- if(istype(user,/mob/living/carbon/human))
- var/mob/living/carbon/human/H = user
- var/obj/machinery/porta_turret/tag/laser_turret = Parent_Turret
- if(laser_turret.lasercolor == "b" && istype(H.wear_suit, /obj/item/clothing/suit/redtag))
- return
- if(laser_turret.lasercolor == "r" && istype(H.wear_suit, /obj/item/clothing/suit/bluetag))
- return
- dat += text({"
- Automatic Portable Turret Installation
- Status: []
"},
-
- "[Parent_Turret.on ? "On" : "Off"]" )
-
- user << browse("