Skip to content

Commit

Permalink
Cleanup and integrate with antag tips
Browse files Browse the repository at this point in the history
  • Loading branch information
itsmeow committed Jan 5, 2024
1 parent a2a0478 commit faf1917
Show file tree
Hide file tree
Showing 11 changed files with 360 additions and 386 deletions.
8 changes: 4 additions & 4 deletions code/datums/mind.dm
Original file line number Diff line number Diff line change
Expand Up @@ -363,11 +363,11 @@
U.setup_unlock_code()
if(!silent)
if(uplink_loc == R)
U.unlock_text = "[employer] has cunningly disguised a Syndicate Uplink as your [R.name]. Simply speak [U.unlock_code] into the :d channel to unlock its hidden features."
U.unlock_text = "[employer] [employer == "You" ? "have" : "has"] cunningly disguised a Syndicate Uplink as your [R.name]. Simply speak [U.unlock_code] into the :d channel to unlock its hidden features."
else if(uplink_loc == PDA)
U.unlock_text = "[employer] has cunningly disguised a Syndicate Uplink as your [PDA.name]. Simply enter the code \"[U.unlock_code]\" into the ring tone selection to unlock its hidden features."
U.unlock_text = "[employer] [employer == "You" ? "have" : "has"] cunningly disguised a Syndicate Uplink as your [PDA.name]. Simply enter the code \"[U.unlock_code]\" into the ring tone selection to unlock its hidden features."
else if(uplink_loc == P)
U.unlock_text = "[employer] has cunningly disguised a Syndicate Uplink as your [P.name]. Simply twist the top of the pen [english_list(U.unlock_code)] from its starting position to unlock its hidden features."
U.unlock_text = "[employer] [employer == "You" ? "have" : "has"] cunningly disguised a Syndicate Uplink as your [P.name]. Simply twist the top of the pen [english_list(U.unlock_code)] from its starting position to unlock its hidden features."
to_chat(traitor_mob, "<span class='boldnotice'>[U.unlock_text]</span>")

if(uplink_owner)
Expand All @@ -379,7 +379,7 @@
I.implant(traitor_mob, null, silent = TRUE)
var/datum/component/uplink/U = I.GetComponent(/datum/component/uplink)
if(!silent)
U.unlock_text = "[employer] has cunningly implanted you with a Syndicate Uplink (although uplink implants cost valuable TC, so you will have slightly less). Simply trigger the uplink to access it."
U.unlock_text = "[employer] [employer == "You" ? "have" : "has"] cunningly implanted [employer == "You" ? "yourself" : "you"] with a Syndicate Uplink (although uplink implants cost valuable TC, so you will have slightly less). Simply trigger the uplink to access it."
to_chat(traitor_mob, "<span class='boldnotice'>[U.unlock_text]</span>")
return I

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@
return
var/no_faction = isnull(faction)
faction = new_faction
employer = new_faction.name
if(new_faction.key == TRAITOR_FACTION_INDEPENDENT)
employer = "You" // "Independent has cunningly disguised a syndicate uplink" doesn't quite work
employer = new_faction.employer_name
if(forced)
// If the UI is open, force it to recognize the new faction
ui_update()
Expand All @@ -55,7 +53,6 @@
if(no_faction)
if(new_faction.give_codewords)
give_codewords()
show_tips("traitor_[new_faction.key]")
equip(silent)

/datum/antagonist/traitor/proc/set_backstory(datum/traitor_backstory/new_backstory)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/datum/traitor_faction
/// The name of this faction
var/name
/// The name of this faction when shown to the player as their employer.
var/employer_name
/// The define tied to this faction
var/key
/// A short description of this faction, OOC
Expand All @@ -12,6 +14,7 @@

/datum/traitor_faction/syndicate
name = "The Syndicate"
employer_name = "The Syndicate"
description = "A classic - either you were forced into it through blackmail, threat, or debts - or you were born for it, built for it, or \
maybe you joined to get revenge.\n\
Either way, you will have potential allies in other syndicate agents, codewords, and communication methods. You'll have all the resources at your disposal.\n\
Expand All @@ -22,6 +25,7 @@

/datum/traitor_faction/black_market
name = "The Black Market"
employer_name = "Your black market liason"
description = "You're in it for the money, or because you were forced into it.\n\
The monetary potential aboard a Nanotrasen station is huge, and there are actors willing to take advantage of your position.\n\
Your employer expects nothing but good results - and you'd better give it to them, lest you face the consequences.\n\
Expand All @@ -32,6 +36,7 @@

/datum/traitor_faction/independent
name = "Independent"
employer_name = "You"
description = "Not for the faint of heart, being an independent traitor requires superior roleplay abilities, and superior traitor skills. \n\
You are a person who holds grudges, and has been hurt greatly by Nanotrasen.\n\
You will have no allies, and you can only get by on your stolen Syndicate uplink. You have one chance, don't blow it. \n\
Expand Down
47 changes: 32 additions & 15 deletions code/modules/antagonists/traitor/backstory/traitor_objective_ui.dm
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
/datum/antagonist/traitor
ui_name = "TraitorObjectivesMenu"
var/datum/action/innate/traitor_menu/menu

