Fixing mobs and turrets (#6444)

This commit is contained in:
Mykhailo Bykhovtsev
2019-05-13 19:15:56 +02:00
committed by Werner
parent 5bd5eea6ed
commit 71a03e3775
3 changed files with 59 additions and 8 deletions
+15 -5
View File
@@ -430,8 +430,14 @@
var/list/targets = list() //list of primary targets
var/list/secondarytargets = list() //targets that are least important
for(var/mob/M in mobs_in_view(world.view, src))
assess_and_assign(M, targets, secondarytargets)
for(var/v in view(world.view, src))
if(isliving(v))
var/mob/living/L = v
assess_and_assign(L, targets, secondarytargets)
else if(istype(v, /obj/mecha))
var/obj/mecha/M = v
if(M.occupant)
secondarytargets += M
if(!tryToShootAt(targets))
if(!tryToShootAt(secondarytargets)) // if no valid targets, go for secondary targets
@@ -452,10 +458,10 @@
if(!istype(L))
return TURRET_NOT_TARGET
if(L.invisibility >= INVISIBILITY_LEVEL_ONE) // Cannot see him. see_invisible is a mob-var
if(!L)
return TURRET_NOT_TARGET
if(!L)
if(L.invisibility >= INVISIBILITY_LEVEL_ONE) // Cannot see him. see_invisible is a mob-var
return TURRET_NOT_TARGET
if(!emagged && issilicon(L)) // Don't target silica
@@ -467,7 +473,11 @@
if(get_dist(src, L) > 7) //if it's too far away, why bother?
return TURRET_NOT_TARGET
if(!(L in check_trajectory(L, src))) //check if we have true line of sight
var/flags = PASSTABLE
if(ispath(projectile, /obj/item/projectile/beam) || ispath(eprojectile, /obj/item/projectile/beam))
flags |= PASSTABLE|PASSGLASS|PASSGRILLE
if(!(L in check_trajectory(L, src, pass_flags=flags))) //check if we have true line of sight
return TURRET_NOT_TARGET
if(emagged) // If emagged not even the dead get a rest
@@ -251,9 +251,7 @@ mob/living/simple_animal/hostile/hitby(atom/movable/AM as mob|obj,var/speed = TH
return FALSE
var/target_hit = FALSE
var/flags = PASSTABLE
if(istype(projectiletype, /obj/item/projectile/beam))
flags |= (PASSGLASS|PASSGRILLE)
var/flags = ispath(projectiletype, /obj/item/projectile/beam) ? PASSTABLE|PASSGLASS|PASSGRILLE : PASSTABLE
for(var/mob/M in check_trajectory(target_mob, src, pass_flags=flags))
if(M == target_mob)
target_hit = TRUE
+43
View File
@@ -0,0 +1,43 @@
################################
# 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
# balance
# admin
# backend
# security
# refactor
#################################
# Your name.
author: PoZe
# 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: "Hostile mobs that use beam weapons now properly check if they can shoot throught windows or grille."
- tweak: "Turrets will now consider piloted mechs as valid targets to shoot."
- tweak: "Turrets now check if their weapon can shoot throught windows or grille at people."