From ad87985ff287d94951862334deeeddd79cc7a4c6 Mon Sep 17 00:00:00 2001 From: ShizCalev Date: Fri, 7 Oct 2022 23:15:37 -0400 Subject: [PATCH] Fixes papersack (#70341) fix: Fixed the papersack. --- .../objects/items/storage/boxes/food_boxes.dm | 77 ++++++++++--------- 1 file changed, 40 insertions(+), 37 deletions(-) diff --git a/code/game/objects/items/storage/boxes/food_boxes.dm b/code/game/objects/items/storage/boxes/food_boxes.dm index 072bbce1c6f..004b5cb6871 100644 --- a/code/game/objects/items/storage/boxes/food_boxes.dm +++ b/code/game/objects/items/storage/boxes/food_boxes.dm @@ -56,6 +56,8 @@ foldable = null /// A list of all available papersack reskins var/list/papersack_designs = list() + ///What design from papersack_designs we are currently using. + var/design_choice = "None" /obj/item/storage/box/papersack/Initialize(mapload) . = ..() @@ -66,50 +68,51 @@ "Heart" = image(icon = src.icon, icon_state = "paperbag_Heart"), "SmileyFace" = image(icon = src.icon, icon_state = "paperbag_SmileyFace") )) + update_appearance() + +/obj/item/storage/box/papersack/vv_edit_var(vname, vval) + . = ..() + if(vname == NAMEOF(src, design_choice)) + update_appearance() /obj/item/storage/box/papersack/update_icon_state() - if(contents.len == 0) - icon_state = "[inhand_icon_state]" - else - icon_state = "[inhand_icon_state]_closed" + icon_state = "paperbag_[design_choice][(contents.len == 0) ? null : "_closed"]" return ..() -/obj/item/storage/box/papersack/attackby(obj/item/W, mob/user, params) - if(istype(W, /obj/item/pen)) - var/choice = show_radial_menu(user, src , papersack_designs, custom_check = CALLBACK(src, .proc/check_menu, user, W), radius = 36, require_near = TRUE) - if(!choice) +/obj/item/storage/box/papersack/update_desc(updates) + switch(design_choice) + if("None") + desc = "A sack neatly crafted out of paper." + if("NanotrasenStandard") + desc = "A standard Nanotrasen paper lunch sack for loyal employees on the go." + if("SyndiSnacks") + desc = "The design on this paper sack is a remnant of the notorious 'SyndieSnacks' program." + if("Heart") + desc = "A paper sack with a heart etched onto the side." + if("SmileyFace") + desc = "A paper sack with a crude smile etched onto the side." + return ..() + +/obj/item/storage/box/papersack/attackby(obj/item/attacking_item, mob/user, params) + if(istype(attacking_item, /obj/item/pen)) + var/choice = show_radial_menu(user, src , papersack_designs, custom_check = CALLBACK(src, .proc/check_menu, user, attacking_item), radius = 36, require_near = TRUE) + if(!choice || choice == design_choice) return FALSE - if(icon_state == "paperbag_[choice]") - return FALSE - switch(choice) - if("None") - desc = "A sack neatly crafted out of paper." - if("NanotrasenStandard") - desc = "A standard Nanotrasen paper lunch sack for loyal employees on the go." - if("SyndiSnacks") - desc = "The design on this paper sack is a remnant of the notorious 'SyndieSnacks' program." - if("Heart") - desc = "A paper sack with a heart etched onto the side." - if("SmileyFace") - desc = "A paper sack with a crude smile etched onto the side." - else - return FALSE + design_choice = choice balloon_alert(user, "modified") - icon_state = "paperbag_[choice]" - inhand_icon_state = "paperbag_[choice]" + update_appearance() return FALSE - else if(W.get_sharpness()) - if(!contents.len) - if(inhand_icon_state == "paperbag_None") - user.show_message(span_notice("You cut eyeholes into [src]."), MSG_VISUAL) - new /obj/item/clothing/head/costume/papersack(user.loc) - qdel(src) - return FALSE - else if(inhand_icon_state == "paperbag_SmileyFace") - user.show_message(span_notice("You cut eyeholes into [src] and modify the design."), MSG_VISUAL) - new /obj/item/clothing/head/costume/papersack/smiley(user.loc) - qdel(src) - return FALSE + if(attacking_item.get_sharpness() && !contents.len) + if(design_choice == "None") + user.show_message(span_notice("You cut eyeholes into [src]."), MSG_VISUAL) + new /obj/item/clothing/head/costume/papersack(drop_location()) + qdel(src) + return FALSE + else if(design_choice == "SmileyFace") + user.show_message(span_notice("You cut eyeholes into [src] and modify the design."), MSG_VISUAL) + new /obj/item/clothing/head/costume/papersack/smiley(drop_location()) + qdel(src) + return FALSE return ..() /**