Adds event regions to GameMaster events (#8334)

* Configures gm events to be selectable by "region"

* Configures event regions for existing events

* Configures event selection to filter by region
This commit is contained in:
Atermonera
2022-01-15 23:52:00 -08:00
committed by GitHub
parent ae7f147ea5
commit cff34e64a1
47 changed files with 232 additions and 126 deletions

View File

@@ -76,20 +76,13 @@ This allows for events that have their announcement happen after the end itself.
/datum/event2/event/proc/is_planet_z_level(z_level)
var/datum/planet/P = LAZYACCESS(SSplanets.z_to_planet, z_level)
if(!istype(P))
return FALSE
return TRUE
return istype(LAZYACCESS(SSplanets.z_to_planet, z_level), /datum/planet)
// Returns a list of empty turfs in the same area.
/datum/event2/event/proc/find_random_turfs(minimum_free_space = 5, list/specific_areas = list(), ignore_occupancy = FALSE)
var/list/area/grand_list_of_areas = find_random_areas(specific_areas)
if(!LAZYLEN(grand_list_of_areas))
return list()
for(var/thing in grand_list_of_areas)
var/list/A = thing
for(var/area/A in grand_list_of_areas)
var/list/turfs = list()
for(var/turf/T in A)
if(!T.check_density())
@@ -98,7 +91,6 @@ This allows for events that have their announcement happen after the end itself.
if(turfs.len < minimum_free_space)
continue // Not enough free space.
return turfs
return list()
/datum/event2/event/proc/find_random_areas(list/specific_areas = list(), ignore_occupancy = FALSE)
@@ -107,8 +99,7 @@ This allows for events that have their announcement happen after the end itself.
var/list/area/grand_list_of_areas = get_all_existing_areas_of_types(specific_areas)
. = list()
for(var/thing in shuffle(grand_list_of_areas))
var/area/A = thing
for(var/area/A in shuffle(grand_list_of_areas))
if(A.forbid_events)
continue
if(!(A.z in get_location_z_levels()))
@@ -182,7 +173,7 @@ This allows for events that have their announcement happen after the end itself.
return
if(!check_rights(R_ADMIN|R_EVENT|R_DEBUG))
message_admins("[usr] has attempted to manipulate an event without sufficent privilages.")
message_admins("[usr] has attempted to manipulate an event without sufficent privileges.")
return
if(href_list["abort"])

View File

@@ -4,6 +4,7 @@
chaos = -10 // A helpful event.
reusable = TRUE
event_type = /datum/event2/event/shipping_error
regions = list(EVENT_REGION_UNIVERSAL)
/datum/event2/meta/shipping_error/get_weight()
return (metric.count_people_with_job(/datum/job/cargo_tech) + metric.count_people_with_job(/datum/job/qm)) * 30

View File

@@ -4,6 +4,7 @@
chaos = 10
chaotic_threshold = EVENT_CHAOS_THRESHOLD_LOW_IMPACT
event_type = /datum/event2/event/manifest_malfunction
regions = list(EVENT_REGION_UNIVERSAL)
/datum/event2/meta/manifest_malfunction/get_weight()
var/security = metric.count_people_in_department(DEPARTMENT_SECURITY)

View File

@@ -4,6 +4,7 @@
chaos = 10
chaotic_threshold = EVENT_CHAOS_THRESHOLD_LOW_IMPACT
event_type = /datum/event2/event/money_hacker
regions = list(EVENT_REGION_UNIVERSAL)
/datum/event2/meta/money_hacker/get_weight()
var/command = metric.count_people_with_job(/datum/job/hop) + metric.count_people_with_job(/datum/job/captain)

View File

@@ -4,6 +4,7 @@
departments = list(DEPARTMENT_COMMAND, DEPARTMENT_CARGO)
chaotic_threshold = EVENT_CHAOS_THRESHOLD_LOW_IMPACT
event_type = /datum/event2/event/raise_funds
regions = list(EVENT_REGION_UNIVERSAL)
/datum/event2/meta/raise_funds/get_weight()
var/command = metric.count_people_in_department(DEPARTMENT_COMMAND)

View File

@@ -5,6 +5,7 @@
chaotic_threshold = EVENT_CHAOS_THRESHOLD_MEDIUM_IMPACT
event_type = /datum/event2/event/airlock_failure
var/needs_medical = FALSE
regions = list(EVENT_REGION_PLAYER_MAIN_AREA)
/datum/event2/meta/airlock_failure/emag
name = "airlock failure - emag"

View File

@@ -8,6 +8,7 @@
// In the distant future, if a mechanical skill system were to come into being, these vars could be replaced with skill checks so off duty people could count.
var/required_fighters = 2 // Fighters refers to engineering OR security.
var/required_support = 1 // Support refers to doctors AND roboticists, depending on fighter composition.
regions = list(EVENT_REGION_PLAYER_MAIN_AREA)
/datum/event2/meta/blob/hard
name = "harder blob"

View File

@@ -4,6 +4,7 @@
chaos = 10
chaotic_threshold = EVENT_CHAOS_THRESHOLD_LOW_IMPACT
event_type = /datum/event2/event/brand_intelligence
regions = list(EVENT_REGION_UNIVERSAL)
/datum/event2/meta/brand_intelligence/get_weight()
return 10 + (metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 20)

View File

@@ -5,6 +5,7 @@
chaotic_threshold = EVENT_CHAOS_THRESHOLD_LOW_IMPACT
reusable = TRUE
event_type = /datum/event2/event/camera_damage
regions = list(EVENT_REGION_PLAYER_MAIN_AREA)
/datum/event2/meta/camera_damage/get_weight()
return 30 + (metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 20) + (metric.count_people_in_department(DEPARTMENT_SYNTHETIC) * 40)

View File

@@ -9,6 +9,7 @@
chaotic_threshold = EVENT_CHAOS_THRESHOLD_LOW_IMPACT
reusable = TRUE
event_type = /datum/event2/event/canister_leak
regions = list(EVENT_REGION_PLAYER_MAIN_AREA)
/datum/event2/meta/canister_leak/get_weight()
return metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 30

View File

@@ -5,6 +5,7 @@
chaotic_threshold = EVENT_CHAOS_THRESHOLD_LOW_IMPACT
reusable = TRUE
event_type = /datum/event2/event/dust
regions = list(EVENT_REGION_SPACESTATION)
/datum/event2/meta/dust/get_weight()
return metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 20

View File

@@ -5,6 +5,7 @@
chaotic_threshold = EVENT_CHAOS_THRESHOLD_LOW_IMPACT
reusable = TRUE
event_type = /datum/event2/event/gas_leak
regions = list(EVENT_REGION_PLAYER_MAIN_AREA)
/datum/event2/meta/gas_leak/get_weight()
// Synthetics are counted in higher value because they can wirelessly connect to alarms.

View File

@@ -11,6 +11,7 @@
chaotic_threshold = EVENT_CHAOS_THRESHOLD_LOW_IMPACT
reusable = TRUE
event_type = /datum/event2/event/grid_check
regions = list(EVENT_REGION_PLAYER_MAIN_AREA)
// Having the turbines be way over their rated limit makes grid checks more likely.
/datum/event2/meta/grid_check/proc/get_overpower()

View File

@@ -1,83 +1,84 @@
// This event gives the station an advance warning about meteors, so that they can prepare in various ways.
/datum/event2/meta/meteor_defense
name = "meteor defense"
departments = list(DEPARTMENT_ENGINEERING, DEPARTMENT_CARGO)
chaos = 50
chaotic_threshold = EVENT_CHAOS_THRESHOLD_HIGH_IMPACT
event_class = "meteor defense"
event_type = /datum/event2/event/meteor_defense
/datum/event2/meta/meteor_defense/get_weight()
// Engineers count as 20.
var/engineers = metric.count_people_in_department(DEPARTMENT_ENGINEERING)
if(engineers < 3) // There -must- be at least three engineers for this to be possible.
return 0
. = engineers * 20
// Cargo and AI/borgs count as 10.
var/cargo = metric.count_people_with_job(/datum/job/cargo_tech) + metric.count_people_with_job(/datum/job/qm)
var/bots = metric.count_people_in_department(DEPARTMENT_SYNTHETIC)
. += (cargo + bots) * 10
/datum/event2/event/meteor_defense
start_delay_lower_bound = 10 MINUTES
start_delay_upper_bound = 15 MINUTES
var/soon_announced = FALSE
var/direction = null // Actual dir used for which side the meteors come from.
var/dir_text = null // Direction shown in the announcement.
var/list/meteor_types = null
var/waves = null // How many times to send meteors.
var/last_wave_time = null // world.time of latest wave.
var/wave_delay = 10 SECONDS
var/wave_upper_bound = 8 // Max amount of meteors per wave.
var/wave_lower_bound = 4 // Min amount.
/datum/event2/event/meteor_defense/proc/set_meteor_types()
meteor_types = meteors_threatening.Copy()
/datum/event2/event/meteor_defense/set_up()
direction = pick(cardinal) // alldirs doesn't work with current meteor code unfortunately.
waves = rand(3, 6)
switch(direction)
if(NORTH)
dir_text = "aft" // For some reason this is needed.
if(SOUTH)
dir_text = "fore"
if(EAST)
dir_text = "port"
if(WEST)
dir_text = "starboard"
set_meteor_types()
/datum/event2/event/meteor_defense/announce()
var/announcement = "Meteors are expected to approach from the [dir_text] side, in approximately [DisplayTimeText(time_to_start - world.time, 60)]."
command_announcement.Announce(announcement, "Meteor Alert", new_sound = 'sound/AI/meteors.ogg')
/datum/event2/event/meteor_defense/wait_tick()
if(!soon_announced)
if((time_to_start - world.time) <= 5 MINUTES)
soon_announced = TRUE
var/announcement = "The incoming meteors are expected to approach from the [dir_text] side. \
ETA to arrival is approximately [DisplayTimeText(time_to_start - world.time, 60)]."
command_announcement.Announce(announcement, "Meteor Alert - Update")
/datum/event2/event/meteor_defense/start()
command_announcement.Announce("Incoming meteors approach from \the [dir_text] side!", "Meteor Alert - Update")
/datum/event2/event/meteor_defense/event_tick()
if(world.time > last_wave_time + wave_delay)
last_wave_time = world.time
waves--
message_admins("[waves] more wave\s of meteors remain.")
// Dir is reversed because the direction describes where meteors are going, not what side it's gonna hit.
spawn_meteors(rand(wave_upper_bound, wave_lower_bound), meteor_types, reverse_dir[direction])
/datum/event2/event/meteor_defense/should_end()
return waves <= 0
/datum/event2/event/meteor_defense/end()
command_announcement.Announce("\The [location_name()] will clear the incoming meteors in a moment.", "Meteor Alert - Update")
// This event gives the station an advance warning about meteors, so that they can prepare in various ways.
/datum/event2/meta/meteor_defense
name = "meteor defense"
departments = list(DEPARTMENT_ENGINEERING, DEPARTMENT_CARGO)
chaos = 50
chaotic_threshold = EVENT_CHAOS_THRESHOLD_HIGH_IMPACT
event_class = "meteor defense"
event_type = /datum/event2/event/meteor_defense
regions = list(EVENT_REGION_SPACESTATION)
/datum/event2/meta/meteor_defense/get_weight()
// Engineers count as 20.
var/engineers = metric.count_people_in_department(DEPARTMENT_ENGINEERING)
if(engineers < 3) // There -must- be at least three engineers for this to be possible.
return 0
. = engineers * 20
// Cargo and AI/borgs count as 10.
var/cargo = metric.count_people_with_job(/datum/job/cargo_tech) + metric.count_people_with_job(/datum/job/qm)
var/bots = metric.count_people_in_department(DEPARTMENT_SYNTHETIC)
. += (cargo + bots) * 10
/datum/event2/event/meteor_defense
start_delay_lower_bound = 10 MINUTES
start_delay_upper_bound = 15 MINUTES
var/soon_announced = FALSE
var/direction = null // Actual dir used for which side the meteors come from.
var/dir_text = null // Direction shown in the announcement.
var/list/meteor_types = null
var/waves = null // How many times to send meteors.
var/last_wave_time = null // world.time of latest wave.
var/wave_delay = 10 SECONDS
var/wave_upper_bound = 8 // Max amount of meteors per wave.
var/wave_lower_bound = 4 // Min amount.
/datum/event2/event/meteor_defense/proc/set_meteor_types()
meteor_types = meteors_threatening.Copy()
/datum/event2/event/meteor_defense/set_up()
direction = pick(cardinal) // alldirs doesn't work with current meteor code unfortunately.
waves = rand(3, 6)
switch(direction)
if(NORTH)
dir_text = "aft" // For some reason this is needed.
if(SOUTH)
dir_text = "fore"
if(EAST)
dir_text = "port"
if(WEST)
dir_text = "starboard"
set_meteor_types()
/datum/event2/event/meteor_defense/announce()
var/announcement = "Meteors are expected to approach from the [dir_text] side, in approximately [DisplayTimeText(time_to_start - world.time, 60)]."
command_announcement.Announce(announcement, "Meteor Alert", new_sound = 'sound/AI/meteors.ogg')
/datum/event2/event/meteor_defense/wait_tick()
if(!soon_announced)
if((time_to_start - world.time) <= 5 MINUTES)
soon_announced = TRUE
var/announcement = "The incoming meteors are expected to approach from the [dir_text] side. \
ETA to arrival is approximately [DisplayTimeText(time_to_start - world.time, 60)]."
command_announcement.Announce(announcement, "Meteor Alert - Update")
/datum/event2/event/meteor_defense/start()
command_announcement.Announce("Incoming meteors approach from \the [dir_text] side!", "Meteor Alert - Update")
/datum/event2/event/meteor_defense/event_tick()
if(world.time > last_wave_time + wave_delay)
last_wave_time = world.time
waves--
message_admins("[waves] more wave\s of meteors remain.")
// Dir is reversed because the direction describes where meteors are going, not what side it's gonna hit.
spawn_meteors(rand(wave_upper_bound, wave_lower_bound), meteor_types, reverse_dir[direction])
/datum/event2/event/meteor_defense/should_end()
return waves <= 0
/datum/event2/event/meteor_defense/end()
command_announcement.Announce("\The [location_name()] will clear the incoming meteors in a moment.", "Meteor Alert - Update")

View File

@@ -4,6 +4,7 @@
chaos = 10 // There's a really rare chance of vines getting something awful like phoron atmosphere but thats not really controllable.
chaotic_threshold = EVENT_CHAOS_THRESHOLD_MEDIUM_IMPACT
event_type = /datum/event2/event/spacevine
regions = list(EVENT_REGION_PLAYER_MAIN_AREA)
/datum/event2/meta/spacevine/get_weight()
return 20 + (metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 10) + (metric.count_people_in_department(DEPARTMENT_EVERYONE) * 5)

View File

@@ -3,6 +3,7 @@
departments = list(DEPARTMENT_ENGINEERING)
reusable = TRUE
event_type = /datum/event2/event/wallrot
regions = list(EVENT_REGION_PLAYER_MAIN_AREA)
/datum/event2/meta/wallrot/get_weight()
return (10 + metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 10) / (times_ran + 1)

View File

@@ -9,6 +9,7 @@
reusable = TRUE
chaotic_threshold = EVENT_CHAOS_THRESHOLD_MEDIUM_IMPACT
event_type = /datum/event2/event/window_break
regions = list(EVENT_REGION_PLAYER_MAIN_AREA)
/datum/event2/meta/window_break/get_weight()
return (metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 20) / (times_ran + 1)

View File

@@ -5,6 +5,7 @@
chaotic_threshold = EVENT_CHAOS_THRESHOLD_MEDIUM_IMPACT
reusable = TRUE
event_type = /datum/event2/event/comms_blackout
regions = list(EVENT_REGION_UNIVERSAL)
/datum/event2/meta/comms_blackout/get_weight()
return 50 + metric.count_people_in_department(DEPARTMENT_EVERYONE) * 5

View File

@@ -8,6 +8,7 @@
chaos = 10
chaotic_threshold = EVENT_CHAOS_THRESHOLD_LOW_IMPACT
event_type = /datum/event2/event/electrical_fault
regions = list(EVENT_REGION_PLAYER_MAIN_AREA)
/datum/event2/meta/electrical_fault/get_weight()
return 10 + (metric.count_people_in_department(DEPARTMENT_EVERYONE) * 5)

View File

@@ -5,6 +5,7 @@
chaotic_threshold = EVENT_CHAOS_THRESHOLD_LOW_IMPACT
reusable = TRUE
event_type = /datum/event2/event/gravity
regions = list(EVENT_REGION_SPACESTATION, EVENT_REGION_DEEPSPACE)
/datum/event2/meta/gravity/get_weight()
return (20 + (metric.count_people_in_department(DEPARTMENT_EVERYONE) * 5)) / (times_ran + 1)

View File

@@ -1,6 +1,7 @@
/datum/event2/meta/infestation
event_class = "infestation"
departments = list(DEPARTMENT_EVERYONE)
regions = list(EVENT_REGION_PLAYER_MAIN_AREA)
/datum/event2/meta/infestation/get_weight()
return metric.count_people_in_department(DEPARTMENT_EVERYONE) * 10

View File

@@ -2,6 +2,7 @@
name = "pda spam"
departments = list(DEPARTMENT_EVERYONE)
event_type = /datum/event2/event/pda_spam
regions = list(EVENT_REGION_UNIVERSAL)
/datum/event2/meta/pda_spam/get_weight()
return metric.count_people_in_department(DEPARTMENT_EVERYONE) * 2
@@ -96,7 +97,7 @@
message = pick("Luxury watches for Blowout sale prices!",\
"Watches, Jewelry & Accessories, Bags & Wallets !",\
"Deposit 100$ and get 300$ totally free!",\
" 100K NT.|WOWGOLD <20>nly $89 <HOT>",\
" 100K NT.|WOWGOLD <20>nly $89 <HOT>",\
"We have been filed with a complaint from one of your customers in respect of their business relations with you.",\
"We kindly ask you to open the COMPLAINT REPORT (attached) to reply on this complaint..")
if(4)

View File

@@ -4,6 +4,7 @@
chaos = 20
chaotic_threshold = EVENT_CHAOS_THRESHOLD_MEDIUM_IMPACT
event_type = /datum/event2/event/radiation_storm
regions = list(EVENT_REGION_SPACESTATION, EVENT_REGION_DEEPSPACE)
/datum/event2/meta/radiation_storm/get_weight()
var/medical_factor = metric.count_people_in_department(DEPARTMENT_MEDICAL) * 10

View File

@@ -10,6 +10,7 @@
departments = list(DEPARTMENT_EVERYONE)
chaotic_threshold = EVENT_CHAOS_THRESHOLD_MEDIUM_IMPACT
event_type = /datum/event2/event/random_antagonist
regions = list(EVENT_REGION_UNIVERSAL)
// This has an abnormally high weight due to antags being very important for the round,
// however the weight will decay with more antags, and more attempts to add antags.

View File

@@ -2,6 +2,7 @@
name = "solar storm"
reusable = TRUE
event_type = /datum/event2/event/solar_storm
regions = list(EVENT_REGION_SPACESTATION, EVENT_REGION_DEEPSPACE)
/datum/event2/meta/solar_storm/get_weight()
var/population_factor = metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 10

View File

@@ -3,6 +3,7 @@
departments = list(DEPARTMENT_EVERYONE)
reusable = TRUE
event_type = /datum/event2/event/sudden_weather_shift
regions = list(EVENT_REGION_PLANETSURFACE)
/datum/event2/meta/sudden_weather_shift/get_weight()
// The proc name is a bit misleading, it only counts players outside, not all mobs.

View File

@@ -4,6 +4,7 @@
chaos = 40
chaotic_threshold = EVENT_CHAOS_THRESHOLD_MEDIUM_IMPACT
event_type = /datum/event2/event/appendicitis
regions = list(EVENT_REGION_PLAYER_MAIN_AREA)
/datum/event2/meta/appendicitis/get_weight()
var/list/doctors = metric.get_people_with_job(/datum/job/doctor)

View File

@@ -5,6 +5,7 @@
chaos = 40
chaotic_threshold = EVENT_CHAOS_THRESHOLD_HIGH_IMPACT
event_type = /datum/event2/event/virus
regions = list(EVENT_REGION_PLAYER_MAIN_AREA)
/datum/event2/meta/virus/superbug
name = "viral superbug"

View File

@@ -5,6 +5,7 @@
chaos = 30
chaotic_threshold = EVENT_CHAOS_THRESHOLD_MEDIUM_IMPACT
event_type = /datum/event2/event/mob_spawning/carp_migration
regions = list(EVENT_REGION_SPACESTATION, EVENT_REGION_DEEPSPACE)
/datum/event2/meta/carp_migration/get_weight()
return 10 + (metric.count_people_in_department(DEPARTMENT_SECURITY) * 20) + (metric.count_all_space_mobs() * 40)

View File

@@ -3,6 +3,7 @@
departments = list(DEPARTMENT_SECURITY, DEPARTMENT_EVERYONE)
chaotic_threshold = EVENT_CHAOS_THRESHOLD_HIGH_IMPACT // Don't run if we just got hit by meteors.
event_type = /datum/event2/event/security_drill
regions = list(EVENT_REGION_PLAYER_MAIN_AREA)
/datum/event2/meta/security_drill/get_weight()
var/sec = metric.count_people_in_department(DEPARTMENT_SECURITY)

View File

@@ -10,6 +10,7 @@
// the prison area.
var/list/relevant_areas = list()
var/list/irrelevant_areas = list()
regions = list(EVENT_REGION_PLAYER_MAIN_AREA)
/datum/event2/meta/prison_break/get_weight()
// First, don't do this if nobody can fix the doors.

View File

@@ -4,6 +4,7 @@
chaos = 40
chaotic_threshold = EVENT_CHAOS_THRESHOLD_MEDIUM_IMPACT
event_type = /datum/event2/event/mob_spawning/rogue_drones
regions = list(EVENT_REGION_SPACESTATION, EVENT_REGION_DEEPSPACE)
/datum/event2/meta/rogue_drones/get_weight()
. = 10 // Start with a base weight, since this event does provide some value even if no sec is around.

View File

@@ -3,6 +3,7 @@
departments = list(DEPARTMENT_SECURITY, DEPARTMENT_EVERYONE)
chaotic_threshold = EVENT_CHAOS_THRESHOLD_HIGH_IMPACT // So this won't get called in the middle of a crisis.
event_type = /datum/event2/event/security_screening
regions = list(EVENT_REGION_UNIVERSAL)
/datum/event2/meta/security_screening/get_weight()
. = 0

View File

@@ -5,6 +5,7 @@
chaos = 30
chaotic_threshold = EVENT_CHAOS_THRESHOLD_MEDIUM_IMPACT
event_type = /datum/event2/event/spider_infestation
regions = list(EVENT_REGION_PLAYER_MAIN_AREA)
/datum/event2/meta/spider_infestation/weak
name = "weak spider infestation"

View File

@@ -6,6 +6,7 @@
chaotic_threshold = EVENT_CHAOS_THRESHOLD_LOW_IMPACT
event_type = /datum/event2/event/ghost_pod_spawner/stowaway
var/safe_for_extended = FALSE
regions = list(EVENT_REGION_PLAYER_MAIN_AREA)
/datum/event2/meta/stowaway/normal
name = "stowaway - normal"

View File

@@ -6,6 +6,7 @@
chaos = 20
chaotic_threshold = EVENT_CHAOS_THRESHOLD_MEDIUM_IMPACT
event_type = /datum/event2/event/surprise_carp
regions = list(EVENT_REGION_SPACESTATION, EVENT_REGION_DEEPSPACE)
/datum/event2/meta/surprise_carp/get_weight()
return metric.count_all_space_mobs() * 50

View File

@@ -7,6 +7,7 @@
chaotic_threshold = EVENT_CHAOS_THRESHOLD_HIGH_IMPACT
enabled = FALSE // Turns out they are in fact grossly OP.
var/safe_for_extended = FALSE
regions = list(EVENT_REGION_SPACESTATION, EVENT_REGION_DEEPSPACE)
/datum/event2/meta/swarm_boarder/get_weight()
if(istype(ticker.mode, /datum/game_mode/extended) && !safe_for_extended)

View File

@@ -4,6 +4,7 @@
chaos = 40
chaotic_threshold = EVENT_CHAOS_THRESHOLD_MEDIUM_IMPACT
event_type = /datum/event2/event/ion_storm
regions = list(EVENT_REGION_SPACESTATION, EVENT_REGION_DEEPSPACE)
/datum/event2/meta/ion_storm/get_weight()
var/list/bots = metric.get_people_in_department(DEPARTMENT_SYNTHETIC)

View File

@@ -14,6 +14,11 @@
// What departments the event attached might affect.
var/list/departments = list(DEPARTMENT_EVERYONE)
// The region affects by this event
// Affects event weight by a similar metric to department population:
// If everybody is planetside, then a meteor storm on the station doesn't really add as much
var/list/regions = list(EVENT_REGION_UNIVERSAL)
// A guess on how disruptive to a round the event might be. If the action is chosen, the GM's
// 'danger' score is increased by this number.
// Negative numbers could be used to signify helpful events.

View File

@@ -91,3 +91,15 @@
num++
if(num)
. = round(. / num, 0.1)
// Computes activity of players on a per-region basis
/datum/metric/proc/assess_player_regions()
. = list()
for(var/mob/living/L in player_list)
var/activity = assess_player_activity(L)
for(var/region in L.get_player_regions())
.[region] += activity
// To prevent the universal region from being chosen too often, scale it down
// If lots of players are active over a wide set of regions, this should prefer events that cover a wider area
.[EVENT_REGION_UNIVERSAL] = round(.[EVENT_REGION_UNIVERSAL] / 2, 1)

View File

@@ -1136,3 +1136,23 @@
// Each mob does vision a bit differently so this is just for inheritence and also so overrided procs can make the vision apply instantly if they call `..()`.
/mob/living/proc/disable_spoiler_vision()
handle_vision()
/mob/living/proc/get_player_regions()
// A living player is always in a universal region
. = list(EVENT_REGION_UNIVERSAL)
var/turf/T = get_turf(src)
var/obj/effect/overmap/visitable/M = get_overmap_sector(T.z)
if(istype(M))
if(M.in_space)
if(T.z in using_map.station_levels)
. |= EVENT_REGION_SPACESTATION
else
. |= EVENT_REGION_DEEPSPACE
else
. |= EVENT_REGION_PLANETSURFACE
var/datum/map_z_level/zlevel = using_map.zlevels["[T.z]"]
if(istype(zlevel))
. |= zlevel.event_regions