mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
OPS
- Fixed inAir check for spawned groups - Reduced SCHEDULER min delay to 0.001 sec (was 0.1 sec)
This commit is contained in:
parent
fd4e478dbf
commit
fe55555c67
@ -1140,8 +1140,8 @@ end
|
||||
-- @param DCS#Vec3 CV2 Vec3
|
||||
function AI_FORMATION:FollowMe(FollowGroup, ClientUnit, CT1, CV1, CT2, CV2)
|
||||
|
||||
if FollowGroup:GetState( FollowGroup, "Mode" ) == self.__Enum.Mode.Formation then
|
||||
|
||||
if FollowGroup:GetState( FollowGroup, "Mode" ) == self.__Enum.Mode.Formation and not self:Is("Stopped") then
|
||||
|
||||
self:T({Mode=FollowGroup:GetState( FollowGroup, "Mode" )})
|
||||
|
||||
FollowGroup:OptionROTEvadeFire()
|
||||
|
||||
@ -122,7 +122,7 @@ function SCHEDULEDISPATCHER:AddSchedule( Scheduler, ScheduleFunction, ScheduleAr
|
||||
self.Schedule[Scheduler][CallID].Function = ScheduleFunction
|
||||
self.Schedule[Scheduler][CallID].Arguments = ScheduleArguments
|
||||
self.Schedule[Scheduler][CallID].StartTime = timer.getTime() + ( Start or 0 )
|
||||
self.Schedule[Scheduler][CallID].Start = Start + 0.1
|
||||
self.Schedule[Scheduler][CallID].Start = Start + 0.001
|
||||
self.Schedule[Scheduler][CallID].Repeat = Repeat or 0
|
||||
self.Schedule[Scheduler][CallID].Randomize = Randomize or 0
|
||||
self.Schedule[Scheduler][CallID].Stop = Stop
|
||||
|
||||
@ -1169,7 +1169,8 @@ function FLIGHTGROUP:OnEventBirth(EventData)
|
||||
|
||||
-- Set element to spawned state.
|
||||
self:T(self.lid..string.format("EVENT: Element %s born at airbase %s==> spawned", element.name, self.homebase and self.homebase:GetName() or "unknown"))
|
||||
self:ElementSpawned(element)
|
||||
-- This is delayed by a millisec because inAir check for units spawned in air failed (returned false even though the unit was spawned in air).
|
||||
self:__ElementSpawned(0.0, element)
|
||||
|
||||
end
|
||||
|
||||
@ -1436,7 +1437,7 @@ function FLIGHTGROUP:onafterElementSpawned(From, Event, To, Element)
|
||||
-- Set element status.
|
||||
self:_UpdateStatus(Element, OPSGROUP.ElementStatus.SPAWNED)
|
||||
|
||||
if Element.unit:InAir() then
|
||||
if Element.unit:InAir(true) then
|
||||
-- Trigger ElementAirborne event. Add a little delay because spawn is also delayed!
|
||||
self:__ElementAirborne(0.11, Element)
|
||||
else
|
||||
@ -2008,7 +2009,7 @@ function FLIGHTGROUP:onafterUpdateRoute(From, Event, To, n)
|
||||
if #wp>1 then
|
||||
|
||||
-- Route group to all defined waypoints remaining.
|
||||
self:Route(wp, 1)
|
||||
self:Route(wp)
|
||||
|
||||
else
|
||||
|
||||
|
||||
@ -2223,7 +2223,7 @@ function OPSGROUP:onafterTaskExecute(From, Event, To, Task)
|
||||
local TaskFinal=self.group:TaskCombo({TaskControlled, TaskDone})
|
||||
|
||||
-- Set task for group.
|
||||
self:SetTask(TaskFinal, 1)
|
||||
self:SetTask(TaskFinal)
|
||||
|
||||
end
|
||||
|
||||
|
||||
@ -1174,8 +1174,9 @@ end
|
||||
|
||||
--- Returns true if the UNIT is in the air.
|
||||
-- @param #UNIT self
|
||||
-- @param #boolean NoHeloCheck If true, no additonal checks for helos are performed.
|
||||
-- @return #boolean Return true if in the air or #nil if the UNIT is not existing or alive.
|
||||
function UNIT:InAir()
|
||||
function UNIT:InAir(NoHeloCheck)
|
||||
self:F2( self.UnitName )
|
||||
|
||||
-- Get DCS unit object.
|
||||
@ -1185,14 +1186,14 @@ function UNIT:InAir()
|
||||
|
||||
-- Get DCS result of whether unit is in air or not.
|
||||
local UnitInAir = DCSUnit:inAir()
|
||||
|
||||
|
||||
-- Get unit category.
|
||||
local UnitCategory = DCSUnit:getDesc().category
|
||||
|
||||
-- If DCS says that it is in air, check if this is really the case, since we might have landed on a building where inAir()=true but actually is not.
|
||||
-- This is a workaround since DCS currently does not acknoledge that helos land on buildings.
|
||||
-- Note however, that the velocity check will fail if the ground is moving, e.g. on an aircraft carrier!
|
||||
if UnitInAir==true and UnitCategory == Unit.Category.HELICOPTER then
|
||||
if UnitInAir==true and UnitCategory == Unit.Category.HELICOPTER and (not NoHeloCheck) then
|
||||
local VelocityVec3 = DCSUnit:getVelocity()
|
||||
local Velocity = UTILS.VecNorm(VelocityVec3)
|
||||
local Coordinate = DCSUnit:getPoint()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user