Skip to content

Commit

Permalink
Rebuild customprop cl physics on full update (#1904)
Browse files Browse the repository at this point in the history
  • Loading branch information
thegrb93 authored Nov 24, 2024
1 parent 1df1858 commit 3aa67c5
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 18 deletions.
36 changes: 18 additions & 18 deletions lua/entities/starfall_hologram/cl_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -186,24 +186,24 @@ end)

-- For when the hologram matrix gets cleared
hook.Add("NetworkEntityCreated", "starfall_hologram_rescale", function(holo)
local sf_userrenderbounds = holo.sf_userrenderbounds
if holo.IsSFHologram then
if holo.HoloMatrix then
holo:EnableMatrix("RenderMultiply", holo.HoloMatrix)
end
if not sf_userrenderbounds then
local mins, maxs = holo:GetModelBounds()
if mins then
local scale = holo:GetScale()
holo:SetRenderBounds(mins * scale, maxs * scale)
end
end
end
if sf_userrenderbounds then
holo:SetRenderBounds(sf_userrenderbounds[1], sf_userrenderbounds[2])
end
local sf_userrenderbounds = holo.sf_userrenderbounds
if holo.IsSFHologram then
if holo.HoloMatrix then
holo:EnableMatrix("RenderMultiply", holo.HoloMatrix)
end

if not sf_userrenderbounds then
local mins, maxs = holo:GetModelBounds()
if mins then
local scale = holo:GetScale()
holo:SetRenderBounds(mins * scale, maxs * scale)
end
end
end

if sf_userrenderbounds then
holo:SetRenderBounds(sf_userrenderbounds[1], sf_userrenderbounds[2])
end
end)

local function ShowHologramOwners()
Expand Down
8 changes: 8 additions & 0 deletions lua/entities/starfall_prop/cl_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ net.Receive("starfall_custom_prop", function()
end
physmesh[i] = convex
end
self.sf_physmesh = physmesh
self:BuildPhysics(physmesh)

local phys = self:GetPhysicsObject()
Expand Down Expand Up @@ -116,3 +117,10 @@ net.Receive("starfall_custom_prop", function()
end
end)
end)

hook.Add("NetworkEntityCreated", "starfall_prop_physics", function(ent)
local mesh = ent.sf_physmesh
if mesh and not IsValidPhys(ent:GetPhysicsObject()) then
ent:BuildPhysics(mesh)
end
end)

0 comments on commit 3aa67c5

Please sign in to comment.