mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-20 06:52:03 +00:00
AUFTRAG
- Added check for cargo in zone
This commit is contained in:
@@ -980,6 +980,28 @@ do -- SET_BASE
|
|||||||
return ObjectNames
|
return ObjectNames
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Checks whether all or optionally any objects is inside a given zone.
|
||||||
|
-- @param #SET_BASE self
|
||||||
|
-- @param Core.Zone#ZONE Zone The zone.
|
||||||
|
-- @param #boolean Any If `true`, at least one object has to be inside the zone. If `false` or `nil`, all objects need to be in the zone.
|
||||||
|
-- @return #boolean Retruns `true` if objects are in the zone and `false` otherwise.
|
||||||
|
function SET_BASE:IsInZone(Zone, Any)
|
||||||
|
|
||||||
|
for ObjectName, Object in pairs(self.Set) do
|
||||||
|
local object=Object --Wrapper.Positionable#POSITIONABLE
|
||||||
|
local inzone=object:IsInZone(Zone)
|
||||||
|
if inzone and Any then
|
||||||
|
-- We want at least one and this one is
|
||||||
|
return true
|
||||||
|
elseif not inzone then
|
||||||
|
-- We want all but at least one is not
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
--- Flushes the current SET_BASE contents in the log ... (for debugging reasons).
|
--- Flushes the current SET_BASE contents in the log ... (for debugging reasons).
|
||||||
-- @param #SET_BASE self
|
-- @param #SET_BASE self
|
||||||
-- @param Core.Base#BASE MasterObject (Optional) The master object as a reference.
|
-- @param Core.Base#BASE MasterObject (Optional) The master object as a reference.
|
||||||
|
|||||||
@@ -4228,6 +4228,28 @@ function AUFTRAG:IsReadyToGo()
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if self.type==AUFTRAG.Type.FREIGHTTRANSPORT then
|
||||||
|
|
||||||
|
local cargoset=self.DCStask.params.cargo --Core.Set#SET_STATIC
|
||||||
|
|
||||||
|
for _,_opsgroup in pairs(self:GetOpsGroups()) do
|
||||||
|
local opsgroup=_opsgroup --Ops.OpsGroup#OPSGROUP
|
||||||
|
|
||||||
|
local vec2=opsgroup.group:GetFirstUnitAlive():GetVec2()
|
||||||
|
|
||||||
|
local zone=ZONE_RADIUS:New("Bla", vec2, 40, true)
|
||||||
|
|
||||||
|
local inzone=cargoset:IsInZone(zone)
|
||||||
|
|
||||||
|
if not inzone then
|
||||||
|
printf("FF cargo is not inside zone")
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-- We're good to go!
|
-- We're good to go!
|
||||||
return true
|
return true
|
||||||
|
|||||||
Reference in New Issue
Block a user