From 3a20f370348e2bb4e7094ce3c7663efb4504b8d5 Mon Sep 17 00:00:00 2001 From: Lzimann Date: Thu, 6 Apr 2017 23:44:13 -0300 Subject: [PATCH] Fixes chaplains not being able to assign their deity/religion plus some minor refactor of the religion subsystem --- code/controllers/subsystem/religion.dm | 12 ++- .../objects/items/weapons/holy_weapons.dm | 38 ++++------ .../objects/items/weapons/storage/book.dm | 11 ++- code/modules/admin/verbs/pray.dm | 4 +- .../jobs/job_types/civilian_chaplain.dm | 75 ++++++++++--------- code/modules/library/lib_machines.dm | 10 +-- .../chemistry/recipes/pyrotechnics.dm | 4 +- 7 files changed, 73 insertions(+), 81 deletions(-) diff --git a/code/controllers/subsystem/religion.dm b/code/controllers/subsystem/religion.dm index b34ab084dd5..9b8c1f55cf6 100644 --- a/code/controllers/subsystem/religion.dm +++ b/code/controllers/subsystem/religion.dm @@ -3,10 +3,8 @@ SUBSYSTEM_DEF(religion) init_order = 19 flags = SS_NO_FIRE|SS_NO_INIT - var/bible_deity_name - var/Bible_icon_state - var/Bible_item_state - var/Bible_name - var/Bible_deity_name - - var/holy_weapon + var/religion + var/deity + var/bible_name + var/list/bible_icons = list("icon_state", "item_state") + var/holy_weapon_type \ No newline at end of file diff --git a/code/game/objects/items/weapons/holy_weapons.dm b/code/game/objects/items/weapons/holy_weapons.dm index 868ec8e059e..d42e135aebf 100644 --- a/code/game/objects/items/weapons/holy_weapons.dm +++ b/code/game/objects/items/weapons/holy_weapons.dm @@ -15,37 +15,31 @@ return (BRUTELOSS|FIRELOSS) /obj/item/weapon/nullrod/attack_self(mob/user) - if(reskinned) - return - if(user.mind && (user.mind.isholy)) + if(user.mind && (user.mind.isholy) && !reskinned) reskin_holy_weapon(user) /obj/item/weapon/nullrod/proc/reskin_holy_weapon(mob/M) + if(SSreligion.holy_weapon_type) + return var/obj/item/weapon/nullrod/holy_weapon + var/list/holy_weapons_list = typesof(/obj/item/weapon/nullrod) + var/list/display_names = list() + for(var/V in holy_weapons_list) + var/atom/A = V + display_names += initial(A.name) - if(SSreligion.holy_weapon) - holy_weapon = new SSreligion.holy_weapon - to_chat(M, "The null rod suddenly morphs into your religions already chosen holy weapon.") - else - var/list/holy_weapons_list = typesof(/obj/item/weapon/nullrod) - var/list/display_names = list() - for(var/V in holy_weapons_list) - var/atom/A = V - display_names += initial(A.name) + var/choice = input(M,"What theme would you like for your holy weapon?","Holy Weapon Theme") as null|anything in display_names + if(QDELETED(src) || !choice || M.stat || !in_range(M, src) || M.restrained() || !M.canmove || reskinned) + return - var/choice = input(M,"What theme would you like for your holy weapon?","Holy Weapon Theme") as null|anything in display_names - if(!src || !choice || M.stat || !in_range(M, src) || M.restrained() || !M.canmove || reskinned) - return + var/index = display_names.Find(choice) + var/A = holy_weapons_list[index] - var/index = display_names.Find(choice) - var/A = holy_weapons_list[index] + holy_weapon = new A - holy_weapon = new A - - SSreligion.holy_weapon = holy_weapon.type - - feedback_set_details("chaplain_weapon","[choice]") + SSreligion.holy_weapon_type = holy_weapon.type + feedback_set_details("chaplain_weapon","[choice]") if(holy_weapon) holy_weapon.reskinned = TRUE diff --git a/code/game/objects/items/weapons/storage/book.dm b/code/game/objects/items/weapons/storage/book.dm index 4292bf7b887..3f266243f1c 100644 --- a/code/game/objects/items/weapons/storage/book.dm +++ b/code/game/objects/items/weapons/storage/book.dm @@ -33,10 +33,9 @@ var/global/list/bibleitemstates = list("bible", "koran", "scrapbook", "bible", if(!istype(H)) return // If H is the Chaplain, we can set the icon_state of the bible (but only once!) - if(!SSreligion.Bible_icon_state && H.job == "Chaplain") + if(!SSreligion.bible_icons["icon_state"] && H.job == "Chaplain") var/dat = "Pick Bible Style

Pick a bible style

" - var/i - for(i = 1, i < biblestates.len, i++) + for(var/i in 1 to biblestates.len) var/icon/bibleicon = icon('icons/obj/storage.dmi', biblestates[i]) var/nicename = biblenames[i] H << browse_rsc(bibleicon, nicename) @@ -47,7 +46,7 @@ var/global/list/bibleitemstates = list("bible", "koran", "scrapbook", "bible", /obj/item/weapon/storage/book/bible/Topic(href, href_list) if(!usr.canUseTopic(src)) return - if(href_list["seticon"] && SSticker && !SSreligion.Bible_icon_state) + if(href_list["seticon"] && SSreligion && !SSreligion.bible_icons["icon_state"]) var/iconi = text2num(href_list["seticon"]) var/biblename = biblenames[iconi] var/obj/item/weapon/storage/book/bible/B = locate(href_list["src"]) @@ -59,8 +58,8 @@ var/global/list/bibleitemstates = list("bible", "koran", "scrapbook", "bible", H.dna.add_mutation(CLOWNMUT) H.equip_to_slot_or_del(new /obj/item/clothing/mask/gas/clown_hat(H), slot_wear_mask) - SSreligion.Bible_icon_state = B.icon_state - SSreligion.Bible_item_state = B.item_state + SSreligion.bible_icons["icon_state"] = B.icon_state + SSreligion.bible_icons["item_state"] = B.item_state feedback_set_details("religion_book","[biblename]") usr << browse(null, "window=editicon") diff --git a/code/modules/admin/verbs/pray.dm b/code/modules/admin/verbs/pray.dm index e9688ec89ed..6d1ab88154d 100644 --- a/code/modules/admin/verbs/pray.dm +++ b/code/modules/admin/verbs/pray.dm @@ -25,8 +25,8 @@ cross = image('icons/obj/storage.dmi',"kingyellow") font_color = "blue" prayer_type = "CHAPLAIN PRAYER" - if(SSreligion.Bible_deity_name) - deity = SSreligion.Bible_deity_name + if(SSreligion.deity) + deity = SSreligion.deity else if(iscultist(usr)) cross = image('icons/obj/storage.dmi',"tome") font_color = "red" diff --git a/code/modules/jobs/job_types/civilian_chaplain.dm b/code/modules/jobs/job_types/civilian_chaplain.dm index 7c9177b7cdd..059c7aa4114 100644 --- a/code/modules/jobs/job_types/civilian_chaplain.dm +++ b/code/modules/jobs/job_types/civilian_chaplain.dm @@ -18,42 +18,33 @@ Chaplain access = list(access_morgue, access_chapel_office, access_crematorium, access_theatre) minimal_access = list(access_morgue, access_chapel_office, access_crematorium, access_theatre) -/datum/outfit/job/chaplain - name = "Chaplain" - jobtype = /datum/job/chaplain +/datum/job/chaplain/after_spawn(mob/living/H, mob/M) + if(M.mind) + M.mind.isholy = TRUE - belt = /obj/item/device/pda/chaplain - uniform = /obj/item/clothing/under/rank/chaplain - backpack_contents = list(/obj/item/device/camera/spooky = 1) - backpack = /obj/item/weapon/storage/backpack/cultpack - satchel = /obj/item/weapon/storage/backpack/cultpack + var/obj/item/weapon/storage/book/bible/booze/B = new - -/datum/outfit/job/chaplain/post_equip(mob/living/carbon/human/H, visualsOnly = FALSE) - ..() - - if(visualsOnly) - return - - if(H.mind) - H.mind.isholy = TRUE - - var/obj/item/weapon/storage/book/bible/B = new /obj/item/weapon/storage/book/bible/booze(H) - - if(SSreligion.Bible_deity_name) - B.deity_name = SSreligion.Bible_deity_name - B.name = SSreligion.Bible_name - B.icon_state = SSreligion.Bible_icon_state - B.item_state = SSreligion.Bible_item_state - to_chat(H, "There is already an established religion onboard the station. You are an acolyte of [SSreligion.Bible_deity_name]. Defer to the Chaplain.") + if(SSreligion.religion) + B.deity_name = SSreligion.deity + B.name = SSreligion.bible_name + B.icon_state = SSreligion.bible_icons["icon_state"] + B.item_state = SSreligion.bible_icons["item_state"] + to_chat(H, "There is already an established religion onboard the station. You are an acolyte of [SSreligion.deity]. Defer to the Chaplain.") H.equip_to_slot_or_del(B, slot_in_backpack) - var/obj/item/weapon/nullrod/N = new(H) + var/obj/item/weapon/nullrod/N = new SSreligion.holy_weapon_type(H) H.equip_to_slot_or_del(N, slot_in_backpack) return var/new_religion = "Christianity" - if(H.client && H.client.prefs.custom_names["religion"]) - new_religion = H.client.prefs.custom_names["religion"] + if(M.client && M.client.prefs.custom_names["religion"]) + new_religion = M.client.prefs.custom_names["religion"] + + var/new_deity = "Space Jesus" + if(M.client && M.client.prefs.custom_names["deity"]) + new_deity = M.client.prefs.custom_names["deity"] + + B.deity_name = new_deity + switch(lowertext(new_religion)) if("christianity") @@ -81,14 +72,24 @@ Chaplain B.name = pick("Principle of Relativity", "Quantum Enigma: Physics Encounters Consciousness", "Programming the Universe", "Quantum Physics and Theology", "String Theory for Dummies", "How To: Build Your Own Warp Drive", "The Mysteries of Bluespace", "Playing God: Collector's Edition") else B.name = "The Holy Book of [new_religion]" - feedback_set_details("religion_name","[new_religion]") - SSreligion.Bible_name = B.name - var/new_deity = "Space Jesus" - if(H.client && H.client.prefs.custom_names["deity"]) - new_deity = H.client.prefs.custom_names["deity"] - B.deity_name = new_deity - SSreligion.Bible_deity_name = B.deity_name - feedback_set_details("religion_deity","[new_deity]") + if(SSreligion) + SSreligion.religion = new_religion + SSreligion.bible_name = B.name + SSreligion.deity = B.deity_name + H.equip_to_slot_or_del(B, slot_in_backpack) + + feedback_set_details("religion_name","[new_religion]") + feedback_set_details("religion_deity","[new_deity]") + +/datum/outfit/job/chaplain + name = "Chaplain" + jobtype = /datum/job/chaplain + + belt = /obj/item/device/pda/chaplain + uniform = /obj/item/clothing/under/rank/chaplain + backpack_contents = list(/obj/item/device/camera/spooky = 1) + backpack = /obj/item/weapon/storage/backpack/cultpack + satchel = /obj/item/weapon/storage/backpack/cultpack \ No newline at end of file diff --git a/code/modules/library/lib_machines.dm b/code/modules/library/lib_machines.dm index 49ae29fa0c3..287f9da781b 100644 --- a/code/modules/library/lib_machines.dm +++ b/code/modules/library/lib_machines.dm @@ -474,11 +474,11 @@ var/global/list/datum/cachedbook/cachedbooks // List of our cached book datums if(href_list["printbible"]) if(cooldown < world.time) var/obj/item/weapon/storage/book/bible/B = new /obj/item/weapon/storage/book/bible(src.loc) - if(SSreligion.Bible_icon_state && SSreligion.Bible_item_state) - B.icon_state = SSreligion.Bible_icon_state - B.item_state = SSreligion.Bible_item_state - B.name = SSreligion.Bible_name - B.deity_name = SSreligion.Bible_deity_name + if(SSreligion.bible_icons["icon_state"] && SSreligion.bible_icons["item_state"]) + B.icon_state = SSreligion.bible_icons["icon_state"] + B.item_state = SSreligion.bible_icons["item_state"] + B.name = SSreligion.bible_name + B.deity_name = SSreligion.deity cooldown = world.time + PRINTER_COOLDOWN else say("Printer currently unavailable, please wait a moment.") diff --git a/code/modules/reagents/chemistry/recipes/pyrotechnics.dm b/code/modules/reagents/chemistry/recipes/pyrotechnics.dm index 2e24309085a..0357f0dbdc4 100644 --- a/code/modules/reagents/chemistry/recipes/pyrotechnics.dm +++ b/code/modules/reagents/chemistry/recipes/pyrotechnics.dm @@ -61,8 +61,8 @@ strengthdiv = 8 for(var/mob/living/simple_animal/revenant/R in get_hearers_in_view(7,get_turf(holder.my_atom))) var/deity - if(SSreligion.Bible_deity_name) - deity = SSreligion.Bible_deity_name + if(SSreligion.deity) + deity = SSreligion.deity else deity = "Christ" to_chat(R, "The power of [deity] compels you!")