From 9d10226da283779305ad7ffd23058b1ee8c455ce Mon Sep 17 00:00:00 2001 From: Henri215 <77684085+Henri215@users.noreply.github.com> Date: Thu, 28 Sep 2023 20:31:32 -0300 Subject: [PATCH] Adds a new crutch mechanic (#22527) * hidden compartment * adjusting text * NODROP * Contra review --- code/game/objects/items/weapons/misc_items.dm | 42 ++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/code/game/objects/items/weapons/misc_items.dm b/code/game/objects/items/weapons/misc_items.dm index 6db509a47b0..9f7ade94a64 100644 --- a/code/game/objects/items/weapons/misc_items.dm +++ b/code/game/objects/items/weapons/misc_items.dm @@ -51,15 +51,55 @@ w_class = WEIGHT_CLASS_BULKY materials = list(MAT_METAL = 500) attack_verb = list("bludgeoned", "whacked", "cracked") + /// Is the secret compartment open? + var/is_open = FALSE + /// Tiny item that can be hidden on crutches with a screwdriver + var/obj/item/hidden = null /obj/item/crutches/Initialize(mapload) . = ..() AddComponent(/datum/component/two_handed, force_unwielded = 5, force_wielded = 5, icon_wielded = "crutches1") -/obj/item/crutches/update_icon_state() //Currently only here to fuck with the on-mob icons. +/obj/item/crutches/Destroy() + if(hidden) + hidden.forceMove(get_turf(src)) + hidden = null + return ..() + +/obj/item/crutches/update_icon_state() //Currently only here to fuck with the on-mob icons. icon_state = "crutches0" return ..() +/obj/item/crutches/attackby(obj/item/I, mob/user, params) + . = ..() + if(!is_open) + return + if(!hidden && I.tool_behaviour != TOOL_SCREWDRIVER && I.w_class == WEIGHT_CLASS_TINY) + if(I.flags & ABSTRACT) + return + if(I.flags & NODROP) + to_chat(user, "[I] is stuck to your hand!") + return + I.forceMove(src) + hidden = I + to_chat(user, "You hide [I] inside the crutch tip.") + +/obj/item/crutches/attack_hand(mob/user, pickupfireoverride) + if(!is_open) + return ..() + if(hidden) + user.put_in_hands(hidden) + to_chat(user, "You remove [hidden] from the crutch tip!") + hidden = null + + add_fingerprint(user) + +/obj/item/crutches/screwdriver_act(mob/living/user, obj/item/I) + if(!I.use_tool(src, user, 0, volume = I.tool_volume)) + return + to_chat(user, "You screw the crutch tip [is_open ? "closed" : "open"].") + is_open = !is_open + /obj/item/crutches/get_crutch_efficiency() // 6 when wielded, 2 when not. Basically a small upgrade to just having 2 canes in each hand return 2 + (4 * HAS_TRAIT(src, TRAIT_WIELDED)) // less efficient when you're holding both in a single hand