Clean up code

This commit is contained in:
rilgamon 2021-04-04 15:48:38 +02:00
parent 1c9463be2c
commit 60ad7436b9
2 changed files with 4 additions and 8 deletions

View File

@ -47,9 +47,9 @@ local function scanAllBags(delayed)
end
local function bagLoop(id, res)
local units = child:GetNamespace('units')
local playerID = child.getPID()
for k, v in pairs(modul['db']) do
if(units[k]) then
local playerID = child.getPID()
if(playerID and units[k]['faction'] == units[playerID]['faction']) then
local unitname = units[k]['name']
for bag, list in pairs(v) do

View File

@ -77,18 +77,14 @@ local function scanAllBankBags(delayed)
end
local function bagLoop(id, res)
local dName = desc
local units = child:GetNamespace('units')
local playerID = child.getPID()
for k,v in pairs(modul['db']) do
local units = child:GetNamespace('units')
if(units[k]) then
local playerID = child.getPID()
if(playerID and units[k]['faction'] == units[playerID]['faction']) then
local unitname = units[k]['name']
for bag, list in pairs(v) do
if(bag == -3) then
dName = 'reagentCount'
else
dName = desc
end
dName = bag == -3 and 'reagentCount' or desc
for a, b in pairs(list) do
if(a == id) then
res[unitname] = res[unitname] or {