/// We will handle this ourselves, thank you.
/datum/antagonist/traitor/make_info_button()
return null

/datum/antagonist/traitor/proc/add_menu_action()
if(menu != null)
if(info_button_ref?.resolve() != null)
return
menu = new /datum/action/innate/traitor_menu(src)
var/datum/action/antag_info/traitor_menu/menu = new(src)
menu.Grant(owner.current)
info_button_ref = WEAKREF(menu)

/datum/action/innate/traitor_menu
name = "Traitor Objectives"
desc = "View and customize your traitor faction, backstory, objectives, and objective backstories."
/datum/action/antag_info/traitor_menu
name = "Traitor Info and Backstory"
desc = "View and customize your traitor faction, backstory, objectives, codewords, uplink location, \
and objective backstories."
button_icon_state = "traitor_objectives"
background_icon_state = "bg_agent"
var/datum/antagonist/traitor/ownerantag

/datum/action/innate/traitor_menu/New(datum/H)
/datum/action/antag_info/traitor_menu/New(datum/H)
. = ..()
name = "Traitor Info and Backstory"
button.name = name
ownerantag = H

/datum/action/innate/traitor_menu/Activate()
ownerantag.ui_interact(owner)

/datum/antagonist/traitor/ui_data(mob/user)

var/list/data = list()
data["allowed_factions"] = allowed_factions
data["allowed_backstories"] = allowed_backstories
Expand All @@ -33,6 +35,21 @@
data["backstory"] = "[backstory.type]"
if(istype(faction))
data["faction"] = faction.key
data["employer"] = employer

var/datum/component/uplink/uplink = uplink_ref?.resolve()
data["antag_name"] = name
data["has_codewords"] = has_codewords
if(has_codewords)
data["phrases"] = jointext(GLOB.syndicate_code_phrase, ", ")
data["responses"] = jointext(GLOB.syndicate_code_response, ", ")
data["code"] = uplink?.unlock_code
data["failsafe_code"] = uplink?.failsafe_code
data["has_uplink"] = uplink ? TRUE : FALSE
if(uplink)
data["uplink_unlock_info"] = uplink.unlock_text
data["objectives"] = get_objectives()

return data

/datum/antagonist/traitor/ui_static_data(mob/user)
Expand Down Expand Up @@ -79,12 +96,12 @@
return TRUE
if(!("[selected_backstory.type]" in allowed_backstories))
return TRUE
set_faction(selected_faction)
if(!istype(faction))
set_faction(selected_faction)
set_backstory(selected_backstory)
return TRUE
if("gimme_uplink")
if(istype(faction))
return TRUE
set_faction(GLOB.traitor_factions_to_datum[TRAITOR_FACTION_SYNDICATE])
SStgui.close_user_uis(usr, src)
return FALSE
return TRUE
49 changes: 3 additions & 46 deletions code/modules/antagonists/traitor/datum_traitor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
banning_key = ROLE_TRAITOR
required_living_playtime = 4
antag_moodlet = /datum/mood_event/focused
ui_name = "AntagInfoTraitor"
hijack_speed = 0.5 //10 seconds per hijack stage by default
var/special_role = ROLE_TRAITOR
/// Shown when giving uplinks and codewords to the player
Expand Down Expand Up @@ -48,32 +47,12 @@
QDEL_NULL(A.radio.keyslot)
A.radio.recalculateChannels()

if(menu)
menu.Remove(owner.current)
QDEL_NULL(menu)

SSticker.mode.traitors -= owner
if(!silent && owner.current)
to_chat(owner.current,"<span class='userdanger'> You are no longer the [special_role]! </span>")
owner.special_role = null
..()

/datum/antagonist/traitor/ui_static_data(mob/user)
var/datum/component/uplink/uplink = uplink_ref?.resolve()
var/list/data = list()
data["antag_name"] = name
data["has_codewords"] = has_codewords
if(has_codewords)
data["phrases"] = jointext(GLOB.syndicate_code_phrase, ", ")
data["responses"] = jointext(GLOB.syndicate_code_response, ", ")
data["code"] = uplink?.unlock_code
data["failsafe_code"] = uplink?.failsafe_code
data["has_uplink"] = uplink ? TRUE : FALSE
if(uplink)
data["uplink_unlock_info"] = uplink.unlock_text
data["objectives"] = get_objectives()
return data

