diff --git a/code/__defines/misc.dm b/code/__defines/misc.dm index e59d3765dc..2dc4afe70a 100644 --- a/code/__defines/misc.dm +++ b/code/__defines/misc.dm @@ -355,4 +355,4 @@ var/global/list/##LIST_NAME = list();\ //https://secure.byond.com/docs/ref/info.html#/atom/var/mouse_opacity #define MOUSE_OPACITY_TRANSPARENT 0 #define MOUSE_OPACITY_ICON 1 -#define MOUSE_OPACITY_OPAQUE 2 +#define MOUSE_OPACITY_OPAQUE 2 diff --git a/code/modules/gamemaster/actions/atmos_leak.dm b/code/modules/gamemaster/actions/atmos_leak.dm index 6506f77f95..ab3947cb15 100644 --- a/code/modules/gamemaster/actions/atmos_leak.dm +++ b/code/modules/gamemaster/actions/atmos_leak.dm @@ -6,6 +6,7 @@ var/gas_type // Chosen gas to release // Exclude these types and sub-types from targeting eligibilty var/list/area/excluded = list( + /area/submap, /area/shuttle, /area/crew_quarters, /area/holodeck, diff --git a/code/modules/gamemaster/actions/electrified_door.dm b/code/modules/gamemaster/actions/electrified_door.dm index bc5bf35ae0..d5365d50aa 100644 --- a/code/modules/gamemaster/actions/electrified_door.dm +++ b/code/modules/gamemaster/actions/electrified_door.dm @@ -3,7 +3,9 @@ departments = list(ROLE_ENGINEERING, ROLE_MEDICAL) chaotic = 10 var/obj/machinery/door/airlock/chosen_door + var/area/target_area var/list/area/excluded = list( + /area/submap, /area/shuttle, /area/crew_quarters ) @@ -19,9 +21,9 @@ //try 10 times for(var/i in 1 to 10) - var/area/A = pick(grand_list_of_areas) + target_area = pick(grand_list_of_areas) var/list/obj/machinery/door/airlock/target_doors = list() - for(var/obj/machinery/door/airlock/target_door in A.contents) + for(var/obj/machinery/door/airlock/target_door in target_area.contents) target_doors += target_door target_doors = shuffle(target_doors) @@ -34,11 +36,15 @@ ..() if(!chosen_door) return - if(prob(33)) - chosen_door.visible_message("\The [chosen_door]'s panel sparks!") + command_announcement.Announce("An electrical issue has been detected in your area, please repair potential electronic overloads.", "Electrical Alert") + chosen_door.visible_message("\The [chosen_door]'s panel sparks!") chosen_door.set_safeties(0) + playsound(get_turf(chosen_door), 'sound/machines/buzz-sigh.ogg', 50, 1) if(severity >= EVENT_LEVEL_MODERATE) chosen_door.electrify(-1) + spawn(rand(10 SECONDS, 2 MINUTES)) + if(chosen_door && chosen_door.arePowerSystemsOn() && prob(25 + 25 * severity)) + command_announcement.Announce("Overload has been localized to \the [target_area].", "Electrical Alert") if(severity >= EVENT_LEVEL_MAJOR) // New Major effect. Hydraulic boom. spawn() diff --git a/code/modules/gamemaster/actions/planet_weather_change.dm b/code/modules/gamemaster/actions/planet_weather_change.dm new file mode 100644 index 0000000000..c24c7914ba --- /dev/null +++ b/code/modules/gamemaster/actions/planet_weather_change.dm @@ -0,0 +1,33 @@ +/datum/gm_action/planet_weather_shift + name = "sudden weather shift" + enabled = TRUE + departments = list(ROLE_EVERYONE) + reusable = TRUE + var/datum/planet/target_planet + + var/list/banned_weathers = list( + /datum/weather/sif/ash_storm, + /datum/weather/sif/emberfall, + /datum/weather/sif/blood_moon, + /datum/weather/sif/fallout) + var/list/possible_weathers = list() + +/datum/gm_action/planet_weather_shift/set_up() + if(!target_planet || isnull(target_planet)) + target_planet = pick(SSplanets.planets) + possible_weathers |= target_planet.weather_holder.allowed_weather_types + possible_weathers -= banned_weathers + return + +/datum/gm_action/planet_weather_shift/get_weight() + return max(0, -15 + (metric.count_all_outdoor_mobs() * 20)) + +/datum/gm_action/planet_weather_shift/start() + ..() + var/new_weather = pick(possible_weathers) + target_planet.weather_holder.change_weather(new_weather) + +/datum/gm_action/planet_weather_shift/announce() + spawn(rand(3 SECONDS, 2 MINUTES)) + command_announcement.Announce("Local weather patterns on [target_planet.name] suggest that a sudden atmospheric fluctuation has occurred. All groundside personnel should be wary of rapidly deteriorating conditions.", "Weather Alert") + return diff --git a/code/modules/gamemaster/actions/spontaneous_appendicitis.dm b/code/modules/gamemaster/actions/spontaneous_appendicitis.dm index 9742b4615e..1758709164 100644 --- a/code/modules/gamemaster/actions/spontaneous_appendicitis.dm +++ b/code/modules/gamemaster/actions/spontaneous_appendicitis.dm @@ -10,4 +10,4 @@ break /datum/gm_action/spontaneous_appendicitis/get_weight() - return 5 + (metric.count_people_in_department(ROLE_MEDICAL) * 10) + return max(0, -5 + (metric.count_people_in_department(ROLE_MEDICAL) * 10)) diff --git a/code/modules/metric/activity.dm b/code/modules/metric/activity.dm index c4acdc57ec..5bdc33f47a 100644 --- a/code/modules/metric/activity.dm +++ b/code/modules/metric/activity.dm @@ -80,3 +80,14 @@ num++ if(num) . = round(. / num, 0.1) + +/datum/metric/proc/assess_all_outdoor_mobs() + . = 0 + var/num = 0 + for(var/mob/living/L in player_list) + var/turf/T = get_turf(L) + if(istype(T) && !istype(T, /turf/space) && T.outdoors) + . += assess_player_activity(L) + num++ + if(num) + . = round(. / num, 0.1) diff --git a/code/modules/metric/count.dm b/code/modules/metric/count.dm new file mode 100644 index 0000000000..430f2fdd93 --- /dev/null +++ b/code/modules/metric/count.dm @@ -0,0 +1,21 @@ +/* + * Procs for counting active players in different situations. Returns the number of active players within the given cutoff. + */ + +/datum/metric/proc/count_all_outdoor_mobs(var/cutoff = 75) + var/num = 0 + for(var/mob/living/L in player_list) + var/turf/T = get_turf(L) + if(istype(T) && !istype(T, /turf/space) && T.outdoors) + if(assess_player_activity(L) >= cutoff) + num++ + return num + +/datum/metric/proc/count_all_space_mobs(var/cutoff = 75) + var/num = 0 + for(var/mob/living/L in player_list) + var/turf/T = get_turf(L) + if(istype(T, /turf/space)) + if(assess_player_activity(L) >= cutoff) + num++ + return num diff --git a/code/modules/metric/department.dm b/code/modules/metric/department.dm index ef146de506..b6996d229c 100644 --- a/code/modules/metric/department.dm +++ b/code/modules/metric/department.dm @@ -69,4 +69,4 @@ for(var/mob/M in player_list) if(guess_department(M) != department) // Ignore people outside the department we're counting. continue - . += 1 \ No newline at end of file + . += 1 diff --git a/vorestation.dme b/vorestation.dme index 2bc3a9d5f4..5387554940 100644 --- a/vorestation.dme +++ b/vorestation.dme @@ -1871,6 +1871,7 @@ #include "code\modules\gamemaster\actions\money_hacker.dm" #include "code\modules\gamemaster\actions\money_lotto.dm" #include "code\modules\gamemaster\actions\money_spam.dm" +#include "code\modules\gamemaster\actions\planet_weather_change.dm" #include "code\modules\gamemaster\actions\prison_break.dm" #include "code\modules\gamemaster\actions\radiation_storm.dm" #include "code\modules\gamemaster\actions\random_antagonist.dm" @@ -2010,6 +2011,7 @@ #include "code\modules\media\media_tracks.dm" #include "code\modules\media\mediamanager.dm" #include "code\modules\metric\activity.dm" +#include "code\modules\metric\count.dm" #include "code\modules\metric\department.dm" #include "code\modules\metric\metric.dm" #include "code\modules\mining\abandonedcrates.dm"