Skip to content

Commit

Permalink
Merged FPP
Browse files Browse the repository at this point in the history
  • Loading branch information
FPtje committed Aug 8, 2024
1 parent 9268b8c commit 4fb7d64
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions gamemode/modules/fpp/pp/server/ownability.lua
Original file line number Diff line number Diff line change
Expand Up @@ -499,11 +499,14 @@ function FPP.RecalculateConstrainedEntities(players, entities)
end

local entMem = {}
local function constraintRemovedTimer(ent1, ent2, constrainedEnts)
if not IsValid(ent1) and not IsValid(ent2) or not constrainedEnts then return end

FPP.RecalculateConstrainedEntities(player.GetAll(), constrainedEnts)
local function constraintRemovedTimer(ent1, ent2)
if not IsValid(ent1) and not IsValid(ent2) then return end
entMem = {}

local allConstrainedEnts = {}
table.Add(allConstrainedEnts, constraint.GetAllConstrainedEntities(ent1))
table.Add(allConstrainedEnts, constraint.GetAllConstrainedEntities(ent2))
FPP.RecalculateConstrainedEntities(player.GetAll(), allConstrainedEnts)
end

local function handleConstraintRemoved(ent)
Expand All @@ -516,10 +519,7 @@ local function handleConstraintRemoved(ent)
entMem[ent1] = true
entMem[ent2] = true

-- the constraint is still there, so this includes ent2's constraints
local constrainedEnts = constraint.GetAllConstrainedEntities(ent1)

timer.Create("FPP_ConstraintRemovedTimer", 0, 1, function() constraintRemovedTimer(ent1, ent2, constrainedEnts) end)
timer.Create("FPP_ConstraintRemovedTimer", 0, 1, function() constraintRemovedTimer(ent1, ent2) end)
end

local function onEntityRemoved(ent)
Expand Down

0 comments on commit 4fb7d64

Please sign in to comment.