Adds a generic projectile hit sound to most projectiles, except for practice laser and laser tag beams. Scales volume of projectile hit sounds by damage done by the specific projectile.

Overrides the generic sound with specific ones for electrodes and
lasers: sear.ogg for lasers and "sparks" for electrodes.

Thanks @optimumtact for your help with getting the hitsound volume scaling to work.
This commit is contained in:
Tenebrosity
2014-01-29 19:22:56 +13:00
parent 2aafd19d2e
commit 84b9a63330
4 changed files with 16 additions and 0 deletions
+10
View File
@@ -18,6 +18,7 @@
anchored = 1 //There's a reason this is here, Mport. God fucking damn it -Agouri. Find&Fix by Pete. The reason this is here is to stop the curving of emitter shots.
pass_flags = PASSTABLE
mouse_opacity = 0
hitsound = 'sound/weapons/pierce.ogg'
var/bumped = 0 //Prevents it from hitting more than one guy at once
var/def_zone = "" //Aiming at
var/mob/firer = null//Who shot it
@@ -59,8 +60,14 @@
var/mob/living/L = target
return L.apply_effects(stun, weaken, paralyze, irradiate, stutter, eyeblur, drowsy, blocked)
proc/vol_by_damage()
if(src.damage)
return Clamp((src.damage) * 2, 30, 100)// Multiply projectile damage by 2, then clamp the value between 30 and 100
else
return 40 //if the projectile doesn't do damage, play its hitsound at 40% volume
Bump(atom/A as mob|obj|turf|area)
if(A == firer)
loc = A.loc
return 0 //cannot shoot yourself
@@ -83,8 +90,11 @@
var/distance = get_dist(get_turf(A), starting) // Get the distance between the turf shot from and the mob we hit and use that for the calculations.
def_zone = ran_zone(def_zone, max(100-(7*distance), 5)) //Lower accurancy/longer range tradeoff. 7 is a balanced number to use.
if(silenced)
playsound(loc, hitsound, 5, 1, -1)
M << "<span class='userdanger'>You've been shot in the [parse_zone(def_zone)] by [src]!</span>"
else
var/volume = vol_by_damage()
playsound(loc, hitsound, volume, 1, -1)
M.visible_message("<span class='danger'>[M] is hit by [src] in the [parse_zone(def_zone)]!", \
"<span class='userdanger'>[M] is hit by [src] in the [parse_zone(def_zone)]!") //X has fired Y is now given by the guns so you cant tell who shot you if you could not see the shooter
add_logs(firer, M, "shot", object="[src]", addition=reagent_note)
@@ -4,6 +4,7 @@
pass_flags = PASSTABLE | PASSGLASS | PASSGRILLE
damage = 20
damage_type = BURN
hitsound = 'sound/weapons/sear.ogg'
flag = "laser"
eyeblur = 2
@@ -12,6 +13,7 @@
icon_state = "laser"
pass_flags = PASSTABLE | PASSGLASS | PASSGRILLE
damage = 0
hitsound = null
damage_type = BURN
flag = "laser"
eyeblur = 2
@@ -58,6 +60,7 @@
/obj/item/projectile/bluetag
name = "lasertag beam"
icon_state = "bluelaser"
hitsound = null
pass_flags = PASSTABLE | PASSGLASS | PASSGRILLE
damage = 0
damage_type = BURN
@@ -73,6 +76,7 @@
/obj/item/projectile/redtag
name = "lasertag beam"
icon_state = "laser"
hitsound = null
pass_flags = PASSTABLE | PASSGLASS | PASSGRILLE
damage = 0
damage_type = BURN
@@ -87,6 +91,7 @@
/obj/item/projectile/omnitag//A laser tag bolt that stuns EVERYONE
name = "lasertag beam"
hitsound = null
icon_state = "omnilaser"
pass_flags = PASSTABLE | PASSGLASS | PASSGRILLE
damage = 0
@@ -13,6 +13,7 @@
stun = 10
weaken = 10
stutter = 10
hitsound = "sparks"
on_hit(var/atom/target, var/blocked = 0)
if(!ismob(target) || blocked >= 2) //Fully blocked by mob or collided with dense object - burst into sparks!
Binary file not shown.