Attempt on forcing effect on client-side. Not working though, I guess. Related to #10.
parent
1ab7c74f9a
commit
2772c9905a
|
@ -5,9 +5,8 @@
|
||||||
* cl_fxfake.lua
|
* cl_fxfake.lua
|
||||||
*
|
*
|
||||||
* Purpose:
|
* Purpose:
|
||||||
* Fake shoot effect on client-side via a trigger from server-side, as
|
* Fake shoot and blood effect on client-side via a trigger from server-side,
|
||||||
* for some reason on multiplayer servers the effect is not rendered on
|
* as for some reason the effects are not rendered on client-side automatically.
|
||||||
* client-side automatically.
|
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013 Carl Kittelberger (Icedream)
|
* Copyright (C) 2013 Carl Kittelberger (Icedream)
|
||||||
*
|
*
|
||||||
|
@ -32,10 +31,21 @@ usermessage.Hook("disguiserShootFX", function(um)
|
||||||
local physbone = um:ReadLong()
|
local physbone = um:ReadLong()
|
||||||
local bFirstTimePredicted = um:ReadBool()
|
local bFirstTimePredicted = um:ReadBool()
|
||||||
|
|
||||||
// Can we trigger shoot effect yet?
|
-- Can we trigger shoot effect yet?
|
||||||
if !LocalPlayer():GetActiveWeapon().DoShootEffect then return false end
|
swep = LocalPlayer():GetActiveWeapon()
|
||||||
|
if !swep.DoShootEffect then return false end
|
||||||
|
|
||||||
// Render shoot effect
|
-- Render shoot effect
|
||||||
LocalPlayer():GetActiveWeapon("disguiser"):DoShootEffect(
|
swep:DoShootEffect(
|
||||||
hitpos, hitnormal, entity, physbone, bFirstTimePredicted)
|
hitpos, hitnormal, entity, physbone, bFirstTimePredicted)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
usermessage.Hook("disguiserBlood", function(um)
|
||||||
|
local edata = EffectData()
|
||||||
|
edata:SetStart(um:ReadVector())
|
||||||
|
edata:SetOrigin(um:ReadVector())
|
||||||
|
edata:SetNormal(um:ReadVectorNormal())
|
||||||
|
edata:SetEntity(um:ReadEntity())
|
||||||
|
util.Effect("BloodImpact", edata)
|
||||||
|
util.Decal("Splash.Large", um:ReadVector(), um:ReadVector())
|
||||||
|
end)
|
|
@ -364,11 +364,11 @@ hook.Add("PlayerDeath", "Disguiser.ThirdPersonDeath", function(victim, inflictor
|
||||||
dentity:Fire("kill", "", 2)
|
dentity:Fire("kill", "", 2)
|
||||||
dentity:Fire("enablemotion","",0)
|
dentity:Fire("enablemotion","",0)
|
||||||
|
|
||||||
/*
|
|
||||||
// Manually draw additional blood (for some reason setting the blood color has no effect)
|
// Manually draw additional blood (for some reason setting the blood color has no effect)
|
||||||
local traceworld = {}
|
local traceworld = {}
|
||||||
traceworld.start = victim:GetPos() + Vector(0, 0, 20)
|
traceworld.start = victim:GetPos() + Vector(0, 0, 20)
|
||||||
traceworld.endpos = traceworld.start + (Vector(0,0,-1) * 8000) // aim max. 8000 units down
|
traceworld.endpos = traceworld.start + (Vector(0,0,-1) * 8000) // aim max. 8000 units down
|
||||||
|
traceworld.filter = victim
|
||||||
local trw = util.TraceLine(traceworld) // Send the trace and get the results.
|
local trw = util.TraceLine(traceworld) // Send the trace and get the results.
|
||||||
local edata = EffectData()
|
local edata = EffectData()
|
||||||
edata:SetStart(victim:GetPos() - physics:GetVelocity())
|
edata:SetStart(victim:GetPos() - physics:GetVelocity())
|
||||||
|
@ -378,7 +378,15 @@ hook.Add("PlayerDeath", "Disguiser.ThirdPersonDeath", function(victim, inflictor
|
||||||
util.Effect("BloodImpact", edata)
|
util.Effect("BloodImpact", edata)
|
||||||
util.Decal("Splash.Large", trw.HitPos + trw.HitNormal, trw.HitPos - trw.HitNormal)
|
util.Decal("Splash.Large", trw.HitPos + trw.HitNormal, trw.HitPos - trw.HitNormal)
|
||||||
|
|
||||||
*/
|
// Make it appear on clientside of victim
|
||||||
|
umsg.Start("disguiserBlood", victim)
|
||||||
|
umsg.Vector(victim:GetPos() - physics:GetVelocity())
|
||||||
|
umsg.Vector(victim:GetPos())
|
||||||
|
umsg.VectorNormal(trw.Normal)
|
||||||
|
umsg.Entity(dentity)
|
||||||
|
umsg.Vector(trw.HitPos + trw.HitNormal)
|
||||||
|
umsg.Vector(trw.HitPos - trw.HitNormal)
|
||||||
|
umsg.End()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue