Tweaks Geiger Counters

Geiger counters now have sounds, which I took from https://freesound.org/people/leonelmail/sounds/328381/ and chopped it up into several .oggs. The license is CC0 (public domain) so it'll fit with our license.
The Geiger counter now turns yellow at any sign of radiation instead of at 5 units, since below five units is still harmful.
Examining the Geiger counter updates the radiation count immediately.
This commit is contained in:
Neerti
2017-11-16 18:13:29 -05:00
parent 0431c2d23c
commit 810f7e694d
11 changed files with 46 additions and 12 deletions

View File

@@ -1,7 +1,7 @@
#define RAD_LEVEL_LOW 5 //10 // Around the level at which radiation starts to become harmful #define RAD_LEVEL_LOW 0.01 // Around the level at which radiation starts to become harmful
#define RAD_LEVEL_MODERATE 15 //15 #define RAD_LEVEL_MODERATE 10
#define RAD_LEVEL_HIGH 50 //50 #define RAD_LEVEL_HIGH 25
#define RAD_LEVEL_VERY_HIGH 100 //100 #define RAD_LEVEL_VERY_HIGH 50
//Geiger counter //Geiger counter
//Rewritten version of TG's geiger counter //Rewritten version of TG's geiger counter
@@ -19,7 +19,14 @@
/obj/item/device/geiger/New() /obj/item/device/geiger/New()
processing_objects |= src processing_objects |= src
/obj/item/device/geiger/Destroy()
processing_objects -= src
return ..()
/obj/item/device/geiger/process() /obj/item/device/geiger/process()
get_radiation()
/obj/item/device/geiger/proc/get_radiation()
if(!scanning) if(!scanning)
return return
radiation_count = radiation_repository.get_rads_at_turf(get_turf(src)) radiation_count = radiation_repository.get_rads_at_turf(get_turf(src))
@@ -27,12 +34,29 @@
/obj/item/device/geiger/examine(mob/user) /obj/item/device/geiger/examine(mob/user)
..(user) ..(user)
to_chat(user, "<span class='warning'>[scanning ? "ambient" : "stored"] radiation level: [radiation_count ? radiation_count : "0"]Bq.</span>") get_radiation()
to_chat(user, "<span class='warning'>[scanning ? "Ambient" : "Stored"] radiation level: [radiation_count ? radiation_count : "0"]Bq.</span>")
/obj/item/device/geiger/rad_act(amount)
if(!amount || !scanning)
return FALSE
if(amount > radiation_count)
radiation_count = amount
var/sound = "geiger"
if(amount < 5)
sound = "geiger_weak"
playsound(src, sound, between(10, 10 + (radiation_count * 4), 100), 0)
if(sound == "geiger_weak") // A weak geiger sound every two seconds sounds too infrequent.
spawn(1 SECOND)
playsound(src, sound, between(10, 10 + (radiation_count * 4), 100), 0)
update_icon()
/obj/item/device/geiger/attack_self(var/mob/user) /obj/item/device/geiger/attack_self(var/mob/user)
scanning = !scanning scanning = !scanning
update_icon() update_icon()
to_chat(user, "<span class='notice'>\icon[src] You switch [scanning ? "on" : "off"] [src].</span>") to_chat(user, "<span class='notice'>\icon[src] You switch [scanning ? "on" : "off"] \the [src].</span>")
/obj/item/device/geiger/update_icon() /obj/item/device/geiger/update_icon()
if(!scanning) if(!scanning)
@@ -40,12 +64,18 @@
return 1 return 1
switch(radiation_count) switch(radiation_count)
if(null) icon_state = "geiger_on_1" if(null)
if(-INFINITY to RAD_LEVEL_LOW) icon_state = "geiger_on_1" icon_state = "geiger_on_1"
if(RAD_LEVEL_LOW + 1 to RAD_LEVEL_MODERATE) icon_state = "geiger_on_2" if(-INFINITY to RAD_LEVEL_LOW)
if(RAD_LEVEL_MODERATE + 1 to RAD_LEVEL_HIGH) icon_state = "geiger_on_3" icon_state = "geiger_on_1"
if(RAD_LEVEL_HIGH + 1 to RAD_LEVEL_VERY_HIGH) icon_state = "geiger_on_4" if(RAD_LEVEL_LOW to RAD_LEVEL_MODERATE)
if(RAD_LEVEL_VERY_HIGH + 1 to INFINITY) icon_state = "geiger_on_5" icon_state = "geiger_on_2"
if(RAD_LEVEL_MODERATE to RAD_LEVEL_HIGH)
icon_state = "geiger_on_3"
if(RAD_LEVEL_HIGH to RAD_LEVEL_VERY_HIGH)
icon_state = "geiger_on_4"
if(RAD_LEVEL_VERY_HIGH to INFINITY)
icon_state = "geiger_on_5"
#undef RAD_LEVEL_LOW #undef RAD_LEVEL_LOW
#undef RAD_LEVEL_MODERATE #undef RAD_LEVEL_MODERATE

