Merge pull request #4191 from CHOMPStation2/upstream-merge-12869

[MIRROR] Dosimeters
This commit is contained in:
Nadyr
2022-05-01 18:14:37 -04:00
committed by GitHub
5 changed files with 145 additions and 0 deletions

View File

@@ -26,6 +26,13 @@
/obj/item/clothing/head/radiation = 3 /obj/item/clothing/head/radiation = 3
) )
/datum/supply_pack/eng/dosimeter
contains = list(/obj/item/weapon/storage/box/dosimeter = 6)
name = "Dosimeters"
cost = 10
containertype = /obj/structure/closet/crate
containername = "dosimeter crate"
/datum/supply_pack/eng/algae /datum/supply_pack/eng/algae
contains = list(/obj/item/stack/material/algae/ten) contains = list(/obj/item/stack/material/algae/ten)
name = "Algae Sheets (10)" name = "Algae Sheets (10)"

View File

@@ -117,6 +117,11 @@
..() ..()
gear_tweaks += gear_tweak_free_color_choice gear_tweaks += gear_tweak_free_color_choice
/datum/gear/accessory/dosimeter
display_name = "Dosimeter"
path = /obj/item/weapon/storage/box/dosimeter
description = "A small device that will display dangerous levels of radiation."
/* /*
Talon pin Talon pin
*/ */

View File

@@ -0,0 +1,132 @@
/obj/item/clothing/accessory/dosimeter
name = "dosimeter"
desc = "A small device used to measure body radiation and warning one after a certain threshold. \
Read manual before use! Can be held, attached to the uniform or worn around the neck."
w_class = ITEMSIZE_SMALL
icon = 'icons/inventory/accessory/item_vr.dmi'
icon_override = 'icons/inventory/accessory/item_vr.dmi'
icon_state = "dosimeter"
item_state = "dosimeter"
overlay_state = "dosimeter"
slot_flags = SLOT_TIE
var/obj/item/weapon/dosimeter_film/current_film = null
/obj/item/clothing/accessory/dosimeter/New()
..()
current_film = new /obj/item/weapon/dosimeter_film(src)
update_state(current_film.state)
START_PROCESSING(SSobj, src)
/obj/item/clothing/accessory/dosimeter/Destroy()
return ..()
/obj/item/clothing/accessory/dosimeter/process()
check_holder()
if(current_film.state > 1)
STOP_PROCESSING(SSobj, src)
/obj/item/clothing/accessory/dosimeter/attack_hand(mob/user as mob)
if(user.get_inactive_hand() == src)
if(current_film)
user.put_in_hands(current_film)
current_film = null
to_chat(user, "<span class='notice'>You pulled out the film out of \the [src].</span>")
desc = "This seems like a dosimeter, but there is no film inside."
STOP_PROCESSING(SSobj, src)
update_state(0)
return
..()
else
return ..()
/obj/item/clothing/accessory/dosimeter/attackby(obj/item/I, mob/user)
if(istype(I, /obj/item/weapon/dosimeter_film))
if(!current_film)
user.drop_item()
I.loc = src
current_film = I
update_state(current_film.state)
to_chat(user, "<span class='notice'>You inserted the film into \the [src].</span>")
desc = "This seems like a dosimeter. It has a film inside."
if(current_film.state < 2)
START_PROCESSING(SSobj, src)
else
to_chat(user, "<span class='notice'>\The [src] already has a film inside.</span>")
else
return ..()
/obj/item/clothing/accessory/dosimeter/proc/check_holder()
if(wearer)
if(current_film && (wearer.radiation >= 25) && (current_film.state == 0))
update_state(1)
visible_message("<span class='warning'>The film of \the [src] starts to darken.</span>")
desc = "This seems like a dosimeter, but the film has darkened."
sleep(30)
else if(current_film && (wearer.radiation >= 50) && (current_film.state == 1))
visible_message("<span class='warning'>The film of \the [src] has turned black!</span>")
update_state(2)
desc = "This seems like a dosimeter, but the film has turned black."
/obj/item/clothing/accessory/dosimeter/proc/update_state(var/tostate)
if(current_film)
current_film.state = tostate
icon_state = "[initial(icon_state)][tostate]"
current_film.icon_state = "dosimeter_film[tostate]"
else
icon_state = "[initial(icon_state)]-empty"
update_icon()
/obj/item/weapon/dosimeter_film
name = "dosimeter film"
desc = "These films can be inserted into dosimeters. It turns from white to black, depending on how much radiation it endured."
w_class = ITEMSIZE_SMALL
icon = 'icons/inventory/accessory/item_vr.dmi'
icon_override = 'icons/inventory/accessory/item_vr.dmi'
icon_state = "dosimeter_film0"
var/state = 0 //0 - White, 1 - Darker, 2 - Black (same as iconstates)
/obj/item/weapon/dosimeter_film/proc/update_state(var/tostate)
icon_state = tostate
update_icon()
/obj/item/weapon/paper/dosimeter_manual
name = "Dosimeter manual"
info = {"<h4>Dosimeter</h4>
<h5>Usage</h5>
<ol>
<li>Insert film into dosimeter.</li>
<li>Attach dosimeter to clothing or carry it.</li>
<li>Replace film if current film turned black.</li>
</ol>
<br />
<h5>Purpose</h5>
<p>This device will let you know about any dangerous radiation levels, that your body is exposed to.
A white film indicates that everything is alright. A darker film indicates, that the radiation level is starting to get dangerous for your body.
The body has absorbed too much radiation if the film turned black.</p>"}
/obj/item/weapon/storage/box/dosimeter
name = "dosimeter case"
desc = "This case can only hold the Dosimeter, a few films and a manual."
item_state_slots = list(slot_r_hand_str = "syringe_kit", slot_l_hand_str = "syringe_kit")
storage_slots = 5
can_hold = list(/obj/item/weapon/paper/dosimeter_manual, /obj/item/clothing/accessory/dosimeter, /obj/item/weapon/dosimeter_film)
max_storage_space = (ITEMSIZE_COST_SMALL * 2) + (ITEMSIZE_COST_TINY * 3)
w_class = ITEMSIZE_SMALL
/obj/item/weapon/storage/box/dosimeter/New()
..()
new /obj/item/weapon/paper/dosimeter_manual(src)
new /obj/item/clothing/accessory/dosimeter(src)
new /obj/item/weapon/dosimeter_film(src)
new /obj/item/weapon/dosimeter_film(src)
new /obj/item/weapon/dosimeter_film(src)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -2232,6 +2232,7 @@
#include "code\modules\clothing\under\accessories\armband.dm" #include "code\modules\clothing\under\accessories\armband.dm"
#include "code\modules\clothing\under\accessories\armor.dm" #include "code\modules\clothing\under\accessories\armor.dm"
#include "code\modules\clothing\under\accessories\badges.dm" #include "code\modules\clothing\under\accessories\badges.dm"
#include "code\modules\clothing\under\accessories\badges_vr.dm"
#include "code\modules\clothing\under\accessories\clothing.dm" #include "code\modules\clothing\under\accessories\clothing.dm"
#include "code\modules\clothing\under\accessories\holster.dm" #include "code\modules\clothing\under\accessories\holster.dm"
#include "code\modules\clothing\under\accessories\holster_vr.dm" #include "code\modules\clothing\under\accessories\holster_vr.dm"