Fixes grenades not exploding 15% of the time you are shot (#27368)

* Fixes grenades not exploding 15% of the time you are shot

* userdanger it
This commit is contained in:
Qwertytoforty
2024-11-18 23:52:30 +00:00
committed by GitHub
parent 98b48c5ca2
commit 07dac1d537
2 changed files with 6 additions and 2 deletions
@@ -114,12 +114,15 @@
/obj/item/grenade/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
var/obj/item/projectile/P = hitby
if(damage && attack_type == PROJECTILE_ATTACK && P.damage_type != STAMINA && prob(15))
owner.visible_message("<span class='danger'>[attack_text] hits [owner]'s [src], setting it off! What a shot!</span>")
owner.visible_message("<span class='userdanger'>[hitby] hits [owner]'s [name], setting it off! What a shot!</span>")
var/turf/T = get_turf(src)
log_game("A projectile ([hitby]) detonated a grenade held by [key_name(owner)] at [COORD(T)]")
add_attack_logs(P.firer, owner, "A projectile ([hitby]) detonated a grenade held", ATKLOG_FEW)
prime()
return 1 //It hit the grenade, not them
if(!QDELETED(src)) // some grenades don't detonate but we want them destroyed, otherwise you can just hold empty grenades as shields.
qdel(src)
return TRUE
return ..()
/obj/item/grenade/chem_grenade/attackby(obj/item/I, mob/user, params)
if(istype(I,/obj/item/hand_labeler))
@@ -11,6 +11,7 @@
slot_flags = ITEM_SLOT_BELT
resistance_flags = FLAMMABLE
max_integrity = 40
flags_2 = RANDOM_BLOCKER_2
/// Has the pin been pulled?
var/active = FALSE
/// Time between the pin being pulled and detonation.