From bfea08665b2436354c6c3be92ba5999a2bdff366 Mon Sep 17 00:00:00 2001 From: Lucy Date: Sat, 6 Jul 2024 21:32:08 -0400 Subject: [PATCH 1/3] Blood Brother storyteller tweaks --- .../code/modules/storytellers/converted_events/_base_event.dm | 2 ++ .../modules/storytellers/converted_events/solo/brother.dm | 4 ++-- .../code/modules/storytellers/storytellers/_storyteller.dm | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/monkestation/code/modules/storytellers/converted_events/_base_event.dm b/monkestation/code/modules/storytellers/converted_events/_base_event.dm index 595c9d7ad75d..e017c12d17a1 100644 --- a/monkestation/code/modules/storytellers/converted_events/_base_event.dm +++ b/monkestation/code/modules/storytellers/converted_events/_base_event.dm @@ -136,6 +136,8 @@ var/antag_datum /// Prompt players for consent to turn them into antags before doing so. Dont allow this for roundstart. var/prompted_picking = FALSE + /// If true, if this is picked at roundstart, the storyteller will forcefully trigger another antag alongside it. + var/force_secondary_antag = FALSE /datum/round_event_control/antagonist/solo/from_ghosts/get_candidates() var/round_started = SSticker.HasRoundStarted() diff --git a/monkestation/code/modules/storytellers/converted_events/solo/brother.dm b/monkestation/code/modules/storytellers/converted_events/solo/brother.dm index c29c3ee7eac3..1f386225b998 100644 --- a/monkestation/code/modules/storytellers/converted_events/solo/brother.dm +++ b/monkestation/code/modules/storytellers/converted_events/solo/brother.dm @@ -30,11 +30,11 @@ JOB_SECURITY_ASSISTANT, ) required_enemies = 1 - // BBs should be less common/abundant than normal traitors, albeit not overly so. - weight = 16 + weight = 10 maximum_antags = 2 denominator = 30 cost = 0.45 // so it doesn't eat up threat for a relatively low-threat antag + force_secondary_antag = TRUE /datum/round_event_control/antagonist/solo/brother/roundstart name = "Blood Brothers" diff --git a/monkestation/code/modules/storytellers/storytellers/_storyteller.dm b/monkestation/code/modules/storytellers/storytellers/_storyteller.dm index 76daca2e1dd2..a2040bb296cd 100644 --- a/monkestation/code/modules/storytellers/storytellers/_storyteller.dm +++ b/monkestation/code/modules/storytellers/storytellers/_storyteller.dm @@ -69,9 +69,9 @@ if(SSgamemode.current_roundstart_event && !SSgamemode.ran_roundstart && (guarantees_roundstart_roleset || roundstart_checks)) buy_event(SSgamemode.current_roundstart_event, EVENT_TRACK_ROLESET, TRUE) log_storyteller("Running SSgamemode.current_roundstart_event\[[SSgamemode.current_roundstart_event]\]") - SSgamemode.current_roundstart_event = null - if(!ignores_roundstart) + if(!ignores_roundstart && !SSgamemode.current_roundstart_event.force_secondary_antag) SSgamemode.ran_roundstart = TRUE + SSgamemode.current_roundstart_event = null add_points(delta_time) handle_tracks() From a9b656c1582e0c2022654253bf5bdfccce25d170 Mon Sep 17 00:00:00 2001 From: Lucy Date: Sat, 6 Jul 2024 21:55:32 -0400 Subject: [PATCH 2/3] refactor to use a `extra_spawned_events` system --- .../converted_events/_base_event.dm | 26 +++++++++++++++++-- .../converted_events/solo/brother.dm | 6 ++++- .../storytellers/storytellers/_storyteller.dm | 4 +-- 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/monkestation/code/modules/storytellers/converted_events/_base_event.dm b/monkestation/code/modules/storytellers/converted_events/_base_event.dm index e017c12d17a1..64ae9ee98f68 100644 --- a/monkestation/code/modules/storytellers/converted_events/_base_event.dm +++ b/monkestation/code/modules/storytellers/converted_events/_base_event.dm @@ -136,8 +136,9 @@ var/antag_datum /// Prompt players for consent to turn them into antags before doing so. Dont allow this for roundstart. var/prompted_picking = FALSE - /// If true, if this is picked at roundstart, the storyteller will forcefully trigger another antag alongside it. - var/force_secondary_antag = FALSE + /// A list of extra events to force whenever this one is chosen by the storyteller. + /// Can either be normal list or a weighted list. + var/list/extra_spawned_events /datum/round_event_control/antagonist/solo/from_ghosts/get_candidates() var/round_started = SSticker.HasRoundStarted() @@ -201,6 +202,15 @@ var/list/setup_minds = list() /// Whether we prompt the players before picking them. var/prompted_picking = FALSE //TODO: Implement this + /// DO NOT SET THIS MANUALLY, THIS IS INHERITED FROM THE EVENT CONTROLLER ON NEW + var/list/extra_spawned_events + +/datum/round_event/antagonist/solo/New(my_processing, datum/round_event_control/event_controller) + . = ..() + if(istype(event_controller, /datum/round_event_control/antagonist/solo)) + var/datum/round_event_control/antagonist/solo/antag_event_controller = event_controller + if(antag_event_controller?.extra_spawned_events) + extra_spawned_events = fill_with_ones(antag_event_controller.extra_spawned_events) /datum/round_event/antagonist/solo/setup() var/datum/round_event_control/antagonist/solo/cast_control = control @@ -269,6 +279,18 @@ candidate.mind.restricted_roles = restricted_roles setup = TRUE + if(LAZYLEN(extra_spawned_events)) + var/event_type = pick_weight(extra_spawned_events) + if(!event_type) + return + var/datum/round_event_control/triggered_event = locate(event_type) in SSgamemode.control + addtimer(CALLBACK(triggered_event, TYPE_PROC_REF(/datum/round_event_control, run_event), FALSE, null, FALSE, "storyteller"), 1 SECONDS) // wait a second to avoid any potential omnitraitor bs + +/datum/round_event/antagonist/solo/proc/spawn_extra_events() + if(!LAZYLEN(extra_spawned_events)) + return + var/datum/round_event_control/event = pick_weight(extra_spawned_events) + event?.run_event(random = FALSE, event_cause = "storyteller") /datum/round_event/antagonist/solo/ghost/setup() diff --git a/monkestation/code/modules/storytellers/converted_events/solo/brother.dm b/monkestation/code/modules/storytellers/converted_events/solo/brother.dm index 1f386225b998..b3dbe356713a 100644 --- a/monkestation/code/modules/storytellers/converted_events/solo/brother.dm +++ b/monkestation/code/modules/storytellers/converted_events/solo/brother.dm @@ -34,12 +34,16 @@ maximum_antags = 2 denominator = 30 cost = 0.45 // so it doesn't eat up threat for a relatively low-threat antag - force_secondary_antag = TRUE /datum/round_event_control/antagonist/solo/brother/roundstart name = "Blood Brothers" roundstart = TRUE earliest_start = 0 SECONDS + extra_spawned_events = list( + /datum/round_event_control/antagonist/solo/traitor/roundstart = 12, + /datum/round_event_control/antagonist/solo/bloodsucker/roundstart = 4, + /datum/round_event_control/antagonist/solo/heretic/roundstart = 2, + ) /datum/round_event_control/antagonist/solo/brother/midround name = "Sleeper Agents (Blood Brothers)" diff --git a/monkestation/code/modules/storytellers/storytellers/_storyteller.dm b/monkestation/code/modules/storytellers/storytellers/_storyteller.dm index a2040bb296cd..76daca2e1dd2 100644 --- a/monkestation/code/modules/storytellers/storytellers/_storyteller.dm +++ b/monkestation/code/modules/storytellers/storytellers/_storyteller.dm @@ -69,9 +69,9 @@ if(SSgamemode.current_roundstart_event && !SSgamemode.ran_roundstart && (guarantees_roundstart_roleset || roundstart_checks)) buy_event(SSgamemode.current_roundstart_event, EVENT_TRACK_ROLESET, TRUE) log_storyteller("Running SSgamemode.current_roundstart_event\[[SSgamemode.current_roundstart_event]\]") - if(!ignores_roundstart && !SSgamemode.current_roundstart_event.force_secondary_antag) - SSgamemode.ran_roundstart = TRUE SSgamemode.current_roundstart_event = null + if(!ignores_roundstart) + SSgamemode.ran_roundstart = TRUE add_points(delta_time) handle_tracks() From 2dc218b59cabba2a2c88bb7aa4d5a26c6c3ac8d8 Mon Sep 17 00:00:00 2001 From: Lucy Date: Sat, 6 Jul 2024 22:06:38 -0400 Subject: [PATCH 3/3] Update monkestation/code/modules/storytellers/converted_events/solo/brother.dm Co-authored-by: F-e-r-n <116040301+F-e-r-n@users.noreply.github.com> --- .../code/modules/storytellers/converted_events/solo/brother.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/monkestation/code/modules/storytellers/converted_events/solo/brother.dm b/monkestation/code/modules/storytellers/converted_events/solo/brother.dm index b3dbe356713a..a2413bc3e608 100644 --- a/monkestation/code/modules/storytellers/converted_events/solo/brother.dm +++ b/monkestation/code/modules/storytellers/converted_events/solo/brother.dm @@ -30,7 +30,7 @@ JOB_SECURITY_ASSISTANT, ) required_enemies = 1 - weight = 10 + weight = 12 maximum_antags = 2 denominator = 30 cost = 0.45 // so it doesn't eat up threat for a relatively low-threat antag