mirror of
https://github.com/wiremod/advdupe2.git
synced 2025-03-04 03:03:05 -05:00
Use ents.Iterator in place of ents.GetAll (#464)
* Use ents.Iterator in place of ents.GetAll * syntax * Update advdupe2.lua --------- Co-authored-by: thegrb93 <grbrown93@sbcglobal.net>
This commit is contained in:
parent
0c6f311f3a
commit
6fe9bc86ea
@ -157,12 +157,9 @@ if(SERVER) then
|
||||
--Find all the entities in a box, given the adjacent corners and the player
|
||||
local function FindInBox(min, max, ply)
|
||||
local PPCheck = (tobool(ply:GetInfo("advdupe2_copy_only_mine")) and ply.CPPIGetOwner~=nil) and PlayerCanDupeCPPI or PlayerCanDupeTool
|
||||
local Entities = ents.GetAll() --Don't use FindInBox. It has a 512 entity limit.
|
||||
local EntTable = {}
|
||||
local pos, ent
|
||||
for i = 1, #Entities do
|
||||
ent = Entities[i]
|
||||
pos = ent:GetPos()
|
||||
for _, ent in ents.Iterator() do
|
||||
local pos = ent:GetPos()
|
||||
if (pos.X>=min.X) and (pos.X<=max.X) and
|
||||
(pos.Y>=min.Y) and (pos.Y<=max.Y) and
|
||||
(pos.Z>=min.Z) and (pos.Z<=max.Z) and PPCheck( ply, ent ) then
|
||||
@ -335,7 +332,7 @@ if(SERVER) then
|
||||
--select all owned props
|
||||
Entities = {}
|
||||
local PPCheck = (tobool(ply:GetInfo("advdupe2_copy_only_mine")) and CPPI~=nil) and PlayerCanDupeCPPI or PlayerCanDupeTool
|
||||
for _, ent in pairs(ents.GetAll()) do
|
||||
for _, ent in ents.Iterator() do
|
||||
if PPCheck( ply, ent ) then
|
||||
Entities[ent:EntIndex()] = ent
|
||||
end
|
||||
@ -812,10 +809,10 @@ if(SERVER) then
|
||||
return
|
||||
end
|
||||
|
||||
local Entities = ents.GetAll()
|
||||
for k,v in pairs(Entities) do
|
||||
if v:CreatedByMap() or not AdvDupe2.duplicator.IsCopyable(v) then
|
||||
Entities[k]=nil
|
||||
local Entities = {}
|
||||
for _, v in ents.Iterator() do
|
||||
if not v:CreatedByMap() and AdvDupe2.duplicator.IsCopyable(v) then
|
||||
Entities[v:EntIndex()] = v
|
||||
end
|
||||
end
|
||||
|
||||
@ -1688,10 +1685,8 @@ if(CLIENT) then
|
||||
|
||||
|
||||
local function FindInBox(min, max, ply)
|
||||
|
||||
local Entities = ents.GetAll()
|
||||
local EntTable = {}
|
||||
for _,ent in pairs(Entities) do
|
||||
for _,ent in ents.Iterator() do
|
||||
local pos = ent:GetPos()
|
||||
if (pos.X>=min.X) and (pos.X<=max.X) and (pos.Y>=min.Y) and (pos.Y<=max.Y) and (pos.Z>=min.Z) and (pos.Z<=max.Z) then
|
||||
--if(ent:GetClass()~="C_BaseFlexclass") then
|
||||
|
Loading…
Reference in New Issue
Block a user