View File

@@ -51,6 +51,8 @@ var/list/keyboard_sound = list ('sound/effects/keyboard/keyboard1.ogg','sound/ef
var/list/mechstep_sound = list('sound/mecha/mechstep1.ogg', 'sound/mecha/mechstep2.ogg') var/list/mechstep_sound = list('sound/mecha/mechstep1.ogg', 'sound/mecha/mechstep2.ogg')
var/list/bodyfall_sound = list('sound/effects/bodyfall1.ogg','sound/effects/bodyfall2.ogg','sound/effects/bodyfall3.ogg','sound/effects/bodyfall4.ogg') var/list/bodyfall_sound = list('sound/effects/bodyfall1.ogg','sound/effects/bodyfall2.ogg','sound/effects/bodyfall3.ogg','sound/effects/bodyfall4.ogg')
var/list/can_sound = list('sound/effects/can_open1.ogg','sound/effects/can_open2.ogg','sound/effects/can_open3.ogg','sound/effects/can_open4.ogg') var/list/can_sound = list('sound/effects/can_open1.ogg','sound/effects/can_open2.ogg','sound/effects/can_open3.ogg','sound/effects/can_open4.ogg')
var/list/geiger_sound = list('sound/items/geiger1.ogg', 'sound/items/geiger2.ogg', 'sound/items/geiger3.ogg', 'sound/items/geiger4.ogg', 'sound/items/geiger5.ogg')
var/list/geiger_weak_sound = list('sound/items/geiger_weak1.ogg', 'sound/items/geiger_weak2.ogg', 'sound/items/geiger_weak3.ogg', 'sound/items/geiger_weak4.ogg')
//var/list/gun_sound = list('sound/weapons/Gunshot.ogg', 'sound/weapons/Gunshot2.ogg','sound/weapons/Gunshot3.ogg','sound/weapons/Gunshot4.ogg') //var/list/gun_sound = list('sound/weapons/Gunshot.ogg', 'sound/weapons/Gunshot2.ogg','sound/weapons/Gunshot3.ogg','sound/weapons/Gunshot4.ogg')
@@ -186,4 +188,6 @@ var/const/FALLOFF_SOUNDS = 0.5
if ("canopen") soundin = pick(can_sound) if ("canopen") soundin = pick(can_sound)
if ("mechstep") soundin = pick(mechstep_sound) if ("mechstep") soundin = pick(mechstep_sound)
//if ("gunshot") soundin = pick(gun_sound) //if ("gunshot") soundin = pick(gun_sound)
if("geiger") soundin = pick(geiger_sound)
if("geiger_weak") soundin = pick(geiger_weak_sound)
return soundin return soundin

BIN
sound/items/geiger1.ogg Normal file

Binary file not shown.

BIN
sound/items/geiger2.ogg Normal file

Binary file not shown.

BIN
sound/items/geiger3.ogg Normal file

Binary file not shown.

BIN
sound/items/geiger4.ogg Normal file

Binary file not shown.

BIN
sound/items/geiger5.ogg Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.