mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-20 10:37:17 +01:00
* iteration 1 * oops * Okay now it actually works * remove rad cap * Adds a singulo monitor * comments and other fixes * rebuild tgui * updates last size now. breach alerts now go before warnings * oops * fix console lables for the field gens * New generator lookup algorithm * comment added * sort out the return and checks on temp_gens * Adds sprites to the singulo monitor * fix sprite stuff and singulo alert * rebuild tgui * Adds a singulo monitor board to RnD. Uses the correct icon when no singulo is being monitored. * give commas some space * Adds a singulo console board to the singulo engine crate * style fixes and fixes the check for singularity location and type * Rebuild Tgui * style fixes and a comment * Removes redundant brackets * Correct the check for there being containing generators * Changes the generator_field variable to a more generic name * adds a period to a comment * Restore accidentally modified icons to their original state * Rebuild TGUI * Rebuild tgui * rebuild tgui * Rebuild TGUI * rebuild tgui * TGUI rebuild * Style fixes * TGUI rebuild * rebuild tgui * rebuild tgui * Let's see if this works * I didn't see that merge conflict. Rebuilding again * rebuild tgui * Rebuild TGUI * Review changes * Changes to the new variable name in the singulo monitor * Adjusts bar values for each colour according to the reduced energy capacity of the new generators * Rebuild TGUI * Review changes * missed a line * improves a couple comments * removes the pre loose warning from the singulo. It will now only alert the station once the singulo is loose. Fixes loose alerts being given repeatedly * Update tgui.bundle.js * TGUI rebuild * Update tgui.bundle.js * Update tgui.bundle.js * Update tgui.bundle.js * Update tgui.bundle.js * Update tgui.bundle.js * Update tgui.bundle.js * Update tgui.bundle.js * Fixes a bug causing the console to announce a singuloose when selecting a singularity at level 2 or above * Removes alerts from the singulo console * Rebuild and Merge Master * Change the name of the singulo gen crate to include the console board * fixes a runtime that terminated the destructor prematurely when deconstructing a console that hasn't selected a singularity * Removes generators from the interface when they become inactive --------- Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
142 lines
4.5 KiB
Plaintext
142 lines
4.5 KiB
Plaintext
/datum/radiation_wave
|
|
/// The thing that spawned this radiation wave
|
|
var/source
|
|
/// The center of the wave
|
|
var/turf/master_turf
|
|
/// How far we've moved
|
|
var/steps = 0
|
|
/// How strong it was originaly
|
|
var/intensity
|
|
/// How much contaminated material it still has
|
|
var/remaining_contam
|
|
/// Higher than 1 makes it drop off faster, 0.5 makes it drop off half etc
|
|
var/range_modifier
|
|
/// The distance from the source point the wave can cover without losing any strength.
|
|
var/source_radius
|
|
/// The direction of movement
|
|
var/move_dir
|
|
/// The directions to the side of the wave, stored for easy looping
|
|
var/list/__dirs
|
|
/// Whether or not this radiation wave can create contaminated objects
|
|
var/can_contaminate
|
|
|
|
/datum/radiation_wave/New(atom/_source, dir, _intensity = 0, _range_modifier = RAD_DISTANCE_COEFFICIENT, _can_contaminate = TRUE, _source_radius = 0)
|
|
|
|
source = "[_source] \[[_source.UID()]\]"
|
|
|
|
master_turf = get_turf(_source)
|
|
|
|
move_dir = dir
|
|
__dirs = list()
|
|
__dirs += turn(dir, 90)
|
|
__dirs += turn(dir, -90)
|
|
|
|
intensity = _intensity
|
|
remaining_contam = intensity
|
|
range_modifier = _range_modifier
|
|
can_contaminate = _can_contaminate
|
|
source_radius = _source_radius
|
|
START_PROCESSING(SSradiation, src)
|
|
|
|
/datum/radiation_wave/Destroy()
|
|
. = QDEL_HINT_IWILLGC
|
|
STOP_PROCESSING(SSradiation, src)
|
|
..()
|
|
|
|
/datum/radiation_wave/process()
|
|
master_turf = get_step(master_turf, move_dir)
|
|
if(!master_turf)
|
|
qdel(src)
|
|
return
|
|
steps++
|
|
var/list/atoms = get_rad_atoms()
|
|
|
|
var/strength
|
|
if(steps > source_radius + 1)
|
|
strength = INVERSE_SQUARE(intensity, max(range_modifier * (steps - source_radius), 1), 1)
|
|
else
|
|
strength = intensity
|
|
|
|
if(strength < RAD_BACKGROUND_RADIATION)
|
|
qdel(src)
|
|
return
|
|
radiate(atoms, strength)
|
|
check_obstructions(atoms) // reduce our overall strength if there are radiation insulators
|
|
|
|
/datum/radiation_wave/proc/get_rad_atoms()
|
|
var/list/atoms = list()
|
|
var/distance = steps
|
|
var/cmove_dir = move_dir
|
|
var/cmaster_turf = master_turf
|
|
|
|
if(cmove_dir == NORTH || cmove_dir == SOUTH)
|
|
distance-- //otherwise corners overlap
|
|
|
|
atoms += get_rad_contents(cmaster_turf)
|
|
|
|
var/turf/place
|
|
for(var/dir in __dirs) //There should be just 2 dirs in here, left and right of the direction of movement
|
|
place = cmaster_turf
|
|
for(var/i in 1 to distance)
|
|
place = get_step(place, dir)
|
|
if(!place)
|
|
break
|
|
atoms += get_rad_contents(place)
|
|
|
|
return atoms
|
|
|
|
/datum/radiation_wave/proc/check_obstructions(list/atoms)
|
|
var/width = steps
|
|
var/cmove_dir = move_dir
|
|
if(cmove_dir == NORTH || cmove_dir == SOUTH)
|
|
width--
|
|
width = 1 + (2 * width)
|
|
|
|
for(var/k in 1 to length(atoms))
|
|
var/atom/thing = atoms[k]
|
|
if(!thing)
|
|
continue
|
|
if(SEND_SIGNAL(thing, COMSIG_ATOM_RAD_WAVE_PASSING, src, width) & COMPONENT_RAD_WAVE_HANDLED)
|
|
continue
|
|
if(thing.rad_insulation != RAD_NO_INSULATION)
|
|
intensity *= (1 - ((1 - thing.rad_insulation) / width))
|
|
|
|
/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
|
|
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))
|
|
for(var/k in atoms)
|
|
var/atom/thing = k
|
|
if(QDELETED(thing))
|
|
continue
|
|
thing.rad_act(strength)
|
|
|
|
// 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,
|
|
/obj/structure/cable,
|
|
/obj/machinery/atmospherics,
|
|
/obj/item/ammo_casing,
|
|
/obj/item/bio_chip,
|
|
/obj/singularity,
|
|
))
|
|
if(!can_contaminate || !can_contam || blacklisted[thing.type])
|
|
continue
|
|
if(thing.flags_2 & RAD_NO_CONTAMINATE_2 || SEND_SIGNAL(thing, COMSIG_ATOM_RAD_CONTAMINATING, strength) & COMPONENT_BLOCK_CONTAMINATION)
|
|
continue
|
|
|
|
if(contamination_strength > remaining_contam)
|
|
contamination_strength = remaining_contam
|
|
if(!prob(contamination_chance))
|
|
continue
|
|
if(SEND_SIGNAL(thing, COMSIG_ATOM_RAD_CONTAMINATING, strength) & COMPONENT_BLOCK_CONTAMINATION)
|
|
continue
|
|
remaining_contam -= contamination_strength
|
|
if(remaining_contam < RAD_BACKGROUND_RADIATION)
|
|
can_contaminate = FALSE
|
|
thing.AddComponent(/datum/component/radioactive, contamination_strength, source)
|