Adds the proximity monitor component. Performance improvement for turf/Entered (#14196)

* proximity monitor

* Update code/__HELPERS/unsorted.dm

Co-authored-by: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com>

* farie review tweaks

* actually I need this

Co-authored-by: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com>
This commit is contained in:
SteelSlayer
2020-09-20 13:31:16 -04:00
committed by GitHub
co-authored by AffectedArc07
parent ead6e898a3
commit 01da8413de
19 changed files with 252 additions and 24 deletions
@@ -28,6 +28,10 @@
var/attached = 0
/obj/item/clothing/mask/facehugger/ComponentInitialize()
. = ..()
AddComponent(/datum/component/proximity_monitor)
/obj/item/clothing/mask/facehugger/take_damage(damage_amount, damage_type = BRUTE, damage_flag = 0, sound_effect = 1, attack_dir)
..()
if(obj_integrity < 90)
@@ -78,7 +82,7 @@
return HasProximity(finder)
return 0
/obj/item/clothing/mask/facehugger/HasProximity(atom/movable/AM as mob|obj)
/obj/item/clothing/mask/facehugger/HasProximity(atom/movable/AM)
if(CanHug(AM) && Adjacent(AM))
return Attach(AM)
return 0
@@ -210,6 +214,7 @@
icon_state = "[initial(icon_state)]_dead"
item_state = "facehugger_inactive"
stat = DEAD
qdel(GetComponent(/datum/component/proximity_monitor))
visible_message("<span class='danger'>[src] curls up into a ball!</span>")