Allows traitor AI's to take direct control of turrets. (#36154)

* Allows traitor AI's to take direct control of turrets.

* Adds some icons
This commit is contained in:
AnturK
2018-03-16 23:30:41 +01:00
committed by CitadelStationBot
parent 13709a7d34
commit 80e046572f
7 changed files with 109 additions and 21 deletions
@@ -76,6 +76,11 @@
var/wall_turret_direction //The turret will try to shoot from a turf in that direction when in a wall
var/manual_control = FALSE //
var/datum/action/turret_quit/quit_action
var/datum/action/turret_toggle/toggle_action
var/mob/remote_controller
/obj/machinery/porta_turret/Initialize()
. = ..()
if(!base)
@@ -154,6 +159,7 @@
cp = null
QDEL_NULL(stored_gun)
QDEL_NULL(spark_system)
remove_control()
return ..()
@@ -179,6 +185,14 @@
dat += "Neutralize All Non-Security and Non-Command Personnel: <A href='?src=[REF(src)];operation=shootall'>[stun_all ? "Yes" : "No"]</A><BR>"
dat += "Neutralize All Unidentified Life Signs: <A href='?src=[REF(src)];operation=checkxenos'>[check_anomalies ? "Yes" : "No"]</A><BR>"
dat += "Neutralize All Non-Loyalty Implanted Personnel: <A href='?src=[REF(src)];operation=checkloyal'>[shoot_unloyal ? "Yes" : "No"]</A><BR>"
if(issilicon(user))
if(!manual_control)
var/mob/living/silicon/S = user
if(S.hack_software)
dat += "Assume direct control : <a href='?src=[REF(src)];operation=manual'>Manual Control</a><br>"
else
dat += "Warning! Remote control protocol enabled.<br>"
var/datum/browser/popup = new(user, "autosec", "Automatic Portable Turret Installation", 300, 300)
popup.set_content(dat)
@@ -212,6 +226,9 @@
check_anomalies = !check_anomalies
if("checkloyal")
shoot_unloyal = !shoot_unloyal
if("manual")
if(issilicon(usr) && !manual_control)
give_control(usr)
interact(usr)
/obj/machinery/porta_turret/power_change()
@@ -359,6 +376,8 @@
popDown()
return
if(manual_control)
return
var/list/targets = list()
var/static/things_to_scan = typecacheof(list(/mob/living, /obj/mecha))
@@ -566,6 +585,66 @@
src.mode = mode
power_change()
/datum/action/turret_toggle
name = "Toggle Mode"
icon_icon = 'icons/mob/actions/actions_mecha.dmi'
button_icon_state = "mech_cycle_equip_off"
/datum/action/turret_toggle/Trigger()
var/obj/machinery/porta_turret/P = target
if(!istype(P))
return
P.setState(P.on,!P.mode)
/datum/action/turret_quit
name = "Release Control"
icon_icon = 'icons/mob/actions/actions_mecha.dmi'
button_icon_state = "mech_eject"
/datum/action/turret_quit/Trigger()
var/obj/machinery/porta_turret/P = target
if(!istype(P))
return
P.remove_control(owner)
/obj/machinery/porta_turret/proc/give_control(mob/A)
if(manual_control)
return FALSE
remote_controller = A
if(!quit_action)
quit_action = new(src)
quit_action.Grant(remote_controller)
if(!toggle_action)
toggle_action = new(src)
toggle_action.Grant(remote_controller)
remote_controller.reset_perspective(src)
remote_controller.click_intercept = src
manual_control = TRUE
always_up = TRUE
popUp()
return TRUE
/obj/machinery/porta_turret/proc/remove_control()
if(!manual_control)
return FALSE
if(remote_controller)
quit_action.Remove(remote_controller)
toggle_action.Remove(remote_controller)
remote_controller.click_intercept = null
remote_controller.reset_perspective()
always_up = initial(always_up)
manual_control = FALSE
remote_controller = null
return TRUE
/obj/machinery/porta_turret/proc/InterceptClickOn(mob/living/caller, params, atom/A)
if(!manual_control)
return FALSE
add_logs(caller,A,"fired with manual turret control at")
target(A)
return TRUE
/obj/machinery/porta_turret/syndicate
installation = null
always_up = 1