diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index e65456e7e41..77b92ada70d 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -8,7 +8,6 @@ var/burning = null var/hitsound = null var/throwhitsound = null - var/throwtapsound = 'sound/weapons/throwtap.ogg' var/w_class = 3.0 var/slot_flags = 0 //This is used to determine on which slots an item can fit. pass_flags = PASSTABLE diff --git a/code/game/objects/items/weapons/twohanded.dm b/code/game/objects/items/weapons/twohanded.dm index 19ad56eb441..8de2ba8e76c 100644 --- a/code/game/objects/items/weapons/twohanded.dm +++ b/code/game/objects/items/weapons/twohanded.dm @@ -150,6 +150,7 @@ obj/item/weapon/twohanded/ name = "fire axe" desc = "Truly, the weapon of a madman. Who would think to fight fire with an axe?" force = 5 + throwforce = 15 w_class = 4.0 slot_flags = SLOT_BACK force_unwielded = 5 diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index 096e77023dd..8562a88446d 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -23,22 +23,39 @@ apply_damage(P.damage, P.damage_type, def_zone, armor) return P.on_hit(src, armor, def_zone) +proc/vol_by_throwforce_and_or_w_class(var/obj/item/I) + if(!I) + return 0 + if(I.throwforce && I.w_class) + return Clamp((I.throwforce + I.w_class) * 5, 30, 100)// Add the item's throwforce to its weight class and multiply by 5, then clamp the value between 30 and 100 + else if(I.w_class) + return Clamp(I.w_class * 8, 20, 100) // Multiply the item's weight class by 8, then clamp the value between 20 and 100 + else + return 0 + /mob/living/hitby(atom/movable/AM)//Standardization and logging -Sieve if(istype(AM, /obj/item)) var/obj/item/I = AM var/zone = ran_zone("chest", 65)//Hits a random part of the body, geared towards the chest var/dtype = BRUTE - if(istype(I,/obj/item/weapon)) + var/volume = vol_by_throwforce_and_or_w_class(I) + if(istype(I,/obj/item/weapon)) //If the item is a weapon... var/obj/item/weapon/W = I dtype = W.damtype - if (W.throwhitsound && W.throwforce > 0) - playsound(loc, W.throwhitsound, 30, 1, -1) - else if(W.throwtapsound && W.throwforce == 0) - playsound(loc, W.throwtapsound, 30, 1, -1) - else if(W.hitsound && W.throwforce > 0) - playsound(loc, W.hitsound, 30, 1, -1) - else - playsound(loc, I.throwtapsound, 30, 1, -1) + + if (W.throwforce > 0) //If the weapon's throwforce is greater than zero... + if (W.throwhitsound) //...and throwhitsound is defined... + playsound(loc, W.throwhitsound, volume, 1, -1) //...play the weapon's throwhitsound. + else if(W.hitsound) //Otherwise, if the weapon's hitsound is defined... + playsound(loc, W.hitsound, volume, 1, -1) //...play the weapon's hitsound. + else if(!W.throwhitsound) //Otherwise, if throwhitsound isn't defined... + playsound(loc, 'sound/weapons/genhit.ogg',volume, 1, -1) //...play genhit.ogg. + + else if(!I.throwhitsound && I.throwforce > 0) //Otherwise, if the item doesn't have a throwhitsound and has a throwforce greater than zero... + playsound(loc, 'sound/weapons/genhit.ogg', volume, 1, -1)//...play genhit.ogg + if(!I.throwforce)// Otherwise, if the item's throwforce is 0... + playsound(loc, 'sound/weapons/throwtap.ogg', 1, volume, -1)//...play throwtap.ogg. + visible_message("[src] has been hit by [I].", \ "[src] has been hit by [I].") var/armor = run_armor_check(zone, "melee", "Your armor has protected your [parse_zone(zone)].", "Your armor has softened hit to your [parse_zone(zone)].")