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
@@ -62,6 +62,8 @@
to_chat(user, "<span class='notice'>You attach the [A] to the valve controls and secure it.</span>")
A.holder = src
A.toggle_secure() //this calls update_icon(), which calls update_icon() on the holder (i.e. the bomb).
if(istype(attached_device, /obj/item/assembly/prox_sensor))
AddComponent(/datum/component/proximity_monitor)
investigate_log("[key_name(user)] attached a [A] to a transfer valve.", INVESTIGATE_BOMB)
add_attack_logs(user, src, "attached [A] to a transfer valve", ATKLOG_FEW)
@@ -137,6 +139,7 @@
attached_device.forceMove(get_turf(src))
attached_device.holder = null
attached_device = null
qdel(GetComponent(/datum/component/proximity_monitor))
update_icon()
else
. = FALSE
+5 -1
View File
@@ -15,6 +15,10 @@
var/armed = 0
var/timepassed = 0
/obj/item/caution/proximity_sign/ComponentInitialize()
. = ..()
AddComponent(/datum/component/proximity_monitor)
/obj/item/caution/proximity_sign/attack_self(mob/user as mob)
if(ishuman(user))
var/mob/living/carbon/human/H = user
@@ -40,7 +44,7 @@
armed = 1
timing = 0
/obj/item/caution/proximity_sign/HasProximity(atom/movable/AM as mob|obj)
/obj/item/caution/proximity_sign/HasProximity(atom/movable/AM)
if(armed)
if(istype(AM, /mob/living/carbon) && !istype(AM, /mob/living/carbon/brain))
var/mob/living/carbon/C = AM
@@ -190,6 +190,8 @@
user.drop_item()
nadeassembly = A
if(nadeassembly.has_prox_sensors())
AddComponent(/datum/component/proximity_monitor)
A.master = src
A.loc = src
assemblyattacher = user.ckey
@@ -219,6 +221,7 @@
nadeassembly.loc = get_turf(src)
nadeassembly.master = null
nadeassembly = null
qdel(GetComponent(/datum/component/proximity_monitor))
if(beakers.len)
for(var/obj/O in beakers)
O.loc = get_turf(src)
@@ -304,6 +307,8 @@
/obj/item/grenade/chem_grenade/proc/CreateDefaultTrigger(var/typekey)
if(ispath(typekey,/obj/item/assembly))
nadeassembly = new(src)
if(nadeassembly.has_prox_sensors())
AddComponent(/datum/component/proximity_monitor)
nadeassembly.a_left = new /obj/item/assembly/igniter(nadeassembly)
nadeassembly.a_left.holder = nadeassembly
nadeassembly.a_left.secured = 1