Reset bounding box when player dies. This should get rid of #11.

master
Icedream 2013-12-27 16:30:21 +01:00
parent c8a3a64d38
commit fc671ec6b6
1 changed files with 9 additions and 2 deletions

View File

@ -353,7 +353,9 @@ hook.Add("PlayerDeath", "Disguiser.ThirdPersonDeath", function(victim, inflictor
dentity:SetPos(victim:GetPos()) dentity:SetPos(victim:GetPos())
dentity:SetVelocity(victim:GetVelocity()) dentity:SetVelocity(victim:GetVelocity())
local physics = victim:GetPhysicsObject() local physics = victim:GetPhysicsObject()
dentity:SetBloodColor(BLOOD_COLOR_RED) -- this thing was alive, ya know? :( if !!victim:GetBloodColor() then
dentity:SetBloodColor(victim:GetBloodColor()) -- this thing was alive, ya know? :(
end
dentity:Spawn() dentity:Spawn()
local dphysics = dentity:GetPhysicsObject() local dphysics = dentity:GetPhysicsObject()
dphysics:SetAngles(physics:GetAngles()) dphysics:SetAngles(physics:GetAngles())
@ -365,7 +367,6 @@ hook.Add("PlayerDeath", "Disguiser.ThirdPersonDeath", function(victim, inflictor
dentity:Fire("enablemotion","",0) dentity:Fire("enablemotion","",0)
// Let the entity bleed wahahaha. I'm mad, ain't I? // Let the entity bleed wahahaha. I'm mad, ain't I?
victim:SetBloodColor(BLOOD_COLOR_RED) -- this thing was alive, ya know? :(
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
@ -377,6 +378,12 @@ hook.Add("PlayerDeath", "Disguiser.ThirdPersonDeath", function(victim, inflictor
edata:SetNormal(trw.Normal) edata:SetNormal(trw.Normal)
edata:SetEntity(dentity) edata:SetEntity(dentity)
util.Effect("BloodImpact", edata) util.Effect("BloodImpact", edata)
// Reset the victim's bounding box to solve the issue with getting stuck at spawn
victim:ResetHull()
umsg.Start("resetHull", owner)
umsg.Entity(owner)
umsg.End()
end end
end) end)