Skip to content

Commit

Permalink
aaaaa
Browse files Browse the repository at this point in the history
  • Loading branch information
XeonMations committed Sep 6, 2024
1 parent 21398f0 commit 4e4c6b0
Show file tree
Hide file tree
Showing 234 changed files with 1,237 additions and 829 deletions.
8 changes: 6 additions & 2 deletions beestation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -648,12 +648,15 @@
#include "code\datums\components\explodable.dm"
#include "code\datums\components\force_move.dm"
#include "code\datums\components\forensics.dm"
#include "code\datums\components\geiger_sound.dm"
#include "code\datums\components\genetic_damage.dm"
#include "code\datums\components\gps.dm"
#include "code\datums\components\grillable.dm"
#include "code\datums\components\haircolor_clothes.dm"
#include "code\datums\components\heirloom.dm"
#include "code\datums\components\honkspam.dm"
#include "code\datums\components\infective.dm"
#include "code\datums\components\irradiated.dm"
#include "code\datums\components\jam_receiver.dm"
#include "code\datums\components\jousting.dm"
#include "code\datums\components\knockoff.dm"
Expand All @@ -673,9 +676,8 @@
#include "code\datums\components\paintable.dm"
#include "code\datums\components\payment.dm"
#include "code\datums\components\pellet_cloud.dm"
#include "code\datums\components\rad_insulation.dm"
#include "code\datums\components\radiation_countdown.dm"
#include "code\datums\components\radio_jamming.dm"
#include "code\datums\components\radioactive.dm"
#include "code\datums\components\religious_tool.dm"
#include "code\datums\components\remote_materials.dm"
#include "code\datums\components\riding.dm"
Expand Down Expand Up @@ -833,6 +835,8 @@
#include "code\datums\elements\openspace_item_click_handler.dm"
#include "code\datums\elements\pet_bonus.dm"
#include "code\datums\elements\point_of_interest.dm"
#include "code\datums\elements\radiation_protected_clothing.dm"
#include "code\datums\elements\radioactive.dm"
#include "code\datums\elements\ranged_attacks.dm"
#include "code\datums\elements\rust.dm"
#include "code\datums\elements\series.dm"
Expand Down
3 changes: 0 additions & 3 deletions code/__DEFINES/combat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
#define ACID "acid"
/// Involved in checking if a disease can infect or spread. Also involved in xeno neurotoxin.
#define BIO "bio"
/// Involves ionizing radiation.
#define RAD "rad"
/// Involves a shockwave, usually from an explosion.
#define BOMB "bomb"
/// Involves a solid projectile.
Expand Down Expand Up @@ -62,7 +60,6 @@
#define EFFECT_UNCONSCIOUS "unconscious"
#define EFFECT_PARALYZE "paralyze"
#define EFFECT_IMMOBILIZE "immobilize"
#define EFFECT_IRRADIATE "irradiate"
#define EFFECT_STUTTER "stutter"
#define EFFECT_SLUR "slur"
#define EFFECT_EYE_BLUR "eye_blur"
Expand Down
34 changes: 23 additions & 11 deletions code/__DEFINES/dcs/signals/signals_atom/signals_atom.dm
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@
#define COMPONENT_CANCEL_BLOB_ACT (1<<0)
///! from base of atom/acid_act(): (acidpwr, acid_volume)
#define COMSIG_ATOM_ACID_ACT "atom_acid_act"
///! from base of atom/rad_act(intensity)
#define COMSIG_ATOM_RAD_ACT "atom_rad_act"
///! from base of atom/narsie_act(): ()
#define COMSIG_ATOM_NARSIE_ACT "atom_narsie_act"
///! from base of atom/ratvar_act(): ()
Expand All @@ -99,15 +97,6 @@
#define COMSIG_ATOM_CONTENTS_DEL "atom_contents_del"
///! from base of atom/has_gravity(): (turf/location, list/forced_gravities)
#define COMSIG_ATOM_HAS_GRAVITY "atom_has_gravity"
///! from proc/get_rad_contents(): ()
#define COMSIG_ATOM_RAD_PROBE "atom_rad_probe"
#define COMPONENT_BLOCK_RADIATION 1
///! from base of datum/radiation_wave/radiate(): (strength)
#define COMSIG_ATOM_RAD_CONTAMINATING "atom_rad_contam"
#define COMPONENT_BLOCK_CONTAMINATION 1
///! from base of datum/radiation_wave/check_obstructions(): (datum/radiation_wave, width)
#define COMSIG_ATOM_RAD_WAVE_PASSING "atom_rad_wave_pass"
#define COMPONENT_RAD_WAVE_HANDLED 1
///! from internal loop in atom/movable/proc/CanReach(): (list/next)
#define COMSIG_ATOM_CANREACH "atom_can_reach"
#define COMPONENT_ALLOW_REACH (1<<0)
Expand Down Expand Up @@ -160,3 +149,26 @@

