diff --git a/code/__defines/obj.dm b/code/__defines/obj.dm index 3a62191b0a1..a4cb682d087 100644 --- a/code/__defines/obj.dm +++ b/code/__defines/obj.dm @@ -26,6 +26,9 @@ /obj/proc/iscoil() return FALSE +/obj/proc/ishammer() + return FALSE + /obj/proc/ispen() return FALSE diff --git a/code/game/machinery/deployable.dm b/code/game/machinery/deployable.dm index c331db9470b..99679488df2 100644 --- a/code/game/machinery/deployable.dm +++ b/code/game/machinery/deployable.dm @@ -100,20 +100,23 @@ for reference: visible_message(SPAN_WARNING("\The [src] is hit by \the [P]!")) /obj/structure/barricade/attackby(obj/item/W, mob/user) - if(istype(W, /obj/item/stack)) - var/obj/item/stack/D = W - if(D.get_material_name() != material.name) - return //hitting things with the wrong type of stack usually doesn't produce messages, and probably doesn't need to. - if(health < maxhealth) - if(D.get_amount() < 1) + if(W.ishammer() && user.a_intent != I_HURT) + var/obj/item/I = usr.get_inactive_hand() + if(I && istype(I, /obj/item/stack)) + var/obj/item/stack/D = I + if(D.get_material_name() != material.name) to_chat(user, SPAN_WARNING("You need one sheet of [material.display_name] to repair \the [src].")) - return - user.visible_message("[user] begins to repair \the [src].", SPAN_NOTICE("You begin to repair \the [src].")) - if(do_after(user, 2 SECONDS) && health < maxhealth) - if(D.use(1)) - health = maxhealth - visible_message("[user] repairs \the [src].", SPAN_NOTICE("You repair \the [src].")) - return + return ..() + if(health < maxhealth) + if(D.get_amount() < 1) + to_chat(user, SPAN_WARNING("You need one sheet of [material.display_name] to repair \the [src].")) + return + user.visible_message("[user] begins to repair \the [src].", SPAN_NOTICE("You begin to repair \the [src].")) + if(do_after(user, 2 SECONDS) && health < maxhealth) + if(D.use(1)) + health = maxhealth + visible_message("[user] repairs \the [src].", SPAN_NOTICE("You repair \the [src].")) + return else user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN) switch(W.damtype) diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index 2865d507270..6c7a56a01fa 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -299,37 +299,39 @@ if(!istype(I, /obj/item/forensics)) src.add_fingerprint(user) - if(istype(I, /obj/item/stack/material) && I.get_material_name() == src.get_material_name()) - if(stat & BROKEN) - to_chat(user, "It looks like \the [src] is pretty busted. It's going to need more than just patching up now.") - return - if(health >= maxhealth) - to_chat(user, "Nothing to fix!") - return - if(!density) - to_chat(user, "\The [src] must be closed before you can repair it.") - return + if(I.ishammer() && user.a_intent != I_HURT) + var/obj/item/W = usr.get_inactive_hand() + if(W && istype(W, /obj/item/stack) && W.get_material_name() == src.get_material_name()) + if(stat & BROKEN) + to_chat(user, SPAN_NOTICE("It looks like \the [src] is pretty busted. It's going to need more than just patching up now.")) + return + if(health >= maxhealth) + to_chat(user, SPAN_NOTICE("Nothing to fix!")) + return + if(!density) + to_chat(user, SPAN_WARNING("\The [src] must be closed before you can repair it.")) + return - //figure out how much metal we need - var/amount_needed = (maxhealth - health) / DOOR_REPAIR_AMOUNT - amount_needed = (round(amount_needed) == amount_needed)? amount_needed : round(amount_needed) + 1 //Why does BYOND not have a ceiling proc? + //figure out how much metal we need + var/amount_needed = (maxhealth - health) / DOOR_REPAIR_AMOUNT + amount_needed = (round(amount_needed) == amount_needed)? amount_needed : round(amount_needed) + 1 //Why does BYOND not have a ceiling proc? - var/obj/item/stack/stack = I - var/transfer - if (repairing) - transfer = stack.transfer_to(repairing, amount_needed - repairing.amount) - if (!transfer) - to_chat(user, "You must weld or remove \the [repairing] from \the [src] before you can add anything else.") - else - repairing = stack.split(amount_needed) + var/obj/item/stack/stack = I + var/transfer if (repairing) - repairing.forceMove(src) - transfer = repairing.amount + transfer = stack.transfer_to(repairing, amount_needed - repairing.amount) + if (!transfer) + to_chat(user, SPAN_WARNING("You must weld or remove \the [repairing] from \the [src] before you can add anything else.")) + else + repairing = stack.split(amount_needed) + if (repairing) + repairing.forceMove(src) + transfer = repairing.amount - if (transfer) - to_chat(user, "You fit [transfer] [stack.singular_name]\s to damaged and broken parts on \the [src].") + if (transfer) + to_chat(user, SPAN_NOTICE("You fit [transfer] [stack.singular_name]\s to damaged and broken parts on \the [src].")) - return + return if(repairing && I.iswelder()) if(!density) diff --git a/code/game/machinery/vending_types.dm b/code/game/machinery/vending_types.dm index a5eb34af8f7..2440407d8ed 100644 --- a/code/game/machinery/vending_types.dm +++ b/code/game/machinery/vending_types.dm @@ -966,7 +966,8 @@ /obj/item/device/analyzer = 5, /obj/item/device/t_scanner = 5, /obj/item/screwdriver = 5, - /obj/item/tape_roll = 3 + /obj/item/tape_roll = 3, + /obj/item/hammer = 3 ) contraband = list( /obj/item/weldingtool/hugetank = 2, diff --git a/code/game/objects/items/weapons/melee/misc.dm b/code/game/objects/items/weapons/melee/misc.dm index 6057cc710f3..b6ec13ff74b 100644 --- a/code/game/objects/items/weapons/melee/misc.dm +++ b/code/game/objects/items/weapons/melee/misc.dm @@ -76,6 +76,9 @@ w_class = ITEMSIZE_NORMAL origin_tech = list(TECH_MATERIAL = 3, TECH_ILLEGAL = 2) +/obj/item/melee/hammer/ishammer() + return TRUE + /obj/item/melee/hammer/powered name = "powered hammer" desc = "A heavily modified plasteel hammer, it seems to be powered by a robust hydraulic system." diff --git a/code/game/objects/items/weapons/storage/belt.dm b/code/game/objects/items/weapons/storage/belt.dm index 3a882e8e36f..2e7e6dbe52d 100644 --- a/code/game/objects/items/weapons/storage/belt.dm +++ b/code/game/objects/items/weapons/storage/belt.dm @@ -100,6 +100,7 @@ /obj/item/weldingtool, /obj/item/wirecutters, /obj/item/wrench, + /obj/item/hammer, /obj/item/device/multitool, /obj/item/device/flashlight, /obj/item/stack/cable_coil, @@ -139,7 +140,8 @@ /obj/item/crowbar = 1, /obj/item/wirecutters/toolbelt = 1, /obj/item/stack/cable_coil/random = 1, - /obj/item/powerdrill = 1 + /obj/item/powerdrill = 1, + /obj/item/hammer = 1 ) /obj/item/storage/belt/utility/very_full diff --git a/code/game/objects/items/weapons/tools.dm b/code/game/objects/items/weapons/tools.dm index 15d32ef3f1c..9b439757411 100644 --- a/code/game/objects/items/weapons/tools.dm +++ b/code/game/objects/items/weapons/tools.dm @@ -955,3 +955,36 @@ new /obj/effect/decal/cleanable/ash(get_turf(src)) qdel(src) + + +/obj/item/hammer + name = "hammer" + desc = "A tool with a weighted head used for striking." + icon = 'icons/obj/tools.dmi' + item_icons = list( + slot_l_hand_str = 'icons/mob/items/lefthand_tools.dmi', + slot_r_hand_str = 'icons/mob/items/righthand_tools.dmi', + ) + icon_state = "hammer" + item_state = "hammer" + flags = CONDUCT + slot_flags = SLOT_BELT + force = 8 + throwforce = 5 + throw_speed = 3 + throw_range = 3 + w_class = ITEMSIZE_SMALL + matter = list(DEFAULT_WALL_MATERIAL = 75) + attack_verb = list("smashed", "hammered") + drop_sound = 'sound/items/drop/crowbar.ogg' + pickup_sound = 'sound/items/pickup/crowbar.ogg' + usesound = /decl/sound_category/crowbar_sound + +/obj/item/hammer/Initialize() + . = ..() + var/mutable_appearance/handle = mutable_appearance('icons/obj/tools.dmi', "hammer_handle") + handle.color = pick(COLOR_BLUE, COLOR_RED, COLOR_PURPLE, COLOR_BROWN, COLOR_GREEN, COLOR_CYAN, COLOR_YELLOW) + add_overlay(handle) + +/obj/item/hammer/ishammer() + return TRUE diff --git a/code/game/objects/random/random.dm b/code/game/objects/random/random.dm index 0db863690ec..3a0c5f9cf7f 100644 --- a/code/game/objects/random/random.dm +++ b/code/game/objects/random/random.dm @@ -65,6 +65,7 @@ /obj/item/weldingtool, /obj/item/crowbar, /obj/item/wrench, + /obj/item/hammer, /obj/item/device/flashlight ) diff --git a/code/modules/tables/interactions.dm b/code/modules/tables/interactions.dm index 5102482215b..21ba97aff98 100644 --- a/code/modules/tables/interactions.dm +++ b/code/modules/tables/interactions.dm @@ -215,6 +215,23 @@ to_chat(user, "There's nothing to put \the [W] on! Try adding plating to \the [src] first.") return + + if(W.ishammer() && user.a_intent != I_HURT) + var/obj/item/I = usr.get_inactive_hand() + if(I && istype(I, /obj/item/stack)) + var/obj/item/stack/D = I + if(D.get_material_name() != material.name) + return ..() + if(health < maxhealth) + if(D.get_amount() < 1) + to_chat(user, SPAN_WARNING("You need one sheet of [material.display_name] to repair \the [src].")) + return + user.visible_message("[user] begins to repair \the [src].", SPAN_NOTICE("You begin to repair \the [src].")) + if(do_after(user, 2 SECONDS) && health < maxhealth) + if(D.use(1)) + health = maxhealth + visible_message("[user] repairs \the [src].", SPAN_NOTICE("You repair \the [src].")) + // Placing stuff on tables if(user.unEquip(W, 0, loc)) //Loc is intentional here so we don't forceMove() items into oblivion user.make_item_drop_sound(W) diff --git a/html/changelogs/alberyk-hammertime.yml b/html/changelogs/alberyk-hammertime.yml new file mode 100644 index 00000000000..386c4d69a25 --- /dev/null +++ b/html/changelogs/alberyk-hammertime.yml @@ -0,0 +1,6 @@ +author: Alberyk, Dongwaiver + +delete-after: True + +changes: + - rscadd: "Added hammers a tool option. They can be used to repair tables, airlocks, and barricades." diff --git a/icons/mob/items/lefthand_tools.dmi b/icons/mob/items/lefthand_tools.dmi index 0efbc63e443..e66cfa3ce16 100644 Binary files a/icons/mob/items/lefthand_tools.dmi and b/icons/mob/items/lefthand_tools.dmi differ diff --git a/icons/mob/items/righthand_tools.dmi b/icons/mob/items/righthand_tools.dmi index 037f1cc49c0..3209d160b88 100644 Binary files a/icons/mob/items/righthand_tools.dmi and b/icons/mob/items/righthand_tools.dmi differ diff --git a/icons/obj/tools.dmi b/icons/obj/tools.dmi index b196d280514..872d15e0660 100644 Binary files a/icons/obj/tools.dmi and b/icons/obj/tools.dmi differ