diff --git a/code/datums/looping_sounds/item_sounds.dm b/code/datums/looping_sounds/item_sounds.dm index e729ed22dd..d8b72be76c 100644 --- a/code/datums/looping_sounds/item_sounds.dm +++ b/code/datums/looping_sounds/item_sounds.dm @@ -1,4 +1,4 @@ -#define RAD_GEIGER_LOW 100 // Geiger counter sound thresholds +#define RAD_GEIGER_LOW 100 // Geiger counter sound thresholds #define RAD_GEIGER_MEDIUM 500 #define RAD_GEIGER_HIGH 1000 diff --git a/code/game/objects/items/devices/geiger_counter.dm b/code/game/objects/items/devices/geiger_counter.dm index 2413a3fb9a..01175969bd 100644 --- a/code/game/objects/items/devices/geiger_counter.dm +++ b/code/game/objects/items/devices/geiger_counter.dm @@ -19,6 +19,7 @@ w_class = WEIGHT_CLASS_SMALL slot_flags = ITEM_SLOT_BELT rad_flags = RAD_NO_CONTAMINATE + item_flags = NOBLUDGEON custom_materials = list(/datum/material/iron = 150, /datum/material/glass = 150) var/grace = RAD_GRACE_PERIOD @@ -35,17 +36,15 @@ . = ..() START_PROCESSING(SSobj, src) - soundloop = new(list(src), FALSE) + soundloop = new(src, FALSE) /obj/item/geiger_counter/Destroy() STOP_PROCESSING(SSobj, src) QDEL_NULL(soundloop) + return ..() -/obj/item/geiger_counter/process() - update_icon() - update_sound() - +/obj/item/geiger_counter/process(delta_time) if(!scanning) current_tick_amount = 0 return @@ -55,58 +54,64 @@ if(current_tick_amount) grace = RAD_GRACE_PERIOD - last_tick_amount = current_tick_amount + last_tick_amount = current_tick_amount - else if(!(obj_flags & EMAGGED)) - grace-- - if(grace <= 0) - radiation_count = 0 + else if(!(obj_flags & EMAGGED)) + grace-- + if(grace <= 0) + radiation_count = 0 current_tick_amount = 0 + update_appearance() + update_sound() + /obj/item/geiger_counter/examine(mob/user) . = ..() if(!scanning) return - . += "Alt-click it to clear stored radiation levels." + . += span_info("Alt-click it to clear stored radiation levels.") if(obj_flags & EMAGGED) - . += "The display seems to be incomprehensible." + . += span_warning("The display seems to be incomprehensible.") return switch(radiation_count) if(-INFINITY to RAD_LEVEL_NORMAL) - . += "Ambient radiation level count reports that all is well." + . += span_notice("Ambient radiation level count reports that all is well.") if(RAD_LEVEL_NORMAL + 1 to RAD_LEVEL_MODERATE) - . += "Ambient radiation levels slightly above average." + . += span_alert("Ambient radiation levels slightly above average.") if(RAD_LEVEL_MODERATE + 1 to RAD_LEVEL_HIGH) - . += "Ambient radiation levels above average." + . += span_warning("Ambient radiation levels above average.") if(RAD_LEVEL_HIGH + 1 to RAD_LEVEL_VERY_HIGH) - . += "Ambient radiation levels highly above average." + . += span_danger("Ambient radiation levels highly above average.") if(RAD_LEVEL_VERY_HIGH + 1 to RAD_LEVEL_CRITICAL) - . += "Ambient radiation levels nearing critical level." + . += span_suicide("Ambient radiation levels nearing critical level.") if(RAD_LEVEL_CRITICAL + 1 to INFINITY) - . += "Ambient radiation levels above critical level!" + . += span_boldannounce("Ambient radiation levels above critical level!") - . += "The last radiation amount detected was [last_tick_amount]" + . += span_notice("The last radiation amount detected was [last_tick_amount]") /obj/item/geiger_counter/update_icon_state() if(!scanning) icon_state = "geiger_off" - else if(obj_flags & EMAGGED) + return ..() + if(obj_flags & EMAGGED) icon_state = "geiger_on_emag" - else - switch(radiation_count) - if(-INFINITY to RAD_LEVEL_NORMAL) - icon_state = "geiger_on_1" - if(RAD_LEVEL_NORMAL + 1 to RAD_LEVEL_MODERATE) - icon_state = "geiger_on_2" - if(RAD_LEVEL_MODERATE + 1 to RAD_LEVEL_HIGH) - icon_state = "geiger_on_3" - if(RAD_LEVEL_HIGH + 1 to RAD_LEVEL_VERY_HIGH) - icon_state = "geiger_on_4" - if(RAD_LEVEL_VERY_HIGH + 1 to RAD_LEVEL_CRITICAL) - icon_state = "geiger_on_4" - if(RAD_LEVEL_CRITICAL + 1 to INFINITY) - icon_state = "geiger_on_5" + return ..() + + switch(radiation_count) + if(-INFINITY to RAD_LEVEL_NORMAL) + icon_state = "geiger_on_1" + if(RAD_LEVEL_NORMAL + 1 to RAD_LEVEL_MODERATE) + icon_state = "geiger_on_2" + if(RAD_LEVEL_MODERATE + 1 to RAD_LEVEL_HIGH) + icon_state = "geiger_on_3" + if(RAD_LEVEL_HIGH + 1 to RAD_LEVEL_VERY_HIGH) + icon_state = "geiger_on_4" + if(RAD_LEVEL_VERY_HIGH + 1 to RAD_LEVEL_CRITICAL) + icon_state = "geiger_on_4" + if(RAD_LEVEL_CRITICAL + 1 to INFINITY) + icon_state = "geiger_on_5" + return ..() /obj/item/geiger_counter/proc/update_sound() var/datum/looping_sound/geiger/loop = soundloop @@ -124,21 +129,21 @@ if(amount <= RAD_BACKGROUND_RADIATION || !scanning) return current_tick_amount += amount - update_icon() + update_appearance() /obj/item/geiger_counter/attack_self(mob/user) scanning = !scanning - update_icon() - to_chat(user, "[icon2html(src, user)] You switch [scanning ? "on" : "off"] [src].") + update_appearance() + to_chat(user, span_notice("[icon2html(src, user)] You switch [scanning ? "on" : "off"] [src].")) -/obj/item/geiger_counter/afterattack(atom/target, mob/user) +/obj/item/geiger_counter/afterattack(atom/target, mob/living/user) . = ..() if(user.a_intent == INTENT_HELP) if(!(obj_flags & EMAGGED)) - user.visible_message("[user] scans [target] with [src].", "You scan [target]'s radiation levels with [src]...") + user.visible_message(span_notice("[user] scans [target] with [src]."), span_notice("You scan [target]'s radiation levels with [src]...")) addtimer(CALLBACK(src, .proc/scan, target, user), 20, TIMER_UNIQUE) // Let's not have spamming GetAllContents else - user.visible_message("[user] scans [target] with [src].", "You project [src]'s stored radiation into [target]!") + user.visible_message(span_notice("[user] scans [target] with [src]."), span_danger("You project [src]'s stored radiation into [target]!")) target.rad_act(radiation_count) radiation_count = 0 return TRUE @@ -156,57 +161,61 @@ if(isliving(A)) var/mob/living/M = A if(!M.radiation) - to_chat(user, "[icon2html(src, user)] Radiation levels within normal boundaries.") + to_chat(user, span_notice("[icon2html(src, user)] Radiation levels within normal boundaries.")) else - to_chat(user, "[icon2html(src, user)] Subject is irradiated. Radiation levels: [M.radiation] rad.") + to_chat(user, span_boldannounce("[icon2html(src, user)] Subject is irradiated. Radiation levels: [M.radiation].")) if(rad_strength) - to_chat(user, "[icon2html(src, user)] Target contains radioactive contamination. Radioactive strength: [rad_strength]") + to_chat(user, span_boldannounce("[icon2html(src, user)] Target contains radioactive contamination. Radioactive strength: [rad_strength]")) else - to_chat(user, "[icon2html(src, user)] Target is free of radioactive contamination.") + to_chat(user, span_notice("[icon2html(src, user)] Target is free of radioactive contamination.")) /obj/item/geiger_counter/attackby(obj/item/I, mob/user, params) if(I.tool_behaviour == TOOL_SCREWDRIVER && (obj_flags & EMAGGED)) if(scanning) - to_chat(user, "Turn off [src] before you perform this action!") - return 0 - user.visible_message("[user] unscrews [src]'s maintenance panel and begins fiddling with its innards...", "You begin resetting [src]...") + to_chat(user, span_warning("Turn off [src] before you perform this action!")) + return FALSE + user.visible_message(span_notice("[user] unscrews [src]'s maintenance panel and begins fiddling with its innards..."), span_notice("You begin resetting [src]...")) if(!I.use_tool(src, user, 40, volume=50)) - return 0 - user.visible_message("[user] refastens [src]'s maintenance panel!", "You reset [src] to its factory settings!") + return FALSE + user.visible_message(span_notice("[user] refastens [src]'s maintenance panel!"), span_notice("You reset [src] to its factory settings!")) obj_flags &= ~EMAGGED radiation_count = 0 - update_icon() - return 1 + update_appearance() + return TRUE else return ..() /obj/item/geiger_counter/AltClick(mob/living/user) - . = ..() if(!istype(user) || !user.canUseTopic(src, BE_CLOSE)) - return + return ..() if(!scanning) - to_chat(usr, "[src] must be on to reset its radiation level!") - return TRUE + to_chat(usr, span_warning("[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.") - update_icon() - return TRUE + to_chat(usr, span_notice("You flush [src]'s radiation counts, resetting it to normal.")) + update_appearance() /obj/item/geiger_counter/emag_act(mob/user) . = ..() if(obj_flags & EMAGGED) return if(scanning) - to_chat(user, "Turn off [src] before you perform this action!") + to_chat(user, span_warning("Turn off [src] before you perform this action!")) return - to_chat(user, "You override [src]'s radiation storing protocols. It will now generate small doses of radiation, and stored rads are now projected into creatures you scan.") + to_chat(user, span_warning("You override [src]'s radiation storing protocols. It will now generate small doses of radiation, and stored rads are now projected into creatures you scan.")) obj_flags |= EMAGGED return TRUE /obj/item/geiger_counter/cyborg var/mob/listeningTo +/obj/item/geiger_counter/cyborg/cyborg_unequip(mob/user) + if(!scanning) + return + scanning = FALSE + update_appearance() + /obj/item/geiger_counter/cyborg/equipped(mob/user) . = ..() if(listeningTo == user) @@ -217,6 +226,7 @@ listeningTo = user /obj/item/geiger_counter/cyborg/proc/redirect_rad_act(datum/source, amount) + SIGNAL_HANDLER rad_act(amount) /obj/item/geiger_counter/cyborg/dropped(mob/user)