Skip to content

Commit

Permalink
Passive radiation structures/effects don't trigger if there are no pl…
Browse files Browse the repository at this point in the history
…ayers nearby (shiptest-ss13#2788)

<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

## About The Pull Request

Assuming some radiation comes from waste planets generating a bunch of
radiation waves, and that there are a lot of radiation generating things
players might not even be affected by, radiation/contamination can be
reduced by preventing these from activating if they wouldn't affect a
player

Also consolidates the random chance for a pulse to trigger into its
timer for structures, since there's not much purpose to it

## Why It's Good For The Game

don't need to waste time with replicating radiation somewhere it's not
going to end up doing anything

## Changelog

:cl:
tweak: radiation structures/effects only irradiate their surroundings if
near a player
/:cl:

<!-- Both :cl:'s are required for the changelog to work! You can put
your name to the right of the first :cl: if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->

---------

Signed-off-by: Theos <theubernyan@gmail.com>
  • Loading branch information
SomeguyManperson authored and MysticalFaceLesS committed Apr 15, 2024
1 parent 8e9bdda commit c5090ca
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 19 deletions.
28 changes: 19 additions & 9 deletions code/game/objects/effects/radiation.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,39 @@
var/rad_power = 33
var/rad_range = 1 // !Range mod = rad dropoff speed
var/rad_spread = 6 // Range of nearby atoms to radiate
var/rad_delay = 20
var/rad_prob = 10
var/_pulse = 0 // Holds the world.time interval in process
COOLDOWN_DECLARE(pulse_cooldown)
var/rad_delay = 2 SECONDS

/obj/effect/radiation/Initialize()
START_PROCESSING(SSobj, src)
. = ..()

/obj/effect/radiation/process()
if(world.time > _pulse)
for(var/obj/O in range(rad_spread, src))
if(prob(rad_prob))
radiation_pulse(O, rad_power, rad_range)
_pulse = world.time + rad_delay
if(!COOLDOWN_FINISHED(src, pulse_cooldown))
return ..()

var/player_in_range = FALSE
for(var/mob/living/L in range(rad_spread))
if(L.client)
player_in_range = TRUE
break
if(!player_in_range)
return ..()
COOLDOWN_START(src, pulse_cooldown, rad_delay)
for(var/obj/O in range(rad_spread, src))
if(prob(rad_prob))
radiation_pulse(O, rad_power, rad_range)

..()

/obj/effect/radiation/waste
rad_power = 33
rad_delay = 40
rad_delay = 4 SECONDS
rad_prob = 20
rad_spread = 3

/obj/effect/radiation/waste/intense //3.6 roetgen. Not bad. Not good.
rad_power = 120
rad_delay = 80
rad_delay = 8 SECONDS
rad_prob = 10
22 changes: 12 additions & 10 deletions code/game/objects/structures/radioactive.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,18 @@
density = TRUE
var/rad_power = 100
var/rad_range = 1 // !Range mod = rad dropoff speed
var/rad_delay = 20
var/rad_prob = 30
var/_pulse = 0 // Holds the world.time interval in process
COOLDOWN_DECLARE(pulse_cooldown)
var/rad_delay = 2 SECONDS

/obj/structure/radioactive/Initialize()
START_PROCESSING(SSobj, src)
. = ..()

/obj/structure/radioactive/process()
if(world.time > _pulse)
if(prob(rad_prob))
for(var/mob/living/L in range(5, src))
if(L.client)
Nuke()
_pulse = world.time + rad_delay
break
..()

/obj/structure/radioactive/bullet_act(obj/projectile/P)
Expand Down Expand Up @@ -50,6 +49,10 @@
Nuke()

/obj/structure/radioactive/proc/Nuke(atom/movable/AM)
if(!COOLDOWN_FINISHED(src, pulse_cooldown))
return

COOLDOWN_START(src, pulse_cooldown, rad_delay)
radiation_pulse(src, rad_power, rad_range)

/obj/structure/radioactive/waste
Expand All @@ -59,15 +62,15 @@
anchored = TRUE
rad_power = 150
rad_range = 0.8
rad_prob = 50
rad_delay = 1 SECONDS

/obj/structure/radioactive/stack
name = "stack of nuclear waste"
desc = "Discarded nuclar waste. If enough of this builds up around a planet, radioactive toxins can poison the whole atmosphere."
icon_state = "barrel_3"
anchored = TRUE
rad_power = 300
rad_prob = 50
rad_delay = 1 SECONDS

/obj/structure/radioactive/supermatter
name = "decayed supermatter crystal"
Expand All @@ -76,5 +79,4 @@
anchored = TRUE
rad_power = 1200
rad_range = 0.2
rad_delay = 20
rad_prob = 60
rad_delay = 0.5 SECONDS

0 comments on commit c5090ca

Please sign in to comment.