Files
kiwistation/code/game/objects/items/weapons/grenades/flashbang.dm
T
phil235 83633edfed - I renamed some of the new adjust procs and create new ones for eye_blind,eye_blurry and eye_stat so they get three procs just like weakened/sleeping/etc.. (Sleeping, AdjustSleeping, SetSleeping)
- renamed the eye_stat var to eye_damage.
- mob/on_varedit() added. Manually var editing a mob's eye_blind var properly updates his vision.
- I removed update_vision_overlays(), we now just update the relevant fullscreens instead of all fullscreens whenever one needs to be updated.
- fixed climbing into mecha not giving you mecha sight.
- simplified and removed copypasta from update_tinttotal() (now update_tint() )
2016-02-07 18:50:18 +01:00

58 lines
1.9 KiB
Plaintext

/obj/item/weapon/grenade/flashbang
name = "flashbang"
icon_state = "flashbang"
item_state = "flashbang"
origin_tech = "materials=2;combat=1"
/obj/item/weapon/grenade/flashbang/prime()
update_mob()
var/flashbang_turf = get_turf(src)
if(!flashbang_turf)
return
for(var/mob/living/M in get_hearers_in_view(7, flashbang_turf))
bang(get_turf(M), M)
for(var/obj/effect/blob/B in get_hear(8,flashbang_turf)) //Blob damage here
var/damage = round(40/(get_dist(B,get_turf(src))+1))
B.take_damage(damage, BURN)
qdel(src)
/obj/item/weapon/grenade/flashbang/proc/bang(turf/T , mob/living/M)
M.show_message("<span class='warning'>BANG</span>", 2)
playsound(loc, 'sound/weapons/flashbang.ogg', 100, 1)
//Checking for protection
var/ear_safety = M.check_ear_prot()
var/distance = max(1,get_dist(src,T))
//Flash
if(M.weakeyes)
M.visible_message("<span class='disarm'><b>[M]</b> screams and collapses!</span>")
M << "<span class='userdanger'><font size=3>AAAAGH!</font></span>"
M.Weaken(15) //hella stunned
M.Stun(15)
M.adjust_eye_damage(8)
if(M.flash_eyes(affect_silicon = 1))
M.Stun(max(10/distance, 3))
M.Weaken(max(10/distance, 3))
//Bang
if((loc == M) || loc == M.loc)//Holding on person or being exactly where lies is significantly more dangerous and voids protection
M.Stun(10)
M.Weaken(10)
if(!ear_safety)
M << sound('sound/weapons/flash_ring.ogg',0,1,0,100)
M.Stun(max(10/distance, 3))
M.Weaken(max(10/distance, 3))
M.setEarDamage(M.ear_damage + rand(0, 5), max(M.ear_deaf,15))
if (M.ear_damage >= 15)
M << "<span class='warning'>Your ears start to ring badly!</span>"
if(prob(M.ear_damage - 10 + 5))
M << "<span class='warning'>You can't hear anything!</span>"
M.disabilities |= DEAF
else
if (M.ear_damage >= 5)
M << "<span class='warning'>Your ears start to ring!</span>"