-
-
Notifications
You must be signed in to change notification settings - Fork 681
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
21398f0
commit 4e4c6b0
Showing
234 changed files
with
1,237 additions
and
829 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.