From df0e69332fcb9dadb7ea884c0a219098713b819d Mon Sep 17 00:00:00 2001 From: warriorstar-orion Date: Fri, 19 Sep 2025 12:05:48 -0400 Subject: [PATCH] fix paper wrapping crates (#30482) * fix paper wrapping crates * define magic number --- .../map_files/tests/test_attack_chain_structures.dmm | 6 +++++- code/__HELPERS/trait_helpers.dm | 3 +++ .../game/objects/structures/crates_lockers/closets.dm | 2 +- code/modules/recycling/sortingmachinery.dm | 11 ++++++----- .../attack_chain/test_attack_chain_structures.dm | 6 ++++++ 5 files changed, 21 insertions(+), 7 deletions(-) diff --git a/_maps/map_files/tests/test_attack_chain_structures.dmm b/_maps/map_files/tests/test_attack_chain_structures.dmm index fc050ce0ca9..a00f72337bc 100644 --- a/_maps/map_files/tests/test_attack_chain_structures.dmm +++ b/_maps/map_files/tests/test_attack_chain_structures.dmm @@ -175,6 +175,10 @@ /obj/structure/ai_core, /turf/simulated/floor/plasteel, /area/game_test) +"Pr" = ( +/obj/structure/closet/crate/sci, +/turf/simulated/floor/plasteel, +/area/game_test) "QL" = ( /obj/structure/disposalconstruct, /turf/simulated/floor/plating, @@ -399,7 +403,7 @@ le rT yd rT -rT +Pr rT rT Od diff --git a/code/__HELPERS/trait_helpers.dm b/code/__HELPERS/trait_helpers.dm index 36724ccf80b..4cf3ede7f05 100644 --- a/code/__HELPERS/trait_helpers.dm +++ b/code/__HELPERS/trait_helpers.dm @@ -407,6 +407,9 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai /// Allows faster butchering times #define TRAIT_BUTCHER "butcher" +/// How much faster pack rats are in wrapping packages as a percentage +#define PACK_RAT_WRAP_SPEEDUP 0.375 + // sec traits /// Gives the user a new tab for being able to open up space law/sop book pages diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index 09a9e03db1a..d116953b9b4 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -316,7 +316,7 @@ emag_act(user) return ITEM_INTERACT_COMPLETE else if(istype(W, /obj/item/stack/package_wrap)) - return ITEM_INTERACT_COMPLETE + return else if(user.a_intent != INTENT_HARM) closed_item_click(user) return ITEM_INTERACT_COMPLETE diff --git a/code/modules/recycling/sortingmachinery.dm b/code/modules/recycling/sortingmachinery.dm index 101dceeab83..c3c0da6bb6f 100644 --- a/code/modules/recycling/sortingmachinery.dm +++ b/code/modules/recycling/sortingmachinery.dm @@ -149,6 +149,7 @@ amount = 25 max_amount = 25 resistance_flags = FLAMMABLE + var/wrap_time = 2 SECONDS var/static/list/no_wrap = list(/obj/item/small_delivery, /obj/structure/big_delivery, /obj/item/evidencebag, /obj/structure/closet/body_bag) /obj/item/stack/package_wrap/pre_attack(atom/atom_target, mob/living/user, params) @@ -233,12 +234,12 @@ to_chat(user, "You need more paper.") return // Checking these again since it's after a delay + var/wrap_do_after = wrap_time if(user.mind && HAS_TRAIT(user.mind, TRAIT_PACK_RAT)) - if(!do_after_once(user, 0.75 SECONDS, target = C) || C.opened || !use(3)) - return - else - if(!do_after_once(user, 2 SECONDS, target = C) || C.opened || !use(3)) - return + wrap_do_after *= PACK_RAT_WRAP_SPEEDUP + if(!do_after_once(user, wrap_do_after, target = C) || C.opened || !use(3)) + return + var/obj/structure/big_delivery/P = new(get_turf(C)) P.wrapped = C C.loc = P diff --git a/code/tests/attack_chain/test_attack_chain_structures.dm b/code/tests/attack_chain/test_attack_chain_structures.dm index 0e41bfc85a3..306adbb2b31 100644 --- a/code/tests/attack_chain/test_attack_chain_structures.dm +++ b/code/tests/attack_chain/test_attack_chain_structures.dm @@ -322,3 +322,9 @@ var/obj/water_cooler = teleport_to_first(player, /obj/structure/reagent_dispensers/water_cooler) player.click_on(water_cooler) TEST_ASSERT_LAST_CHATLOG(player, "You fill [bucket] with 20 units of the contents of [water_cooler]") + player.drop_held_item() + + crate = teleport_to_first(player, /obj/structure/closet/crate/sci) + player.spawn_fast_tool(/obj/item/stack/package_wrap) + player.click_on(crate) + TEST_ASSERT_LAST_CHATLOG(player, "[player.puppet] wraps [crate]")