mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-18 13:04:45 +00:00
## 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. /🆑
70 lines
2.1 KiB
Plaintext
70 lines
2.1 KiB
Plaintext
/datum/round_event_control/falsealarm
|
|
name = "False Alarm"
|
|
typepath = /datum/round_event/falsealarm
|
|
weight = 20
|
|
max_occurrences = 5
|
|
category = EVENT_CATEGORY_BUREAUCRATIC
|
|
description = "Fakes an event announcement."
|
|
admin_setup = list(/datum/event_admin_setup/listed_options/false_alarm)
|
|
|
|
/datum/round_event_control/falsealarm/can_spawn_event(players_amt, allow_magic = FALSE)
|
|
. = ..()
|
|
if(!.)
|
|
return .
|
|
|
|
if(!length(gather_false_events()))
|
|
return FALSE
|
|
return TRUE
|
|
|
|
/datum/round_event/falsealarm
|
|
announce_when = 0
|
|
end_when = 1
|
|
fakeable = FALSE
|
|
/// Admin's pick of fake event (wow! you picked blob!! you're so creative and smart!)
|
|
var/forced_type
|
|
|
|
/datum/round_event/falsealarm/announce(fake)
|
|
if(fake) //What are you doing
|
|
return
|
|
var/players_amt = get_active_player_count(alive_check = 1, afk_check = 1, human_check = 1)
|
|
|
|
var/events_list = gather_false_events(players_amt)
|
|
var/datum/round_event_control/event_control
|
|
if(forced_type)
|
|
event_control = forced_type
|
|
else
|
|
event_control = pick(events_list)
|
|
if(event_control)
|
|
var/datum/round_event/Event = new event_control.typepath()
|
|
message_admins("False Alarm: [Event]")
|
|
Event.kill() //do not process this event - no starts, no ticks, no ends
|
|
Event.announce(TRUE) //just announce it like it's happening
|
|
|
|
/proc/gather_false_events(players_amt)
|
|
. = list()
|
|
for(var/datum/round_event_control/E in SSevents.control)
|
|
if(istype(E, /datum/round_event_control/falsealarm))
|
|
continue
|
|
if(!E.can_spawn_event(players_amt))
|
|
continue
|
|
|
|
var/datum/round_event/event = E.typepath
|
|
if(!initial(event.fakeable))
|
|
continue
|
|
. += E
|
|
|
|
/datum/event_admin_setup/listed_options/false_alarm
|
|
normal_run_option = "Random Fake Event"
|
|
|
|
/datum/event_admin_setup/listed_options/false_alarm/get_list()
|
|
var/list/possible_types = list()
|
|
for(var/datum/round_event_control/event_control in SSevents.control)
|
|
var/datum/round_event/event = event_control.typepath
|
|
if(!initial(event.fakeable))
|
|
continue
|
|
possible_types += event_control
|
|
return possible_types
|
|
|
|
/datum/event_admin_setup/listed_options/false_alarm/apply_to_event(datum/round_event/falsealarm/event)
|
|
event.forced_type = chosen
|