/datum/antagonist/traitor/proc/handle_hearing(datum/source, list/hearing_args)
SIGNAL_HANDLER
var/message = hearing_args[HEARING_RAW_MESSAGE]
Expand All @@ -98,19 +77,12 @@
/datum/antagonist/traitor/greet()
var/list/msg = list()
msg += "<span class='alertsyndie'>You are the [owner.special_role].</span>"
msg += "<span class='alertsyndie'>Use the 'Open [owner.special_role] Information' action at the top left in order to review your objectives and codewords!</span>"
msg += "<span class='alertsyndie'>Use the 'Traitor Info and Backstory' action at the top left in order to select a backstory and review your objectives, uplink location, and codewords!</span>"
to_chat(owner.current, EXAMINE_BLOCK(msg.Join("\n")))
owner.current.client?.tgui_panel?.give_antagonist_popup("Traitor",
"Complete your objectives, no matter the cost.")
if(traitor_kind == TRAITOR_AI)
give_codewords() // humans get this assigned by their faction

/datum/antagonist/traitor/proc/forge_single_objective()
switch(traitor_kind)
if(TRAITOR_AI)
return forge_single_AI_objective()
else
return forge_single_human_objective()
has_codewords = TRUE

/datum/antagonist/traitor/proc/update_traitor_icons_added(datum/mind/traitor_mind)
var/datum/atom_hud/antag/traitorhud = GLOB.huds[ANTAG_HUD_TRAITOR]
Expand Down Expand Up @@ -149,26 +121,11 @@
A.hack_software = FALSE
UnregisterSignal(owner.current, COMSIG_MOVABLE_HEAR, PROC_REF(handle_hearing))

/// Enables displaying codewords to this traitor.
/datum/antagonist/traitor/proc/give_codewords()
if(!owner.current || !istype(faction))
return
has_codewords = TRUE
give_codewords_to_player(owner.current, src, faction.name)

/proc/give_codewords_to_player(mob/player, datum/antagonist/antag_datum, employer = "The Syndicate")
var/phrases = jointext(GLOB.syndicate_code_phrase, ", ")
var/responses = jointext(GLOB.syndicate_code_response, ", ")

to_chat(player, "<U><B>[employer] have provided you with the following codewords to identify fellow agents:</B></U>")
to_chat(player, "<B>Code Phrase</B>: <span class='blue'>[phrases]</span>")
to_chat(player, "<B>Code Response</B>: <span class='red'>[responses]</span>")

if(istype(antag_datum))
antag_datum.antag_memory += "<b>Code Phrase</b>: <span class='blue'>[phrases]</span><br>"
antag_datum.antag_memory += "<b>Code Response</b>: <span class='red'>[responses]</span><br>"

to_chat(player, "Use the codewords during regular conversation to identify other agents. Proceed with caution, however, as everyone is a potential foe.")
to_chat(player, "<span class='alertwarning'>You memorize the codewords, allowing you to recognise them when heard.</span>")

/datum/antagonist/traitor/proc/equip(var/silent = FALSE)
if(traitor_kind == TRAITOR_HUMAN)
Expand Down
1 change: 0 additions & 1 deletion code/modules/antagonists/traitor/equipment/contractor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
to_chat(owner.current, "<span class='alertsyndie'>You are the Contractor Support Unit.</span>")
owner.announce_objectives()
if(owner.current)
give_codewords_to_player(owner.current, src)
if(owner.current.client)
owner.current.client.tgui_panel?.give_antagonist_popup("Contractor Support Unit", "Follow your contractor's orders.")

Expand Down
14 changes: 0 additions & 14 deletions html/antagtips/traitor_black_market.html

This file was deleted.

14 changes: 0 additions & 14 deletions html/antagtips/traitor_independent.html

This file was deleted.

15 changes: 0 additions & 15 deletions html/antagtips/traitor_syndicate.html

This file was deleted.

36 changes: 21 additions & 15 deletions tgui/packages/tgui/interfaces/AntagInfoTraitor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,26 +100,32 @@ const CodewordsSection = (_props, context) => {
);
};

export const AntagInfoTraitor = (_props, context) => {
export const AntagInfoTraitorContent = (_props, context) => {
const { data } = useBackend<Info>(context);
const { antag_name, objectives } = data;
return (
<Stack vertical fill>
<Stack.Item>
<AntagInfoHeader name={antag_name || 'Traitor'} asset="traitor.png" />
</Stack.Item>
<Stack.Item grow>
<ObjectivesSection objectives={objectives} />
</Stack.Item>
<Stack.Item>
<UplinkSection />
</Stack.Item>
<Stack.Item>
<CodewordsSection />
</Stack.Item>
</Stack>
);
};

export const AntagInfoTraitor = (_props, context) => {
return (
<Window width={620} height={620} theme="syndicate">
<Window.Content>
<Stack vertical fill>
<Stack.Item>
<AntagInfoHeader name={antag_name || 'Traitor'} asset="traitor.png" />
</Stack.Item>
<Stack.Item grow>
<ObjectivesSection objectives={objectives} />
</Stack.Item>
<Stack.Item>
<UplinkSection />
</Stack.Item>
<Stack.Item>
<CodewordsSection />
</Stack.Item>
</Stack>
<AntagInfoTraitorContent />
</Window.Content>
</Window>
);
Expand Down
Loading

0 comments on commit faf1917

Please sign in to comment.