mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-27 23:27:34 +01:00
[MIRROR] Console Hack / Unfavourable Events won't run ghost roles which don't have time to do anything [MDB IGNORE] (#19331)
* Console Hack / Unfavourable Events won't run ghost roles which don't have time to do anything * nya * Update dynamic_unfavorable_situation.dm * Update dynamic_unfavorable_situation.dm --------- Co-authored-by: Jacquerel <hnevard@gmail.com> Co-authored-by: lessthnthree <three@lessthanthree.dk>
This commit is contained in:
co-authored by
Jacquerel
lessthnthree
parent
0c44e04bee
commit
b6c0baff7f
@@ -11,9 +11,26 @@
|
||||
var/static/list/unfavorable_random_events = list()
|
||||
if (!length(unfavorable_random_events))
|
||||
unfavorable_random_events = generate_unfavourable_events()
|
||||
var/list/possible_heavies = list()
|
||||
var/list/possible_heavies = generate_unfavourable_heavy_rulesets()
|
||||
if (!length(possible_heavies))
|
||||
var/datum/round_event_control/round_event_control_type = pick(unfavorable_random_events)
|
||||
var/delay = rand(20 SECONDS, 1 MINUTES)
|
||||
|
||||
// Ignored factors: threat cost, minimum round time
|
||||
log_dynamic_and_announce("An unfavorable situation was requested, but no heavy rulesets could be drafted. Spawning [initial(round_event_control_type.name)] in [DisplayTimeText(delay)] instead.")
|
||||
|
||||
var/datum/round_event_control/round_event_control = new round_event_control_type
|
||||
addtimer(CALLBACK(round_event_control, TYPE_PROC_REF(/datum/round_event_control, runEvent)), delay)
|
||||
else
|
||||
var/datum/dynamic_ruleset/midround/heavy_ruleset = pick_weight(possible_heavies)
|
||||
log_dynamic_and_announce("An unfavorable situation was requested, spawning [initial(heavy_ruleset.name)]")
|
||||
picking_specific_rule(heavy_ruleset, forced = TRUE, ignore_cost = TRUE)
|
||||
|
||||
/// Return a valid heavy dynamic ruleset, or an empty list if there's no time to run any rulesets
|
||||
/datum/game_mode/dynamic/proc/generate_unfavourable_heavy_rulesets()
|
||||
if (EMERGENCY_PAST_POINT_OF_NO_RETURN)
|
||||
return list()
|
||||
|
||||
var/list/possible_heavies = list()
|
||||
for (var/datum/dynamic_ruleset/midround/ruleset as anything in midround_rules)
|
||||
if (ruleset.midround_ruleset_style != MIDROUND_RULESET_STYLE_HEAVY)
|
||||
continue
|
||||
@@ -40,19 +57,7 @@
|
||||
continue
|
||||
|
||||
possible_heavies[ruleset] = ruleset.get_weight()
|
||||
|
||||
if (possible_heavies.len == 0)
|
||||
var/datum/round_event_control/round_event_control_type = pick(unfavorable_random_events)
|
||||
var/delay = rand(20 SECONDS, 1 MINUTES)
|
||||
|
||||
log_dynamic_and_announce("An unfavorable situation was requested, but no heavy rulesets could be drafted. Spawning [initial(round_event_control_type.name)] in [DisplayTimeText(delay)] instead.")
|
||||
|
||||
var/datum/round_event_control/round_event_control = new round_event_control_type
|
||||
addtimer(CALLBACK(round_event_control, TYPE_PROC_REF(/datum/round_event_control, runEvent)), delay)
|
||||
else
|
||||
var/datum/dynamic_ruleset/midround/heavy_ruleset = pick_weight(possible_heavies)
|
||||
log_dynamic_and_announce("An unfavorable situation was requested, spawning [initial(heavy_ruleset.name)]")
|
||||
picking_specific_rule(heavy_ruleset, forced = TRUE, ignore_cost = TRUE)
|
||||
return possible_heavies
|
||||
|
||||
/// Filter the below list by which events can actually run on this map
|
||||
/datum/game_mode/dynamic/proc/generate_unfavourable_events()
|
||||
|
||||
@@ -892,15 +892,20 @@ GLOBAL_VAR_INIT(cops_arrived, FALSE)
|
||||
// If we have a certain amount of ghosts, we'll add some more !!fun!! options to the list
|
||||
var/num_ghosts = length(GLOB.current_observers_list) + length(GLOB.dead_player_list)
|
||||
|
||||
// Pirates require empty space for the ship, and ghosts for the pirates obviously
|
||||
if(!SSmapping.is_planetary() && (num_ghosts >= MIN_GHOSTS_FOR_PIRATES))
|
||||
hack_options += HACK_PIRATE
|
||||
// Fugitives require empty space for the hunter's ship, and ghosts for both fugitives and hunters (Please no waldo)
|
||||
if(!SSmapping.is_planetary() && (num_ghosts >= MIN_GHOSTS_FOR_FUGITIVES))
|
||||
hack_options += HACK_FUGITIVES
|
||||
// If less than a certain percent of the population is ghosts, consider sleeper agents
|
||||
if(num_ghosts < (length(GLOB.clients) * MAX_PERCENT_GHOSTS_FOR_SLEEPER))
|
||||
hack_options += HACK_SLEEPER
|
||||
// Pirates / Fugitives have enough lead in time that there's no point summoning them if the shuttle is called
|
||||
// Both of these events also summon space ships and so cannot run on planetary maps
|
||||
if (EMERGENCY_IDLE_OR_RECALLED && !SSmapping.is_planetary())
|
||||
// Pirates require ghosts for the pirates obviously
|
||||
if(num_ghosts >= MIN_GHOSTS_FOR_PIRATES)
|
||||
hack_options += HACK_PIRATE
|
||||
// Fugitives require ghosts for both fugitives and hunters (Please no waldo)
|
||||
if(num_ghosts >= MIN_GHOSTS_FOR_FUGITIVES)
|
||||
hack_options += HACK_FUGITIVES
|
||||
|
||||
if (!EMERGENCY_PAST_POINT_OF_NO_RETURN)
|
||||
// If less than a certain percent of the population is ghosts, consider sleeper agents
|
||||
if(num_ghosts < (length(GLOB.clients) * MAX_PERCENT_GHOSTS_FOR_SLEEPER))
|
||||
hack_options += HACK_SLEEPER
|
||||
|
||||
var/picked_option = pick(hack_options)
|
||||
message_admins("[ADMIN_LOOKUPFLW(hacker)] hacked a [name] located at [ADMIN_VERBOSEJMP(src)], resulting in: [picked_option]!")
|
||||
|
||||
Reference in New Issue
Block a user