Merge pull request #3642 from Citadel-Station-13/upstream-merge-32051
[MIRROR] More radiation balance changes and fixes
This commit is contained in:
@@ -27,6 +27,9 @@
|
||||
CRASH("Something that wasn't an atom was given /datum/component/radioactive")
|
||||
return
|
||||
|
||||
if(strength > RAD_MINIMUM_CONTAMINATION)
|
||||
SSradiation.warn(src)
|
||||
|
||||
START_PROCESSING(SSradiation, src)
|
||||
|
||||
/datum/component/radioactive/Destroy()
|
||||
@@ -34,9 +37,8 @@
|
||||
return ..()
|
||||
|
||||
/datum/component/radioactive/process()
|
||||
radiation_pulse(parent,strength,1,FALSE,can_contaminate)
|
||||
|
||||
if(hl3_release_date && prob(50))
|
||||
radiation_pulse(parent, strength, RAD_DISTANCE_COEFFICIENT*2, FALSE, can_contaminate)
|
||||
strength -= strength / hl3_release_date
|
||||
if(strength <= RAD_BACKGROUND_RADIATION)
|
||||
qdel(src)
|
||||
@@ -48,7 +50,6 @@
|
||||
return
|
||||
var/datum/component/radioactive/other = C
|
||||
strength = max(strength, other.strength)
|
||||
return
|
||||
|
||||
/datum/component/radioactive/proc/rad_examine(mob/user, atom/thing)
|
||||
var/atom/master = parent
|
||||
@@ -69,6 +70,7 @@
|
||||
/datum/component/radioactive/proc/rad_attack(atom/movable/target, mob/living/user)
|
||||
radiation_pulse(parent, strength/20)
|
||||
target.rad_act(strength/2)
|
||||
strength -= strength / hl3_release_date
|
||||
|
||||
#undef RAD_AMOUNT_LOW
|
||||
#undef RAD_AMOUNT_MEDIUM
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
#define RAD_GEIGER_LOW 100 // Geiger counter sound thresholds
|
||||
#define RAD_GEIGER_MEDIUM 500
|
||||
#define RAD_GEIGER_HIGH 1000
|
||||
|
||||
/datum/looping_sound/geiger
|
||||
mid_sounds = list(
|
||||
list('sound/items/geiger/low1.ogg'=1, 'sound/items/geiger/low2.ogg'=1, 'sound/items/geiger/low3.ogg'=1, 'sound/items/geiger/low4.ogg'=1),
|
||||
list('sound/items/geiger/med1.ogg'=1, 'sound/items/geiger/med2.ogg'=1, 'sound/items/geiger/med3.ogg'=1, 'sound/items/geiger/med4.ogg'=1),
|
||||
list('sound/items/geiger/high1.ogg'=1, 'sound/items/geiger/high2.ogg'=1, 'sound/items/geiger/high3.ogg'=1, 'sound/items/geiger/high4.ogg'=1),
|
||||
list('sound/items/geiger/ext1.ogg'=1, 'sound/items/geiger/ext2.ogg'=1, 'sound/items/geiger/ext3.ogg'=1, 'sound/items/geiger/ext4.ogg'=1)
|
||||
)
|
||||
mid_length = 2
|
||||
volume = 25
|
||||
var/last_radiation
|
||||
|
||||
/datum/looping_sound/geiger/get_sound(looped)
|
||||
var/danger
|
||||
switch(last_radiation)
|
||||
if(RAD_BACKGROUND_RADIATION to RAD_GEIGER_LOW)
|
||||
danger = 1
|
||||
if(RAD_GEIGER_LOW to RAD_GEIGER_MEDIUM)
|
||||
danger = 2
|
||||
if(RAD_GEIGER_MEDIUM to RAD_GEIGER_HIGH)
|
||||
danger = 3
|
||||
if(RAD_GEIGER_HIGH to INFINITY)
|
||||
danger = 4
|
||||
else
|
||||
return null
|
||||
return ..(looped, mid_sounds[danger])
|
||||
|
||||
/datum/looping_sound/geiger/stop()
|
||||
. = ..()
|
||||
last_radiation = 0
|
||||
|
||||
#undef RAD_GEIGER_LOW
|
||||
#undef RAD_GEIGER_MEDIUM
|
||||
#undef RAD_GEIGER_HIGH
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
list/atom/output_atoms
|
||||
output_atoms (list of atoms) The destination(s) for the sounds
|
||||
|
||||
mid_sounds (list or soundfile) Since this can be either a list or a single soundfile you can have random sounds. May contain further lists but must contain a soundfile at the end.
|
||||
mid_length (num) The length to wait between playing mid_sounds
|
||||
@@ -13,6 +13,7 @@
|
||||
volume (num) Sound output volume
|
||||
muted (bool) Private. Used to stop the sound loop.
|
||||
max_loops (num) The max amount of loops to run for.
|
||||
direct (bool) If true plays directly to provided atoms instead of from them
|
||||
*/
|
||||
/datum/looping_sound
|
||||
var/list/atom/output_atoms
|
||||
@@ -22,19 +23,18 @@
|
||||
var/start_length
|
||||
var/end_sound
|
||||
var/chance
|
||||
var/volume
|
||||
var/volume = 100
|
||||
var/muted = TRUE
|
||||
var/max_loops
|
||||
var/direct
|
||||
|
||||
/datum/looping_sound/New(list/_output_atoms, start_immediately=FALSE)
|
||||
/datum/looping_sound/New(list/_output_atoms=list(), start_immediately=FALSE, _direct=FALSE)
|
||||
if(!mid_sounds)
|
||||
WARNING("A looping sound datum was created without sounds to play.")
|
||||
return
|
||||
|
||||
if(_output_atoms)
|
||||
output_atoms = _output_atoms
|
||||
else
|
||||
output_atoms = list()
|
||||
output_atoms = _output_atoms
|
||||
direct = _direct
|
||||
|
||||
if(start_immediately)
|
||||
start()
|
||||
@@ -44,13 +44,17 @@
|
||||
output_atoms = null
|
||||
return ..()
|
||||
|
||||
/datum/looping_sound/proc/start()
|
||||
/datum/looping_sound/proc/start(atom/add_thing)
|
||||
if(add_thing)
|
||||
output_atoms |= add_thing
|
||||
if(!muted)
|
||||
return
|
||||
muted = FALSE
|
||||
on_start()
|
||||
|
||||
/datum/looping_sound/proc/stop()
|
||||
/datum/looping_sound/proc/stop(atom/remove_thing)
|
||||
if(remove_thing)
|
||||
output_atoms -= remove_thing
|
||||
if(muted)
|
||||
return
|
||||
muted = TRUE
|
||||
@@ -65,9 +69,16 @@
|
||||
|
||||
/datum/looping_sound/proc/play(soundfile)
|
||||
var/list/atoms_cache = output_atoms
|
||||
var/sound/S = sound(soundfile)
|
||||
if(direct)
|
||||
S.channel = open_sound_channel()
|
||||
S.volume = volume
|
||||
for(var/i in 1 to atoms_cache.len)
|
||||
var/atom/thing = atoms_cache[i]
|
||||
playsound(thing, soundfile, volume)
|
||||
if(direct)
|
||||
SEND_SOUND(thing, S)
|
||||
else
|
||||
playsound(thing, S, volume)
|
||||
|
||||
/datum/looping_sound/proc/get_sound(looped, _mid_sounds)
|
||||
if(!_mid_sounds)
|
||||
|
||||
@@ -89,18 +89,24 @@
|
||||
continue
|
||||
thing.rad_act(strength)
|
||||
|
||||
var/static/list/blacklisted = typecacheof(list( //These types will never be contaminated
|
||||
// This list should only be for types which don't get contaminated but you want to look in their contents
|
||||
// If you don't want to look in their contents and you don't want to rad_act them:
|
||||
// modify the ignored_things list in __HELPERS/radiation.dm instead
|
||||
var/static/list/blacklisted = typecacheof(list(
|
||||
/turf,
|
||||
/mob,
|
||||
/obj/structure/cable,
|
||||
/obj/machinery/atmospherics
|
||||
/obj/machinery/atmospherics,
|
||||
/obj/item/ammo_casing,
|
||||
/obj/item/implant
|
||||
))
|
||||
if(!can_contaminate || blacklisted[thing.type])
|
||||
continue
|
||||
if(prob((strength-RAD_MINIMUM_CONTAMINATION) * RAD_CONTAMINATION_CHANCE_COEFFICIENT * min(1/(steps*range_modifier), 1))) // Only stronk rads get to have little baby rads
|
||||
var/contamination_chance = (strength-RAD_MINIMUM_CONTAMINATION) * RAD_CONTAMINATION_CHANCE_COEFFICIENT * min(1, 1/(steps*range_modifier))
|
||||
if(prob(contamination_chance)) // Only stronk rads get to have little baby rads
|
||||
var/datum/component/rad_insulation/insulation = thing.GetComponent(/datum/component/rad_insulation)
|
||||
if(insulation && insulation.contamination_proof)
|
||||
continue
|
||||
else
|
||||
var/rad_strength = (strength-RAD_MINIMUM_CONTAMINATION) * RAD_CONTAMINATION_STR_COEFFICIENT * min(1/(steps*range_modifier), 1)
|
||||
var/rad_strength = (strength-RAD_MINIMUM_CONTAMINATION) * RAD_CONTAMINATION_STR_COEFFICIENT
|
||||
thing.AddComponent(/datum/component/radioactive, rad_strength, source)
|
||||
Reference in New Issue
Block a user