Moved trajectory check to during target assessment

This commit is contained in:
Loganbacca
2015-07-11 01:41:03 +12:00
parent f30fa4b4be
commit c04fc312e2
3 changed files with 10 additions and 45 deletions

View File

@@ -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)

View File

@@ -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...

View File

@@ -1,37 +1,5 @@
################################
# Example Changelog File
#
# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
#
# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
# When it is, any changes listed below will disappear.
#
# Valid Prefixes:
# bugfix
# wip (For works in progress)
# tweak
# soundadd
# sounddel
# rscadd (general adding of nice things)
# rscdel (general deleting of nice things)
# imageadd
# imagedel
# maptweak
# spellcheck (typo fixes)
# experiment
#################################
# Your name.
author: Loganbacca
# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
delete-after: True
# Any changes you've made. See valid prefix list above.
# INDENT WITH TWO SPACES. NOT TABS. SPACES.
# SCREW THIS UP AND IT WON'T WORK.
# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries.
# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog.
changes:
- bugfix: "Turrets no longer burn holes through the AI."
- tweak: "Projectiles now have a chance of hitting mobs riding cargo trains."