mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-29 11:32:13 +00:00
Merge pull request #4078 from Mechoid/Projectile_Turretfunctions
Turret Targetting Update
This commit is contained in:
@@ -24,6 +24,15 @@
|
|||||||
|
|
||||||
return mobs
|
return mobs
|
||||||
|
|
||||||
|
/proc/mobs_in_xray_view(var/range, var/source)
|
||||||
|
var/list/mobs = list()
|
||||||
|
for(var/atom/movable/AM in orange(range, source))
|
||||||
|
var/M = AM.get_mob()
|
||||||
|
if(M)
|
||||||
|
mobs += M
|
||||||
|
|
||||||
|
return mobs
|
||||||
|
|
||||||
proc/random_hair_style(gender, species = "Human")
|
proc/random_hair_style(gender, species = "Human")
|
||||||
var/h_style = "Bald"
|
var/h_style = "Bald"
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,7 @@
|
|||||||
var/check_access = 1 //if this is active, the turret shoots everything that does not meet the access requirements
|
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_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/check_synth = 0 //if active, will shoot at anything not an AI or cyborg
|
||||||
|
var/check_all = 0 //If active, will fire on anything, including synthetics.
|
||||||
var/ailock = 0 // AI cannot use this
|
var/ailock = 0 // AI cannot use this
|
||||||
|
|
||||||
var/attacked = 0 //if set to 1, the turret gets pissed off and shoots at people nearby (unless they have sec access!)
|
var/attacked = 0 //if set to 1, the turret gets pissed off and shoots at people nearby (unless they have sec access!)
|
||||||
@@ -71,6 +72,7 @@
|
|||||||
check_records = 1
|
check_records = 1
|
||||||
check_weapons = 1
|
check_weapons = 1
|
||||||
check_anomalies = 1
|
check_anomalies = 1
|
||||||
|
check_all = 0
|
||||||
|
|
||||||
/obj/machinery/porta_turret/stationary
|
/obj/machinery/porta_turret/stationary
|
||||||
ailock = 1
|
ailock = 1
|
||||||
@@ -229,6 +231,7 @@ var/list/turret_icons
|
|||||||
settings[++settings.len] = list("category" = "Check Arrest Status", "setting" = "check_arrest", "value" = check_arrest)
|
settings[++settings.len] = list("category" = "Check Arrest Status", "setting" = "check_arrest", "value" = check_arrest)
|
||||||
settings[++settings.len] = list("category" = "Check Access Authorization", "setting" = "check_access", "value" = check_access)
|
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" = "Check misc. Lifeforms", "setting" = "check_anomalies", "value" = check_anomalies)
|
||||||
|
settings[++settings.len] = list("category" = "Neutralize All Entities", "setting" = "check_all", "value" = check_all)
|
||||||
data["settings"] = settings
|
data["settings"] = settings
|
||||||
|
|
||||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||||
@@ -278,6 +281,8 @@ var/list/turret_icons
|
|||||||
check_access = value
|
check_access = value
|
||||||
else if(href_list["command"] == "check_anomalies")
|
else if(href_list["command"] == "check_anomalies")
|
||||||
check_anomalies = value
|
check_anomalies = value
|
||||||
|
else if(href_list["command"] == "check_all")
|
||||||
|
check_all = value
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
@@ -465,7 +470,7 @@ var/list/turret_icons
|
|||||||
var/list/targets = list() //list of primary targets
|
var/list/targets = list() //list of primary targets
|
||||||
var/list/secondarytargets = list() //targets that are least important
|
var/list/secondarytargets = list() //targets that are least important
|
||||||
|
|
||||||
for(var/mob/M in mobs_in_view(world.view, src))
|
for(var/mob/M in mobs_in_xray_view(world.view, src))
|
||||||
assess_and_assign(M, targets, secondarytargets)
|
assess_and_assign(M, targets, secondarytargets)
|
||||||
|
|
||||||
if(!tryToShootAt(targets))
|
if(!tryToShootAt(targets))
|
||||||
@@ -496,7 +501,7 @@ var/list/turret_icons
|
|||||||
if(!L)
|
if(!L)
|
||||||
return TURRET_NOT_TARGET
|
return TURRET_NOT_TARGET
|
||||||
|
|
||||||
if(!emagged && issilicon(L)) // Don't target silica
|
if(!emagged && issilicon(L) && check_all == 0) // Don't target silica, unless told to neutralize everything.
|
||||||
return TURRET_NOT_TARGET
|
return TURRET_NOT_TARGET
|
||||||
|
|
||||||
if(L.stat && !emagged) //if the perp is dead/dying, no need to bother really
|
if(L.stat && !emagged) //if the perp is dead/dying, no need to bother really
|
||||||
@@ -514,7 +519,7 @@ var/list/turret_icons
|
|||||||
if(lethal && locate(/mob/living/silicon/ai) in get_turf(L)) //don't accidentally kill the AI!
|
if(lethal && locate(/mob/living/silicon/ai) in get_turf(L)) //don't accidentally kill the AI!
|
||||||
return TURRET_NOT_TARGET
|
return TURRET_NOT_TARGET
|
||||||
|
|
||||||
if(check_synth) //If it's set to attack all non-silicons, target them!
|
if(check_synth || check_all) //If it's set to attack all non-silicons or everything, target them!
|
||||||
if(L.lying)
|
if(L.lying)
|
||||||
return lethal ? TURRET_SECONDARY_TARGET : TURRET_NOT_TARGET
|
return lethal ? TURRET_SECONDARY_TARGET : TURRET_NOT_TARGET
|
||||||
return TURRET_PRIORITY_TARGET
|
return TURRET_PRIORITY_TARGET
|
||||||
@@ -671,6 +676,7 @@ var/list/turret_icons
|
|||||||
var/check_arrest
|
var/check_arrest
|
||||||
var/check_weapons
|
var/check_weapons
|
||||||
var/check_anomalies
|
var/check_anomalies
|
||||||
|
var/check_all
|
||||||
var/ailock
|
var/ailock
|
||||||
|
|
||||||
/obj/machinery/porta_turret/proc/setState(var/datum/turret_checks/TC)
|
/obj/machinery/porta_turret/proc/setState(var/datum/turret_checks/TC)
|
||||||
@@ -686,6 +692,7 @@ var/list/turret_icons
|
|||||||
check_arrest = TC.check_arrest
|
check_arrest = TC.check_arrest
|
||||||
check_weapons = TC.check_weapons
|
check_weapons = TC.check_weapons
|
||||||
check_anomalies = TC.check_anomalies
|
check_anomalies = TC.check_anomalies
|
||||||
|
check_all = TC.check_all
|
||||||
ailock = TC.ailock
|
ailock = TC.ailock
|
||||||
|
|
||||||
power_change()
|
power_change()
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
var/check_access = 1 //if this is active, the turret shoots everything that does not meet the access requirements
|
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_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/check_synth = 0 //if active, will shoot at anything not an AI or cyborg
|
||||||
|
var/check_all = 0 //If active, will shoot at anything.
|
||||||
var/ailock = 0 //Silicons cannot use this
|
var/ailock = 0 //Silicons cannot use this
|
||||||
|
|
||||||
req_access = list(access_ai_upload)
|
req_access = list(access_ai_upload)
|
||||||
@@ -130,6 +131,8 @@
|
|||||||
settings[++settings.len] = list("category" = "Check Arrest Status", "setting" = "check_arrest", "value" = check_arrest)
|
settings[++settings.len] = list("category" = "Check Arrest Status", "setting" = "check_arrest", "value" = check_arrest)
|
||||||
settings[++settings.len] = list("category" = "Check Access Authorization", "setting" = "check_access", "value" = check_access)
|
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" = "Check misc. Lifeforms", "setting" = "check_anomalies", "value" = check_anomalies)
|
||||||
|
settings[++settings.len] = list("category" = "Neutralize All Entities", "setting" = "check_all", "value" = check_all)
|
||||||
|
|
||||||
data["settings"] = settings
|
data["settings"] = settings
|
||||||
|
|
||||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||||
@@ -161,6 +164,8 @@
|
|||||||
check_access = value
|
check_access = value
|
||||||
else if(href_list["command"] == "check_anomalies")
|
else if(href_list["command"] == "check_anomalies")
|
||||||
check_anomalies = value
|
check_anomalies = value
|
||||||
|
else if(href_list["command"] == "check_all")
|
||||||
|
check_all = value
|
||||||
|
|
||||||
updateTurrets()
|
updateTurrets()
|
||||||
return 1
|
return 1
|
||||||
@@ -175,6 +180,7 @@
|
|||||||
TC.check_arrest = check_arrest
|
TC.check_arrest = check_arrest
|
||||||
TC.check_weapons = check_weapons
|
TC.check_weapons = check_weapons
|
||||||
TC.check_anomalies = check_anomalies
|
TC.check_anomalies = check_anomalies
|
||||||
|
TC.check_all = check_all
|
||||||
TC.ailock = ailock
|
TC.ailock = ailock
|
||||||
|
|
||||||
if(istype(control_area))
|
if(istype(control_area))
|
||||||
|
|||||||
@@ -150,8 +150,10 @@
|
|||||||
/obj/structure/foamedmetal/ex_act(severity)
|
/obj/structure/foamedmetal/ex_act(severity)
|
||||||
qdel(src)
|
qdel(src)
|
||||||
|
|
||||||
/obj/structure/foamedmetal/bullet_act()
|
/obj/structure/foamedmetal/bullet_act(var/obj/item/projectile/P)
|
||||||
if(metal == 1 || prob(50))
|
if(istype(P, /obj/item/projectile/test))
|
||||||
|
return
|
||||||
|
else if(metal == 1 || prob(50))
|
||||||
qdel(src)
|
qdel(src)
|
||||||
|
|
||||||
/obj/structure/foamedmetal/attack_hand(var/mob/user)
|
/obj/structure/foamedmetal/attack_hand(var/mob/user)
|
||||||
|
|||||||
@@ -419,6 +419,8 @@
|
|||||||
return //cannot shoot yourself
|
return //cannot shoot yourself
|
||||||
if(istype(A, /obj/item/projectile))
|
if(istype(A, /obj/item/projectile))
|
||||||
return
|
return
|
||||||
|
if(istype(A, /obj/structure/foamedmetal)) //Turrets can detect through foamed metal, but will have to blast through it. Similar to windows, if someone runs behind it, a person should probably just not shoot.
|
||||||
|
return
|
||||||
if(istype(A, /mob/living) || istype(A, /obj/mecha) || istype(A, /obj/vehicle))
|
if(istype(A, /mob/living) || istype(A, /obj/mecha) || istype(A, /obj/vehicle))
|
||||||
result = 2 //We hit someone, return 1!
|
result = 2 //We hit someone, return 1!
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user