Fix AreaCopy when used with the CopyOutside param (#466)

* Fix AreaCopy when used with the CopyOutside param

* Adjust param order

* Fix call parameters
This commit is contained in:
Brandon Sturgeon 2024-04-25 13:11:14 -07:00 committed by GitHub
parent 19eb2221a1
commit 94c6f4a4dd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 7 deletions

View File

@ -446,10 +446,9 @@ AdvDupe2.duplicator.Copy = Copy
--[[
Name: AreaCopy
Desc: Copy based on a box
Params: <entity> Entity
Returns: <table> Entities, <table> Constraints
]]
function AdvDupe2.duplicator.AreaCopy(Entities, Offset, CopyOutside)
function AdvDupe2.duplicator.AreaCopy(ply, Entities, Offset, CopyOutside)
local Constraints, EntTable, ConstraintTable = {}, {}, {}
local index, add, AddEnts, AddConstrs, ConstTable, EntTab
@ -492,7 +491,7 @@ function AdvDupe2.duplicator.AreaCopy(Entities, Offset, CopyOutside)
else -- Copy entities and constraints outside of the box that are constrained to entities inside the box
ConstraintTable[_] = ConstTable
for k, v in pairs(EntTab) do
Copy(v, EntTable, ConstraintTable, Offset)
Copy(ply, v, EntTable, ConstraintTable, Offset)
end
end
end

View File

@ -289,7 +289,7 @@ if(SERVER) then
HeadEnt.Index = Ent:EntIndex()
HeadEnt.Pos = Ent:GetPos()
Entities, Constraints = AdvDupe2.duplicator.AreaCopy(Ents, HeadEnt.Pos, tobool(ply:GetInfo("advdupe2_copy_outside")))
Entities, Constraints = AdvDupe2.duplicator.AreaCopy(ply, Ents, HeadEnt.Pos, tobool(ply:GetInfo("advdupe2_copy_outside")))
self:SetStage(0)
AdvDupe2.RemoveSelectBox(ply)
@ -348,7 +348,7 @@ if(SERVER) then
HeadEnt.Index = Ent:EntIndex()
HeadEnt.Pos = Ent:GetPos()
Entities, Constraints = AdvDupe2.duplicator.AreaCopy(Entities, HeadEnt.Pos, tobool(ply:GetInfo("advdupe2_copy_outside")))
Entities, Constraints = AdvDupe2.duplicator.AreaCopy(ply, Entities, HeadEnt.Pos, tobool(ply:GetInfo("advdupe2_copy_outside")))
end
end
@ -782,7 +782,7 @@ if(SERVER) then
})
Tab.HeadEnt.Z = WorldTrace.Hit and math.abs(Tab.HeadEnt.Pos.Z - WorldTrace.HitPos.Z) or 0
Tab.Entities, Tab.Constraints = AdvDupe2.duplicator.AreaCopy(Entities, Tab.HeadEnt.Pos, dupe.AutoSaveOutSide)
Tab.Entities, Tab.Constraints = AdvDupe2.duplicator.AreaCopy(ply, Entities, Tab.HeadEnt.Pos, dupe.AutoSaveOutSide)
end
Tab.Constraints = GetSortedConstraints(ply, Tab.Constraints)
Tab.Description = dupe.AutoSaveDesc
@ -830,7 +830,7 @@ if(SERVER) then
})
Tab.HeadEnt.Z = WorldTrace.Hit and math.abs(Tab.HeadEnt.Pos.Z - WorldTrace.HitPos.Z) or 0
Tab.Entities, Tab.Constraints = AdvDupe2.duplicator.AreaCopy(Entities, Tab.HeadEnt.Pos, true)
Tab.Entities, Tab.Constraints = AdvDupe2.duplicator.AreaCopy(ply, Entities, Tab.HeadEnt.Pos, true)
Tab.Constraints = GetSortedConstraints(ply, Tab.Constraints)
Tab.Map = true