From affc0c913e6b3958bce9f4f193f58334bad0ef86 Mon Sep 17 00:00:00 2001 From: VisVirific Date: Sat, 11 Jun 2022 15:29:22 -0300 Subject: [PATCH] Wrapping Paper Stuff Bugfixes (#14282) --- code/game/objects/items/stacks/wrap.dm | 78 +++++++++++-------- .../objects/items/weapons/storage/boxes.dm | 14 ++++ html/changelogs/wrapping_paper_stuff.yml | 9 +++ 3 files changed, 69 insertions(+), 32 deletions(-) create mode 100644 html/changelogs/wrapping_paper_stuff.yml diff --git a/code/game/objects/items/stacks/wrap.dm b/code/game/objects/items/stacks/wrap.dm index fb6efe4e3d2..8963f521320 100644 --- a/code/game/objects/items/stacks/wrap.dm +++ b/code/game/objects/items/stacks/wrap.dm @@ -1,6 +1,7 @@ /obj/item/stack/wrapping_paper name = "wrapping paper" desc = "You can use this to wrap items in." + desc_info = "To wrap something into a gift, click on the wrapping paper that's not in your hands with the object you wish to wrap." icon = 'icons/obj/stacks/wrap.dmi' item_icons = list( slot_l_hand_str = 'icons/mob/items/stacks/lefthand_wrap.dmi', @@ -8,7 +9,7 @@ ) icon_state = "wrap_paper" singular_name = "square unit" - amount = 20.0 + amount = 20 drop_sound = 'sound/items/drop/wrapper.ogg' pickup_sound = 'sound/items/pickup/wrapper.ogg' @@ -31,7 +32,7 @@ return if (W.w_class < ITEMSIZE_LARGE) var/a_used = 2 * (src.w_class - 1) - if (src.amount < a_used) + if(src.amount < a_used) to_chat(user, SPAN_WARNING("You need more paper!")) return else @@ -49,7 +50,9 @@ G.add_fingerprint(user) W.add_fingerprint(user) src.add_fingerprint(user) - if (src.amount <= 0) + user.visible_message("\The [user] wraps \the [W] into \a [G].", SPAN_NOTICE("You wrap \the [W] into \a [G], leaving [amount] of \the [src] remaining.")) + update_icon() + if(src.amount <= 0) new /obj/item/c_tube(src.loc) qdel(src) return @@ -58,22 +61,21 @@ to_chat(user, SPAN_WARNING("This object is far too large to wrap!")) return - - /obj/item/stack/wrapping_paper/examine(mob/user) if(..(user, 1)) to_chat(user, "There [amount == 1 ? "is" : "are"] about [amount] [singular_name]\s of paper left!") -/obj/item/stack/wrapping_paper/attack(mob/target as mob, mob/user as mob) - if (!istype(target, /mob/living/carbon/human)) return - var/mob/living/carbon/human/H = target +/obj/item/stack/wrapping_paper/attack(mob/target, mob/user) + if(!ishuman(target)) + return - if (istype(H.wear_suit, /obj/item/clothing/suit/straight_jacket) || H.stat) - if (src.amount > 2) + var/mob/living/carbon/human/H = target + if(istype(H.wear_suit, /obj/item/clothing/suit/straight_jacket) || H.stat) + if(src.amount >= 2) var/obj/effect/spresent/present = new /obj/effect/spresent (H.loc) src.amount -= 2 - if (H.client) + if(H.client) H.client.perspective = EYE_PERSPECTIVE H.client.eye = present @@ -84,23 +86,29 @@ msg_admin_attack("[key_name_admin(user)] used [src] to wrap [key_name_admin(H)] (JMP)",ckey=key_name(user),ckey_target=key_name(H)) else - to_chat(user, "You need more paper.") + to_chat(user, SPAN_WARNING("You need more paper.")) else to_chat(user, "They are moving around too much. A straightjacket would help.") /obj/item/stack/packageWrap name = "package wrapper" icon = 'icons/obj/stacks/wrap.dmi' + item_icons = list( + slot_l_hand_str = 'icons/mob/items/stacks/lefthand_wrap.dmi', + slot_r_hand_str = 'icons/mob/items/stacks/righthand_wrap.dmi', + ) icon_state = "deliveryPaper" desc = "A roll of paper used to enclose an object for delivery." + desc_info = "To package wrap the object for delivery, use the package wrapper on the object." w_class = ITEMSIZE_NORMAL amount = 30 var/wrapping_tag = "Sorting Office" drop_sound = 'sound/items/drop/wrapper.ogg' pickup_sound = 'sound/items/pickup/wrapper.ogg' -/obj/item/stack/packageWrap/afterattack(var/obj/target as obj, mob/user as mob, proximity) - if(!proximity) return +/obj/item/stack/packageWrap/afterattack(var/obj/target, mob/user, proximity) // VTD: Need to make it ask if you want to wrap boxes + if(!proximity) + return if(!istype(target)) //this really shouldn't be necessary (but it is). -Pete return if(istype(target, /obj/item/smallDelivery) || istype(target,/obj/structure/bigDelivery) \ @@ -115,10 +123,9 @@ user.attack_log += text("\[[time_stamp()]\] Has used [src.name] on \ref[target]") - - if (istype(target, /obj/item) && !(istype(target, /obj/item/storage) && !istype(target,/obj/item/storage/box))) + if(istype(target, /obj/item) && !(istype(target, /obj/item/storage) && !istype(target,/obj/item/storage/box))) var/obj/item/O = target - if (src.amount > 1) + if(src.amount >= 1) var/obj/item/smallDelivery/P = new /obj/item/smallDelivery(get_turf(O.loc)) //Aaannd wrap it up! if(!istype(O.loc, /turf)) if(user.client) @@ -146,12 +153,13 @@ src.add_fingerprint(usr) src.amount -= 1 user.visible_message("\The [user] wraps \a [target] with \a [src].",\ - "You wrap \the [target], leaving [amount] units of paper on \the [src].",\ + SPAN_NOTICE("You wrap \the [target], leaving [amount] units of paper on \the [src]."),\ "You hear someone taping paper around a small object.") playsound(loc, 'sound/items/package_wrap.ogg', 50, 1) - else if (istype(target, /obj/structure/closet/crate)) + update_icon() + else if(istype(target, /obj/structure/closet/crate)) var/obj/structure/closet/crate/O = target - if (src.amount > 3 && !O.opened) + if (src.amount >= 3 && !O.opened) var/obj/structure/bigDelivery/P = new /obj/structure/bigDelivery(get_turf(O.loc)) P.icon_state = "deliverycrate" P.wrapped = O @@ -159,14 +167,15 @@ O.forceMove(P) src.amount -= 3 user.visible_message("\The [user] wraps \a [target] with \a [src].",\ - "You wrap \the [target], leaving [amount] units of paper on \the [src].",\ + SPAN_NOTICE("You wrap \the [target], leaving [amount] units of paper on \the [src]."),\ "You hear someone taping paper around a large object.") playsound(loc, 'sound/items/package_wrap.ogg', 50, 1) + update_icon() else if(src.amount < 3) - to_chat(user, "You need more paper.") - else if (istype (target, /obj/structure/closet)) + to_chat(user, SPAN_WARNING("You need more paper.")) + else if(istype (target, /obj/structure/closet)) var/obj/structure/closet/O = target - if (src.amount > 3 && !O.opened) + if(src.amount >= 3 && !O.opened) var/obj/structure/bigDelivery/P = new /obj/structure/bigDelivery(get_turf(O.loc)) P.wrapped = O O.welded = 1 @@ -174,29 +183,34 @@ O.forceMove(P) src.amount -= 3 user.visible_message("\The [user] wraps \a [target] with \a [src].",\ - "You wrap \the [target], leaving [amount] units of paper on \the [src].",\ + SPAN_NOTICE("You wrap \the [target], leaving [amount] units of paper on \the [src]."),\ "You hear someone taping paper around a large object.") playsound(loc, 'sound/items/package_wrap.ogg', 50, 1) + update_icon() else if(src.amount < 3) - to_chat(user, "You need more paper.") + to_chat(user, SPAN_WARNING("You need more paper.")) else - to_chat(user, "The object you are trying to wrap is unsuitable for the sorting machinery!") - if (src.amount <= 0) - new /obj/item/c_tube( src.loc ) + to_chat(user, SPAN_NOTICE("The object you are trying to wrap is unsuitable for the sorting machinery!")) + if(src.amount <= 0) + var/obj/item/c_tube/tube = new(loc) + user.put_in_hands(tube) qdel(src) return return /obj/item/stack/packageWrap/examine(mob/user) if(..(user, 0)) - to_chat(user, "There are [amount] units of package wrap left!") - + to_chat(user, SPAN_NOTICE("There are [amount] units of package wrap left!")) return /obj/item/c_tube name = "cardboard tube" - desc = "A tube... of cardboard." + desc = "A tube of cardboard." icon = 'icons/obj/stacks/wrap.dmi' + item_icons = list( + slot_l_hand_str = 'icons/mob/items/stacks/lefthand_wrap.dmi', + slot_r_hand_str = 'icons/mob/items/stacks/righthand_wrap.dmi', + ) icon_state = "c_tube" throwforce = 1 w_class = ITEMSIZE_SMALL diff --git a/code/game/objects/items/weapons/storage/boxes.dm b/code/game/objects/items/weapons/storage/boxes.dm index 5ad364000fe..3a1ca0e303e 100644 --- a/code/game/objects/items/weapons/storage/boxes.dm +++ b/code/game/objects/items/weapons/storage/boxes.dm @@ -122,6 +122,20 @@ qdel(src) user.put_in_hands(trash) +/obj/item/storage/box/attackby(obj/item/W, mob/user) + if(istype(W, /obj/item/stack/packageWrap)) + var/total_storage_space = W.get_storage_cost() + for(var/obj/item/I in contents) + total_storage_space += I.get_storage_cost() + if(total_storage_space <= max_storage_space) + var/question = alert(user, "Will you want to wrap \the [src] or store the item inside?", "Wrap or Store", "Wrap", "Store") + if(question == "Wrap") + return + else if(question == "Store") + return ..() + else + ..() + /obj/item/storage/box/survival name = "emergency survival box" desc = "A faithful box that will remain with you, no matter where you go, and probably save you." diff --git a/html/changelogs/wrapping_paper_stuff.yml b/html/changelogs/wrapping_paper_stuff.yml new file mode 100644 index 00000000000..5e0eb23d17d --- /dev/null +++ b/html/changelogs/wrapping_paper_stuff.yml @@ -0,0 +1,9 @@ +author: Vrow + +delete-after: True + +changes: + - bugfix: "Fixes the Package Wrapper not properly wrapping boxes if it had enough space to get stored in. It now asks whether you want to wrap it or store it if the box has enough space to store it." + - bugfix: "Fixes the Wrapping Paper (for Gifts) and the Package Wrapper not properly turning into cardboard tubes when used up completely" + - bugfix: "Fixes the above not updating their amount number when used" + - bugfix: "Fixes the Package Wrapper and Cardboard Tube in-hands not showing up properly"