mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-19 12:05:59 +01:00
[MIRROR] events now have to check parent to see if they can run [MDB IGNORE] (#16506)
* events now have to check parent to see if they can run (#70128) * events now have to check parent to see if they can run * update supermatter_surge Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com> Co-authored-by: tastyfish <crazychris32@gmail.com>
This commit is contained in:
@@ -91,7 +91,7 @@ SUBSYSTEM_DEF(events)
|
||||
// Only alive, non-AFK human players count towards this.
|
||||
var/sum_of_weights = 0
|
||||
for(var/datum/round_event_control/E in control)
|
||||
if(!E.canSpawnEvent(players_amt))
|
||||
if(!E.can_spawn_event(players_amt))
|
||||
continue
|
||||
//SKYRAT EDIT ADDITION
|
||||
if(threat_override && !E.alert_observers)
|
||||
@@ -108,7 +108,7 @@ SUBSYSTEM_DEF(events)
|
||||
sum_of_weights = rand(0,sum_of_weights) //reusing this variable. It now represents the 'weight' we want to select
|
||||
|
||||
for(var/datum/round_event_control/E in control)
|
||||
if(!E.canSpawnEvent(players_amt))
|
||||
if(!E.can_spawn_event(players_amt))
|
||||
continue
|
||||
sum_of_weights -= E.weight
|
||||
|
||||
|
||||
@@ -41,7 +41,8 @@
|
||||
|
||||
// Checks if the event can be spawned. Used by event controller and "false alarm" event.
|
||||
// Admin-created events override this.
|
||||
/datum/round_event_control/proc/canSpawnEvent(players_amt)
|
||||
/datum/round_event_control/proc/can_spawn_event(players_amt)
|
||||
SHOULD_CALL_PARENT(TRUE)
|
||||
if(occurrences >= max_occurrences)
|
||||
return FALSE
|
||||
if(earliest_start >= world.time-SSticker.round_start_time)
|
||||
@@ -75,7 +76,7 @@
|
||||
message_admins("Random Event triggering in [DisplayTimeText(RANDOM_EVENT_ADMIN_INTERVENTION_TIME)]: [name] (<a href='?src=[REF(src)];cancel=1'>CANCEL</a> | <a href='?src=[REF(src)];something_else=1'>SOMETHING ELSE</a>)") //SKYRAT EDIT CHANGE
|
||||
sleep(RANDOM_EVENT_ADMIN_INTERVENTION_TIME)
|
||||
var/players_amt = get_active_player_count(alive_check = TRUE, afk_check = TRUE, human_check = TRUE)
|
||||
if(!canSpawnEvent(players_amt))
|
||||
if(!can_spawn_event(players_amt))
|
||||
message_admins("Second pre-condition check for [name] failed, skipping...")
|
||||
return EVENT_INTERRUPTED
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
category = EVENT_CATEGORY_FRIENDLY
|
||||
description = "A colourful display can be seen through select windows. And the kitchen."
|
||||
|
||||
/datum/round_event_control/aurora_caelus/canSpawnEvent(players)
|
||||
if(!CONFIG_GET(flag/starlight)&&!(SSmapping.empty_space))
|
||||
/datum/round_event_control/aurora_caelus/can_spawn_event(players)
|
||||
if(!CONFIG_GET(flag/starlight) && !(SSmapping.empty_space))
|
||||
return FALSE
|
||||
return ..()
|
||||
|
||||
|
||||
@@ -21,8 +21,14 @@
|
||||
|
||||
forced_type = input(usr, "Select the scare.","False event") as null|anything in sort_names(possible_types)
|
||||
|
||||
/datum/round_event_control/falsealarm/canSpawnEvent(players_amt)
|
||||
return ..() && length(gather_false_events())
|
||||
/datum/round_event_control/falsealarm/can_spawn_event(players_amt)
|
||||
. = ..()
|
||||
if(!.)
|
||||
return .
|
||||
|
||||
if(!length(gather_false_events()))
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/datum/round_event/falsealarm
|
||||
announce_when = 0
|
||||
@@ -53,7 +59,7 @@
|
||||
for(var/datum/round_event_control/E in SSevents.control)
|
||||
if(istype(E, /datum/round_event_control/falsealarm))
|
||||
continue
|
||||
if(!E.canSpawnEvent(players_amt))
|
||||
if(!E.can_spawn_event(players_amt))
|
||||
continue
|
||||
|
||||
var/datum/round_event/event = E.typepath
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
category = EVENT_CATEGORY_ENTITIES
|
||||
description = "A xenomorph larva spawns on a random vent."
|
||||
|
||||
/datum/round_event_control/alien_infestation/canSpawnEvent()
|
||||
/datum/round_event_control/alien_infestation/can_spawn_event(players_amt)
|
||||
. = ..()
|
||||
if(!.)
|
||||
return .
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
category = EVENT_CATEGORY_ENTITIES
|
||||
description = "Spawns a new blob overmind."
|
||||
|
||||
/datum/round_event_control/blob/canSpawnEvent(players)
|
||||
/datum/round_event_control/blob/can_spawn_event(players)
|
||||
if(EMERGENCY_PAST_POINT_OF_NO_RETURN) // no blobs if the shuttle is past the point of no return
|
||||
return FALSE
|
||||
|
||||
|
||||
@@ -5,7 +5,11 @@
|
||||
category = EVENT_CATEGORY_ENGINEERING
|
||||
description = "Turns off the gravity generator."
|
||||
|
||||
/datum/round_event_control/gravity_generator_blackout/canSpawnEvent()
|
||||
/datum/round_event_control/gravity_generator_blackout/can_spawn_event(players_amt)
|
||||
. = ..()
|
||||
if(!.)
|
||||
return .
|
||||
|
||||
var/station_generator_exists = FALSE
|
||||
for(var/obj/machinery/gravity_generator/main/the_generator in GLOB.machines)
|
||||
if(is_station_level(the_generator.z))
|
||||
|
||||
@@ -11,11 +11,11 @@
|
||||
///Number of candidates to be smote
|
||||
var/quantity = 1
|
||||
|
||||
/datum/round_event_control/heart_attack/canSpawnEvent()
|
||||
/datum/round_event_control/heart_attack/can_spawn_event(players_amt)
|
||||
. = ..()
|
||||
if(!.)
|
||||
return .
|
||||
generate_candidates() //generating candidates and checking in canSpawnEvent prevents extreme edge case of there being the 40 minimum players, with all being ineligible for a heart attack, wasting the event
|
||||
generate_candidates() //generating candidates and checking in can_spawn_event prevents extreme edge case of there being the 40 minimum players, with all being ineligible for a heart attack, wasting the event
|
||||
if(length(heart_attack_candidates))
|
||||
return TRUE
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
if(!check_rights(R_FUN))
|
||||
return
|
||||
|
||||
generate_candidates() //canSpawnEvent() is bypassed by admin_setup, so this makes sure that the candidates are still generated
|
||||
generate_candidates() //can_spawn_event() is bypassed by admin_setup, so this makes sure that the candidates are still generated
|
||||
|
||||
if(!length(heart_attack_candidates))
|
||||
message_admins("There are no candidates eligible to recieve a heart attack!")
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
scrubber_list += scrubber
|
||||
return pick(scrubber_list)
|
||||
|
||||
/datum/round_event_control/scrubber_clog/canSpawnEvent(players_amt)
|
||||
/datum/round_event_control/scrubber_clog/can_spawn_event(players_amt)
|
||||
. = ..()
|
||||
if(!.)
|
||||
return
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
if(!scrubbers.len)
|
||||
return kill()
|
||||
|
||||
/datum/round_event_control/scrubber_overflow/canSpawnEvent(players_amt)
|
||||
/datum/round_event_control/scrubber_overflow/can_spawn_event(players_amt)
|
||||
. = ..()
|
||||
if(!.)
|
||||
return
|
||||
|
||||
@@ -6,14 +6,18 @@
|
||||
category = EVENT_CATEGORY_BUREAUCRATIC
|
||||
description = "Replaces the emergency shuttle with a random one."
|
||||
|
||||
/datum/round_event_control/shuttle_catastrophe/canSpawnEvent(players)
|
||||
/datum/round_event_control/shuttle_catastrophe/can_spawn_event(players)
|
||||
. = ..()
|
||||
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 ..()
|
||||
return TRUE
|
||||
|
||||
|
||||
/datum/round_event/shuttle_catastrophe
|
||||
|
||||
@@ -7,14 +7,18 @@
|
||||
category = EVENT_CATEGORY_BUREAUCRATIC
|
||||
description = "A sketchy but legit insurance offer."
|
||||
|
||||
/datum/round_event_control/shuttle_insurance/canSpawnEvent(players)
|
||||
/datum/round_event_control/shuttle_insurance/can_spawn_event(players)
|
||||
. = ..()
|
||||
if(!.)
|
||||
return .
|
||||
|
||||
if(!SSeconomy.get_dep_account(ACCOUNT_CAR))
|
||||
return FALSE //They can't pay?
|
||||
if(SSshuttle.shuttle_purchased == SHUTTLEPURCHASE_FORCED)
|
||||
return FALSE //don't do it if there's nothing to insure
|
||||
if(EMERGENCY_AT_LEAST_DOCKED)
|
||||
return FALSE //catastrophes won't trigger so no point
|
||||
return ..()
|
||||
return TRUE
|
||||
|
||||
/datum/round_event/shuttle_insurance
|
||||
var/ship_name = "\"In the Unlikely Event\""
|
||||
|
||||
@@ -7,9 +7,14 @@
|
||||
description = "Everything becomes pointy enough to embed in people when thrown."
|
||||
|
||||
///behold... the only reason sticky is a subtype...
|
||||
/datum/round_event_control/wizard/embedpocalypse/canSpawnEvent(players_amt, gamemode)
|
||||
/datum/round_event_control/wizard/embedpocalypse/can_spawn_event(players_amt, gamemode)
|
||||
. = ..()
|
||||
if(!.)
|
||||
return .
|
||||
|
||||
if(GLOB.global_funny_embedding)
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/datum/round_event/wizard/embedpocalypse/start()
|
||||
GLOB.global_funny_embedding = new /datum/global_funny_embedding/pointy
|
||||
|
||||
@@ -5,12 +5,14 @@
|
||||
max_occurrences = 1
|
||||
description = "Makes everyone dressed up like a wizard."
|
||||
|
||||
/datum/round_event_control/wizard/identity_spoof/canSpawnEvent(players_amt)
|
||||
/datum/round_event_control/wizard/identity_spoof/can_spawn_event(players_amt)
|
||||
. = ..()
|
||||
if(.)
|
||||
return FALSE
|
||||
return .
|
||||
|
||||
if(GLOB.current_anonymous_theme) //already anonymous, ABORT ABORT
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/datum/round_event/wizard/identity_spoof/start()
|
||||
if(GLOB.current_anonymous_theme)
|
||||
|
||||
@@ -19,9 +19,10 @@
|
||||
max_occurrences = 4
|
||||
earliest_start = 20 MINUTES
|
||||
|
||||
/datum/round_event_control/supermatter_surge/canSpawnEvent()
|
||||
/datum/round_event_control/supermatter_surge/can_spawn_event(players_amt)
|
||||
if(!GLOB.main_supermatter_engine?.has_been_powered) // We don't want to cause a deadly delam if the engineers haven't started the engine yet.
|
||||
return FALSE
|
||||
|
||||
return ..()
|
||||
|
||||
/datum/round_event/supermatter_surge
|
||||
|
||||
Reference in New Issue
Block a user