Skip to content

Commit

Permalink
[MIRROR] Minor update to admin secrets panel (free antags for everyon…
Browse files Browse the repository at this point in the history
…e) (#1900)

* Minor update to admin secrets panel (free antags for everyone) (#81292)

---------

Co-authored-by: NovaBot <[email protected]>
Co-authored-by: Holoo <[email protected]>
  • Loading branch information
3 people authored Feb 9, 2024
1 parent ffd4672 commit 00bd3b7
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 43 deletions.
118 changes: 85 additions & 33 deletions code/modules/admin/verbs/secrets.dm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GLOBAL_DATUM(everyone_a_traitor, /datum/everyone_is_a_traitor_controller)
GLOBAL_DATUM(everyone_an_antag, /datum/everyone_is_an_antag_controller)

/client/proc/secrets() //Creates a verb for admins to open up the ui
set name = "Secrets"
Expand Down Expand Up @@ -457,24 +457,35 @@ GLOBAL_DATUM(everyone_a_traitor, /datum/everyone_is_a_traitor_controller)
for(var/i in GLOB.human_list)
var/mob/living/carbon/human/H = i
INVOKE_ASYNC(H, TYPE_PROC_REF(/mob/living/carbon, monkeyize))
if("traitor_all")
if("antag_all")
if(!is_funmin)
return
if(!SSticker.HasRoundStarted())
tgui_alert(usr,"The game hasn't started yet!")
return
if(GLOB.everyone_a_traitor)
tgui_alert(usr, "The everyone is a traitor secret has already been triggered")
if(GLOB.everyone_an_antag)
var/are_we_antagstacking = tgui_alert(usr, "The everyone is antag secret has already been triggered. Do you want to stack antags?", "DANGER ZONE. Are you sure about this?", list("Confirm", "Abort"))
if(are_we_antagstacking != "Confirm")
return

var/chosen_antag = tgui_input_list(usr, "Choose antag", "Chose antag", list(ROLE_TRAITOR, ROLE_CHANGELING, ROLE_HERETIC, ROLE_CULTIST, ROLE_NINJA, ROLE_WIZARD, ROLE_NIGHTMARE))
if(!chosen_antag)
return
var/objective = tgui_input_text(holder, "Enter an objective", "Objective")
var/objective = tgui_input_text(usr, "Enter an objective", "Objective")
if(!objective)
return
GLOB.everyone_a_traitor = new /datum/everyone_is_a_traitor_controller(objective)
SSblackbox.record_feedback("nested tally", "admin_secrets_fun_used", 1, list("Traitor All", "[objective]"))
var/confirmation = tgui_alert(usr, "Make everyone in to [chosen_antag] with objective: [objective]", "Are you sure about this?", list("Confirm", "Abort"))
if(confirmation != "Confirm")
return
var/keep_generic_objecives = tgui_alert(usr, "Generate normal objectives?", "Give default objectives?", list("Yes", "No"))
keep_generic_objecives = (keep_generic_objecives != "Yes") ? FALSE : TRUE

GLOB.everyone_an_antag = new /datum/everyone_is_an_antag_controller(chosen_antag, objective, keep_generic_objecives)
SSblackbox.record_feedback("nested tally", "admin_secrets_fun_used", 1, list("[chosen_antag] All", "[objective]"))
for(var/mob/living/player in GLOB.player_list)
GLOB.everyone_a_traitor.make_traitor(null, player)
message_admins(span_adminnotice("[key_name_admin(holder)] used everyone is a traitor secret. Objective is [objective]"))
log_admin("[key_name(holder)] used everyone is a traitor secret. Objective is [objective]")
GLOB.everyone_an_antag.make_antag(null, player)
message_admins(span_adminnotice("[key_name_admin(holder)] used everyone is antag secret. Antag is [chosen_antag]. Objective is [objective]. Generate default objectives: [keep_generic_objecives]"))
log_admin("[key_name(holder)] used everyone is antag secret: [chosen_antag] . Objective is [objective]. Generate default objectives: [keep_generic_objecives]. ")
if("massbraindamage")
if(!is_funmin)
return
Expand Down Expand Up @@ -641,38 +652,79 @@ GLOBAL_DATUM(everyone_a_traitor, /datum/everyone_is_a_traitor_controller)
T.flick_overlay_static(portal_appearance[GET_TURF_PLANE_OFFSET(T) + 1], 15)
playsound(T, 'sound/magic/lightningbolt.ogg', rand(80, 100), TRUE)

///Makes sure latejoining crewmembers also become traitors.
/datum/everyone_is_a_traitor_controller
/datum/everyone_is_an_antag_controller
var/chosen_antag = ""
var/objective = ""
var/keep_generic_objecives

/datum/everyone_is_a_traitor_controller/New(objective)
/datum/everyone_is_an_antag_controller/New(chosen_antag, objective, keep_generic_objecives)
. = ..()
src.chosen_antag = chosen_antag
src.objective = objective
RegisterSignal(SSdcs, COMSIG_GLOB_CREWMEMBER_JOINED, PROC_REF(make_traitor))
src.keep_generic_objecives = keep_generic_objecives
RegisterSignal(SSdcs, COMSIG_GLOB_CREWMEMBER_JOINED, PROC_REF(make_antag_delay))

/datum/everyone_is_a_traitor_controller/Destroy()
/datum/everyone_is_an_antag_controller/Destroy()
UnregisterSignal(SSdcs, COMSIG_GLOB_CREWMEMBER_JOINED)
return ..()

/datum/everyone_is_a_traitor_controller/proc/make_traitor(datum/source, mob/living/player)
/datum/everyone_is_an_antag_controller/proc/assign_admin_objective_and_antag(mob/living/player, datum/antagonist/antag_datum)
var/datum/objective/new_objective = new(objective)
new_objective.team = player
new_objective.team_explanation_text = objective
antag_datum.objectives += new_objective
player.mind.add_antag_datum(antag_datum)

/datum/everyone_is_an_antag_controller/proc/make_antag_delay(datum/source, mob/living/player)
SIGNAL_HANDLER
INVOKE_ASYNC(src, PROC_REF(make_antag), source, player)


/datum/everyone_is_an_antag_controller/proc/make_antag(datum/source, mob/living/player)
if(player.stat == DEAD || !player.mind)
return
if(is_special_character(player))
return
sleep(1)
if(ishuman(player))
var/datum/antagonist/traitor/traitor_datum = new(give_objectives = FALSE)
var/datum/objective/new_objective = new
new_objective.owner = player
new_objective.explanation_text = objective
traitor_datum.objectives += new_objective
player.mind.add_antag_datum(traitor_datum)
var/datum/uplink_handler/uplink = traitor_datum.uplink_handler
uplink.has_progression = FALSE
uplink.has_objectives = FALSE
switch(chosen_antag)
if(ROLE_TRAITOR)
var/datum/antagonist/traitor/antag_datum = new(give_objectives = keep_generic_objecives)
assign_admin_objective_and_antag(player, antag_datum)
var/datum/uplink_handler/uplink = antag_datum.uplink_handler
uplink.has_progression = FALSE
uplink.has_objectives = FALSE
if(ROLE_CHANGELING)
var/datum/antagonist/changeling/antag_datum = new
antag_datum.give_objectives = keep_generic_objecives
assign_admin_objective_and_antag(player, antag_datum)
if(ROLE_HERETIC)
var/datum/antagonist/heretic/antag_datum = new
antag_datum.give_objectives = keep_generic_objecives
assign_admin_objective_and_antag(player, antag_datum)
if(ROLE_CULTIST)
var/datum/antagonist/cult/antag_datum = new
assign_admin_objective_and_antag(player, antag_datum)
if(ROLE_NINJA)
var/datum/antagonist/ninja/antag_datum = new
antag_datum.give_objectives = keep_generic_objecives
for(var/obj/item/item_to_drop in player)
if(!istype(item_to_drop, /obj/item/implant)) //avoid removing implanted uplinks
player.dropItemToGround(item_to_drop, FALSE)
assign_admin_objective_and_antag(player, antag_datum)
if(ROLE_WIZARD)
var/datum/antagonist/wizard/antag_datum = new
antag_datum.give_objectives = keep_generic_objecives
antag_datum.move_to_lair = FALSE
for(var/obj/item/item_to_drop in player) //avoid deleting player's items
if(!istype(item_to_drop, /obj/item/implant))
player.dropItemToGround(item_to_drop, FALSE)
assign_admin_objective_and_antag(player, antag_datum)
if(ROLE_NIGHTMARE)
var/datum/antagonist/nightmare/antag_datum = new
assign_admin_objective_and_antag(player, antag_datum)
player.set_species(/datum/species/shadow/nightmare)

else if(isAI(player))
var/datum/antagonist/malf_ai/malfunction_datum = new(give_objectives = FALSE)
var/datum/objective/new_objective = new
new_objective.owner = player
new_objective.explanation_text = objective
malfunction_datum.objectives += new_objective
player.mind.add_antag_datum(malfunction_datum)
var/datum/antagonist/malf_ai/antag_datum = new
antag_datum.give_objectives = keep_generic_objecives
assign_admin_objective_and_antag(player, antag_datum)

2 changes: 0 additions & 2 deletions code/modules/antagonists/malf_ai/malf_ai.dm
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@

/// Generates a complete set of malf AI objectives up to the traitor objective limit.
/datum/antagonist/malf_ai/proc/forge_ai_objectives()
objectives.Cut()

if(prob(PROB_SPECIAL))
forge_special_objective()

Expand Down
1 change: 0 additions & 1 deletion code/modules/antagonists/traitor/datum_traitor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@

/// Generates a complete set of traitor objectives up to the traitor objective limit, including non-generic objectives such as martyr and hijack.
/datum/antagonist/traitor/proc/forge_traitor_objectives()
objectives.Cut()
var/objective_count = 0

if((GLOB.joined_player_list.len >= HIJACK_MIN_PLAYERS) && prob(HIJACK_PROB))
Expand Down
6 changes: 1 addition & 5 deletions tgui/packages/tgui/interfaces/AntagInfoChangeling.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,7 @@ const IntroductionSection = (props) => {
const { act, data } = useBackend<Info>();
const { true_name, hive_name, objectives, can_change_objective } = data;
return (
<Section
fill
title="Intro"
scrollable={!!objectives && objectives.length > 4}
>
<Section fill title="Intro" style={{ overflowY: 'auto' }}>
<Stack vertical fill>
<Stack.Item fontSize="25px">
You are {true_name} from the
Expand Down
4 changes: 2 additions & 2 deletions tgui/packages/tgui/interfaces/Secrets.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -482,8 +482,8 @@ const FunForYouTab = (props) => {
color="red"
icon="user-secret"
fluid
content="Everyone is the traitor"
onClick={() => act('traitor_all')}
content="Everyone is the antag"
onClick={() => act('antag_all')}
/>
</NoticeBox>
</Stack.Item>
Expand Down

0 comments on commit 00bd3b7

Please sign in to comment.