#define COMSIG_ATOM_JAMMED "become_jammed" //! Relayed to atoms when they become jammed if they have the jam_receiver components.
#define COMSIG_ATOM_UNJAMMED "become_unjammed" //! Relayed to atoms when they become unjammed if they have the jam_receiver components.

// Radiation signals

/// From the radiation subsystem, called before a potential irradiation.
/// This does not guarantee radiation can reach or will succeed, but merely that there's a radiation source within range.
/// (datum/radiation_pulse_information/pulse_information, insulation_to_target)
#define COMSIG_IN_RANGE_OF_IRRADIATION "in_range_of_irradiation"

/// Fired when the target could be irradiated, right before the chance check is rolled.
/// (datum/radiation_pulse_information/pulse_information)
#define COMSIG_IN_THRESHOLD_OF_IRRADIATION "pre_potential_irradiation_within_range"
#define CANCEL_IRRADIATION (1 << 0)

/// If this is flipped, then minimum exposure time will not be checked.
/// If it is not flipped, and the pulse information has a minimum exposure time, then
/// the countdown will begin.
#define SKIP_MINIMUM_EXPOSURE_TIME_CHECK (1 << 1)

/// Fired when scanning something with a geiger counter.
/// (mob/user, obj/item/geiger_counter/geiger_counter)
#define COMSIG_GEIGER_COUNTER_SCAN "geiger_counter_scan"
/// If not flagged by any handler, will report the subject as being free of irradiation
#define COMSIG_GEIGER_COUNTER_SCAN_SUCCESSFUL (1 << 0)
3 changes: 3 additions & 0 deletions code/__DEFINES/dcs/signals/signals_mob/signals_living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
#define COMSIG_LIVING_LIFE "living_life"
///from base of mob/living/death(): (gibbed, was_dead_before)
#define COMSIG_LIVING_DEATH "living_death"
/// from /proc/healthscan(): (list/scan_results, advanced, mob/user, mode)
/// Consumers are allowed to mutate the scan_results list to add extra information
#define COMSIG_LIVING_HEALTHSCAN "living_healthscan"
/// from base of mob/living/updatehealth(): ()
#define COMSIG_LIVING_UPDATE_HEALTH "living_update_health"
/// Called when a living mob has its resting updated: (resting_state)
Expand Down
4 changes: 0 additions & 4 deletions code/__DEFINES/flags.dm
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,6 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204

#define MOBILITY_FLAGS_DEFAULT (MOBILITY_MOVE | MOBILITY_STAND | MOBILITY_PICKUP | MOBILITY_USE | MOBILITY_UI | MOBILITY_STORAGE | MOBILITY_PULL)

// radiation
#define RAD_PROTECT_CONTENTS (1<<0)
#define RAD_NO_CONTAMINATE (1<<1)

//alternate appearance flags
#define AA_TARGET_SEE_APPEARANCE (1<<0)
#define AA_MATCH_TARGET_OVERLAYS (1<<1)
Expand Down
5 changes: 0 additions & 5 deletions code/__DEFINES/maths.dm
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,6 @@
/// Returns the nth root of x.
#define ROOT(n, x) ((x) ** (1 / (n)))

/// Low-pass filter a value to smooth out high frequent peaks. This can be thought of as a moving average filter as well.
/// delta_time is how many seconds since we last ran this command. RC is the filter constant, high RC means more smoothing
/// See https://en.wikipedia.org/wiki/Low-pass_filter#Simple_infinite_impulse_response_filter for the maths
#define LPFILTER(memory, signal, delta_time, RC) (delta_time / (RC + delta_time)) * signal + (1 - delta_time / (RC + delta_time)) * memory

// The quadratic formula. Returns a list with the solutions, or an empty list
// if they are imaginary.
/proc/SolveQuadratic(a, b, c)
Expand Down
65 changes: 22 additions & 43 deletions code/__DEFINES/radiation.dm
Original file line number Diff line number Diff line change
@@ -1,31 +1,18 @@
/*
These defines are the balancing points of various parts of the radiation system.
Changes here can have widespread effects: make sure you test well.
Ask ninjanomnom if they're around
Ask god if they're around
*/

#define RAD_BACKGROUND_RADIATION 9 // How much radiation is harmless to a mob
#define RAD_MOB_HAIRLOSS (1 MINUTES) // How much stored radiation to check for hair loss

// apply_effect((amount*RAD_MOB_COEFFICIENT)/max(1, (radiation**2)*RAD_OVERDOSE_REDUCTION), IRRADIATE, blocked)
#define RAD_MOB_COEFFICIENT 0.20 // Radiation applied is multiplied by this
#define RAD_MOB_SKIN_PROTECTION ((1/RAD_MOB_COEFFICIENT)+RAD_BACKGROUND_RADIATION)
#define RAD_MOB_MUTATE (2 MINUTES) // How much stored radiation to check for mutation

#define RAD_LOSS_PER_TICK 0.5
#define RAD_TOX_COEFFICIENT 0.08 // Toxin damage per tick coefficient
#define RAD_OVERDOSE_REDUCTION 0.000001 // Coefficient to the reduction in applied rads once the thing, usualy mob, has too much radiation
// WARNING: This number is highly sensitive to change, graph is first for best results
#define RAD_BURN_THRESHOLD 1000 // Applied radiation must be over this to burn

#define RAD_MOB_SAFE 500 // How much stored radiation in a mob with no ill effects

#define RAD_MOB_HAIRLOSS 800 // How much stored radiation to check for hair loss

#define RAD_MOB_MUTATE 1250 // How much stored radiation to check for mutation

#define RAD_MOB_VOMIT 2000 // The amount of radiation to check for vomitting
/// The time since irradiated before checking for vomitting
#define RAD_MOB_VOMIT (2 MINUTES)
#define RAD_MOB_VOMIT_PROB 1 // Chance per tick of vomitting

#define RAD_MOB_KNOCKDOWN 2000 // How much stored radiation to check for stunning
#define RAD_MOB_KNOCKDOWN (2 MINUTES) // How much stored radiation to check for stunning
#define RAD_MOB_KNOCKDOWN_PROB 1 // Chance of knockdown per tick when over threshold
#define RAD_MOB_KNOCKDOWN_AMOUNT 3 // Amount of knockdown when it occurs

Expand All @@ -35,31 +22,23 @@ Ask ninjanomnom if they're around
#define RAD_MEDIUM_INSULATION 0.7 // What common walls have
#define RAD_HEAVY_INSULATION 0.6 // What reinforced walls have
#define RAD_EXTREME_INSULATION 0.5 // What rad collectors have
#define RAD_FULL_INSULATION 0 // What depleted uranium windows have
#define RAD_FULL_INSULATION 0 // Completely stops radiation from coming through

/// The default chance something can be irradiated
#define DEFAULT_RADIATION_CHANCE 10

// WARNING: The defines below could have disastrous consequences if tweaked incorrectly. See: The great SM purge of Oct.6.2017
// contamination_chance = [doesn't matter, will always contaminate]
// contamination_strength = strength * RAD_CONTAMINATION_STR_COEFFICIENT
// contamination_threshold = 1 / (RAD_CONTAMINATION_BUDGET_SIZE * RAD_CONTAMINATION_STR_COEFFICIENT)
#define RAD_CONTAMINATION_BUDGET_SIZE 0.2 // Mob and non-mob budgets each gets a share from the radiation as large as this;
// So this means 10% of the rads is "absorbed" by non-mobs (if there is a non-mob),
// and another 10% of the rads is "absorbed" by mobs (if there is a mob)
#define RAD_DISTANCE_COEFFICIENT 1 // Lower means further rad spread
/// The default chance for uranium structures to irradiate
#define URANIUM_IRRADIATION_CHANCE DEFAULT_RADIATION_CHANCE

#define RAD_DISTANCE_COEFFICIENT_COMPONENT_MULTIPLIER 2 // Radiation components have additional penalty at distance coefficient
// This is to reduce radiation by contaminated objects, mostly
/// The minimum exposure time before uranium structures can irradiate
#define URANIUM_RADIATION_MINIMUM_EXPOSURE_TIME (3 SECONDS)

#define RAD_HALF_LIFE 90 // The half-life of contaminated objects
/// Return values of [proc/get_perceived_radiation_danger]
// If you change these, update /datum/looping_sound/geiger as well.
#define PERCEIVED_RADIATION_DANGER_LOW 1
#define PERCEIVED_RADIATION_DANGER_MEDIUM 2
#define PERCEIVED_RADIATION_DANGER_HIGH 3
#define PERCEIVED_RADIATION_DANGER_EXTREME 4

#define RAD_WAVE_MINIMUM 10 // Radiation waves with less than this amount of power stop spreading
// WARNING: Reducing can make rads subsytem more expensive
#define RAD_COMPONENT_MINIMUM 1 // To ensure slow contamination
// WARNING: Reducing can make rads subsytem more expensive
#define RAD_CONTAMINATION_STR_COEFFICIENT (1 / RAD_HALF_LIFE / 8 * RAD_DISTANCE_COEFFICIENT_COMPONENT_MULTIPLIER ** 2)
// Higher means higher strength scaling contamination strength
// This number represents perservation of radiation
// Set to control the most typical situation: clutters around typical radiation sources
// This define is long and ugly because of the amount of math involved
// and to free this define from mathematical errors of future define number tweakers
#define RAD_GEIGER_RC 4 // RC-constant for the LP filter for geiger counters. See #define LPFILTER for more info.
#define RAD_GEIGER_GRACE_PERIOD 4 // How many seconds after we last detect a radiation pulse until we stop blipping
/// The time before geiger counters reset back to normal without any radiation pulses
#define TIME_WITHOUT_RADIATION_BEFORE_RESET (5 SECONDS)
4 changes: 2 additions & 2 deletions code/__DEFINES/supermatter.dm
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@

#define MATTER_POWER_CONVERSION 10 //Crystal converts 1/this value of stored matter into energy.

//These would be what you would get at point blank, decreases with distance
#define DETONATION_RADS 200
#define DETONATION_HALLUCINATION 600

/// All humans within this range will be irradiated
#define DETONATION_RADIATION_RANGE 20

#define WARNING_DELAY 60

Expand Down
18 changes: 18 additions & 0 deletions code/__DEFINES/traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -540,3 +540,21 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai
#define NO_GRAVITY_TRAIT "no-gravity"
#define LIFECANDLE_TRAIT "lifecandle"
#define LEAPER_BUBBLE_TRAIT "leaper-bubble"


// Radiation defines

/// Marks that this object is irradiated
#define TRAIT_IRRADIATED "iraddiated"

/// Harmful radiation effects, the toxin damage and the burns, will not occur while this trait is active
#define TRAIT_HALT_RADIATION_EFFECTS "halt_radiation_effects"

/// This clothing protects the user from radiation.
/// This should not be used on clothing_traits, but should be applied to the clothing itself.
#define TRAIT_RADIATION_PROTECTED_CLOTHING "radiation_protected_clothing"

/// Whether or not this item will allow the radiation SS to go through standard
/// radiation processing as if this wasn't already irradiated.
/// Basically, without this, COMSIG_IN_RANGE_OF_IRRADIATION won't fire once the object is irradiated.
#define TRAIT_BYPASS_EARLY_IRRADIATED_CHECK "radiation_bypass_early_irradiated_check"
1 change: 0 additions & 1 deletion code/__DEFINES/vv.dm
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@
#define VV_HK_TRIGGER_EMP "empulse"
#define VV_HK_TRIGGER_EXPLOSION "explode"
#define VV_HK_AUTO_RENAME "auto_rename"
#define VV_HK_RADIATE "radiate"
#define VV_HK_EDIT_FILTERS "edit_filters"
#define VV_HK_EDIT_COLOR_MATRIX "edit_color_matrix"
#define VV_HK_EDIT_PARTICLES "edit_particles"
Expand Down
100 changes: 54 additions & 46 deletions code/__HELPERS/radiation.dm
Original file line number Diff line number Diff line change
@@ -1,52 +1,60 @@
// A special GetAllContents that doesn't search past things with rad insulation
// Components which return COMPONENT_BLOCK_RADIATION prevent further searching into that object's contents. The object itself will get returned still.
// The ignore list makes those objects never return at all
/proc/get_rad_contents(atom/location)
var/static/list/ignored_things = typecacheof(list(
/mob/dead,
/mob/camera,
/mob/living/simple_animal/revenant,
/obj/effect,
/obj/docking_port,
/atom/movable/lighting_object,
/obj/projectile,
/obj/structure/chisel_message,
/mob/living/simple_animal/eminence
))
var/list/processing_list = list(location)
. = list()
while(processing_list.len)
var/atom/thing = processing_list[1]
processing_list -= thing
if(thing == null)
continue
if(ignored_things[thing.type])
continue
. += thing
if((thing.rad_flags & RAD_PROTECT_CONTENTS) || (SEND_SIGNAL(thing, COMSIG_ATOM_RAD_PROBE) & COMPONENT_BLOCK_RADIATION))
continue
processing_list += thing.contents

/proc/radiation_pulse(atom/source, intensity, range_modifier, log=FALSE, can_contaminate=TRUE)
/// Whether or not it's possible for this atom to be irradiated
#define CAN_IRRADIATE(atom) (ishuman(##atom) || isitem(##atom))

/// Sends out a pulse of radiation, eminating from the source.
/// Radiation is performed by collecting all radiatables within the max range (0 means source only, 1 means adjacent, etc),
/// then makes their way towards them. A number, starting at 1, is multiplied
/// by the insulation amounts of whatever is in the way (for example, walls lowering it down).
/// If this number hits equal or below the threshold, then the target can no longer be irradiated.
/// If the number is above the threshold, then the chance is the chance that the target will be irradiated.
/// As a consumer, this means that max_range going up usually means you want to lower the threshold too,
/// as well as the other way around.
/// If max_range is high, but threshold is too high, then it usually won't reach the source at the max range in time.
/// If max_range is low, but threshold is too low, then it basically guarantees everyone nearby, even if there's walls
/// and such in the way, can be irradiated.
/// You can also pass in a minimum exposure time. If this is set, then this radiation pulse
/// will not irradiate the source unless they have been around *any* radioactive source for that
/// period of time.
/proc/radiation_pulse(atom/source, max_range, threshold, chance = DEFAULT_RADIATION_CHANCE, minimum_exposure_time = 0)
if(!SSradiation.can_fire)
return

var/list/things = get_rad_contents(isturf(source) ? source : get_turf(source)) //copypasta because I don't want to put special code in waves to handle their origin
for(var/k in 1 to things.len)
var/atom/thing = things[k]
if(!thing)
continue
thing.rad_act(intensity)

if(intensity >= RAD_WAVE_MINIMUM) // Don't bother to spawn rad waves if they're just going to immediately go out
new /datum/radiation_wave(source, intensity, range_modifier, can_contaminate)
var/datum/radiation_pulse_information/pulse_information = new
pulse_information.source_ref = WEAKREF(source)
pulse_information.max_range = max_range
pulse_information.threshold = threshold
pulse_information.chance = chance
pulse_information.minimum_exposure_time = minimum_exposure_time

var/static/last_huge_pulse = 0
if(intensity > 3000 && world.time > last_huge_pulse + 200)
last_huge_pulse = world.time
log = TRUE
if(log)
var/turf/_source_T = isturf(source) ? source : get_turf(source)
log_game("Radiation pulse with intensity: [intensity] and range modifier: [range_modifier] in [loc_name(_source_T)] ")
SSradiation.processing += pulse_information

return TRUE

/datum/radiation_pulse_information
var/datum/weakref/source_ref
var/max_range
var/threshold
var/chance
var/minimum_exposure_time

#define MEDIUM_RADIATION_THRESHOLD_RANGE 0.5
#define EXTREME_RADIATION_CHANCE 30

/// Gets the perceived "danger" of radiation pulse, given the threshold to the target.
/// Returns a RADIATION_DANGER_* define, see [code/__DEFINES/radiation.dm]
/proc/get_perceived_radiation_danger(datum/radiation_pulse_information/pulse_information, insulation_to_target)
if (insulation_to_target > pulse_information.threshold)
// We could get irradiated! The only thing stopping us now is chance, so scale based on that.
if (pulse_information.chance >= EXTREME_RADIATION_CHANCE)
return PERCEIVED_RADIATION_DANGER_EXTREME
else
return PERCEIVED_RADIATION_DANGER_HIGH
else
// We're out of the threshold from being irradiated, but by how much?
if (insulation_to_target / pulse_information.threshold <= MEDIUM_RADIATION_THRESHOLD_RANGE)
return PERCEIVED_RADIATION_DANGER_MEDIUM
else
return PERCEIVED_RADIATION_DANGER_LOW

#undef MEDIUM_RADIATION_THRESHOLD_RANGE
#undef EXTREME_RADIATION_CHANCE
5 changes: 0 additions & 5 deletions code/_globalvars/bitfields.dm
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,6 @@ DEFINE_BITFIELD(mobility_flags, list(
"PULL" = MOBILITY_PULL,
))

DEFINE_BITFIELD(rad_flags, list(
"RAD_PROTECT_CONTENTS" = RAD_PROTECT_CONTENTS,
"RAD_NO_CONTAMINATE" = RAD_NO_CONTAMINATE,
))

DEFINE_BITFIELD(disease_flags, list(
"CURABLE" = CURABLE,
"CAN_CARRY" = CAN_CARRY,
Expand Down
Loading

0 comments on commit 4e4c6b0

Please sign in to comment.