From 111310ef322883c67adc337a4b28c67ff221a8ec Mon Sep 17 00:00:00 2001 From: Techhead0 Date: Mon, 6 Jun 2016 17:42:06 -0400 Subject: [PATCH 1/2] Adds the Solar Storm event. New Random Event: Solar Storms. Similar to a radiation storm, but anywhere inside the station is safe. Also boosts solar panel output significantly for the duration. --- code/modules/events/event_container.dm | 1 + code/modules/events/solar_storm.dm | 52 ++++++++++++++++++++++++++ code/modules/power/solar.dm | 4 +- html/changelogs/Techhead-SunStorm.yml | 11 ++++++ polaris.dme | 1 + 5 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 code/modules/events/solar_storm.dm create mode 100644 html/changelogs/Techhead-SunStorm.yml diff --git a/code/modules/events/event_container.dm b/code/modules/events/event_container.dm index 4eae167a654..4d204310391 100644 --- a/code/modules/events/event_container.dm +++ b/code/modules/events/event_container.dm @@ -158,6 +158,7 @@ var/global/list/severity_to_string = list(EVENT_LEVEL_MUNDANE = "Mundane", EVENT new /datum/event_meta(EVENT_LEVEL_MODERATE, "Radiation Storm", /datum/event/radiation_storm, 0, list(ASSIGNMENT_MEDICAL = 50), 1), new /datum/event_meta(EVENT_LEVEL_MODERATE, "Random Antagonist", /datum/event/random_antag, 2.5, list(ASSIGNMENT_SECURITY = 1), 1, 0, 5), new /datum/event_meta(EVENT_LEVEL_MODERATE, "Rogue Drones", /datum/event/rogue_drone, 20, list(ASSIGNMENT_SECURITY = 20)), + new /datum/event_meta(EVENT_LEVEL_MODERATE, "Solar Storm", /datum/event/solar_storm, 10, list(ASSIGNMENT_ENGINEER = 20, ASSIGNMENT_SECURITY = 10), 1), new /datum/event_meta(EVENT_LEVEL_MODERATE, "Space Dust", /datum/event/dust, 30, list(ASSIGNMENT_ENGINEER = 5)), new /datum/event_meta(EVENT_LEVEL_MODERATE, "Spider Infestation", /datum/event/spider_infestation, 100, list(ASSIGNMENT_SECURITY = 30), 1), new /datum/event_meta(EVENT_LEVEL_MODERATE, "Virology Breach", /datum/event/prison_break/virology, 0, list(ASSIGNMENT_MEDICAL = 100)), diff --git a/code/modules/events/solar_storm.dm b/code/modules/events/solar_storm.dm new file mode 100644 index 00000000000..ce3b9053a28 --- /dev/null +++ b/code/modules/events/solar_storm.dm @@ -0,0 +1,52 @@ +/datum/event/solar_storm + startWhen = 45 + announceWhen = 1 + var/const/rad_interval = 5 //Same interval period as radiation storms. + var/base_solar_gen_rate + + +/datum/event/solar_storm/setup() + endWhen = startWhen + rand(30,90) + rand(30,90) //2-6 minute duration + +/datum/event/solar_storm/announce() + command_announcement.Announce("A solar storm has been detected approaching the station. Please halt all EVA activites immediately and return to the interior of the station.", "Anomaly Alert", new_sound = 'sound/AI/radiation.ogg') + adjust_solar_output(1.5) + +/datum/event/solar_storm/proc/adjust_solar_output(var/mult = 1) + if(isnull(base_solar_gen_rate)) base_solar_gen_rate = solar_gen_rate + solar_gen_rate = mult * base_solar_gen_rate + + +/datum/event/solar_storm/start() + command_announcement.Announce("The solar storm has reached the station. Please refain from EVA and remain inside the station until it has passed.", "Anomaly Alert") + adjust_solar_output(5) + + +/datum/event/solar_storm/tick() + if(activeFor % rad_interval == 0) + radiate() + +/datum/event/solar_storm/proc/radiate() + for(var/mob/living/L in living_mob_list) + var/turf/T = get_turf(L) + if(!T || !(T.z in using_map.player_levels)) + continue + + if(!istype(T.loc,/area/space) && !istype(T,/turf/space)) //Make sure you're in a space area or on a space turf + continue + + //Todo: Apply some burn damage from the heat of the sun. Until then, enjoy some moderate radiation. + L.apply_effect((rand(15,30)),IRRADIATE,blocked = L.getarmor(null, "rad")) + + +/datum/event/solar_storm/end() + command_announcement.Announce("The solar storm has passed the station. It is now safe to resume EVA activities. Please report to medbay if you experience any unusual symptoms. ", "Anomaly Alert") + adjust_solar_output() + + +//For a false alarm scenario. +/datum/event/solar_storm/syndicate/adjust_solar_output() + return + +/datum/event/solar_storm/syndicate/radiate() + return diff --git a/code/modules/power/solar.dm b/code/modules/power/solar.dm index dd1c2a56b60..7c4ee96991c 100644 --- a/code/modules/power/solar.dm +++ b/code/modules/power/solar.dm @@ -1,6 +1,6 @@ #define SOLAR_MAX_DIST 40 -#define SOLARGENRATE 1500 +var/solar_gen_rate = 1500 var/list/solars_list = list() /obj/machinery/power/solar @@ -130,7 +130,7 @@ var/list/solars_list = list() if(powernet == control.powernet)//check if the panel is still connected to the computer if(obscured) //get no light from the sun, so don't generate power return - var/sgen = SOLARGENRATE * sunfrac + var/sgen = solar_gen_rate * sunfrac add_avail(sgen) control.gen += sgen else //if we're no longer on the same powernet, remove from control computer diff --git a/html/changelogs/Techhead-SunStorm.yml b/html/changelogs/Techhead-SunStorm.yml new file mode 100644 index 00000000000..816e7eb8262 --- /dev/null +++ b/html/changelogs/Techhead-SunStorm.yml @@ -0,0 +1,11 @@ +author: Techhead + +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - rscadd: "New Random Event: Solar Storms. Similar to a radiation storm, but anywhere inside the station is safe. Also boosts solar panel output significantly for the duration." diff --git a/polaris.dme b/polaris.dme index 23e2ded9e62..898693c9de5 100644 --- a/polaris.dme +++ b/polaris.dme @@ -1283,6 +1283,7 @@ #include "code\modules\events\radiation_storm.dm" #include "code\modules\events\random_antagonist.dm" #include "code\modules\events\rogue_drones.dm" +#include "code\modules\events\solar_storm.dm" #include "code\modules\events\space_ninja.dm" #include "code\modules\events\spacevine.dm" #include "code\modules\events\spider_infestation.dm" From 546b59f6483267516f6e683e058ab06f876719ef Mon Sep 17 00:00:00 2001 From: Yoshax Date: Sun, 10 Jul 2016 04:15:32 +0100 Subject: [PATCH 2/2] Polaris fix --- code/modules/events/solar_storm.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/modules/events/solar_storm.dm b/code/modules/events/solar_storm.dm index ce3b9053a28..971e0418bc9 100644 --- a/code/modules/events/solar_storm.dm +++ b/code/modules/events/solar_storm.dm @@ -29,9 +29,9 @@ /datum/event/solar_storm/proc/radiate() for(var/mob/living/L in living_mob_list) var/turf/T = get_turf(L) - if(!T || !(T.z in using_map.player_levels)) + if(!T) continue - + if(!istype(T.loc,/area/space) && !istype(T,/turf/space)) //Make sure you're in a space area or on a space turf continue