mirror of
https://github.com/mrSkortch/MissionScriptingTools.git
synced 2025-08-15 10:47:23 +00:00
Hotfix some bugs
Fixed: verifyDB to check for empty string from static objects because it apparently can happen. Fixed: checkSpawnedEventsNew to better handle errors from dbUpdate Fixed: getUnitsInPolygon was erroneously checking for category 14 instead of 1 Fixed: getUNitsInZones had an incorrectly named variable that defined an entry as nil.
This commit is contained in:
parent
f657c5d5a6
commit
d1e57e4107
26
mist.lua
26
mist.lua
@ -35,7 +35,7 @@ mist = {}
|
|||||||
-- don't change these
|
-- don't change these
|
||||||
mist.majorVersion = 4
|
mist.majorVersion = 4
|
||||||
mist.minorVersion = 5
|
mist.minorVersion = 5
|
||||||
mist.build = 103
|
mist.build = 104
|
||||||
|
|
||||||
-- forward declaration of log shorthand
|
-- forward declaration of log shorthand
|
||||||
local log
|
local log
|
||||||
@ -927,7 +927,10 @@ do -- the main scope
|
|||||||
|
|
||||||
if stillExists == true and (updated == true or not mist.DBs.groupsByName[name]) then
|
if stillExists == true and (updated == true or not mist.DBs.groupsByName[name]) then
|
||||||
--dbLog:info('Get Table')
|
--dbLog:info('Get Table')
|
||||||
writeGroups[#writeGroups+1] = {data = dbUpdate(name, gData.type), isUpdated = updated}
|
local dbData = dbUpdate(name, gData.type)
|
||||||
|
if dbData and type(dbData) == 'table' then
|
||||||
|
writeGroups[#writeGroups+1] = {data = dbData, isUpdated = updated}
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
-- Work done, so remove
|
-- Work done, so remove
|
||||||
@ -1226,12 +1229,15 @@ do -- the main scope
|
|||||||
for i = 1, #st do
|
for i = 1, #st do
|
||||||
local s = st[i]
|
local s = st[i]
|
||||||
if StaticObject.isExist(s) then
|
if StaticObject.isExist(s) then
|
||||||
if not mist.DBs.unitsByName[s:getName()] then
|
local name = s:getName()
|
||||||
--env.info(StaticObject.getID(s) .. ' Not found in DB yet')
|
if not mist.DBs.unitsByName[name] then
|
||||||
tempSpawnedGroups[s:getName()] = {type = 'static'}
|
dbLog:warn('$1 Not found in DB yet. ID: $2', name, StaticObject.getID(s))
|
||||||
tempSpawnGroupsCounter = tempSpawnGroupsCounter + 1
|
if string.len(name) > 0 then -- because in this mission someone sent the name was returning as an empty string. Gotta be careful.
|
||||||
end
|
tempSpawnedGroups[s:getName()] = {type = 'static'}
|
||||||
end
|
tempSpawnGroupsCounter = tempSpawnGroupsCounter + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@ -2941,7 +2947,7 @@ function mist.getUnitsInPolygon(unit_names, polyZone, max_alt)
|
|||||||
for i =1, #units do
|
for i =1, #units do
|
||||||
local lUnit = units[i]
|
local lUnit = units[i]
|
||||||
local lCat = lUnit:getCategory()
|
local lCat = lUnit:getCategory()
|
||||||
if ((lCat == 14 and lUnit:isActive()) or lCat ~= 1) and mist.pointInPolygon(lUnit:getPosition().p, polyZone, max_alt) then
|
if ((lCat == 1 and lUnit:isActive()) or lCat ~= 1) and mist.pointInPolygon(lUnit:getPosition().p, polyZone, max_alt) then
|
||||||
inZoneUnits[#inZoneUnits + 1] = lUnit
|
inZoneUnits[#inZoneUnits + 1] = lUnit
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -2964,7 +2970,7 @@ function mist.getUnitsInZones(unit_names, zone_names, zone_type)
|
|||||||
local zones = {}
|
local zones = {}
|
||||||
|
|
||||||
if zone_names and type(zone_names) == 'string' then
|
if zone_names and type(zone_names) == 'string' then
|
||||||
zone_names = {zoneNames}
|
zone_names = {zone_names}
|
||||||
end
|
end
|
||||||
for k = 1, #unit_names do
|
for k = 1, #unit_names do
|
||||||
|
|
||||||
|
|||||||
@ -35,7 +35,7 @@ mist = {}
|
|||||||
-- don't change these
|
-- don't change these
|
||||||
mist.majorVersion = 4
|
mist.majorVersion = 4
|
||||||
mist.minorVersion = 5
|
mist.minorVersion = 5
|
||||||
mist.build = 103
|
mist.build = 104
|
||||||
|
|
||||||
-- forward declaration of log shorthand
|
-- forward declaration of log shorthand
|
||||||
local log
|
local log
|
||||||
@ -927,7 +927,10 @@ do -- the main scope
|
|||||||
|
|
||||||
if stillExists == true and (updated == true or not mist.DBs.groupsByName[name]) then
|
if stillExists == true and (updated == true or not mist.DBs.groupsByName[name]) then
|
||||||
--dbLog:info('Get Table')
|
--dbLog:info('Get Table')
|
||||||
writeGroups[#writeGroups+1] = {data = dbUpdate(name, gData.type), isUpdated = updated}
|
local dbData = dbUpdate(name, gData.type)
|
||||||
|
if dbData and type(dbData) == 'table' then
|
||||||
|
writeGroups[#writeGroups+1] = {data = dbData, isUpdated = updated}
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
-- Work done, so remove
|
-- Work done, so remove
|
||||||
@ -1226,12 +1229,15 @@ do -- the main scope
|
|||||||
for i = 1, #st do
|
for i = 1, #st do
|
||||||
local s = st[i]
|
local s = st[i]
|
||||||
if StaticObject.isExist(s) then
|
if StaticObject.isExist(s) then
|
||||||
if not mist.DBs.unitsByName[s:getName()] then
|
local name = s:getName()
|
||||||
--env.info(StaticObject.getID(s) .. ' Not found in DB yet')
|
if not mist.DBs.unitsByName[name] then
|
||||||
tempSpawnedGroups[s:getName()] = {type = 'static'}
|
dbLog:warn('$1 Not found in DB yet. ID: $2', name, StaticObject.getID(s))
|
||||||
tempSpawnGroupsCounter = tempSpawnGroupsCounter + 1
|
if string.len(name) > 0 then -- because in this mission someone sent the name was returning as an empty string. Gotta be careful.
|
||||||
end
|
tempSpawnedGroups[s:getName()] = {type = 'static'}
|
||||||
end
|
tempSpawnGroupsCounter = tempSpawnGroupsCounter + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@ -2941,7 +2947,7 @@ function mist.getUnitsInPolygon(unit_names, polyZone, max_alt)
|
|||||||
for i =1, #units do
|
for i =1, #units do
|
||||||
local lUnit = units[i]
|
local lUnit = units[i]
|
||||||
local lCat = lUnit:getCategory()
|
local lCat = lUnit:getCategory()
|
||||||
if ((lCat == 14 and lUnit:isActive()) or lCat ~= 1) and mist.pointInPolygon(lUnit:getPosition().p, polyZone, max_alt) then
|
if ((lCat == 1 and lUnit:isActive()) or lCat ~= 1) and mist.pointInPolygon(lUnit:getPosition().p, polyZone, max_alt) then
|
||||||
inZoneUnits[#inZoneUnits + 1] = lUnit
|
inZoneUnits[#inZoneUnits + 1] = lUnit
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -2964,7 +2970,7 @@ function mist.getUnitsInZones(unit_names, zone_names, zone_type)
|
|||||||
local zones = {}
|
local zones = {}
|
||||||
|
|
||||||
if zone_names and type(zone_names) == 'string' then
|
if zone_names and type(zone_names) == 'string' then
|
||||||
zone_names = {zoneNames}
|
zone_names = {zone_names}
|
||||||
end
|
end
|
||||||
for k = 1, #unit_names do
|
for k = 1, #unit_names do
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user