diff --git a/code/modules/cm_marines/codebook.dm b/code/modules/cm_marines/codebook.dm index 08e1b4352bcf..11013f764538 100644 --- a/code/modules/cm_marines/codebook.dm +++ b/code/modules/cm_marines/codebook.dm @@ -1,24 +1,56 @@ +GLOBAL_LIST_EMPTY(codebook_data) -/obj/item/book/codebook - name = "Almayer Code Book" - unique = 1 - dat = "" +/obj/item/book/codebook/proc/create_codebook(faction = FACTION_MARINE) + if(!GLOB.codebook_data[faction]) + GLOB.codebook_data[faction] = generate_code() -/obj/item/book/codebook/Initialize() - . = ..() + dat = GLOB.codebook_data[faction] + +/obj/item/book/codebook/proc/generate_code() var/number var/letter - dat = "" + var/code_data = "
CallResponse
" for(var/i in 1 to 10) letter = pick(greek_letters) number = rand(100,999) - dat += "" + code_data += "" letter = pick(greek_letters) number = rand(100,999) - dat += "" + code_data += "" + code_data += "
CallResponse
[letter]-[number]
[letter]-[number][letter]-[number]
[letter]-[number]
" + return code_data + +/obj/item/book/codebook + name = "USS Almayer Code Book" + author = "United States Colonial Marines" + unique = 1 + dat = "" + var/faction = FACTION_MARINE + +/obj/item/book/codebook/Initialize() + . = ..() + title = name + create_codebook(faction) + +/obj/item/book/codebook/clf + name = "Liberation Front Authenticators" + faction = FACTION_CLF + author = "\[Obscured Ink\]" + +/obj/item/book/codebook/twe + name = "Imperial Authentication Codes" + faction = FACTION_TWE + author = "Royal Marines" - dat += "" +/obj/item/book/codebook/upp + name = "Union Authentication Codes" + faction = FACTION_UPP + author = "People's Army" +/obj/item/book/codebook/wey_yu + name = "Corporate Authentication Codes" + faction = FACTION_WY + author = "Weyland-Yutani Communications Division" /obj/item/book/codebook/attackby(obj/item/W, mob/living/user) if(istype(W, /obj/item/tool/kitchen/knife) || HAS_TRAIT(W, TRAIT_TOOL_WIRECUTTERS))