This commit is contained in:
Applevangelist 2023-12-29 14:51:19 +01:00
parent bfab0fa542
commit c11ca9df4d
3 changed files with 17 additions and 9 deletions

View File

@ -22,7 +22,7 @@
-- @module Functional.Mantis
-- @image Functional.Mantis.jpg
--
-- Last Update: Nov 2023
-- Last Update: Dec 2023
-------------------------------------------------------------------------
--- **MANTIS** class, extends Core.Base#BASE
@ -631,7 +631,7 @@ do
-- TODO Version
-- @field #string version
self.version="0.8.15"
self.version="0.8.16"
self:I(string.format("***** Starting MANTIS Version %s *****", self.version))
--- FSM Functions ---
@ -1149,7 +1149,7 @@ do
--self:T(self.lid.." Relocating HQ")
local text = self.lid.." Relocating HQ"
--local m= MESSAGE:New(text,10,"MANTIS"):ToAll()
_hqgrp:RelocateGroundRandomInRadius(20,500,true,true)
_hqgrp:RelocateGroundRandomInRadius(20,500,true,true,nil,true)
end
--relocate EWR
-- TODO: maybe dependent on AlarmState? Observed: SA11 SR only relocates if no objects in reach
@ -1163,7 +1163,7 @@ do
local text = self.lid.." Relocating EWR ".._grp:GetName()
local m= MESSAGE:New(text,10,"MANTIS"):ToAllIf(self.debug)
if self.verbose then self:I(text) end
_grp:RelocateGroundRandomInRadius(20,500,true,true)
_grp:RelocateGroundRandomInRadius(20,500,true,true,nil,true)
end
end
end

View File

@ -17,9 +17,9 @@
--
-- ===
--
-- ### Authors: **FlightControl**, **applevangelist**
-- ### Authors: **applevangelist**, **FlightControl**
--
-- Last Update: Oct 2023
-- Last Update: Dec 2023
--
-- ===
--
@ -144,7 +144,7 @@ function SEAD:New( SEADGroupPrefixes, Padding )
self:AddTransition("*", "ManageEvasion", "*")
self:AddTransition("*", "CalculateHitZone", "*")
self:I("*** SEAD - Started Version 0.4.5")
self:I("*** SEAD - Started Version 0.4.6")
return self
end
@ -401,7 +401,7 @@ function SEAD:onafterManageEvasion(From,Event,To,_targetskill,_targetgroup,SEADP
grp:EnableEmission(false)
end
grp:OptionAlarmStateGreen() -- needed else we cannot move around
grp:RelocateGroundRandomInRadius(20,300,false,false,"Diamond")
grp:RelocateGroundRandomInRadius(20,300,false,false,"Diamond",true)
if self.UseCallBack then
local object = self.CallBack
object:SeadSuppressionStart(grp,name,attacker)

View File

@ -4025,14 +4025,22 @@ end
-- @param #boolean onroad If true, route on road (less problems with AI way finding), default true
-- @param #boolean shortcut If true and onroad is set, take a shorter route - if available - off road, default false
-- @param #string formation Formation string as in the mission editor, e.g. "Vee", "Diamond", "Line abreast", etc. Defaults to "Off Road"
-- @param #boolean onland (optional) If true, try up to 50 times to get a coordinate on land.SurfaceType.LAND. Note - this descriptor value is not reliably implemented on all maps.
-- @return #CONTROLLABLE self
function CONTROLLABLE:RelocateGroundRandomInRadius( speed, radius, onroad, shortcut, formation )
function CONTROLLABLE:RelocateGroundRandomInRadius( speed, radius, onroad, shortcut, formation, onland )
self:F2( { self.ControllableName } )
local _coord = self:GetCoordinate()
local _radius = radius or 500
local _speed = speed or 20
local _tocoord = _coord:GetRandomCoordinateInRadius( _radius, 100 )
if onland then
for i=1,50 do
local island = _tocoord:GetSurfaceType() == land.SurfaceType.LAND and true or false
if island then break end
_tocoord = _coord:GetRandomCoordinateInRadius( _radius, 100 )
end
end
local _onroad = onroad or true
local _grptsk = {}
local _candoroad = false