Files
Bubberstation/code/modules/events/_event_admin_setup.dm
tralezab c0ef4ba907 Adds the Dark Matt-eor when you emag a stupid amount of meteor shields + lots of meteor file sorting + qol + dark matter singularity + dark matt-eor summoning final traitor objective (#74330)
## About The Pull Request

<details>
  <summary>Dark Matt-eor Image</summary>
  

![image](https://user-images.githubusercontent.com/40974010/228368755-34ae5f89-e1bb-498b-bbf8-a14ff4240dc0.png)

</details>

> A barely visible blur in the cosmic darkness, like a ghostly shadow on
a moonless night. A piercing howl in the vacuum of space, as if it were
tearing the fabric of reality. A twisted halo of light around it,
bending and breaking the rays of distant suns. A shower of quantum
sparks, flickering and fading in its wake. A dark matter meteor (dark
matt-eor) is a wonder to witness, and to dread.

> A sudden impact, like a hammer blow to the heart of the station. A
violent tremor, shaking and shattering the metal walls and windows. A
deafening roar, as the air rushes out of the breached hull. A blinding
flash, as the dark matter meteor unleashes its hidden energy. A tiny
black hole, forming and growing in the center of the station. A
relentless pull, dragging everything towards the abyss. A dark matter
meteor is incredibly deadly.

Emagging too many meteor shields will summon a dark matt-eor. This comes
with several warnings, and after awhile, warns the station that someone
is trying to summon a dark matteor.

The dark matt-eor itself is not that damaging in its impact, but drops a
singularity in its final resting place.

## Why It's Good For The Game

It's a new way to terrorize a round as an antagonist. Before, emagging a
lot of meteor shields would basically make meteor showers the only event
that can run, which is cool, but since constant meteor waves are going
to destroy the station, let's also throw in the mother of all meteors!

This also adds warnings to spamming emagging meteor shields, which imo
needs it. The round ends when someone spams emagged meteor shields, and
since they're meteor shields nobody is going to reasonably check on
them.

## Changelog
🆑
add: The dark matt-eor
add: Summon a dark matt-eor final traitor objective
add: Dark matter singularity variant, which can't grow as big as a
regular singularity but hungers for blood
code: cleaned up/sorted meteor shield code, satellite control, and more
qol: added a lot of feedback to interacting with meteor shields
balance: emagging a lot of meteor shields warns the station, but
emagging enough of them summons a Dark Matt-eor.
/🆑
2023-03-29 19:48:15 +00:00

162 lines
6.1 KiB
Plaintext

/// Datum that holds a proc for additional options when running an event.
/// Prototypes are declared here, non-prototypes on the event files.
/datum/event_admin_setup
/// event control that owns this.
var/datum/round_event_control/event_control
/datum/event_admin_setup/New(event_control)
src.event_control = event_control
/datum/event_admin_setup/proc/prompt_admins()
SHOULD_CALL_PARENT(FALSE)
CRASH("Unimplemented prompt_admins() on [event_control]'s admin setup.")
/datum/event_admin_setup/proc/apply_to_event(datum/round_event/event)
SHOULD_CALL_PARENT(FALSE)
CRASH("Unimplemented apply_to_event() on [event_control]'s admin setup.")
/// A very common pattern is picking from a tgui list input, so this does that.
/// Supply a list in `get_list` and prompt admins will have the admin pick from it or cancel.
/datum/event_admin_setup/listed_options
/// Text to ask the user, for example "What deal would you like to offer the crew?"
var/input_text = "Unset Text"
/// If set, picking this will be the same as running the event without admin setup.
var/normal_run_option
/// if you want a special button, this will add it. Remember to actually handle that case for chosen in `apply_to_event`
/// Example is in scrubber_overflow.dm
var/special_run_option
/// Picked list option to be applied.
var/chosen
/datum/event_admin_setup/listed_options/proc/get_list()
SHOULD_CALL_PARENT(FALSE)
CRASH("Unimplemented get_list() on [event_control]'s admin setup.")
/datum/event_admin_setup/listed_options/prompt_admins()
var/list/options = get_list()
if(special_run_option)
options.Insert(1, special_run_option)
if(normal_run_option)
options.Insert(1, normal_run_option)
chosen = tgui_input_list(usr, input_text, event_control.name, options)
if(!chosen)
return ADMIN_CANCEL_EVENT
if(normal_run_option && chosen == normal_run_option)
chosen = null //no admin pick = runs as normal
/// For admin setups that want a custom string. Suggests what the event would have picked normally.
/datum/event_admin_setup/text_input
/// Text to ask the user, for example "What horrifying truth will you reveal?"
var/input_text = "Unset Text"
/// Picked string to be applied.
var/chosen
/// Returns a string to suggest to the admin, which would be what the event would have chosen.
/// No suggestion if an empty string, which is default behavior.
/datum/event_admin_setup/text_input/proc/get_text_suggestion()
return ""
/datum/event_admin_setup/text_input/prompt_admins()
var/suggestion = get_text_suggestion()
chosen = tgui_input_text(usr, input_text, event_control.name, suggestion)
if(!chosen)
return ADMIN_CANCEL_EVENT
/// Some events are not always a good idea when a game state is in a certain situation.
/// This runs a check and warns the admin.
/datum/event_admin_setup/warn_admin
/// Warning text shown to admin on the alert.
var/warning_text = "Unset warning text"
/// Message sent to other admins. Example: "has forced a shuttle catastrophe while a shuttle was already docked."
var/snitch_text = "Unset snitching text (be mad at coders AND the admin responsible)"
/datum/event_admin_setup/warn_admin/prompt_admins()
if(!should_warn())
return
var/mob/admin = usr
if(tgui_alert(usr, "WARNING: [warning_text]", event_control.name, list("Yes", "No")) == "Yes")
if(snitch_text)
message_admins("[admin.ckey] [snitch_text]")
else
return ADMIN_CANCEL_EVENT
/// Returns whether the admin should get an alert.
/datum/event_admin_setup/warn_admin/proc/should_warn()
SHOULD_CALL_PARENT(FALSE)
CRASH("Unimplemented should_warn() on [event_control]'s admin setup.")
/datum/event_admin_setup/warn_admin/apply_to_event(datum/round_event/event)
return
/datum/event_admin_setup/set_location
///Text shown when admins are queried about setting the target location.
var/input_text = "Aimed at the turf we're on?"
///Turf that will be passed onto the event.
var/atom/chosen_turf
/datum/event_admin_setup/set_location/prompt_admins()
var/set_location = tgui_alert(usr, input_text, event_control.name, list("Yes", "No", "Cancel"))
switch(set_location)
if("Yes")
chosen_turf = get_turf(usr)
if("No")
chosen_turf = null
else
return ADMIN_CANCEL_EVENT
/datum/event_admin_setup/input_number
///Text shown when admins are queried about what number to set.
var/input_text = ""
///The value the number will be set to by default
var/default_value
///The highest value setable by the admin.
var/max_value = 10000
///The lowest value setable by the admin
var/min_value = 0
///Value selected by the admin
var/chosen_value
/datum/event_admin_setup/input_number/prompt_admins()
chosen_value = tgui_input_number(usr, input_text, event_control.name, default_value, max_value, min_value)
if(isnull(chosen_value))
return ADMIN_CANCEL_EVENT
///For events that mandate a set number of candidates to function
/datum/event_admin_setup/minimum_candidate_requirement
///Text shown when there are not enough candidates
var/output_text = "There are no candidates eligible to..."
///Minimum number of candidates for the event to function
var/min_candidates = 1
/datum/event_admin_setup/minimum_candidate_requirement/prompt_admins()
var/candidate_count = count_candidates()
if(candidate_count < min_candidates)
tgui_alert(usr, output_text, "Error")
return ADMIN_CANCEL_EVENT
tgui_alert(usr, "[candidate_count] candidates found!", event_control.name)
/// Checks for candidates. Should return the total number of candidates
/datum/event_admin_setup/minimum_candidate_requirement/proc/count_candidates()
SHOULD_CALL_PARENT(FALSE)
CRASH("Unimplemented count_candidates() on [event_control]'s admin setup.")
/datum/event_admin_setup/minimum_candidate_requirement/apply_to_event(datum/round_event/event)
return
///For events that require a true/false question
/datum/event_admin_setup/question
///Question shown to the admin.
var/input_text = "Are you sure you would like to do this?"
///Value passed to the event.
var/chosen
/datum/event_admin_setup/question/prompt_admins()
var/response = tgui_alert(usr, input_text , event_control.name , list("Yes", "No", "Cancel"))
switch(response)
if("Yes")
chosen = TRUE
if("No")
chosen = FALSE
else
return ADMIN_CANCEL_EVENT