Merge remote-tracking branch 'origin/develop' into develop

This commit is contained in:
Applevangelist 2024-08-12 16:17:30 +02:00
commit 875b5fb34d
3 changed files with 183 additions and 180 deletions

View File

@ -26,7 +26,7 @@
-- @module Core.Base -- @module Core.Base
-- @image Core_Base.JPG -- @image Core_Base.JPG
local _TraceOnOff = true local _TraceOnOff = false -- default to no tracing
local _TraceLevel = 1 local _TraceLevel = 1
local _TraceAll = false local _TraceAll = false
local _TraceClass = {} local _TraceClass = {}
@ -1280,7 +1280,7 @@ end
-- @param Arguments A #table or any field. -- @param Arguments A #table or any field.
function BASE:F( Arguments ) function BASE:F( Arguments )
if BASE.Debug and _TraceOnOff then if BASE.Debug and _TraceOnOff == true then
local DebugInfoCurrent = BASE.Debug.getinfo( 2, "nl" ) local DebugInfoCurrent = BASE.Debug.getinfo( 2, "nl" )
local DebugInfoFrom = BASE.Debug.getinfo( 3, "l" ) local DebugInfoFrom = BASE.Debug.getinfo( 3, "l" )
@ -1295,7 +1295,7 @@ end
-- @param Arguments A #table or any field. -- @param Arguments A #table or any field.
function BASE:F2( Arguments ) function BASE:F2( Arguments )
if BASE.Debug and _TraceOnOff then if BASE.Debug and _TraceOnOff == true and _TraceLevel >= 2 then
local DebugInfoCurrent = BASE.Debug.getinfo( 2, "nl" ) local DebugInfoCurrent = BASE.Debug.getinfo( 2, "nl" )
local DebugInfoFrom = BASE.Debug.getinfo( 3, "l" ) local DebugInfoFrom = BASE.Debug.getinfo( 3, "l" )
@ -1310,7 +1310,7 @@ end
-- @param Arguments A #table or any field. -- @param Arguments A #table or any field.
function BASE:F3( Arguments ) function BASE:F3( Arguments )
if BASE.Debug and _TraceOnOff then if BASE.Debug and _TraceOnOff == true and _TraceLevel >= 3 then
local DebugInfoCurrent = BASE.Debug.getinfo( 2, "nl" ) local DebugInfoCurrent = BASE.Debug.getinfo( 2, "nl" )
local DebugInfoFrom = BASE.Debug.getinfo( 3, "l" ) local DebugInfoFrom = BASE.Debug.getinfo( 3, "l" )
@ -1354,7 +1354,7 @@ end
-- @param Arguments A #table or any field. -- @param Arguments A #table or any field.
function BASE:T( Arguments ) function BASE:T( Arguments )
if BASE.Debug and _TraceOnOff then if BASE.Debug and _TraceOnOff == true then
local DebugInfoCurrent = BASE.Debug.getinfo( 2, "nl" ) local DebugInfoCurrent = BASE.Debug.getinfo( 2, "nl" )
local DebugInfoFrom = BASE.Debug.getinfo( 3, "l" ) local DebugInfoFrom = BASE.Debug.getinfo( 3, "l" )
@ -1369,7 +1369,7 @@ end
-- @param Arguments A #table or any field. -- @param Arguments A #table or any field.
function BASE:T2( Arguments ) function BASE:T2( Arguments )
if BASE.Debug and _TraceOnOff then if BASE.Debug and _TraceOnOff == true and _TraceLevel >= 2 then
local DebugInfoCurrent = BASE.Debug.getinfo( 2, "nl" ) local DebugInfoCurrent = BASE.Debug.getinfo( 2, "nl" )
local DebugInfoFrom = BASE.Debug.getinfo( 3, "l" ) local DebugInfoFrom = BASE.Debug.getinfo( 3, "l" )
@ -1384,7 +1384,7 @@ end
-- @param Arguments A #table or any field. -- @param Arguments A #table or any field.
function BASE:T3( Arguments ) function BASE:T3( Arguments )
if BASE.Debug and _TraceOnOff then if BASE.Debug and _TraceOnOff == true and _TraceLevel >= 3 then
local DebugInfoCurrent = BASE.Debug.getinfo( 2, "nl" ) local DebugInfoCurrent = BASE.Debug.getinfo( 2, "nl" )
local DebugInfoFrom = BASE.Debug.getinfo( 3, "l" ) local DebugInfoFrom = BASE.Debug.getinfo( 3, "l" )

