diff --git a/code/modules/events/event.dm b/code/modules/events/event.dm index 90fe76db6fb..f0c4c0a821b 100644 --- a/code/modules/events/event.dm +++ b/code/modules/events/event.dm @@ -8,10 +8,12 @@ var/one_shot = 0 // If true, then the event will not be re-added to the list of available events var/add_to_queue= 1 // If true, add back to the queue of events upon finishing. var/list/role_weights = list() + var/list/minimum_job_requirement = list() //Minimum amount of jobs required for the event to fire. + var/pop_requirement = 0 //Minimum amount of player_list mobs for this to fire. var/list/excluded_gamemodes // A lazylist of gamemodes during which this event won't fire. var/datum/event/event_type -/datum/event_meta/New(var/event_severity, var/event_name, var/datum/event/type, var/event_weight, var/list/job_weights, var/is_one_shot = 0, var/min_event_weight = 0, var/max_event_weight = 0, var/list/excluded_roundtypes, var/add_to_queue = TRUE) +/datum/event_meta/New(var/event_severity, var/event_name, var/datum/event/type, var/event_weight, var/list/job_weights, var/is_one_shot = 0, var/min_event_weight = 0, var/max_event_weight = 0, var/list/excluded_roundtypes, var/add_to_queue = TRUE, var/list/minimum_job_requirement_list, var/pop_needed = 0) name = event_name severity = event_severity event_type = type @@ -20,8 +22,11 @@ min_weight = min_event_weight max_weight = max_event_weight src.add_to_queue = add_to_queue + pop_requirement = pop_needed if(job_weights) role_weights = job_weights + if(minimum_job_requirement_list) + minimum_job_requirement = minimum_job_requirement_list if(excluded_roundtypes) excluded_gamemodes = excluded_roundtypes @@ -29,15 +34,26 @@ if(!enabled) return 0 + if(length(player_list) <= pop_requirement) + return 0 + if(LAZYISIN(excluded_gamemodes, SSticker.mode.name)) // There's no way it'll be run this round anyways. enabled = FALSE return 0 var/job_weight = 0 - for(var/role in role_weights) - if(role in active_with_role) - job_weight += active_with_role[role] * role_weights[role] + var/minimum_met = TRUE + if(minimum_job_requirement) + for(var/role in minimum_job_requirement) + if(active_with_role[role] >= minimum_job_requirement[role]) + minimum_met = TRUE + else + minimum_met = FALSE + if(minimum_met) + for(var/role in role_weights) + if(role in active_with_role) + job_weight += active_with_role[role] * role_weights[role] var/total_weight = weight + job_weight diff --git a/code/modules/events/event_container.dm b/code/modules/events/event_container.dm index 94dbd98d7a6..e062ff46e30 100644 --- a/code/modules/events/event_container.dm +++ b/code/modules/events/event_container.dm @@ -233,7 +233,7 @@ var/global/list/severity_to_string = list(EVENT_LEVEL_MUNDANE = "Mundane", EVENT severity = EVENT_LEVEL_MAJOR available_events = list( new /datum/event_meta(EVENT_LEVEL_MAJOR, "Nothing", /datum/event/nothing, 135), - new /datum/event_meta(EVENT_LEVEL_MAJOR, "Blob", /datum/event/blob, 0, list(ASSIGNMENT_ENGINEER = 10), TRUE), + new /datum/event_meta(EVENT_LEVEL_MAJOR, "Blob", /datum/event/blob, 0, list(ASSIGNMENT_ENGINEER = 10), TRUE, minimum_job_requirement_list = list("Engineer" = 2), pop_needed = 10), new /datum/event_meta(EVENT_LEVEL_MAJOR, "Space Vines", /datum/event/spacevine, 0, list(ASSIGNMENT_ANY = 1, ASSIGNMENT_ENGINEER = 10, ASSIGNMENT_GARDENER = 20), TRUE), new /datum/event_meta(EVENT_LEVEL_MAJOR, "Spider Infestation", /datum/event/spider_infestation, 25, list(ASSIGNMENT_SECURITY = 10, ASSIGNMENT_MEDICAL = 5), TRUE), new /datum/event_meta(EVENT_LEVEL_MAJOR, "Major Vermin Infestation", /datum/event/infestation/major, 15, list(ASSIGNMENT_SECURITY = 15, ASSIGNMENT_MEDICAL = 5)), diff --git a/html/changelogs/mattatlas-blobmoments.yml b/html/changelogs/mattatlas-blobmoments.yml new file mode 100644 index 00000000000..8ef248c0b9e --- /dev/null +++ b/html/changelogs/mattatlas-blobmoments.yml @@ -0,0 +1,41 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +# balance +# admin +# backend +# security +# refactor +################################# + +# Your name. +author: MattAtlas + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +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: "Blobs now only spawn with a minimum of 10 players active and 2 engineers."