Fixes papersack (#70341)

fix: Fixed the papersack.
This commit is contained in:
ShizCalev
2022-10-07 20:15:37 -07:00
committed by GitHub
parent 7048110298
commit ad87985ff2
@@ -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 ..()
/**