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
|
||||
*
|
||||
* Purpose:
|
||||
* Fake shoot effect on client-side via a trigger from server-side, as
|
||||
* for some reason on multiplayer servers the effect is not rendered on
|
||||
* client-side automatically.
|
||||
* Fake shoot and blood effect on client-side via a trigger from server-side,
|
||||
* as for some reason the effects are not rendered on client-side automatically.
|
||||
*
|
||||
* Copyright (C) 2013 Carl Kittelberger (Icedream)
|
||||
*
|
||||
|
@ -32,10 +31,21 @@ usermessage.Hook("disguiserShootFX", function(um)
|
|||
local physbone = um:ReadLong()
|
||||
local bFirstTimePredicted = um:ReadBool()
|
||||
|
||||
// Can we trigger shoot effect yet?
|
||||
if !LocalPlayer():GetActiveWeapon().DoShootEffect then return false end
|
||||
-- Can we trigger shoot effect yet?
|
||||
swep = LocalPlayer():GetActiveWeapon()
|
||||
if !swep.DoShootEffect then return false end
|
||||
|
||||
// Render shoot effect
|
||||
LocalPlayer():GetActiveWeapon("disguiser"):DoShootEffect(
|
||||
-- Render shoot effect
|
||||
swep:DoShootEffect(
|
||||
hitpos, hitnormal, entity, physbone, bFirstTimePredicted)
|
||||
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("enablemotion","",0)
|
||||
|
||||
/*
|
||||
// Manually draw additional blood (for some reason setting the blood color has no effect)
|
||||
local traceworld = {}
|
||||
traceworld.start = victim:GetPos() + Vector(0, 0, 20)
|
||||
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 edata = EffectData()
|
||||
edata:SetStart(victim:GetPos() - physics:GetVelocity())
|
||||
|
@ -377,8 +377,16 @@ hook.Add("PlayerDeath", "Disguiser.ThirdPersonDeath", function(victim, inflictor
|
|||
edata:SetEntity(dentity)
|
||||
util.Effect("BloodImpact", edata)
|
||||
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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue