From 28f608b5cd843c6a22e73ab968bf4d453c5ff234 Mon Sep 17 00:00:00 2001 From: lm40 Date: Fri, 3 Jun 2022 18:44:48 -0400 Subject: [PATCH] localizes religion and adds custom chaplain titles --- code/_global_vars/religion.dm | 8 --- code/datums/mind.dm | 4 +- code/game/jobs/job/civilian_chaplain.dm | 60 +++++++++++++------ .../objects/items/weapons/storage/bible.dm | 47 ++++++++------- code/modules/library/lib_machines.dm | 11 +--- 5 files changed, 73 insertions(+), 57 deletions(-) delete mode 100644 code/_global_vars/religion.dm diff --git a/code/_global_vars/religion.dm b/code/_global_vars/religion.dm deleted file mode 100644 index 7dab008b193..00000000000 --- a/code/_global_vars/religion.dm +++ /dev/null @@ -1,8 +0,0 @@ -// All religion stuff -GLOBAL_VAR(religion) -GLOBAL_VAR(deity) - -//bible -GLOBAL_VAR(bible_name) -GLOBAL_VAR(bible_icon_state) -GLOBAL_VAR(bible_item_state) diff --git a/code/datums/mind.dm b/code/datums/mind.dm index a35c23cd6b4..736fdff0214 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -75,6 +75,8 @@ //used to store what traits the player had picked out in their preferences before joining, in text form. var/list/traits = list() + var/datum/religion/my_religion + /datum/mind/New(var/key) src.key = key purchase_log = list() @@ -571,4 +573,4 @@ /mob/living/simple_mob/construct/juggernaut/mind_initialize() . = ..() mind.assigned_role = "Juggernaut" - mind.special_role = "Cultist" + mind.special_role = "Cultist" \ No newline at end of file diff --git a/code/game/jobs/job/civilian_chaplain.dm b/code/game/jobs/job/civilian_chaplain.dm index 5fba7b155dc..f811abf9572 100644 --- a/code/game/jobs/job/civilian_chaplain.dm +++ b/code/game/jobs/job/civilian_chaplain.dm @@ -29,20 +29,14 @@ return var/obj/item/weapon/storage/bible/B = locate(/obj/item/weapon/storage/bible) in H - if(!B) + var/obj/item/weapon/card/id/I = locate(/obj/item/weapon/card/id) in H + + if(!B || !I) return - if(GLOB.religion) - B.deity_name = GLOB.deity - B.name = GLOB.bible_name - B.icon_state = GLOB.bible_icon_state - B.item_state = GLOB.bible_item_state - to_chat(H, "There is already an established religion onboard the station. You are an acolyte of [GLOB.deity]. Defer to the [title].") - return - - INVOKE_ASYNC(src, .proc/religion_prompts, H, B) + INVOKE_ASYNC(src, .proc/religion_prompts, H, B, I) -/datum/job/chaplain/proc/religion_prompts(mob/living/carbon/human/H, obj/item/weapon/storage/bible/B) +/datum/job/chaplain/proc/religion_prompts(mob/living/carbon/human/H, obj/item/weapon/storage/bible/B, obj/item/weapon/card/id/I) var/religion_name = "Unitarianism" var/new_religion = sanitize(input(H, "You are the crew services officer. Would you like to change your religion? Default is Unitarianism", "Name change", religion_name), MAX_NAME_LEN) if(!new_religion) @@ -83,18 +77,48 @@ B.name = "Guru Granth Sahib" else B.name = "The Holy Book of [new_religion]" - feedback_set_details("religion_name","[new_religion]") var/deity_name = "Hashem" var/new_deity = sanitize(input(H, "Would you like to change your deity? Default is Hashem", "Name change", deity_name), MAX_NAME_LEN) if((length(new_deity) == 0) || (new_deity == "Hashem")) new_deity = deity_name - B.deity_name = new_deity - GLOB.religion = new_religion - GLOB.bible_name = B.name - GLOB.deity = B.deity_name - feedback_set_details("religion_deity","[new_deity]") - + var/new_title = sanitize(input(H, "Would you like to change your title?", "Title Change", I.assignment), MAX_NAME_LEN) + var/list/all_jobs = get_job_datums() + + // Are they trying to fake an actual existent job + var/faking_job = FALSE + + for (var/datum/job/J in all_jobs) + if (J.title == new_title || (new_title in get_alternate_titles(J.title))) + faking_job = TRUE + + if (length(new_title) != 0 && !faking_job) + I.assignment = new_title + + H.mind.my_religion = new /datum/religion(new_religion, new_deity, B.name, "bible", "bible", new_title) + + B.deity_name = H.mind.my_religion.deity + I.assignment = H.mind.my_religion.title + I.name = text("[I.registered_name]'s ID Card ([I.assignment])") + data_core.manifest_modify(I.registered_name, I.assignment, I.rank) + +/datum/religion + var/religion = "Unitarianism" + var/deity = "Hashem" + var/bible_name = "Bible" + var/bible_icon_state = "bible" + var/bible_item_state = "bible" + var/title = "Chaplain" + var/configured = FALSE + +/datum/religion/New(var/r, var/d, var/bn, var/bis, var/bits, var/t) + . = ..() + religion = r + deity = d + bible_name = bn + bible_icon_state = bis + bible_item_state = bits + title = t \ No newline at end of file diff --git a/code/game/objects/items/weapons/storage/bible.dm b/code/game/objects/items/weapons/storage/bible.dm index aaa7fbe144e..20fe500575d 100644 --- a/code/game/objects/items/weapons/storage/bible.dm +++ b/code/game/objects/items/weapons/storage/bible.dm @@ -37,30 +37,35 @@ GLOBAL_LIST_INIT(bibleitemstates, list( drop_sound = 'sound/bureaucracy/bookclose.ogg' /obj/item/weapon/storage/bible/attack_self(mob/living/carbon/human/user) - if(GLOB.bible_icon_state) - icon_state = GLOB.bible_icon_state - item_state = GLOB.bible_item_state - return FALSE + if(user?.mind?.assigned_role != "Chaplain") return FALSE - var/list/skins = list() - for(var/i in 1 to GLOB.biblestates.len) - var/image/bible_image = image(icon = 'icons/obj/storage.dmi', icon_state = GLOB.biblestates[i]) - skins += list("[GLOB.biblenames[i]]" = bible_image) - - var/choice = show_radial_menu(user, src, skins, custom_check = CALLBACK(src, .proc/check_menu, user), radius = 40, require_near = TRUE) - if(!choice) + if (!user.mind.my_religion) return FALSE - var/bible_index = GLOB.biblenames.Find(choice) - if(!bible_index) - return FALSE - icon_state = GLOB.biblestates[bible_index] - item_state = GLOB.bibleitemstates[bible_index] - GLOB.bible_icon_state = icon_state - GLOB.bible_item_state = item_state - feedback_set_details("religion_book", "[choice]") + if (!user.mind.my_religion.configured) + var/list/skins = list() + for(var/i in 1 to GLOB.biblestates.len) + var/image/bible_image = image(icon = 'icons/obj/storage.dmi', icon_state = GLOB.biblestates[i]) + skins += list("[GLOB.biblenames[i]]" = bible_image) + + var/choice = show_radial_menu(user, src, skins, custom_check = CALLBACK(src, .proc/check_menu, user), radius = 40, require_near = TRUE) + if(!choice) + return FALSE + var/bible_index = GLOB.biblenames.Find(choice) + if(!bible_index) + return FALSE + + user.mind.my_religion.bible_icon_state = GLOB.biblestates[bible_index] + user.mind.my_religion.bible_item_state = GLOB.bibleitemstates[bible_index] + user.mind.my_religion.configured = TRUE + + deity_name = user.mind.my_religion.deity + name = user.mind.my_religion.bible_name + icon_state = user.mind.my_religion.bible_icon_state + item_state = user.mind.my_religion.bible_item_state + to_chat(user, "You invoke [user.mind.my_religion.deity] and prepare a copy of [src].") /** * Checks if we are allowed to interact with a radial menu @@ -69,7 +74,7 @@ GLOBAL_LIST_INIT(bibleitemstates, list( * * user The mob interacting with the menu */ /obj/item/weapon/storage/bible/proc/check_menu(mob/living/carbon/human/user) - if(GLOB.bible_icon_state) + if(user.mind.my_religion.configured) return FALSE if(!istype(user)) return FALSE @@ -107,4 +112,4 @@ GLOBAL_LIST_INIT(bibleitemstates, list( /obj/item/weapon/storage/bible/attackby(obj/item/weapon/W as obj, mob/user as mob) if (src.use_sound) playsound(src, src.use_sound, 50, 1, -5) - ..() + ..() \ No newline at end of file diff --git a/code/modules/library/lib_machines.dm b/code/modules/library/lib_machines.dm index 9f5a2d511b5..41f0c8688ea 100644 --- a/code/modules/library/lib_machines.dm +++ b/code/modules/library/lib_machines.dm @@ -341,14 +341,7 @@ screenstate = 5 if("6") if(!bibledelay) - - var/obj/item/weapon/storage/bible/B = new /obj/item/weapon/storage/bible(src.loc) - if(GLOB.religion) - B.icon_state = GLOB.bible_icon_state - B.item_state = GLOB.bible_item_state - B.name = GLOB.bible_name - B.deity_name = GLOB.deity - + new /obj/item/weapon/storage/bible(src.loc) bibledelay = 1 spawn(60) bibledelay = 0 @@ -578,4 +571,4 @@ b.icon_state = "book[rand(1,7)]" qdel(O) else - ..() + ..() \ No newline at end of file