Add a craftable, two-handed sledgehammer.

- Can be made out of plasteel, rods and metal.
- Relatively high damage but less than the fireaxe.
- Special sound.
This commit is contained in:
lbnesquik
2020-01-21 13:48:28 +01:00
parent 9aaaa44ace
commit e0fcf47373
9 changed files with 230 additions and 0 deletions
@@ -0,0 +1,124 @@
/obj/item/weapon/hammer_head
name = "hammer head"
desc = "A rectangular plasteel head. Feels very heavy in your hand.."
icon = 'icons/obj/hammer_construction_ch.dmi'
icon_state = "hammer_construction_1"
description_info = "You need rods, metal, a wrench and welding fuel to finish this up."
var/construction_stage = 1
/obj/item/weapon/hammer_head/attackby(var/obj/item/thing, var/mob/user)
if(istype(thing, /obj/item/stack/rods) && construction_stage == 1)
var/obj/item/stack/rods = thing
if(rods.get_amount() < 4)
to_chat(user, "<span class='warning'>You need at least 4 rods for this task.</span>")
return
rods.use(4)
user.visible_message("<span class='notice'>\The [user] puts some rods together in \the [src] hole.</span>")
increment_construction_stage()
return
if(istype(thing, /obj/item/weapon/weldingtool) && construction_stage == 2)
var/obj/item/weapon/weldingtool/welder = thing
if(!welder.isOn())
to_chat(user, "<span class='warning'>Turn it on first!</span>")
return
if(!welder.remove_fuel(0,user))
to_chat(user, "<span class='warning'>You need more fuel!</span>")
return
user.visible_message("<span class='notice'>\The [user] weld the rods to the head \the [src] together with \the [thing].</span>")
playsound(src.loc, 'sound/items/Welder2.ogg', 100, 1)
spawn(5)
increment_construction_stage()
return
if(istype(thing, /obj/item/stack/rods) && construction_stage == 3)
var/obj/item/stack/rods = thing
if(rods.get_amount() < 4)
to_chat(user, "<span class='warning'>You need at least 4 rods for this task.</span>")
return
rods.use(4)
user.visible_message("<span class='notice'>\The [user] jams \the [thing]'s into \the [src].</span>")
increment_construction_stage()
return
if(istype(thing, /obj/item/weapon/weldingtool) && construction_stage == 4)
var/obj/item/weapon/weldingtool/welder = thing
if(!welder.isOn())
to_chat(user, "<span class='warning'>Turn it on first!</span>")
return
if(!welder.remove_fuel(0,user))
to_chat(user, "<span class='warning'>You need more fuel!</span>")
return
user.visible_message("<span class='notice'>\The [user] welds the rods together of the handle into place, forming a long irregular shaft.</span>")
playsound(src.loc, 'sound/items/Welder2.ogg', 100, 1)
increment_construction_stage()
return
if(istype(thing, /obj/item/stack/material) && construction_stage == 5)
var/obj/item/stack/material/reinforcing = thing
var/material/reinforcing_with = reinforcing.get_material()
if(reinforcing_with.name == DEFAULT_WALL_MATERIAL) // Steel
if(reinforcing.get_amount() < 3)
to_chat(user, "<span class='warning'>You need at least 3 [reinforcing.singular_name]\s for this task.</span>")
return
reinforcing.use(3)
user.visible_message("<span class='notice'>\The [user] shapes some metal sheets around the rods.</span>")
increment_construction_stage()
return
if(istype(thing, /obj/item/weapon/weldingtool) && construction_stage == 6)
var/obj/item/weapon/weldingtool/welder = thing
if(!welder.isOn())
to_chat(user, "<span class='warning'>Turn it on first!</span>")
return
if(!welder.remove_fuel(10,user))
to_chat(user, "<span class='warning'>You need more fuel!</span>")
return
user.visible_message("<span class='notice'>\The [user] heats up the metal sheets until it glows red.</span>")
playsound(src.loc, 'sound/items/Welder2.ogg', 100, 1)
increment_construction_stage()
return
if(istype(thing, /obj/item/weapon/tool/wrench) && construction_stage == 7)
user.visible_message("<span class='notice'>\The [user] whacks at \the [src] like a caveman, shaping the metal with \the [thing] into a rough handle, finishing it off.</span>")
increment_construction_stage()
playsound(src.loc, 'sound/weapons/smash5.ogg', 100, 1)
var/obj/item/weapon/material/twohanded/sledgehammer/sledge = new(loc)
var/put_in_hands
var/mob/M = src.loc
if(istype(M))
put_in_hands = M == user
M.drop_from_inventory(src)
if(put_in_hands)
user.put_in_hands(sledge)
qdel(src)
return
return ..()
/obj/item/weapon/hammer_head/proc/increment_construction_stage()
if(construction_stage < 7)
construction_stage++
icon_state = "hammer_construction_[construction_stage]"
/obj/item/weapon/hammer_head/examine(var/mob/user)
. = ..(user,2)
if(.)
switch(construction_stage)
if(2) to_chat(user, "<span class='notice'>It has a bunch of rods sticking out of the hole.</span>")
if(3) to_chat(user, "<span class='notice'>It has a short rough metal shaft sticking to it, quite short.</span>")
if(4) to_chat(user, "<span class='notice'>It has a bunch of rods jammed into the shaft/</span>")
if(4) to_chat(user, "<span class='notice'>It has a pretty long rough metal shaft sticking out of it, it look hard to grab.</span>")
if(5) to_chat(user, "<span class='notice'>It has a few sheets bent in half across the handle.</span>")
if(6) to_chat(user, "<span class='notice'>It has red hot, pliable looking metal sheets spread over the handle. What a sloppy job.</span>")
if(7) to_chat(user, "<span class='notice'>It has a roughly shaped metal handle.</span>")
@@ -0,0 +1,100 @@
/*
*
*Sledgehammer
*Mjollnir
*
*/
/obj/item/weapon/material/twohanded/sledgehammer // a SLEGDGEHAMMER
icon_state = "sledgehammer0"
base_icon = "sledgehammer"
name = "sledgehammer"
desc = "A long, heavy hammer meant to be used with both hands. Typically used for breaking rocks and driving posts, it can also be used for breaking bones or driving points home."
description_info = "This weapon can cleave, striking nearby lesser, hostile enemies close to the primary target. It must be held in both hands to do this."
unwielded_force_divisor = 0.25
force = 25
force_divisor = 0.9 // 10/42 with hardness 60 (steel) and 0.25 unwielded divisor
hitsound = 'sound/weapons/heavysmash.ogg'
icon = 'icons/obj/hammer_sprites_ch.dmi'
w_class = ITEMSIZE_HUGE
slowdown = 1.5
dulled_divisor = 0.95 //Still metal on a stick
sharp = 0
edge = 0
force_wielded = 23 //A fair bit less than the fireaxe.
attack_verb = list("attacked", "smashed", "crushed", "wacked", "pounded")
applies_material_colour = 0
item_icons = list(
slot_l_hand_str = 'icons/mob/items/lefthand_material_ch.dmi',
slot_r_hand_str = 'icons/mob/items/righthand_material_ch.dmi',
)
/obj/item/weapon/material/twohanded/sledgehammer/update_held_icon()
var/mob/living/M = loc
if(istype(M) && !issmall(M) && M.item_is_in_hands(src) && !M.hands_are_full())
wielded = 1
pry = 1
force = force_wielded
name = "[base_name] (wielded)"
update_icon()
else
wielded = 0
pry = 0
force = force_unwielded
name = "[base_name]"
update_icon()
..()
/obj/item/weapon/material/twohanded/sledgehammer/afterattack(atom/A as mob|obj|turf|area, mob/user as mob, proximity)
if(!proximity) return
..()
if(A && wielded)
if(istype(A,/obj/structure/window))
var/obj/structure/window/W = A
W.shatter()
else if(istype(A,/obj/structure/grille))
qdel(A)
else if(istype(A,/obj/effect/plant))
var/obj/effect/plant/P = A
P.die_off()
// This cannot go into afterattack since some mobs delete themselves upon dying.
/obj/item/weapon/material/twohanded/sledgehammer/pre_attack(var/mob/living/target, var/mob/living/user)
if(istype(target))
cleave(user, target)
/obj/item/weapon/material/twohanded/sledgehammer/mjollnir
icon_state = "mjollnir0"
base_icon = "mjollnir"
name = "Mjollnir"
desc = "A long, heavy hammer. This weapons crackles with barely contained energy."
force_divisor = 2
hitsound = 'sound/effects/lightningbolt.ogg'
force = 50
throwforce = 15
force_wielded = 75
slowdown = 0
/obj/item/weapon/material/twohanded/sledgehammer/mjollnir/afterattack(mob/living/G, mob/user)
..()
if(wielded)
if(prob(10))
G.electrocute_act(500, src, def_zone = BP_TORSO)
return
if(prob(10))
G.dust()
return
else
G.stun_effect_act(10 , 50,def_zone = BP_TORSO, src)
G.take_organ_damage(10)
G.Paralyse(20)
playsound(src.loc, "sparks", 50, 1)
return
/obj/item/weapon/material/twohanded/sledgehammer/mjollnir/update_icon() //Currently only here to fuck with the on-mob icons.
icon_state = "mjollnir[wielded]"
return