diff --git a/code/game/machinery/portable_turret.dm b/code/game/machinery/portable_turret.dm index 10d86aa4b2..934aeec09c 100644 --- a/code/game/machinery/portable_turret.dm +++ b/code/game/machinery/portable_turret.dm @@ -474,19 +474,23 @@ 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 + if(!emagged && 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) - return 0 + if(get_dist(src, L) > 7) //if it's too far away, why bother? + return TURRET_NOT_TARGET + + 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(lethal && locate(/mob/living/silicon/ai) in get_turf(L)) //don't accidentally kill the AI! + return TURRET_NOT_TARGET if(check_synth) //If it's set to attack all non-silicons, target them! if(L.lying) @@ -498,6 +502,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 @@ -605,7 +610,6 @@ var/list/turret_icons if(!raised) //the turret has to be raised in order to fire - makes sense, right? return - update_icon() var/obj/item/projectile/A if(emagged || lethal) diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index 9feebbd64b..73ca2b7476 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -37,7 +37,7 @@ var/dispersion = 0.0 var/damage = 10 - var/damage_type = BRUTE //BRUTE, BURN, TOX, OXY, CLONE are the only things that should be in here + var/damage_type = BRUTE //BRUTE, BURN, TOX, OXY, CLONE, HALLOSS are the only things that should be in here var/nodamage = 0 //Determines if the projectile will skip any damage inflictions var/taser_effect = 0 //If set then the projectile will apply it's agony damage using stun_effect_act() to mobs it hits, and other damage will be ignored var/check_armour = "bullet" //Defines what armor to use when it hits things. Must be set to bullet, laser, energy,or bomb //Cael - bio and rad are also valid @@ -385,7 +385,7 @@ return //cannot shoot yourself if(istype(A, /obj/item/projectile)) return - if(istype(A, /mob/living)) + if(istype(A, /mob/living) || istype(A, /obj/mecha) || istype(A, /obj/vehicle)) result = 2 //We hit someone, return 1! return result = 1 @@ -424,15 +424,14 @@ if(istype(M)) return 1 -/proc/check_trajectory(atom/target as mob, var/mob/living/user as mob, var/pass_flags=PASSTABLE|PASSGLASS|PASSGRILLE, flags=null) //Checks if you can hit them or not. - if(!istype(target) || !istype(user)) +/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(user,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... trace.pass_flags = pass_flags //And the pass flags to that of the real projectile... - trace.firer = user var/output = trace.process() //Test it! qdel(trace) //No need for it anymore return output //Send it back to the gun! diff --git a/code/modules/vehicles/cargo_train.dm b/code/modules/vehicles/cargo_train.dm index b539dde039..c6ff870988 100644 --- a/code/modules/vehicles/cargo_train.dm +++ b/code/modules/vehicles/cargo_train.dm @@ -79,6 +79,13 @@ return ..() +//cargo trains are open topped, so there is a chance the projectile will hit the mob ridding the train instead +/obj/vehicle/train/cargo/bullet_act(var/obj/item/projectile/Proj) + if(buckled_mob && prob(70)) + buckled_mob.bullet_act(Proj) + return + ..() + /obj/vehicle/train/cargo/update_icon() if(open) icon_state = initial(icon_state) + "_open" diff --git a/html/changelogs/Loganbacca-fixes.yml b/html/changelogs/Loganbacca-fixes.yml new file mode 100644 index 0000000000..fd4c2f8b00 --- /dev/null +++ b/html/changelogs/Loganbacca-fixes.yml @@ -0,0 +1,5 @@ +author: Loganbacca +delete-after: True +changes: + - bugfix: "Turrets no longer burn holes through the AI." + - tweak: "Projectiles now have a chance of hitting mobs riding cargo trains."