Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes basic mobs targeting ventcrawling/jaunting mobs #5648

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
///Returns something the target might be hiding inside of
/datum/targeting_strategy/proc/find_hidden_mobs(mob/living/living_mob, atom/target)
var/atom/target_hiding_location
if(istype(target.loc, /obj/structure/closet) || istype(target.loc, /obj/machinery/disposal) || istype(target.loc, /obj/machinery/sleeper))
target_hiding_location = target.loc
var/atom/target_loc = target.loc
if(istype(target_loc, /obj/structure/closet) || istype(target_loc, /obj/machinery/disposal) || istype(target_loc, /obj/machinery/sleeper))
target_hiding_location = target_loc
return target_hiding_location

/datum/targeting_strategy/basic
Expand All @@ -32,30 +33,42 @@
if(isturf(the_target) || isnull(the_target)) // bail out on invalids
return FALSE

if(isobj(the_target.loc))
var/obj/container = the_target.loc
var/atom/target_loc = the_target.loc
var/atom/mob_loc = living_mob.loc

if(QDELETED(target_loc) || QDELETED(mob_loc))
return FALSE // I don't know how you'd end up in this situation, but let's just... not.

if(HAS_TRAIT(target_loc, TRAIT_SECLUDED_LOCATION))
return FALSE // don't attack people in an out-of-bounds location (aka if they're using a desynchronizer)

if(isobj(target_loc))
var/obj/container = target_loc
if(container.resistance_flags & INDESTRUCTIBLE)
return FALSE
if(isstructure(the_target))
return HAS_TRAIT(the_target, TRAIT_MOB_DESTROYABLE)

if(isstructure(the_target))
if(!HAS_TRAIT(the_target, TRAIT_MOB_DESTROYABLE))
return FALSE
return TRUE

if(ismob(the_target)) //Target is in godmode, ignore it.
if(living_mob.loc == the_target)
if(ismob(the_target))
if(mob_loc == the_target)
return FALSE // We've either been eaten or are shapeshifted, let's assume the latter because we're still alive
var/mob/M = the_target
if(HAS_TRAIT(M, TRAIT_GODMODE))
return FALSE
if(HAS_TRAIT(the_target, TRAIT_MOVE_VENTCRAWLING))
return FALSE // you can't bite people inside of vents
if(HAS_TRAIT(the_target, TRAIT_MAGICALLY_PHASED))
return FALSE // you can't bite anything that's incorporeal
if(HAS_TRAIT(the_target, TRAIT_GODMODE))
return FALSE // target is in godmode, ignore it

if(!ignore_sight && !can_see(living_mob, the_target, vision_range)) //Target has moved behind cover and we have lost line of sight to it
return FALSE

if(living_mob.see_invisible < the_target.invisibility) //Target's invisible to us, forget it
return FALSE

if(isturf(living_mob.loc) && isturf(the_target.loc) && living_mob.z != the_target.z) // z check will always fail if target is in a mech or pawn is shapeshifted or jaunting
if(!isturf(mob_loc))
return FALSE

if(isturf(target_loc) && living_mob.z != the_target.z) // z check will always fail if target is in a mech or pawn is shapeshifted or jaunting
return FALSE

if(isliving(the_target)) //Targeting vs living mobs
Expand Down
Loading