mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
Moved trajectory check to during target assessment
This commit is contained in:
@@ -474,20 +474,21 @@ var/list/turret_icons
|
||||
if(!L)
|
||||
return TURRET_NOT_TARGET
|
||||
|
||||
// If emagged not even the dead get a rest
|
||||
if(emagged)
|
||||
return L.stat ? TURRET_SECONDARY_TARGET : TURRET_PRIORITY_TARGET
|
||||
|
||||
if(issilicon(L)) // Don't target silica
|
||||
return TURRET_NOT_TARGET
|
||||
|
||||
if(L.stat) //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
|
||||
return TURRET_NOT_TARGET //move onto next potential victim!
|
||||
|
||||
var/dst = get_dist(src, L) //if it's too far away, why bother?
|
||||
if(dst > 7)
|
||||
if(get_dist(src, L) > 7) //if it's too far away, why bother?
|
||||
return 0
|
||||
|
||||
if(!check_trajectory(L, src)) //check if we have true line of sight
|
||||
return TURRET_NOT_TARGET
|
||||
|
||||
if(emagged) // If emagged not even the dead get a rest
|
||||
return L.stat ? TURRET_SECONDARY_TARGET : TURRET_PRIORITY_TARGET
|
||||
|
||||
if(check_synth) //If it's set to attack all non-silicons, target them!
|
||||
if(L.lying)
|
||||
return lethal ? TURRET_SECONDARY_TARGET : TURRET_NOT_TARGET
|
||||
@@ -498,6 +499,7 @@ var/list/turret_icons
|
||||
|
||||
if(isanimal(L) || issmall(L)) // Animals are not so dangerous
|
||||
return check_anomalies ? TURRET_SECONDARY_TARGET : TURRET_NOT_TARGET
|
||||
|
||||
if(isxenomorph(L) || isalien(L)) // Xenos are dangerous
|
||||
return check_anomalies ? TURRET_PRIORITY_TARGET : TURRET_NOT_TARGET
|
||||
|
||||
@@ -606,11 +608,6 @@ var/list/turret_icons
|
||||
return
|
||||
|
||||
update_icon()
|
||||
|
||||
//targeting check, can we hit them?
|
||||
if(!check_trajectory(target, src))
|
||||
return
|
||||
|
||||
var/obj/item/projectile/A
|
||||
if(emagged || lethal)
|
||||
A = new eprojectile(loc)
|
||||
|
||||
@@ -427,7 +427,7 @@
|
||||
/proc/check_trajectory(atom/target as mob|obj, atom/firer as mob|obj, var/pass_flags=PASSTABLE|PASSGLASS|PASSGRILLE, flags=null) //Checks if you can hit them or not.
|
||||
if(!istype(target) || !istype(firer))
|
||||
return 0
|
||||
var/obj/item/projectile/test/trace = new /obj/item/projectile/test(get_step_to(firer,target)) //Making the test....
|
||||
var/obj/item/projectile/test/trace = new /obj/item/projectile/test(get_turf(firer)) //Making the test....
|
||||
trace.target = target
|
||||
if(!isnull(flags))
|
||||
trace.flags = flags //Set the flags...
|
||||
|
||||
Reference in New Issue
Block a user