Delays handing out of Traitor objectives (#24857)

* Idk man

* IT WORKS

* SO CLOSE TO GREATNESS

* IT ALL WORKS AAAAAA

* Actually add a random timer

* Oopsie

* Removes empty proc

* Update code/game/gamemodes/traitor/traitor.dm

Co-authored-by: SteelSlayer <42044220+SteelSlayer@users.noreply.github.com>

* Contra requested changes

* Adds randomness to random_time

* Whoops

* Contra + AA Review

* Removes TODO

* Reverts standard mode

* Makes CI not fail

* Removes unused proc

* FUCK

* Fixes a kit bug (Thanks Erik)

* Tourte Review

* Matt review

* Changes text, adds admin logs

* Clarifies the log

* New and improved version!

* Fixes

* Revert "Fixes"

This reverts commit ea29aa92b2.

* Revert "New and improved version!"

This reverts commit ea053f3b94.

* Properly rerolls objectives at handout

* Adds trifecta support

* Contra and Sirryan review

* Forgor this

* Fix CI

* Final fixes

* Update code/game/gamemodes/traitor/traitor.dm

Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>
Signed-off-by: DGamerL <108773801+DGamerL@users.noreply.github.com>

* Update code/game/gamemodes/trifecta/trifecta.dm

Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>
Signed-off-by: DGamerL <108773801+DGamerL@users.noreply.github.com>

* Steel review

* Wow I was silly

* Less whitespace

* Dumbest bug in a while

* No more lavaland player getting autobalanced

* Streamlines a proc + another fix

* AAAAA FUCK

* Update code/game/gamemodes/objective.dm

Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com>
Signed-off-by: DGamerL <108773801+DGamerL@users.noreply.github.com>

* Update code/game/gamemodes/objective.dm

Signed-off-by: DGamerL <108773801+DGamerL@users.noreply.github.com>

* Contra review

* Faire review

* Forgor to push this

* Farie + Contra review

* Hal + Contra review

* Uses `replaceobjective` now + Fix

* Farie review

* Farie review

* Farie review 2: electric bogaloo

* Fix

* Update code/game/gamemodes/objective_holder.dm

Co-authored-by: Farie82 <farie82@users.noreply.github.com>
Signed-off-by: DGamerL <108773801+DGamerL@users.noreply.github.com>

* Contra review

* Update code/game/gamemodes/objective_holder.dm

Co-authored-by: Farie82 <farie82@users.noreply.github.com>
Signed-off-by: DGamerL <108773801+DGamerL@users.noreply.github.com>

---------

Signed-off-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
Co-authored-by: SteelSlayer <42044220+SteelSlayer@users.noreply.github.com>
Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>
Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com>
Co-authored-by: Farie82 <farie82@users.noreply.github.com>
This commit is contained in:
DGamerL
2024-07-24 10:09:14 +02:00
committed by GitHub
parent 98f0931c14
commit 3f8aff4374
11 changed files with 238 additions and 80 deletions
@@ -55,6 +55,9 @@ GLOBAL_LIST_EMPTY(antagonists)
var/blurb_b = 0
var/blurb_a = 0
/// Do we have delayed objective giving?
var/delayed_objectives = FALSE
/datum/antagonist/New()
GLOB.antagonists += src
objective_holder = new(src)
@@ -236,14 +239,15 @@ GLOBAL_LIST_EMPTY(antagonists)
* * explanation_text - the explanation text that will be passed into the objective's `New()` proc
* * mob/target_override - a target for the objective
*/
/datum/antagonist/proc/add_antag_objective(datum/objective/O, explanation_text, mob/target_override)
if(ispath(O))
O = new O()
if(O.owner)
stack_trace("[O], [O.type] was assigned as an objective to [owner] (mind), but already had an owner: [O.owner] (mind). Overriding.")
O.owner = owner
/datum/antagonist/proc/add_antag_objective(datum/objective/objective_to_add, explanation_text, mob/target_override)
if(ispath(objective_to_add))
objective_to_add = new objective_to_add()
return objective_holder.add_objective(O, explanation_text, target_override)
if(objective_to_add.owner)
stack_trace("[objective_to_add], [objective_to_add.type] was assigned as an objective to [owner] (mind), but already had an owner: [objective_to_add.owner] (mind). Overriding.")
objective_to_add.owner = owner
return objective_holder.add_objective(objective_to_add, explanation_text, target_override)
/**
* Complement to add_antag_objective that removes the objective.
@@ -136,19 +136,29 @@ RESTRICT_TYPE(/datum/antagonist/traitor)
* Create and assign a single randomized human traitor objective.
*/
/datum/antagonist/traitor/proc/forge_single_human_objective()
var/datum/objective/objective_to_add
if(prob(50))
if(length(active_ais()) && prob(100 / length(GLOB.player_list)))
add_antag_objective(/datum/objective/destroy)
objective_to_add = /datum/objective/destroy
else if(prob(5))
add_antag_objective(/datum/objective/debrain)
objective_to_add = /datum/objective/debrain
else if(prob(30))
add_antag_objective(/datum/objective/maroon)
objective_to_add = /datum/objective/maroon
else if(prob(30))
add_antag_objective(/datum/objective/assassinateonce)
objective_to_add = /datum/objective/assassinateonce
else
add_antag_objective(/datum/objective/assassinate)
objective_to_add = /datum/objective/assassinate
else
add_antag_objective(/datum/objective/steal)
objective_to_add = /datum/objective/steal
if(delayed_objectives)
objective_to_add = new /datum/objective/delayed(objective_to_add)
add_antag_objective(objective_to_add)
/**
* Give human traitors their uplink, and AI traitors their law 0. Play the traitor an alert sound.
@@ -267,3 +277,14 @@ RESTRICT_TYPE(/datum/antagonist/traitor)
/datum/antagonist/traitor/custom_blurb()
return "[GLOB.current_date_string], [station_time_timestamp()]\n[station_name()], [get_area_name(owner.current, TRUE)]\nBEGIN_MISSION"
/datum/antagonist/traitor/proc/reveal_delayed_objectives()
for(var/datum/objective/delayed/delayed_obj in objective_holder.objectives)
delayed_obj.reveal_objective()
if(!owner?.current)
return
SEND_SOUND(owner.current, sound('sound/ambience/alarm4.ogg'))
var/list/messages = owner.prepare_announce_objectives()
to_chat(owner.current, chat_box_red(messages.Join("<br>")))
delayed_objectives = FALSE