diff --git a/code/datums/mind.dm b/code/datums/mind.dm
index a10a539830e..405901e4f80 100644
--- a/code/datums/mind.dm
+++ b/code/datums/mind.dm
@@ -47,7 +47,7 @@
var/role_alt_title
var/datum/job/assigned_job
- var/list/kills=list()
+ var/list/kills = list()
var/list/datum/objective/objectives = list()
var/list/datum/objective/special_verbs = list()
@@ -78,9 +78,8 @@
//zealot_master is a reference to the mob that converted them into a zealot (for ease of investigation and such)
var/mob/living/carbon/human/zealot_master = null
-/datum/mind/New(var/key)
- src.key = key
-
+/datum/mind/New(new_key)
+ key = new_key
/datum/mind/Destroy()
ticker.minds -= src
@@ -122,7 +121,7 @@
/datum/mind/proc/wipe_memory()
memory = null
-/datum/mind/proc/show_memory(mob/recipient, window=1)
+/datum/mind/proc/show_memory(mob/recipient, window = 1)
if(!recipient)
recipient = current
var/output = "[current.real_name]'s Memories:
"
@@ -130,11 +129,7 @@
if(objectives.len)
output += "
Objectives:"
-
- var/obj_count = 1
- for(var/datum/objective/objective in objectives)
- output += "Objective #[obj_count]: [objective.explanation_text]"
- obj_count++
+ output += gen_objective_text()
if(job_objectives.len)
output += "
Job Objectives:"
@@ -145,17 +140,213 @@
obj_count++
output += "
"
if(window)
- recipient << browse(output,"window=memory")
+ recipient << browse(output, "window=memory")
else
to_chat(recipient, "[output]")
+/datum/mind/proc/gen_objective_text(admin = FALSE)
+ . = ""
+ var/obj_count = 1
+ for(var/datum/objective/objective in objectives)
+ . += "Objective #[obj_count]: [objective.explanation_text]"
+ if(admin)
+ . += "Edit " // Edit
+ . += "Delete " // Delete
+
+ . += "" // Mark Completed
+ . += "Toggle Completion"
+ . += ""
+ . += "
"
+ obj_count++
+
+/datum/mind/proc/_memory_edit_header(gamemode, list/alt)
+ . = gamemode
+ if(ticker.mode.config_tag == gamemode || (LAZYLEN(alt) && (ticker.mode.config_tag in alt)))
+ . = uppertext(.)
+ . = "[.]: "
+
+/datum/mind/proc/_memory_edit_role_enabled(role)
+ . = "|Disabled in Prefs"
+ if(current && current.client && (role in current.client.prefs.be_special))
+ . = "|Enabled in Prefs"
+
+/datum/mind/proc/memory_edit_implant(mob/living/carbon/human/H)
+ if(ismindshielded(H))
+ . = "Mindshield Implant:Remove|Implanted"
+ else
+ . = "Mindshield Implant:No Implant|Implant [H.p_them()]!"
+
+
+/datum/mind/proc/memory_edit_revolution(mob/living/carbon/human/H)
+ . = _memory_edit_header("revolution")
+ if(ismindshielded(H))
+ . += "NO|headrev|rev"
+ else if(src in ticker.mode.head_revolutionaries)
+ . += "no|HEADREV|rev"
+ . += "
Flash: give"
+
+ var/list/L = current.get_contents()
+ var/obj/item/flash/flash = locate() in L
+ if(flash)
+ if(!flash.broken)
+ . += "|take."
+ else
+ . += "|take|repair."
+ else
+ . += "."
+
+ . += " Reequip (gives traitor uplink)."
+ if(objectives.len==0)
+ . += "
Objectives are empty! Set to kill all heads."
+ else if(src in ticker.mode.revolutionaries)
+ . += "no|headrev|REV"
+ else
+ . += "NO|headrev|rev"
+
+ . += _memory_edit_role_enabled(ROLE_REV)
+
+/datum/mind/proc/memory_edit_cult(mob/living/carbon/human/H)
+ . = _memory_edit_header("cult")
+ if(ismindshielded(H))
+ . += "NO|cultist"
+ else if(src in ticker.mode.cult)
+ . += "no|CULTIST"
+ . += "
Give tome|equip."
+ else
+ . += "NO|cultist"
+
+ . += _memory_edit_role_enabled(ROLE_CULTIST)
+
+/datum/mind/proc/memory_edit_wizard(mob/living/carbon/human/H)
+ . = _memory_edit_header("wizard")
+ if(src in ticker.mode.wizards)
+ . += "WIZARD|no"
+ . += "
To lair, undress, dress up, let choose name."
+ if(objectives.len==0)
+ . += "
Objectives are empty! Randomize!"
+ else
+ . += "wizard|NO"
+
+ . += _memory_edit_role_enabled(ROLE_WIZARD)
+
+/datum/mind/proc/memory_edit_changeling(mob/living/carbon/human/H)
+ . = _memory_edit_header("changeling", list("traitorchan"))
+ if(src in ticker.mode.changelings)
+ . += "CHANGELING|no"
+ if(objectives.len==0)
+ . += "
Objectives are empty! Randomize!"
+ if(changeling && changeling.absorbed_dna.len && (current.real_name != changeling.absorbed_dna[1]))
+ . += "
Transform to initial appearance."
+ else
+ . += "changeling|NO"
+
+ . += _memory_edit_role_enabled(ROLE_CHANGELING)
+
+/datum/mind/proc/memory_edit_vampire(mob/living/carbon/human/H)
+ . = _memory_edit_header("vampire", list("traitorvamp"))
+ if(src in ticker.mode.vampires)
+ . += "VAMPIRE|no"
+ if(objectives.len==0)
+ . += "
Objectives are empty! Randomize!"
+ else
+ . += "vampire|NO"
+
+ . += _memory_edit_role_enabled(ROLE_VAMPIRE)
+ /** Enthralled ***/
+ . += "
enthralled: "
+ if(src in ticker.mode.vampire_enthralled)
+ . += "THRALL|no"
+ else
+ . += "thrall|NO"
+
+/datum/mind/proc/memory_edit_nuclear(mob/living/carbon/human/H)
+ . = _memory_edit_header("nuclear")
+ if(src in ticker.mode.syndicates)
+ . += "OPERATIVE|no"
+ . += "
To shuttle, undress, dress up."
+ var/code
+ for(var/obj/machinery/nuclearbomb/bombue in machines)
+ if(length(bombue.r_code) <= 5 && bombue.r_code != "LOLNO" && bombue.r_code != "ADMIN")
+ code = bombue.r_code
+ break
+ if(code)
+ . += " Code is [code]. tell the code."
+ else
+ . += "operative|NO"
+
+ . += _memory_edit_role_enabled(ROLE_OPERATIVE)
+
+/datum/mind/proc/memory_edit_shadowling(mob/living/carbon/human/H)
+ . = _memory_edit_header("shadowling")
+ if(src in ticker.mode.shadows)
+ . += "SHADOWLING|thrall|no"
+ else if(src in ticker.mode.shadowling_thralls)
+ . += "Shadowling|THRALL|no"
+ else
+ . += "shadowling|thrall|NO"
+
+ . += _memory_edit_role_enabled(ROLE_SHADOWLING)
+
+/datum/mind/proc/memory_edit_abductor(mob/living/carbon/human/H)
+ . = _memory_edit_header("abductor")
+ if(src in ticker.mode.abductors)
+ . += "ABDUCTOR|no"
+ . += "|undress|equip"
+ else
+ . += "abductor|NO"
+
+ . += _memory_edit_role_enabled(ROLE_ABDUCTOR)
+
+/datum/mind/proc/memory_edit_traitor()
+ . = _memory_edit_header("traitor", list("traitorchan", "traitorvamp"))
+ if(src in ticker.mode.traitors)
+ . += "TRAITOR|no"
+ if(objectives.len==0)
+ . += "
Objectives are empty! Randomize!"
+ else
+ . += "traitor|NO"
+
+ . += _memory_edit_role_enabled(ROLE_TRAITOR)
+
+/datum/mind/proc/memory_edit_silicon()
+ . = "Silicon: "
+ var/mob/living/silicon/robot/robot = current
+ if(istype(robot) && robot.emagged)
+ . += "
Cyborg: Is emagged! Unemag!
0th law: [robot.laws.zeroth_law]"
+ var/mob/living/silicon/ai/ai = current
+ if(istype(ai) && ai.connected_robots.len)
+ var/n_e_robots = 0
+ for(var/mob/living/silicon/robot/R in ai.connected_robots)
+ if(R.emagged)
+ n_e_robots++
+ . += "
[n_e_robots] of [ai.connected_robots.len] slaved cyborgs are emagged. Unemag"
+
+/datum/mind/proc/memory_edit_uplink()
+ . = ""
+ if(ishuman(current) && ((src in ticker.mode.head_revolutionaries) || \
+ (src in ticker.mode.traitors) || \
+ (src in ticker.mode.syndicates)))
+ . = "Uplink: give"
+ var/obj/item/uplink/hidden/suplink = find_syndicate_uplink()
+ var/crystals
+ if(suplink)
+ crystals = suplink.uses
+ if(suplink)
+ . += "|take"
+ if(usr.client.holder.rights & (R_SERVER|R_EVENT))
+ . += ", [crystals] crystals"
+ else
+ . += ", [crystals] crystals"
+ . += "." //hiel grammar
+ // ^ whoever left this comment is literally a grammar nazi. stalin better. in russia grammar correct you.
+
/datum/mind/proc/edit_memory()
if(!ticker || !ticker.mode)
alert("Not before round-start!", "Alert")
return
- var/out = "[name][(current&&(current.real_name!=name))?" (as [current.real_name])":""]
"
- out += "Mind currently owned by key: [key] [active?"(synced)":"(not synced)"]
"
+ var/out = "[name][(current && (current.real_name != name))?" (as [current.real_name])" : ""]
"
+ out += "Mind currently owned by key: [key] [active ? "(synced)" : "(not synced)"]
"
out += "Assigned role: [assigned_role]. Edit
"
out += "Factions and special roles:
"
@@ -169,284 +360,60 @@
"nuclear",
"traitor", // "traitorchan",
)
- var/text = ""
var/mob/living/carbon/human/H = current
if(ishuman(current))
/** Impanted**/
- if(ismindshielded(H))
- text = "Mindshield Implant:Remove|Implanted"
- else
- text = "Mindshield Implant:No Implant|Implant [H.p_them()]!"
- sections["implant"] = text
+ sections["implant"] = memory_edit_implant(H)
/** REVOLUTION ***/
- text = "revolution"
- if(ticker.mode.config_tag=="revolution")
- text += uppertext(text)
- text = "[text]: "
- if(ismindshielded(H))
- text += "NO|headrev|rev"
- else if(src in ticker.mode.head_revolutionaries)
- text += "no|HEADREV|rev"
- text += "
Flash: give"
-
- var/list/L = current.get_contents()
- var/obj/item/flash/flash = locate() in L
- if(flash)
- if(!flash.broken)
- text += "|take."
- else
- text += "|take|repair."
- else
- text += "."
-
- text += " Reequip (gives traitor uplink)."
- if(objectives.len==0)
- text += "
Objectives are empty! Set to kill all heads."
- else if(src in ticker.mode.revolutionaries)
- text += "no|headrev|REV"
- else
- text += "NO|headrev|rev"
-
- if(current && current.client && (ROLE_REV in current.client.prefs.be_special))
- text += "|Enabled in Prefs"
- else
- text += "|Disabled in Prefs"
-
- sections["revolution"] = text
-
+ sections["revolution"] = memory_edit_revolution(H)
/** CULT ***/
- text = "cult"
- if(ticker.mode.config_tag=="cult")
- text = uppertext(text)
- text = "[text]: "
- if(ismindshielded(H))
- text += "NO|cultist"
- else if(src in ticker.mode.cult)
- text += "no|CULTIST"
- text += "
Give tome|equip."
-/*
- if(objectives.len==0)
- text += "
Objectives are empty! Set to sacrifice and escape or summon."
-*/
- else
- text += "NO|cultist"
-
-
- if(current && current.client && (ROLE_CULTIST in current.client.prefs.be_special))
- text += "|Enabled in Prefs"
- else
- text += "|Disabled in Prefs"
-
- sections["cult"] = text
-
+ sections["cult"] = memory_edit_cult(H)
/** WIZARD ***/
- text = "wizard"
- if(ticker.mode.config_tag=="wizard")
- text = uppertext(text)
- text = "[text]: "
- if(src in ticker.mode.wizards)
- text += "WIZARD|no"
- text += "
To lair, undress, dress up, let choose name."
- if(objectives.len==0)
- text += "
Objectives are empty! Randomize!"
- else
- text += "wizard|NO"
-
- if(current && current.client && (ROLE_WIZARD in current.client.prefs.be_special))
- text += "|Enabled in Prefs"
- else
- text += "|Disabled in Prefs"
-
- sections["wizard"] = text
-
+ sections["wizard"] = memory_edit_wizard(H)
/** CHANGELING ***/
- text = "changeling"
- if(ticker.mode.config_tag=="changeling" || ticker.mode.config_tag=="traitorchan")
- text = uppertext(text)
- text = "[text]: "
- if(src in ticker.mode.changelings)
- text += "CHANGELING|no"
- if(objectives.len==0)
- text += "
Objectives are empty! Randomize!"
- if( changeling && changeling.absorbed_dna.len && (current.real_name != changeling.absorbed_dna[1]) )
- text += "
Transform to initial appearance."
- else
- text += "changeling|NO"
-
- if(current && current.client && (ROLE_CHANGELING in current.client.prefs.be_special))
- text += "|Enabled in Prefs"
- else
- text += "|Disabled in Prefs"
-
- sections["changeling"] = text
-
+ sections["changeling"] = memory_edit_changeling(H)
/** VAMPIRE ***/
- text = "vampire"
- if(ticker.mode.config_tag=="vampire" || ticker.mode.config_tag=="traitorvamp")
- text = uppertext(text)
- text = "[text]: "
- if(src in ticker.mode.vampires)
- text += "VAMPIRE|no"
- if(objectives.len==0)
- text += "
Objectives are empty! Randomize!"
- else
- text += "vampire|NO"
-
- if(current && current.client && (ROLE_VAMPIRE in current.client.prefs.be_special))
- text += "|Enabled in Prefs"
- else
- text += "|Disabled in Prefs"
- /** Enthralled ***/
- text += "
enthralled: "
- if(src in ticker.mode.vampire_enthralled)
- text += "THRALL|no"
- else
- text += "thrall|NO"
-
- sections["vampire"] = text
-
-
+ sections["vampire"] = memory_edit_vampire(H)
/** NUCLEAR ***/
- text = "nuclear"
- if(ticker.mode.config_tag=="nuclear")
- text = uppertext(text)
- text = "[text]: "
- if(src in ticker.mode.syndicates)
- text += "OPERATIVE|no"
- text += "
To shuttle, undress, dress up."
- var/code
- for(var/obj/machinery/nuclearbomb/bombue in machines)
- if(length(bombue.r_code) <= 5 && bombue.r_code != "LOLNO" && bombue.r_code != "ADMIN")
- code = bombue.r_code
- break
- if(code)
- text += " Code is [code]. tell the code."
- else
- text += "operative|NO"
-
- if(current && current.client && (ROLE_OPERATIVE in current.client.prefs.be_special))
- text += "|Enabled in Prefs"
- else
- text += "|Disabled in Prefs"
-
- sections["nuclear"] = text
-
+ sections["nuclear"] = memory_edit_nuclear(H)
/** SHADOWLING **/
- text = "shadowling"
- if(ticker.mode.config_tag == "shadowling")
- text = uppertext(text)
- text = "[text]: "
- if(src in ticker.mode.shadows)
- text += "SHADOWLING|thrall|no"
- else if(src in ticker.mode.shadowling_thralls)
- text += "Shadowling|THRALL|no"
- else
- text += "shadowling|thrall|NO"
-
- if(current && current.client && (ROLE_SHADOWLING in current.client.prefs.be_special))
- text += "|Enabled in Prefs"
- else
- text += "|Disabled in Prefs"
-
- sections["shadowling"] = text
-
+ sections["shadowling"] = memory_edit_shadowling(H)
/** Abductors **/
-
- text = "abductor"
- if(ticker.mode.config_tag == "abductor")
- text = uppertext(text)
- text = "[text]: "
- if(src in ticker.mode.abductors)
- text += "ABDUCTOR|no"
- text += "|undress|equip"
- else
- text += "abductor|NO"
-
- if(current && current.client && (ROLE_ABDUCTOR in current.client.prefs.be_special))
- text += "|Enabled in Prefs"
- else
- text += "|Disabled in Prefs"
-
-
- sections["Abductor"] = text
-
+ sections["abductor"] = memory_edit_abductor(H)
/** TRAITOR ***/
- text = "traitor"
- if(ticker.mode.config_tag=="traitor" || ticker.mode.config_tag=="traitorchan" || ticker.mode.config_tag=="traitorvamp")
- text = uppertext(text)
- text = "[text]: "
- if(src in ticker.mode.traitors)
- text += "TRAITOR|no"
- if(objectives.len==0)
- text += "
Objectives are empty! Randomize!"
- else
- text += "traitor|NO"
-
- if(current && current.client && (ROLE_TRAITOR in current.client.prefs.be_special))
- text += "|Enabled in Prefs"
- else
- text += "|Disabled in Prefs"
-
- sections["traitor"] = text
-
+ sections["traitor"] = memory_edit_traitor()
/** SILICON ***/
-
if(issilicon(current))
- text = "silicon"
- var/mob/living/silicon/robot/robot = current
- if(istype(robot) && robot.emagged)
- text += "
Cyborg: Is emagged! Unemag!
0th law: [robot.laws.zeroth_law]"
- var/mob/living/silicon/ai/ai = current
- if(istype(ai) && ai.connected_robots.len)
- var/n_e_robots = 0
- for(var/mob/living/silicon/robot/R in ai.connected_robots)
- if(R.emagged)
- n_e_robots++
- text += "
[n_e_robots] of [ai.connected_robots.len] slaved cyborgs are emagged. Unemag"
-
+ sections["silicon"] = memory_edit_silicon()
+ /*
+ This prioritizes antags relevant to the current round to make them appear at the top of the panel.
+ Traitorchan and traitorvamp are snowflaked in because they have multiple sections.
+ */
if(ticker.mode.config_tag == "traitorchan")
if(sections["traitor"])
- out += sections["traitor"]+"
"
+ out += sections["traitor"] + "
"
if(sections["changeling"])
- out += sections["changeling"]+"
"
+ out += sections["changeling"] + "
"
sections -= "traitor"
sections -= "changeling"
-
- if(ticker.mode.config_tag == "traitorvamp")
+ // Elif technically unnecessary but it makes the following else look better
+ else if(ticker.mode.config_tag == "traitorvamp")
if(sections["traitor"])
- out += sections["traitor"]+"
"
+ out += sections["traitor"] + "
"
if(sections["vampire"])
- out += sections["vampire"]+"
"
+ out += sections["vampire"] + "
"
sections -= "traitor"
sections -= "vampire"
else
if(sections[ticker.mode.config_tag])
- out += sections[ticker.mode.config_tag]+"
"
+ out += sections[ticker.mode.config_tag] + "
"
sections -= ticker.mode.config_tag
+
for(var/i in sections)
if(sections[i])
- out += sections[i]+"
"
-
-
- if(((src in ticker.mode.head_revolutionaries) || \
- (src in ticker.mode.traitors) || \
- (src in ticker.mode.syndicates)) && \
- ishuman(current) )
-
- text = "Uplink: give"
- var/obj/item/uplink/hidden/suplink = find_syndicate_uplink()
- var/crystals
- if(suplink)
- crystals = suplink.uses
- if(suplink)
- text += "|take"
- if(usr.client.holder.rights & (R_SERVER|R_EVENT))
- text += ", [crystals] crystals"
- else
- text += ", [crystals] crystals"
- text += "." //hiel grammar
- out += text
+ out += sections[i] + "
"
+ out += memory_edit_uplink()
out += "
"
out += "Memory:
"
@@ -456,14 +423,9 @@
if(objectives.len == 0)
out += "EMPTY
"
else
- var/obj_count = 1
- for(var/datum/objective/objective in objectives)
- out += "[obj_count]: [objective.explanation_text] Edit Delete Toggle Completion
"
- obj_count++
+ out += gen_objective_text(admin = TRUE)
out += "Add objective
"
-
out += "Announce objectives
"
-
usr << browse(out, "window=edit_memory[src];size=400x500")
/datum/mind/Topic(href, href_list)
@@ -1284,12 +1246,9 @@
return A
/datum/mind/proc/announce_objectives()
- var/obj_count = 1
to_chat(current, "Your current objectives:")
- for(var/objective in objectives)
- var/datum/objective/O = objective
- to_chat(current, "Objective #[obj_count]: [O.explanation_text]")
- obj_count++
+ for(var/line in splittext(gen_objective_text(), "
"))
+ to_chat(current, line)
/datum/mind/proc/find_syndicate_uplink()
var/list/L = current.get_contents()