Improves Geiger Counters; Allows Toggle (#15366)

* Improves Geiger Counters; Allows Toggle

* no arg

* spelling

* tweaks
This commit is contained in:
Fox McCloud
2021-01-30 23:22:21 +00:00
committed by GitHub
parent 17424b786e
commit 82f1d2ce59
5 changed files with 57 additions and 37 deletions
@@ -33,31 +33,29 @@
/obj/item/geiger_counter/Destroy()
STOP_PROCESSING(SSobj, src)
QDEL_NULL(soundloop)
return ..()
/obj/item/geiger_counter/process()
update_icon()
update_sound()
if(scanning)
radiation_count -= radiation_count / RAD_GEIGER_MEASURE_SMOOTHING
radiation_count += current_tick_amount / RAD_GEIGER_MEASURE_SMOOTHING
if(!scanning)
current_tick_amount = 0
return
if(current_tick_amount)
grace = RAD_GEIGER_GRACE_PERIOD
last_tick_amount = current_tick_amount
radiation_count -= radiation_count / RAD_GEIGER_MEASURE_SMOOTHING
radiation_count += current_tick_amount / RAD_GEIGER_MEASURE_SMOOTHING
if(current_tick_amount)
grace = RAD_GEIGER_GRACE_PERIOD
last_tick_amount = current_tick_amount
else if(!emagged)
grace--
if(grace <= 0)
radiation_count = 0
else if(!emagged)
grace--
if(grace <= 0)
radiation_count = 0
current_tick_amount = 0
update_icon()
update_sound()
/obj/item/geiger_counter/examine(mob/user)
. = ..()
if(!scanning)
@@ -104,10 +102,7 @@
/obj/item/geiger_counter/proc/update_sound()
var/datum/looping_sound/geiger/loop = soundloop
if(!scanning)
loop.stop()
return
if(!radiation_count)
if(!scanning || !radiation_count)
loop.stop()
return
loop.last_radiation = radiation_count
@@ -169,13 +164,13 @@
return ..()
/obj/item/geiger_counter/AltClick(mob/living/user)
if(!istype(user) || !!user.Adjacent(src))
if(!istype(user) || !user.Adjacent(src))
return ..()
if(!scanning)
to_chat(usr, "<span class='warning'>[src] must be on to reset its radiation level!</span>")
to_chat(user, "<span class='warning'>[src] must be on to reset its radiation level!</span>")
return
radiation_count = 0
to_chat(usr, "<span class='notice'>You flush [src]'s radiation counts, resetting it to normal.</span>")
to_chat(user, "<span class='notice'>You flush [src]'s radiation counts, resetting it to normal.</span>")
update_icon()
/obj/item/geiger_counter/emag_act(mob/user)