File diff suppressed because it is too large Load Diff

View File

@ -2817,6 +2817,7 @@ function CTLD:_FindCratesNearby( _group, _unit, _dist, _ignoreweight)
local capabilities = {} local capabilities = {}
local maxmass = 2000 local maxmass = 2000
local maxloadable = 2000 local maxloadable = 2000
local IsNoHook = not self:IsHook(_unit)
if not _ignoreweight then if not _ignoreweight then
maxloadable = self:_GetMaxLoadableMass(_unit) maxloadable = self:_GetMaxLoadableMass(_unit)
end end
@ -2830,14 +2831,14 @@ function CTLD:_FindCratesNearby( _group, _unit, _dist, _ignoreweight)
local cargoalive = false -- TODO dyn cargo spawn workaround local cargoalive = false -- TODO dyn cargo spawn workaround
local dcsunit = nil local dcsunit = nil
local dcsunitpos = nil local dcsunitpos = nil
if static.DCSCargoObject then if static and static.DCSCargoObject then
dcsunit = Unit.getByName(static.StaticName) dcsunit = Unit.getByName(static.StaticName)
if dcsunit then if dcsunit then
cargoalive = dcsunit:isExist() ~= nil and true or false cargoalive = dcsunit:isExist() ~= nil and true or false
end end
if cargoalive == true then if cargoalive == true then
local dcsvec3 = dcsunit:getPoint() or dcsunit:getPosition().p or {x=0,y=0,z=0} local dcsvec3 = dcsunit:getPoint() or dcsunit:getPosition().p or {x=0,y=0,z=0}
self:I({dcsvec3 = dcsunit:getPoint(), dcspos = dcsunit:getPosition().p}) self:T({dcsvec3 = dcsunit:getPoint(), dcspos = dcsunit:getPosition().p})
if dcsvec3 then if dcsvec3 then
dcsunitpos = COORDINATE:New(dcsvec3.x,dcsvec3.z,dcsvec3.y) dcsunitpos = COORDINATE:New(dcsvec3.x,dcsvec3.z,dcsvec3.y)
end end
@ -2850,9 +2851,10 @@ function CTLD:_FindCratesNearby( _group, _unit, _dist, _ignoreweight)
local agl = staticpos.y-landheight local agl = staticpos.y-landheight
agl = UTILS.Round(agl,2) agl = UTILS.Round(agl,2)
local GCloaded = agl > 0 and true or false local GCloaded = agl > 0 and true or false
if IsNoHook == true then GCloaded = false end
--- Testing --- Testing
local distance = self:_GetDistance(location,staticpos) local distance = self:_GetDistance(location,staticpos)
self:I({name=static:GetName(),agl=agl,GCloaded=GCloaded,distance=string.format("%.2f",distance or 0)}) self:T({name=static:GetName(),IsNoHook=IsNoHook,agl=agl,GCloaded=GCloaded,distance=string.format("%.2f",distance or 0)})
if (not GCloaded) and distance <= finddist and static and (weight <= maxloadable or _ignoreweight) then if (not GCloaded) and distance <= finddist and static and (weight <= maxloadable or _ignoreweight) then
index = index + 1 index = index + 1
table.insert(found, staticid, cargo) table.insert(found, staticid, cargo)