- Removes the throwtapsound var from items. It was unnecessary.

- Thrown items play throwhitsound on impact. If no throwhitsound is defined, they play hitsound instead. If that isn't defined, they play genhit.ogg. The latter fixes \#2508. The volume of the sound is dependant on the item's throwforce and/or weight class.

- Adds 15 throwforce to the fireaxe, which previously had only 1.
This commit is contained in:
Tenebrosity
2014-01-26 17:25:28 +13:00
parent 6908a7194b
commit 0851b341da
3 changed files with 27 additions and 10 deletions
-1
View File
@@ -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
@@ -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
+26 -9
View File
@@ -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("<span class='danger'>[src] has been hit by [I].</span>", \
"<span class='userdanger'>[src] has been hit by [I].</span>")
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)].")