From c04fc312e26bc3f5672f6175e46c77d7ea406279 Mon Sep 17 00:00:00 2001 From: Loganbacca Date: Sat, 11 Jul 2015 01:41:03 +1200 Subject: [PATCH] Moved trajectory check to during target assessment --- code/game/machinery/portable_turret.dm | 21 ++++++++--------- code/modules/projectiles/projectile.dm | 2 +- html/changelogs/Loganbacca-fixes.yml | 32 -------------------------- 3 files changed, 10 insertions(+), 45 deletions(-) diff --git a/code/game/machinery/portable_turret.dm b/code/game/machinery/portable_turret.dm index 6a0ad704a25..e5b5e53cbd5 100644 --- a/code/game/machinery/portable_turret.dm +++ b/code/game/machinery/portable_turret.dm @@ -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) diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index 335df661057..73ca2b7476b 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -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... diff --git a/html/changelogs/Loganbacca-fixes.yml b/html/changelogs/Loganbacca-fixes.yml index a8d0df89415..fd4c2f8b003 100644 --- a/html/changelogs/Loganbacca-fixes.yml +++ b/html/changelogs/Loganbacca-fixes.yml @@ -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."