Merge pull request #6219 from Mechoid/Event_Retweakening

Tweaks the NewTM event system further
This commit is contained in:
Anewbe
2019-06-19 22:33:26 -05:00
committed by VirgoBot
parent efbefb956b
commit d017075732
9 changed files with 81 additions and 7 deletions

View File

@@ -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

View File

@@ -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,

View File

@@ -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("<span class='danger'>\The [chosen_door]'s panel sparks!</span>")
command_announcement.Announce("An electrical issue has been detected in your area, please repair potential electronic overloads.", "Electrical Alert")
chosen_door.visible_message("<span class='danger'>\The [chosen_door]'s panel sparks!</span>")
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()

View File

@@ -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

View File

@@ -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))

View File

@@ -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)

View File

@@ -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

View File

@@ -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
. += 1

View File

@@ -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"