Hostile mobs no longer target logged out players. (#16200)

* Hostile mobs no longer target logged out players.

* ffs

---------

Co-authored-by: Matt Atlas <liermattia@gmail.com>
This commit is contained in:
Matt Atlas
2023-04-14 22:21:36 +00:00
committed by GitHub
co-authored by Matt Atlas
parent 8c474f304e
commit 6e45e5620d
2 changed files with 50 additions and 1 deletions
@@ -70,6 +70,10 @@
for (var/atom/A in targets)
if(A == src)
continue
if(ismob(A)) //Don't target mobs with keys that have logged out.
var/mob/M = A
if(M.key && !M.client)
continue
if(!isturf(A.loc))
A = A.loc
var/datum/callback/cb = null
@@ -121,7 +125,7 @@
target_mob = user
change_stance(HOSTILE_STANCE_ATTACK)
mob/living/simple_animal/hostile/hitby(atom/movable/AM as mob|obj,var/speed = THROWFORCE_SPEED_DIVISOR)//Standardization and logging -Sieve
/mob/living/simple_animal/hostile/hitby(atom/movable/AM as mob|obj,var/speed = THROWFORCE_SPEED_DIVISOR)//Standardization and logging -Sieve
..()
if(istype(AM,/obj/))
var/obj/O = AM
@@ -170,6 +174,10 @@ mob/living/simple_animal/hostile/hitby(atom/movable/AM as mob|obj,var/speed = TH
if(QDELETED(target_mob) || SA_attackable(target_mob))
LoseTarget()
return 0
if(ismob(target_mob)) //target_mob is not in fact always a mob
if(target_mob.key && !target_mob.client)
LoseTarget()
return 0
if(!(target_mob in targets))
LoseTarget()
return 0
@@ -0,0 +1,41 @@
################################
# 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: MattAtlas
# 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:
- rscadd: "Hostile mobs no longer target players that have logged out."