mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-06-04 13:45:25 +01:00
105dff5058
## About The Pull Request Requested by @tralezab Admin event setups now use a list rather than a single setup. This means common functionality list setting position and picking an option from a list can be applied to events that have multiple customizable factors rather than needing to making entirely overridden subtypes for every event. Adds a few new subtypes of event_admin_setup: - input_number for setting a number value. An example can be found in the heart attack event. - set_location for causing an event to occur in a specific location. An example can be found in the stray cargo pod event. - question, yes no question that returns true/false. An example of its usage can be found in immovable rod - candidate_check, a more niche subtype used to block events that do not function unless theres a specific number of valid candidates. An example of its usage can be found in the disease events. While doing the refactor I also implemented some simple extra options for some of the refactored events. Classic Disease now has an option for admins to roll **any** disease rather than just the "safe" ones. And shuttle catastrophe now allows admins to select which shuttle is used. ## Why It's Good For The Game Cuts back on duplicate lines of code a lot, should make adding more customization to events slightly easier. Also more admin customization. ## Changelog 🆑 refactor: Admin event setup's have been refactored to use lists. fix: When admins customize the pirate event all options will be available rather than just options that have not been randomly rolled. fix: The stray meteor event no longer runtimes when customized by admins. admin: Admins can now select the shuttle brought in by the shuttle catastrophe event. admin: Admins can now randomize the disease outbreak classic event to roll any disease type, including transformation diseases so have fun with that. /🆑
82 lines
4.2 KiB
Plaintext
82 lines
4.2 KiB
Plaintext
/datum/round_event_control/shuttle_catastrophe
|
|
name = "Shuttle Catastrophe"
|
|
typepath = /datum/round_event/shuttle_catastrophe
|
|
weight = 10
|
|
max_occurrences = 1
|
|
category = EVENT_CATEGORY_BUREAUCRATIC
|
|
description = "Replaces the emergency shuttle with a random one."
|
|
admin_setup = list(/datum/event_admin_setup/warn_admin/shuttle_catastrophe, /datum/event_admin_setup/listed_options/shuttle_catastrophe)
|
|
|
|
/datum/round_event_control/shuttle_catastrophe/can_spawn_event(players, allow_magic = FALSE)
|
|
. = ..()
|
|
if(!.)
|
|
return .
|
|
|
|
if(SSshuttle.shuttle_purchased == SHUTTLEPURCHASE_FORCED)
|
|
return FALSE //don't do it if its already been done
|
|
if(istype(SSshuttle.emergency, /obj/docking_port/mobile/emergency/shuttle_build))
|
|
return FALSE //don't undo manual player engineering, it also would unload people and ghost them, there's just a lot of problems
|
|
if(EMERGENCY_AT_LEAST_DOCKED)
|
|
return FALSE //don't remove all players when its already on station or going to centcom
|
|
return TRUE
|
|
|
|
/datum/round_event/shuttle_catastrophe
|
|
var/datum/map_template/shuttle/new_shuttle
|
|
|
|
/datum/round_event/shuttle_catastrophe/announce(fake)
|
|
var/cause = pick("was attacked by [syndicate_name()] Operatives", "mysteriously teleported away", "had its refuelling crew mutiny",
|
|
"was found with its engines stolen", "\[REDACTED\]", "flew into the sunset, and melted", "learned something from a very wise cow, and left on its own",
|
|
"had cloning devices on it", "had its shuttle inspector put the shuttle in reverse instead of park, causing the shuttle to crash into the hangar")
|
|
var/message = "Your emergency shuttle [cause]. "
|
|
|
|
if(SSshuttle.shuttle_insurance)
|
|
message += "Luckily, your shuttle insurance has covered the costs of repair!"
|
|
if(SSeconomy.get_dep_account(ACCOUNT_CAR))
|
|
message += " You have been awarded a bonus from [command_name()] for smart spending."
|
|
else
|
|
message += "Your replacement shuttle will be the [new_shuttle.name] until further notice."
|
|
priority_announce(message, "[command_name()] Spacecraft Engineering")
|
|
|
|
/datum/round_event/shuttle_catastrophe/setup()
|
|
if(SSshuttle.shuttle_insurance || !isnull(new_shuttle)) //If an admin has overridden it don't re-roll it
|
|
return
|
|
var/list/valid_shuttle_templates = list()
|
|
for(var/shuttle_id in SSmapping.shuttle_templates)
|
|
var/datum/map_template/shuttle/template = SSmapping.shuttle_templates[shuttle_id]
|
|
if(!isnull(template.who_can_purchase) && template.credit_cost < INFINITY) //if we could get it from the communications console, it's cool for us to get it here
|
|
valid_shuttle_templates += template
|
|
new_shuttle = pick(valid_shuttle_templates)
|
|
|
|
/datum/round_event/shuttle_catastrophe/start()
|
|
if(SSshuttle.shuttle_insurance)
|
|
var/datum/bank_account/station_balance = SSeconomy.get_dep_account(ACCOUNT_CAR)
|
|
station_balance?.adjust_money(8000)
|
|
return
|
|
SSshuttle.shuttle_purchased = SHUTTLEPURCHASE_FORCED
|
|
SSshuttle.unload_preview()
|
|
SSshuttle.existing_shuttle = SSshuttle.emergency
|
|
SSshuttle.action_load(new_shuttle, replace = TRUE)
|
|
log_shuttle("Shuttle Catastrophe set a new shuttle, [new_shuttle.name].")
|
|
|
|
/datum/event_admin_setup/warn_admin/shuttle_catastrophe
|
|
warning_text = "This will unload the currently docked emergency shuttle, and ERASE ANYTHING within it. Proceed anyways?"
|
|
snitch_text = "has forced a shuttle catastrophe while a shuttle was already docked."
|
|
|
|
/datum/event_admin_setup/warn_admin/shuttle_catastrophe/should_warn()
|
|
return EMERGENCY_AT_LEAST_DOCKED || istype(SSshuttle.emergency, /obj/docking_port/mobile/emergency/shuttle_build)
|
|
|
|
/datum/event_admin_setup/listed_options/shuttle_catastrophe
|
|
input_text = "Select a specific shuttle?"
|
|
normal_run_option = "Random shuttle"
|
|
|
|
/datum/event_admin_setup/listed_options/shuttle_catastrophe/get_list()
|
|
var/list/valid_shuttle_templates = list()
|
|
for(var/shuttle_id in SSmapping.shuttle_templates)
|
|
var/datum/map_template/shuttle/template = SSmapping.shuttle_templates[shuttle_id]
|
|
if(!isnull(template.who_can_purchase) && template.credit_cost < INFINITY) //Even admins cannot force the cargo shuttle to act as an escape shuttle
|
|
valid_shuttle_templates += template
|
|
return valid_shuttle_templates
|
|
|
|
/datum/event_admin_setup/listed_options/shuttle_catastrophe/apply_to_event(datum/round_event/shuttle_catastrophe/event)
|
|
event.new_shuttle = chosen
|