diff --git a/code/_helpers/names.dm b/code/_helpers/names.dm index cf9debf6581..8a2f57782cd 100644 --- a/code/_helpers/names.dm +++ b/code/_helpers/names.dm @@ -69,8 +69,8 @@ var/syndicate_name = null //Traitors and traitor silicons will get these. Revs will not. -var/syndicate_code_phrase//Code phrase for traitors. -var/syndicate_code_response//Code response for traitors. +var/syndicate_code_phrase //Code phrase for traitors. +var/syndicate_code_response //Code response for traitors. /* Should be expanded. @@ -86,63 +86,63 @@ var/syndicate_code_response//Code response for traitors. -N */ -/proc/generate_code_phrase()//Proc is used for phrase and response in master_controller.dm +// Helper. Called in misc_late.dm for late misc init. +/proc/populate_code_phrases(override = FALSE) + if (override || !syndicate_code_phrase) + syndicate_code_phrase = generate_code_phrase() + if (override || !syndicate_code_response) + syndicate_code_response = generate_code_phrase() - var/code_phrase = ""//What is returned when the proc finishes. - var/words = pick(//How many words there will be. Minimum of two. 2, 4 and 5 have a lesser chance of being selected. 3 is the most likely. +/proc/generate_code_phrase() //Proc is used for phrase and response in master_controller.dm + + var/code_phrase = "" //What is returned when the proc finishes. + var/words = pick( //How many words there will be. Minimum of two. 2, 4 and 5 have a lesser chance of being selected. 3 is the most likely. 50; 2, 200; 3, 50; 4, 25; 5 ) - var/safety[] = list(1,2,3)//Tells the proc which options to remove later on. + var/safety[] = list(1,2,3) //Tells the proc which options to remove later on. var/nouns[] = list("love","hate","anger","peace","pride","sympathy","bravery","loyalty","honesty","integrity","compassion","charity","success","courage","deceit","skill","beauty","brilliance","pain","misery","beliefs","dreams","justice","truth","faith","liberty","knowledge","thought","information","culture","trust","dedication","progress","education","hospitality","leisure","trouble","friendships", "relaxation") var/drinks[] = list("vodka and tonic","gin fizz","bahama mama","manhattan","black Russian","whiskey soda","long island tea","margarita","Irish coffee"," manly dwarf","Irish cream","doctor's delight","Beepksy Smash","tequilla sunrise","brave bull","gargle blaster","bloody mary","whiskey cola","white Russian","vodka martini","martini","Cuba libre","kahlua","vodka","wine","moonshine") - var/locations[] = teleportlocs.len ? teleportlocs : drinks//if null, defaults to drinks instead. + var/locations[] = teleportlocs.len ? teleportlocs : drinks //if null, defaults to drinks instead. - var/names[] = list() - for(var/datum/data/record/t in data_core.general)//Picks from crew manifest. - names += t.fields["name"] + var/maxwords = words //Extra var to check for duplicates. - var/maxwords = words//Extra var to check for duplicates. + for(words, words > 0, words--) //Randomly picks from one of the choices below. - for(words,words>0,words--)//Randomly picks from one of the choices below. + if(words == 1 && (1 in safety) && (2 in safety)) //If there is only one word remaining and choice 1 or 2 have not been selected. + safety = list(pick(1,2)) //Select choice 1 or 2. + else if (words == 1 && maxwords == 2) //Else if there is only one word remaining (and there were two originally), and 1 or 2 were chosen, + safety = list(3) //Default to list 3 - if(words==1&&(1 in safety)&&(2 in safety))//If there is only one word remaining and choice 1 or 2 have not been selected. - safety = list(pick(1,2))//Select choice 1 or 2. - else if(words==1&&maxwords==2)//Else if there is only one word remaining (and there were two originally), and 1 or 2 were chosen, - safety = list(3)//Default to list 3 - - switch(pick(safety))//Chance based on the safety list. - if(1)//1 and 2 can only be selected once each to prevent more than two specific names/places/etc. - switch(rand(1,2))//Mainly to add more options later. - if(1) - if(names.len&&prob(70)) - code_phrase += pick(names) - else - code_phrase += pick(pick(first_names_male,first_names_female)) - code_phrase += " " - code_phrase += pick(last_names) - if(2) - code_phrase += pick(joblist)//Returns a job. + switch (pick(safety)) //Chance based on the safety list. + if (1) //1 and 2 can only be selected once each to prevent more than two specific names/places/etc. + switch (rand(1,2)) //Mainly to add more options later. + if (1) + code_phrase += pick(pick(first_names_male,first_names_female)) + code_phrase += " " + code_phrase += pick(last_names) + if (2) + code_phrase += pick(joblist) //Returns a job. safety -= 1 - if(2) - switch(rand(1,2))//Places or things. - if(1) + if (2) + switch (rand(1,2)) //Places or things. + if (1) code_phrase += pick(drinks) - if(2) + if (2) code_phrase += pick(locations) safety -= 2 - if(3) - switch(rand(1,3))//Nouns, adjectives, verbs. Can be selected more than once. - if(1) + if (3) + switch (rand(1,3)) //Nouns, adjectives, verbs. Can be selected more than once. + if (1) code_phrase += pick(nouns) - if(2) + if (2) code_phrase += pick(adjectives) - if(3) + if (3) code_phrase += pick(verbs) - if(words==1) + if (words == 1) code_phrase += "." else code_phrase += ", " diff --git a/code/controllers/subsystems/initialization/misc_late.dm b/code/controllers/subsystems/initialization/misc_late.dm index cb7214a52a9..7653f912727 100644 --- a/code/controllers/subsystems/initialization/misc_late.dm +++ b/code/controllers/subsystems/initialization/misc_late.dm @@ -36,6 +36,8 @@ if (config.fastboot) admin_notice("Fastboot is enabled; some features may not be available.", R_DEBUG) + populate_code_phrases() + ..(timeofday) /proc/sorted_add_area(area/A) diff --git a/code/game/antagonist/antagonist_equip.dm b/code/game/antagonist/antagonist_equip.dm index bab31375624..3e006b87ac0 100644 --- a/code/game/antagonist/antagonist_equip.dm +++ b/code/game/antagonist/antagonist_equip.dm @@ -16,3 +16,11 @@ if(!istype(player)) return 0 return 1 + +/datum/antagonist/proc/give_codewords(mob/living/traitor_mob) + traitor_mob << "Your employers/contacts provided you with the following information on how to identify possible allies:" + traitor_mob << "Code Phrase: [syndicate_code_phrase]" + traitor_mob << "Code Response: [syndicate_code_response]" + traitor_mob.mind.store_memory("Code Phrase: [syndicate_code_phrase]") + traitor_mob.mind.store_memory("Code Response: [syndicate_code_response]") + traitor_mob << "Use the code words, preferably in the order provided, during regular conversation, to identify other agents. Proceed with caution, however, as everyone is a potential foe." diff --git a/code/game/antagonist/outsider/mercenary.dm b/code/game/antagonist/outsider/mercenary.dm index 6fe8a1d9345..06f97d3937f 100644 --- a/code/game/antagonist/outsider/mercenary.dm +++ b/code/game/antagonist/outsider/mercenary.dm @@ -58,4 +58,6 @@ var/datum/antagonist/mercenary/mercs create_id("Mercenary", player) create_radio(SYND_FREQ, player) + + give_codewords(player) return 1 diff --git a/code/game/antagonist/outsider/raider.dm b/code/game/antagonist/outsider/raider.dm index 61f96e63cf9..07782f109b3 100644 --- a/code/game/antagonist/outsider/raider.dm +++ b/code/game/antagonist/outsider/raider.dm @@ -248,6 +248,8 @@ var/datum/antagonist/raider/raiders spawn_money(rand(50,150)*10,W) create_radio(RAID_FREQ, player) + give_codewords(player) + return 1 /datum/antagonist/raider/proc/equip_weapons(var/mob/living/carbon/human/player) diff --git a/code/game/antagonist/station/revolutionary.dm b/code/game/antagonist/station/revolutionary.dm index e1b4836a319..416a756aebc 100644 --- a/code/game/antagonist/station/revolutionary.dm +++ b/code/game/antagonist/station/revolutionary.dm @@ -61,4 +61,6 @@ var/datum/antagonist/revolutionary/revs return 0 player.equip_to_slot_or_del(new /obj/item/device/announcer(player), slot_in_backpack) + + give_codewords(player) return 1 diff --git a/code/game/antagonist/station/traitor.dm b/code/game/antagonist/station/traitor.dm index 5e9a9bb65a9..e956e800b50 100644 --- a/code/game/antagonist/station/traitor.dm +++ b/code/game/antagonist/station/traitor.dm @@ -97,14 +97,6 @@ var/datum/antagonist/traitor/traitors //Begin code phrase. give_codewords(traitor_mob) -/datum/antagonist/traitor/proc/give_codewords(mob/living/traitor_mob) - traitor_mob << "Your employers provided you with the following information on how to identify possible allies:" - traitor_mob << "Code Phrase: [syndicate_code_phrase]" - traitor_mob << "Code Response: [syndicate_code_response]" - traitor_mob.mind.store_memory("Code Phrase: [syndicate_code_phrase]") - traitor_mob.mind.store_memory("Code Response: [syndicate_code_response]") - traitor_mob << "Use the code words, preferably in the order provided, during regular conversation, to identify other agents. Proceed with caution, however, as everyone is a potential foe." - /datum/antagonist/traitor/proc/spawn_uplink(var/mob/living/carbon/human/traitor_mob) if(!istype(traitor_mob)) return diff --git a/html/changelogs/skull132-codephrases.yml b/html/changelogs/skull132-codephrases.yml new file mode 100644 index 00000000000..73ea55028bc --- /dev/null +++ b/html/changelogs/skull132-codephrases.yml @@ -0,0 +1,6 @@ +author: Skull132 +delete-after: True + +changes: + - bugfix: "Code phrases and responses are properly generated again." + - tweak: "Mercs, heisters, and revs now get code phrases and responses, as they're all somewhat involved with the Syndicate. This is with mixed modes in mind."