diff --git a/code/datums/action.dm b/code/datums/action.dm
index 5e4ceedf7b3..8d02d4622cf 100644
--- a/code/datums/action.dm
+++ b/code/datums/action.dm
@@ -369,6 +369,14 @@
return FALSE
return ..()
+/datum/action/item_action/toggle_geiger_counter
+ name = "Toggle Geiger Counter"
+
+/datum/action/item_action/toggle_geiger_counter/Trigger()
+ var/obj/item/clothing/head/helmet/space/hardsuit/H = target
+ if(istype(H))
+ H.toggle_geiger_counter()
+
/datum/action/item_action/hands_free
check_flags = AB_CHECK_CONSCIOUS
diff --git a/code/datums/elements/rad_insulation.dm b/code/datums/elements/rad_insulation.dm
index a0c9812820f..2c9492dac9d 100644
--- a/code/datums/elements/rad_insulation.dm
+++ b/code/datums/elements/rad_insulation.dm
@@ -6,7 +6,7 @@
/datum/element/rad_insulation/Attach(datum/target, _amount = RAD_MEDIUM_INSULATION, protects = TRUE, contamination_proof = TRUE)
. = ..()
if(!isatom(target))
- return COMPONENT_INCOMPATIBLE
+ return ELEMENT_INCOMPATIBLE
if(protects) // Does this protect things in its contents from being affected?
RegisterSignal(target, COMSIG_ATOM_RAD_PROBE, .proc/rad_probe_react)
diff --git a/code/datums/radiation_wave.dm b/code/datums/radiation_wave.dm
index 8cc0f7dc136..0c6f32c4555 100644
--- a/code/datums/radiation_wave.dm
+++ b/code/datums/radiation_wave.dm
@@ -4,7 +4,7 @@
/// The center of the wave
var/turf/master_turf
/// How far we've moved
- var/steps=0
+ var/steps = 0
/// How strong it was originaly
var/intensity
/// How much contaminated material it still has
@@ -101,7 +101,7 @@
/datum/radiation_wave/proc/radiate(list/atoms, strength)
var/can_contam = strength >= RAD_MINIMUM_CONTAMINATION
- var/contamination_strength = (strength-RAD_MINIMUM_CONTAMINATION) * RAD_CONTAMINATION_STR_COEFFICIENT
+ var/contamination_strength = (strength - RAD_MINIMUM_CONTAMINATION) * RAD_CONTAMINATION_STR_COEFFICIENT
contamination_strength = max(contamination_strength, RAD_BACKGROUND_RADIATION)
// It'll never reach 100% chance but the further out it gets the more likely it'll contaminate
var/contamination_chance = 100 - (90 / (1 + steps * 0.1))
diff --git a/code/game/objects/items/devices/geiger_counter.dm b/code/game/objects/items/devices/geiger_counter.dm
index e9539fdafd7..c24d92e7a96 100644
--- a/code/game/objects/items/devices/geiger_counter.dm
+++ b/code/game/objects/items/devices/geiger_counter.dm
@@ -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, "[src] must be on to reset its radiation level!")
+ to_chat(user, "[src] must be on to reset its radiation level!")
return
radiation_count = 0
- to_chat(usr, "You flush [src]'s radiation counts, resetting it to normal.")
+ to_chat(user, "You flush [src]'s radiation counts, resetting it to normal.")
update_icon()
/obj/item/geiger_counter/emag_act(mob/user)
diff --git a/code/modules/clothing/spacesuits/hardsuit.dm b/code/modules/clothing/spacesuits/hardsuit.dm
index 3af6b4055d7..8a563999ea0 100644
--- a/code/modules/clothing/spacesuits/hardsuit.dm
+++ b/code/modules/clothing/spacesuits/hardsuit.dm
@@ -12,8 +12,9 @@
var/on = FALSE
var/obj/item/clothing/suit/space/hardsuit/suit
item_color = "engineering" //Determines used sprites: hardsuit[on]-[color] and hardsuit[on]-[color]2 (lying down sprite)
- actions_types = list(/datum/action/item_action/toggle_helmet_light)
+ actions_types = list(/datum/action/item_action/toggle_helmet_light, /datum/action/item_action/toggle_geiger_counter)
+ var/scanning = TRUE
var/current_tick_amount = 0
var/radiation_count = 0
var/grace = RAD_GEIGER_GRACE_PERIOD
@@ -46,6 +47,7 @@
/obj/item/clothing/head/helmet/space/hardsuit/Destroy()
STOP_PROCESSING(SSobj, src)
+ QDEL_NULL(soundloop)
return ..()
/obj/item/clothing/head/helmet/space/hardsuit/attack_self(mob/user)
@@ -90,7 +92,7 @@
soundloop.stop(user)
else
qdel(src)
- else
+ else if(scanning)
soundloop.start(user)
/obj/item/clothing/head/helmet/space/hardsuit/proc/display_visor_message(var/msg)
@@ -105,19 +107,34 @@
current_tick_amount += amount
/obj/item/clothing/head/helmet/space/hardsuit/process()
- radiation_count -= radiation_count / RAD_GEIGER_MEASURE_SMOOTHING
- radiation_count += current_tick_amount / RAD_GEIGER_MEASURE_SMOOTHING
+ if(scanning)
+ 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
-
- grace--
- if(grace <= 0)
- radiation_count = 0
+ if(current_tick_amount)
+ grace = RAD_GEIGER_GRACE_PERIOD
+ else
+ grace--
+ if(grace <= 0)
+ radiation_count = 0
current_tick_amount = 0
- soundloop.last_radiation = radiation_count
+ if(ishuman(loc))
+ update_sound()
+
+/obj/item/clothing/head/helmet/space/hardsuit/proc/update_sound()
+ var/datum/looping_sound/geiger/loop = soundloop
+ if(!scanning || !radiation_count)
+ loop.stop(loc)
+ return
+ loop.last_radiation = radiation_count
+ loop.start(loc)
+
+/obj/item/clothing/head/helmet/space/hardsuit/proc/toggle_geiger_counter()
+ scanning = !scanning
+ if(ishuman(loc))
+ to_chat(loc, "You toggle [src]'s internal geiger counter [scanning ? "on" : "off"].")
/obj/item/clothing/head/helmet/space/hardsuit/emp_act(severity)
..()