mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2025-12-31 12:41:46 +00:00
* initial changes * Rad wave is working. now to implement the rest * Makes the waves square * Makes wave square * multiplies the strength in all instances of radiation_pulse by 4 because each pulse makes one wave instead of 4 now * Undef thing and apply suggestion * Make radiation_pulse() not radiate the radiation source and implements contamination * Adds contamination to uranium walls and meteors * Fixes stuff * Handle some contamination on attack still need to take care of meteors * Fixed the meteor stuff * Introduce emission types * moves contaminate_touch to an atom proc and renames it to contaminate_atom * deduplicates some contamination code * Move inherent radioactivity to a component and signals from the atom vars and behaviour * fix some things with the new component * Update inherent_radioactivity.dm * implement contaminating things that hit things that are inherently radioactive * window things * adds emission type to the rad_act call * Changes radiation insulation values on a bunch of stuff * fixes radioactive component radiating the wrong type * more adjustments * refactros rad_act * adjustments to collector power production * Adds plastitaniumglass windows and makes further adjustments * Adds sprites to the shards and plastitanium directional window * Update misc_cleanables.dm * removes alpha rad insulation from floor turfs * Fixes a bug with the starting tile of radiation waves * More adjustments * Adjusting singularity rad production * reduces window half life a bit to make power smoother and buffs full window rad conversion * Strengthens gamma and beta radiation effect on mobs. * Makes radsuit block radiation completely * Fixes Geiger Counters * Fixes contamination not irradiating the contaminated thing * Fixes inherent radioactivity not processing. Also makes it stop processing when a nuke core is contained * Fixes ghost contamination * Adds info to the collector * Handles alpha radiation better on humans and changes some instances of rad_act to base_rad_act * oops * adjustments and fixes to alpha rad handling on mobs * Make collector info more compact * Core no longer radiates and contaminates from within the nuke until the plates are removed * Contamination no longer counts as being inside a mob(it is supposed to be surface level) * Adds inherent radioactivity to a bunch of uranium things. makes it all process. * Nerf full windows * Adjustments to collector and fulltile window radiation absorption * Reduces passive contamination, especially while on the floor * Adds different rad types to the geiger counter and fixes a runtime * Makes full tile windows strong again and disallows building them on top of collectors * adds emissive blockers to the rad blacklist and gives windows and collectors priority when irradiating for increased consistency * Gives each contamination type it's own color. * Gives each contamination type it's own color. And makes the rad hud display them separately * Changes how much the radiation wave affects the source tile, adds decay for performance reasons and adjusts collector parameters as well as SM and singulo rad production * improves performance at very high rad amounts * Fixes supermatter sliver box not containing radiation * Restores supermatter sliver to old behaviour(not inherently radioactive) * Slight nerf to fulltile windows and removes an unnecessary multiplication from rad wave processing * Removes redundant line from window rad act * Fixes radiation waves ignoring walls * fixes it better * more adjustments to collector stats * Adjustment to collector gamma absorption * increases grille beta blocking * Review changes
176 lines
6.3 KiB
Plaintext
176 lines
6.3 KiB
Plaintext
#define RAD_AMOUNT_LOW 50
|
|
#define RAD_AMOUNT_MEDIUM 200
|
|
#define RAD_AMOUNT_HIGH 500
|
|
#define RAD_AMOUNT_EXTREME 1000
|
|
#define GLOW_ALPHA "#225dff5d"
|
|
#define GLOW_BETA "#39ff1430"
|
|
#define GLOW_GAMMA "#c125ff6b"
|
|
|
|
/datum/component/radioactive
|
|
dupe_mode = COMPONENT_DUPE_UNIQUE_PASSARGS
|
|
|
|
var/source
|
|
///the half-life measured in ticks
|
|
var/hl3_release_date
|
|
var/alpha_strength
|
|
var/beta_strength
|
|
var/gamma_strength
|
|
|
|
/datum/component/radioactive/Initialize(_strength, _source, emission_type, _half_life = RAD_HALF_LIFE)
|
|
if(!istype(parent, /atom))
|
|
return COMPONENT_INCOMPATIBLE
|
|
switch(emission_type)
|
|
if(ALPHA_RAD)
|
|
alpha_strength = _strength
|
|
if(BETA_RAD)
|
|
beta_strength = _strength
|
|
if(GAMMA_RAD)
|
|
gamma_strength = _strength
|
|
source = _source
|
|
hl3_release_date = _half_life
|
|
RegisterSignal(parent, COMSIG_PARENT_EXAMINE, PROC_REF(rad_examine))
|
|
RegisterSignal(parent, COMSIG_ADMIN_DECONTAMINATE, PROC_REF(admin_decontaminate))
|
|
if(isitem(parent))
|
|
RegisterSignal(parent, COMSIG_ATTACK, PROC_REF(rad_attack))
|
|
RegisterSignal(parent, COMSIG_ATTACK_OBJ, PROC_REF(rad_attack))
|
|
//Let's make er glow
|
|
//This relies on parent not being a turf or something. IF YOU CHANGE THAT, CHANGE THIS
|
|
var/atom/movable/master = parent
|
|
master.add_filter("rad_glow", 2, list("type" = "outline", "color" = get_glow_color(), "size" = 2))
|
|
addtimer(CALLBACK(src, PROC_REF(glow_loop), master), rand(1, 19)) //Things should look uneven
|
|
LAZYADD(SSradiation.all_radiations, src)
|
|
START_PROCESSING(SSradiation, src)
|
|
|
|
/datum/component/radioactive/Destroy()
|
|
STOP_PROCESSING(SSradiation, src)
|
|
LAZYREMOVE(SSradiation.all_radiations, src)
|
|
var/atom/movable/master = parent
|
|
master.remove_filter("rad_glow")
|
|
return ..()
|
|
|
|
/datum/component/radioactive/proc/get_glow_color()
|
|
var/list/glow_alpha = rgb2num(GLOW_ALPHA)
|
|
var/list/glow_beta = rgb2num(GLOW_BETA)
|
|
var/list/glow_gamma = rgb2num(GLOW_GAMMA)
|
|
var/list/rad_color = list()
|
|
var/alpha_part = alpha_strength / (alpha_strength + beta_strength + gamma_strength)
|
|
var/beta_part = beta_strength / (alpha_strength + beta_strength + gamma_strength)
|
|
var/gamma_part = 1 - (alpha_part + beta_part)
|
|
var/max_ratio = 0
|
|
for(var/i in 1 to 4)
|
|
rad_color += glow_alpha[i] * alpha_part + glow_beta[i] * beta_part + glow_gamma[i] * gamma_part
|
|
// Find the ratio between the color value closest to 256 and 256.
|
|
if(i < 4 && max_ratio < (rad_color[i] / 256))
|
|
max_ratio = rad_color[i] / 256
|
|
return rgb(rad_color[1] / max_ratio, rad_color[2] / max_ratio, rad_color[3] / max_ratio, rad_color[4])
|
|
|
|
/datum/component/radioactive/process()
|
|
if(alpha_strength > RAD_BACKGROUND_RADIATION)
|
|
radiation_pulse(parent, alpha_strength, ALPHA_RAD)
|
|
if(beta_strength > RAD_BACKGROUND_RADIATION)
|
|
radiation_pulse(parent, beta_strength, BETA_RAD)
|
|
if(gamma_strength > RAD_BACKGROUND_RADIATION)
|
|
radiation_pulse(parent, gamma_strength, GAMMA_RAD)
|
|
|
|
if(!hl3_release_date)
|
|
return
|
|
|
|
alpha_strength -= alpha_strength / hl3_release_date
|
|
beta_strength -= beta_strength / hl3_release_date
|
|
gamma_strength -= gamma_strength / hl3_release_date
|
|
|
|
SSradiation.update_rad_cache_contaminated(src)
|
|
|
|
if(alpha_strength + beta_strength + gamma_strength <= RAD_BACKGROUND_RADIATION)
|
|
qdel(src)
|
|
return PROCESS_KILL
|
|
|
|
/datum/component/radioactive/proc/glow_loop(atom/movable/master)
|
|
var/filter = master.get_filter("rad_glow")
|
|
if(filter)
|
|
animate(filter, alpha = 110, time = 15, loop = -1)
|
|
animate(alpha = 40, time = 25)
|
|
|
|
/datum/component/radioactive/InheritComponent(datum/component/C, i_am_original, _strength, _source, emission_type, _half_life = RAD_HALF_LIFE)
|
|
if(!i_am_original)
|
|
return
|
|
if(!hl3_release_date) // Permanently radioactive things don't get to grow stronger
|
|
return
|
|
if(C)
|
|
var/datum/component/radioactive/other = C
|
|
alpha_strength = max(alpha_strength, other.alpha_strength)
|
|
beta_strength = max(beta_strength, other.beta_strength)
|
|
gamma_strength = max(gamma_strength, other.gamma_strength)
|
|
hl3_release_date = other.hl3_release_date
|
|
else
|
|
switch(emission_type)
|
|
if(ALPHA_RAD)
|
|
alpha_strength = max(alpha_strength, _strength)
|
|
if(BETA_RAD)
|
|
beta_strength = max(beta_strength, _strength)
|
|
if(GAMMA_RAD)
|
|
gamma_strength = max(gamma_strength, _strength)
|
|
|
|
hl3_release_date = _half_life
|
|
var/atom/movable/master = parent
|
|
var/filter = master.get_filter("rad_glow")
|
|
animate(filter, color = get_glow_color())
|
|
|
|
/datum/component/radioactive/proc/rad_examine(datum/source, mob/user, list/out)
|
|
SIGNAL_HANDLER
|
|
|
|
var/atom/master = parent
|
|
|
|
var/list/fragments = list()
|
|
if(get_dist(master, user) <= 1)
|
|
fragments += "The air around [master] feels warm"
|
|
switch(alpha_strength + beta_strength + gamma_strength)
|
|
if(0 to RAD_AMOUNT_LOW)
|
|
if(length(fragments))
|
|
fragments += "."
|
|
if(RAD_AMOUNT_LOW to RAD_AMOUNT_MEDIUM)
|
|
fragments += "[length(fragments) ? " and [master.p_they()] " : "[master] "]feel[master.p_s()] weird to look at."
|
|
if(RAD_AMOUNT_MEDIUM to RAD_AMOUNT_HIGH)
|
|
fragments += "[length(fragments) ? " and [master.p_they()] " : "[master] "]seem[master.p_s()] to be glowing a bit."
|
|
if(RAD_AMOUNT_HIGH to INFINITY) //At this level the object can contaminate other objects
|
|
fragments += "[length(fragments) ? " and [master.p_they()] " : "[master] "]hurt[master.p_s()] to look at."
|
|
|
|
if(length(fragments))
|
|
out += "<span class='warning'>[fragments.Join()]</span>"
|
|
|
|
/datum/component/radioactive/proc/rad_attack(datum/source, atom/movable/target, mob/living/user)
|
|
SIGNAL_HANDLER
|
|
if(alpha_strength > RAD_BACKGROUND_RADIATION)
|
|
radiation_pulse(parent, alpha_strength / 20, ALPHA_RAD)
|
|
target.base_rad_act(parent ,alpha_strength / 2, ALPHA_RAD)
|
|
if(beta_strength > RAD_BACKGROUND_RADIATION)
|
|
radiation_pulse(parent, beta_strength / 20, BETA_RAD)
|
|
target.base_rad_act(parent, beta_strength / 2, BETA_RAD)
|
|
if(gamma_strength > RAD_BACKGROUND_RADIATION)
|
|
radiation_pulse(parent, gamma_strength / 20, GAMMA_RAD)
|
|
target.base_rad_act(parent, gamma_strength / 2, GAMMA_RAD)
|
|
if(!hl3_release_date)
|
|
return
|
|
alpha_strength -= alpha_strength / hl3_release_date
|
|
beta_strength -= beta_strength / hl3_release_date
|
|
gamma_strength -= gamma_strength / hl3_release_date
|
|
|
|
/datum/component/radioactive/proc/admin_decontaminate()
|
|
SIGNAL_HANDLER
|
|
. = TRUE
|
|
if(ismob(parent))
|
|
var/mob/M = parent
|
|
M.radiation = 0
|
|
if(ismob(source))
|
|
var/mob/M = source
|
|
M.radiation = 0
|
|
qdel(src)
|
|
|
|
#undef RAD_AMOUNT_LOW
|
|
#undef RAD_AMOUNT_MEDIUM
|
|
#undef RAD_AMOUNT_HIGH
|
|
#undef RAD_AMOUNT_EXTREME
|
|
#undef GLOW_ALPHA
|
|
#undef GLOW_BETA
|
|
#undef GLOW_GAMMA
|