Merge pull request #6407 from Nalarac/Turret

Adds Setting for Turrets to Shoot Downed People
This commit is contained in:
Atermonera
2019-08-21 13:29:42 -08:00
committed by GitHub
2 changed files with 46 additions and 4 deletions

View File

@@ -74,6 +74,7 @@
var/check_synth = FALSE //if active, will shoot at anything not an AI or cyborg
var/check_all = FALSE //If active, will fire on anything, including synthetics.
var/ailock = FALSE // AI cannot use this
var/check_down = FALSE //If active, will shoot to kill when lethals are also on
var/faction = null //if set, will not fire at people in the same faction for any reason.
var/attacked = FALSE //if set to TRUE, the turret gets pissed off and shoots at people nearby (unless they have sec access!)
@@ -103,6 +104,7 @@
check_weapons = TRUE
check_anomalies = TRUE
check_all = FALSE
check_down = TRUE
/obj/machinery/porta_turret/can_catalogue(mob/user) // Dead turrets can't be scanned.
if(stat & BROKEN)
@@ -224,6 +226,7 @@
check_records = FALSE
check_anomalies = FALSE
check_all = FALSE
check_down = FALSE
/obj/machinery/porta_turret/lasertag/red
turret_type = "red"
@@ -404,7 +407,7 @@
return 1
if(locked && !issilicon(user))
to_chat(user, "<span class='notice'>Access denied.</span>")
to_chat(user, "<span class='notice'>Controls locked.</span>")
return 1
return 0
@@ -438,6 +441,7 @@
settings[++settings.len] = list("category" = "Check Access Authorization", "setting" = "check_access", "value" = check_access)
settings[++settings.len] = list("category" = "Check misc. Lifeforms", "setting" = "check_anomalies", "value" = check_anomalies)
settings[++settings.len] = list("category" = "Neutralize All Entities", "setting" = "check_all", "value" = check_all)
settings[++settings.len] = list("category" = "Neutralize Downed Entities", "setting" = "check_down", "value" = check_down)
data["settings"] = settings
ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open)
@@ -489,6 +493,8 @@
check_anomalies = value
else if(href_list["command"] == "check_all")
check_all = value
else if(href_list["command"] == "check_down")
check_down = value
return 1
@@ -732,7 +738,7 @@
if(!emagged && issilicon(L) && check_all == FALSE) // Don't target silica, unless told to neutralize everything.
return TURRET_NOT_TARGET
if(L.stat && !emagged) //if the perp is dead/dying, no need to bother really
if(L.stat == DEAD && !emagged) //if the perp is dead, no need to bother really
return TURRET_NOT_TARGET //move onto next potential victim!
if(get_dist(src, L) > 7) //if it's too far away, why bother?
@@ -749,7 +755,7 @@
if(check_synth || check_all) //If it's set to attack all non-silicons or everything, target them!
if(L.lying)
return lethal ? TURRET_SECONDARY_TARGET : TURRET_NOT_TARGET
return check_down ? TURRET_SECONDARY_TARGET : TURRET_NOT_TARGET
return TURRET_PRIORITY_TARGET
if(iscuffed(L)) // If the target is handcuffed, leave it alone
@@ -766,7 +772,7 @@
return TURRET_NOT_TARGET //if threat level < 4, keep going
if(L.lying) //if the perp is lying down, it's still a target but a less-important target
return lethal ? TURRET_SECONDARY_TARGET : TURRET_NOT_TARGET
return check_down ? TURRET_SECONDARY_TARGET : TURRET_NOT_TARGET
return TURRET_PRIORITY_TARGET //if the perp has passed all previous tests, congrats, it is now a "shoot-me!" nominee