mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-23 20:16:55 +01:00
Improves Geiger Counters; Allows Toggle (#15366)
* Improves Geiger Counters; Allows Toggle * no arg * spelling * tweaks
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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, "<span class='notice'>You toggle [src]'s internal geiger counter [scanning ? "on" : "off"].</span>")
|
||||
|
||||
/obj/item/clothing/head/helmet/space/hardsuit/emp_act(severity)
|
||||
..()
|
||||
|
||||
Reference in New Issue
Block a user