From 83e1b4f0df25f13dc4c92d16f1342c7710042f50 Mon Sep 17 00:00:00 2001 From: Detective Google <48196179+Detective-Google@users.noreply.github.com> Date: Fri, 14 Aug 2020 15:07:22 -0500 Subject: [PATCH] woo yeah yeah woo --- code/game/objects/items/storage/book.dm | 77 +++++++++++++++---------- 1 file changed, 47 insertions(+), 30 deletions(-) diff --git a/code/game/objects/items/storage/book.dm b/code/game/objects/items/storage/book.dm index 7532aacbfa..28850e79a2 100644 --- a/code/game/objects/items/storage/book.dm +++ b/code/game/objects/items/storage/book.dm @@ -47,41 +47,58 @@ GLOBAL_LIST_INIT(bibleitemstates, list("bible", "koran", "scrapbook", "bible", user.visible_message("[user] is offering [user.p_them()]self to [deity_name]! It looks like [user.p_theyre()] trying to commit suicide!") return (BRUTELOSS) -/obj/item/storage/book/bible/attack_self(mob/living/carbon/human/H) - if(!istype(H)) +/obj/item/storage/book/bible/attack_self(mob/living/carbon/human/user) + if(!istype(user)) return - // If H is the Chaplain, we can set the icon_state of the bible (but only once!) - if(!GLOB.bible_icon_state && H.job == "Chaplain") - var/dat = "Pick Bible Style

Pick a bible style

" - for(var/i in 1 to GLOB.biblestates.len) - var/icon/bibleicon = icon('icons/obj/storage.dmi', GLOB.biblestates[i]) - var/nicename = GLOB.biblenames[i] - H << browse_rsc(bibleicon, nicename) - dat += {""} - dat += "
[nicename]
" - H << browse(dat, "window=editicon;can_close=0;can_minimize=0;size=250x650") + if(GLOB.bible_icon_state) // if there is already a bible icon return FALSE + return FALSE + if(user.job != "Chaplain") // if the user is not the chaplain, return FALSE + return FALSE -/obj/item/storage/book/bible/Topic(href, href_list) - if(!usr.canUseTopic(src)) - return - if(href_list["seticon"] && GLOB && !GLOB.bible_icon_state) - var/iconi = text2num(href_list["seticon"]) - var/biblename = GLOB.biblenames[iconi] - var/obj/item/storage/book/bible/B = locate(href_list["src"]) - B.icon_state = GLOB.biblestates[iconi] - B.item_state = GLOB.bibleitemstates[iconi] + 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) - if(B.icon_state == "honk1" || B.icon_state == "honk2") - var/mob/living/carbon/human/H = usr - H.dna.add_mutation(CLOWNMUT) - H.dna.add_mutation(SMILE) - H.equip_to_slot_or_del(new /obj/item/clothing/mask/gas/clown_hat(H), SLOT_WEAR_MASK) + 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 + icon_state = GLOB.biblestates[bible_index] + item_state = GLOB.bibleitemstates[bible_index] - GLOB.bible_icon_state = B.icon_state - GLOB.bible_item_state = B.item_state + if(icon_state == "honk1" || icon_state == "honk2") + var/mob/living/carbon/human/H = usr + H.dna.add_mutation(CLOWNMUT) + H.dna.add_mutation(SMILE) + H.equip_to_slot_or_del(new /obj/item/clothing/mask/gas/clown_hat(H), SLOT_WEAR_MASK) - SSblackbox.record_feedback("text", "religion_book", 1, "[biblename]") - usr << browse(null, "window=editicon") + GLOB.bible_icon_state = icon_state + GLOB.bibleitemstates = item_state + SSblackbox.record_feedback("text", "religion_book", 1, "[choice]") + +/** + * Checks if we are allowed to interact with the radial + * + * Arguements: user The mob interacting with the menu + */ + +/obj/item/storage/book/bible/proc/check_menu(mob/living/carbon/human/user) + if(GLOB.bible_icon_state) + return FALSE + if(!istype(user)) + return FALSE + if(!user.is_holding(src)) + return FALSE + if(!user.can_read(src)) + return FALSE + if(user.incapacitated()) + return FALSE + if(user.job != "Chaplain") + return FALSE + return TRUE /obj/item/storage/book/bible/proc/bless(mob/living/carbon/human/H, mob/living/user) for(var/X in H.bodyparts)