////////////////////////
//Turret Control Panel//
////////////////////////
/area
// Turrets use this list to see if individual power/lethal settings are allowed
var/list/turret_controls = list()
/obj/machinery/turretid
name = "turret control panel"
desc = "Used to control a room's automated defenses."
icon = 'icons/obj/machines/turret_control.dmi'
icon_state = "control_standby"
anchored = 1
density = 0
var/enabled = 0
var/lethal = 0
var/locked = 1
var/control_area //can be area name, path or nothing.
var/check_arrest = 1 //checks if the perp is set to arrest
var/check_records = 1 //checks if a security record exists at all
var/check_weapons = 0 //checks if it can shoot people that have a weapon they aren't authorized to have
var/check_access = 1 //if this is active, the turret shoots everything that does not meet the access requirements
var/check_anomalies = 1 //checks if it can shoot at unidentified lifeforms (ie xenos)
var/check_synth = 0 //if active, will shoot at anything not an AI or cyborg
var/ailock = 0 // AI cannot use this
req_access = list(access_ai_upload)
/obj/machinery/turretid/stun
enabled = 1
icon_state = "control_stun"
/obj/machinery/turretid/lethal
enabled = 1
lethal = 1
icon_state = "control_kill"
/obj/machinery/turretid/Del()
if(control_area)
var/area/A = control_area
if(A && istype(A))
A.turret_controls -= src
..()
/obj/machinery/turretid/initialize()
if(!control_area)
var/area/CA = get_area(src)
if(CA.master && CA.master != CA)
control_area = CA.master
else
control_area = CA
else if(istext(control_area))
for(var/area/A in world)
if(A.name && A.name==control_area)
control_area = A
break
power_change() //Checks power and initial settings
//don't have to check if control_area is path, since get_area_all_atoms can take path.
if(control_area)
var/area/A = control_area
if(A && istype(A))
A.turret_controls += src
return
/obj/machinery/turretid/proc/can_use(mob/user)
if (get_dist(src, user) > 0 && !issilicon(user))
user << "You are too far away."
user.unset_machine()
user << browse(null, "window=turretid")
return 0
if(ailock && issilicon(user))
user << "There seems to be a firewall preventing you from accessing this device."
return 0
return 1
/obj/machinery/turretid/attackby(obj/item/weapon/W, mob/user)
if(stat & BROKEN) return
if (istype(user, /mob/living/silicon))
return src.attack_hand(user)
if (istype(W, /obj/item/weapon/card/emag) && !emagged)
user << "You short out the turret controls' access analysis module."
emagged = 1
locked = 0
if(user.machine==src)
src.attack_hand(user)
return
else if( get_dist(src, user) == 0 ) // trying to unlock the interface
if (src.allowed(usr))
if(emagged)
user << "The turret control is unresponsive."
return
locked = !locked
user << "You [ locked ? "lock" : "unlock"] the panel."
if (locked)
if (user.machine==src)
user.unset_machine()
user << browse(null, "window=turretid")
else
if (user.machine==src)
src.attack_hand(user)
else
user << "Access denied."
/obj/machinery/turretid/attack_ai(mob/user as mob)
return attack_hand(user)
/obj/machinery/turretid/attack_hand(mob/user as mob)
if(!can_use(user))
return
user.set_machine(src)
var/loc = src.loc
if (istype(loc, /turf))
var/turf/T = loc
loc = T.loc
if (!istype(loc, /area))
return
var/area/area = loc
var/dat = ""
if(!locked || issilicon(user))
dat += text({"
Lethal Mode: []
Neutralize All Non-Synthetics: []
"},
"[lethal ? "Enabled" : "Disabled"]",
"[check_synth ? "Yes" : "No"]")
if(!check_synth)
dat += text({"Check for Weapon Authorization: []
Check Security Records: []
Check Arrest Status: []
Neutralize All Non-Authorized Personnel: []
Neutralize All Unidentified Life Signs: []
"},
"[check_weapons ? "Yes" : "No"]",
"[check_records ? "Yes" : "No"]",
"[check_arrest ? "Yes" : "No"]",
"[check_access ? "Yes" : "No"]",
"[check_anomalies ? "Yes" : "No"]" )
else
dat += "