Skip to content

Commit 9937f2c

Browse files
committed
smg grenade interaction
1 parent 54770dc commit 9937f2c

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

lua/gwater2_interactions.lua

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,15 @@ if SERVER then
121121
-- does not detect instantly, can be a couple ticks behind
122122
-- grenades that get exploded by other grenades (chain grenade explosions) are not detected
123123
hook.Add("EntityRemoved", "gwater2_explosion", function(ent)
124-
if !IsValid(ent) or ent:GetClass() != "npc_grenade_frag" then return end
124+
if !IsValid(ent) then return end
125125

126-
-- the grenade will explode (and is not just being removed with remover tool)
127-
if ent:GetInternalVariable("m_flDetonateTime") != -CurTime() then
126+
-- smg grenade, theres no way to detect whether it exploded or not, so we just assume it always does
127+
if ent:GetClass() == "grenade_ar2" then
128+
gwater2.AddForceField(ent:GetPos(), 250, 100, 1, true)
129+
end
130+
131+
-- a grenade will explode (and is not just being removed with remover tool)
132+
if ent:GetClass() == "npc_grenade_frag" and ent:GetInternalVariable("m_flDetonateTime") != -CurTime() then
128133
gwater2.AddForceField(ent:GetPos(), 250, 100, 1, true)
129134
end
130135
end)

0 commit comments

Comments
 (0)