mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
Merge remote-tracking branch 'origin/master' into branch
This commit is contained in:
commit
1e1ed92d52
@ -867,6 +867,7 @@ do
|
||||
-- my_ctld.TroopUnloadDistHoverHook = 5 -- When hovering, unload troops this far behind the Chinook
|
||||
-- my_ctld.showstockinmenuitems = false -- When set to true, the menu lines will also show the remaining items in stock (that is, if you set any), downside is that the menu for all will be build every 30 seconds anew.
|
||||
-- my_ctld.onestepmenu = false -- When set to true, the menu will create Drop and build, Get and load, Pack and remove, Pack and load, Pack. it will be a 1 step solution.
|
||||
-- my_ctld.VehicleMoveFormation = AI.Task.VehicleFormation.VEE -- When a group moves to a MOVE zone, then it takes this formation. Can be a table of formations, which are then randomly chosen. Defaults to "Vee".
|
||||
--
|
||||
-- ## 2.1 CH-47 Chinook support
|
||||
--
|
||||
@ -1294,6 +1295,7 @@ CTLD = {
|
||||
LoadedGroupsTable = {},
|
||||
keeploadtable = true,
|
||||
allowCATransport = false,
|
||||
VehicleMoveFormation = AI.Task.VehicleFormation.VEE,
|
||||
}
|
||||
|
||||
------------------------------
|
||||
@ -1414,7 +1416,7 @@ CTLD.FixedWingTypes = {
|
||||
|
||||
--- CTLD class version.
|
||||
-- @field #string version
|
||||
CTLD.version="1.3.36"
|
||||
CTLD.version="1.3.37"
|
||||
|
||||
--- Instantiate a new CTLD.
|
||||
-- @param #CTLD self
|
||||
@ -1554,6 +1556,8 @@ function CTLD:New(Coalition, Prefixes, Alias)
|
||||
self.movetroopsdistance = 5000
|
||||
self.troopdropzoneradius = 100
|
||||
|
||||
self.VehicleMoveFormation = AI.Task.VehicleFormation.VEE
|
||||
|
||||
-- added support Hercules Mod
|
||||
self.enableHercules = false -- deprecated
|
||||
self.enableFixedWing = false
|
||||
@ -4197,6 +4201,17 @@ function CTLD:_BuildObjectFromCrates(Group,Unit,Build,Repair,RepairLocation,Mult
|
||||
return self
|
||||
end
|
||||
|
||||
--- (Internal) Function to get a vehicle formation for a moving group
|
||||
-- @param #CTLD self
|
||||
-- @return #string Formation
|
||||
function CTLD:_GetVehicleFormation()
|
||||
local VehicleMoveFormation = self.VehicleMoveFormation or AI.Task.VehicleFormation.VEE
|
||||
if type(self.VehicleMoveFormation)=="table" then
|
||||
VehicleMoveFormation = self.VehicleMoveFormation[math.random(1,#self.VehicleMoveFormation)]
|
||||
end
|
||||
return VehicleMoveFormation
|
||||
end
|
||||
|
||||
--- (Internal) Function to move group to WP zone.
|
||||
-- @param #CTLD self
|
||||
-- @param Wrapper.Group#GROUP Group The Group to move.
|
||||
@ -4211,18 +4226,20 @@ function CTLD:_MoveGroupToZone(Group)
|
||||
-- yes, we can ;)
|
||||
local groupname = Group:GetName()
|
||||
local zonecoord = zone:GetRandomCoordinate(20,125) -- Core.Point#COORDINATE
|
||||
local coordinate = zonecoord:GetVec2()
|
||||
local formation = self:_GetVehicleFormation()
|
||||
--local coordinate = zonecoord:GetVec2()
|
||||
Group:SetAIOn()
|
||||
Group:OptionAlarmStateAuto()
|
||||
Group:OptionDisperseOnAttack(30)
|
||||
Group:OptionROEOpenFirePossible()
|
||||
Group:RouteToVec2(coordinate,5)
|
||||
Group:OptionROEOpenFire()
|
||||
Group:RouteGroundTo(zonecoord,25,formation)
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
--- (Internal) Housekeeping - Cleanup crates when build
|
||||
-- @param #CTLD self
|
||||
--
|
||||
-- @param #table Crates Table of #CTLD_CARGO objects near the unit.
|
||||
-- @param #CTLD.Buildable Build Table build object.
|
||||
-- @param #number Number Number of objects in Crates (found) to limit search.
|
||||
@ -7134,6 +7151,16 @@ end
|
||||
local filepath = self.filepath
|
||||
self:__Save(interval,filepath,filename)
|
||||
end
|
||||
|
||||
if type(self.VehicleMoveFormation) == "table" then
|
||||
local Formations = {}
|
||||
for _,_formation in pairs(self.VehicleMoveFormation) do
|
||||
table.insert(Formations,_formation)
|
||||
end
|
||||
self.VehicleMoveFormation = nil
|
||||
self.VehicleMoveFormation = Formations
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
@ -4598,16 +4598,16 @@ function UTILS.DoStringIn(State,DoString)
|
||||
return net.dostring_in(State,DoString)
|
||||
end
|
||||
|
||||
--- Show a picture on the screen
|
||||
--- Show a picture on the screen to all
|
||||
-- @param #string FileName File name of the picture
|
||||
-- @param #number Duration Duration in seconds, defaults to 10
|
||||
-- @param #boolean ClearView If true, clears the view before showing the picture, defaults to false
|
||||
-- @param #number StartDelay Delay in seconds before showing the picture, defaults to 0
|
||||
-- @param #number HorizontalAlign Horizontal alignment of the picture, defaults to 1 (left), can be 0 (center) or 2 (right)
|
||||
-- @param #number VerticalAlign Vertical alignment of the picture, defaults to 1 (top), can be 0 (center) or 2 (bottom)
|
||||
-- @param #number HorizontalAlign Horizontal alignment of the picture, 0: Left, 1: Center, 2: Right
|
||||
-- @param #number VerticalAlign Vertical alignment of the picture, 0: Top, 1: Center, 2: Bottom
|
||||
-- @param #number Size Size of the picture in percent, defaults to 100
|
||||
-- @param #number SizeUnits Size units, defaults to 0 (percent), can be 1 (pixels)
|
||||
function UTILS.ShowPicture(FileName, Duration, ClearView, StartDelay, HorizontalAlign, VerticalAlign, Size, SizeUnits)
|
||||
-- @param #number SizeUnits Size units, 0 for % of original picture size, and 1 for % of window size
|
||||
function UTILS.ShowPictureToAll(FilePath, Duration, ClearView, StartDelay, HorizontalAlign, VerticalAlign, Size, SizeUnits)
|
||||
ClearView = ClearView or false
|
||||
StartDelay = StartDelay or 0
|
||||
HorizontalAlign = HorizontalAlign or 1
|
||||
@ -4617,7 +4617,101 @@ function UTILS.ShowPicture(FileName, Duration, ClearView, StartDelay, Horizontal
|
||||
|
||||
if ClearView then ClearView = "true" else ClearView = "false" end
|
||||
|
||||
net.dostring_in("mission", string.format("a_out_picture(getValueResourceByKey(\"%s\"), %d, %s, %d, \"%d\", \"%d\", %d, \"%d\")", FileName, Duration or 10, ClearView, StartDelay, HorizontalAlign, VerticalAlign, Size, SizeUnits))
|
||||
net.dostring_in("mission", string.format("a_out_picture(\"%s\", %d, %s, %d, \"%d\", \"%d\", %d, \"%d\")", FilePath, Duration or 10, ClearView, StartDelay, HorizontalAlign, VerticalAlign, Size, SizeUnits))
|
||||
end
|
||||
|
||||
--- Show a picture on the screen to Coalition
|
||||
-- @param #number Coalition Coalition ID, can be coalition.side.BLUE, coalition.side.RED or coalition.side.NEUTRAL
|
||||
-- @param #string FileName File name of the picture
|
||||
-- @param #number Duration Duration in seconds, defaults to 10
|
||||
-- @param #boolean ClearView If true, clears the view before showing the picture, defaults to false
|
||||
-- @param #number StartDelay Delay in seconds before showing the picture, defaults to 0
|
||||
-- @param #number HorizontalAlign Horizontal alignment of the picture, 0: Left, 1: Center, 2: Right
|
||||
-- @param #number VerticalAlign Vertical alignment of the picture, 0: Top, 1: Center, 2: Bottom
|
||||
-- @param #number Size Size of the picture in percent, defaults to 100
|
||||
-- @param #number SizeUnits Size units, 0 for % of original picture size, and 1 for % of window size
|
||||
function UTILS.ShowPictureToCoalition(Coalition, FilePath, Duration, ClearView, StartDelay, HorizontalAlign, VerticalAlign, Size, SizeUnits)
|
||||
ClearView = ClearView or false
|
||||
StartDelay = StartDelay or 0
|
||||
HorizontalAlign = HorizontalAlign or 1
|
||||
VerticalAlign = VerticalAlign or 1
|
||||
Size = Size or 100
|
||||
SizeUnits = SizeUnits or 0
|
||||
|
||||
if ClearView then ClearView = "true" else ClearView = "false" end
|
||||
|
||||
local coalName = string.lower(UTILS.GetCoalitionName(Coalition))
|
||||
|
||||
net.dostring_in("mission", string.format("a_out_picture_s(\"%s\", \"%s\", %d, %s, %d, \"%d\", \"%d\", %d, \"%d\")", coalName, FilePath, Duration or 10, ClearView, StartDelay, HorizontalAlign, VerticalAlign, Size, SizeUnits))
|
||||
end
|
||||
|
||||
--- Show a picture on the screen to Country
|
||||
-- @param #number Country Country ID, can be country.id.USA, country.id.RUSSIA, etc.
|
||||
-- @param #string FileName File name of the picture
|
||||
-- @param #number Duration Duration in seconds, defaults to 10
|
||||
-- @param #boolean ClearView If true, clears the view before showing the picture, defaults to false
|
||||
-- @param #number StartDelay Delay in seconds before showing the picture, defaults to 0
|
||||
-- @param #number HorizontalAlign Horizontal alignment of the picture, 0: Left, 1: Center, 2: Right
|
||||
-- @param #number VerticalAlign Vertical alignment of the picture, 0: Top, 1: Center, 2: Bottom
|
||||
-- @param #number Size Size of the picture in percent, defaults to 100
|
||||
-- @param #number SizeUnits Size units, 0 for % of original picture size, and 1 for % of window size
|
||||
function UTILS.ShowPictureToCountry(Country, FilePath, Duration, ClearView, StartDelay, HorizontalAlign, VerticalAlign, Size, SizeUnits)
|
||||
ClearView = ClearView or false
|
||||
StartDelay = StartDelay or 0
|
||||
HorizontalAlign = HorizontalAlign or 1
|
||||
VerticalAlign = VerticalAlign or 1
|
||||
Size = Size or 100
|
||||
SizeUnits = SizeUnits or 0
|
||||
|
||||
if ClearView then ClearView = "true" else ClearView = "false" end
|
||||
|
||||
net.dostring_in("mission", string.format("a_out_picture_c(%d, \"%s\", %d, %s, %d, \"%d\", \"%d\", %d, \"%d\")", Country, FilePath, Duration or 10, ClearView, StartDelay, HorizontalAlign, VerticalAlign, Size, SizeUnits))
|
||||
end
|
||||
|
||||
--- Show a picture on the screen to Group
|
||||
-- @param Wrapper.Group#GROUP Group Group to show the picture to
|
||||
-- @param #string FileName File name of the picture
|
||||
-- @param #number Duration Duration in seconds, defaults to 10
|
||||
-- @param #boolean ClearView If true, clears the view before showing the picture, defaults to false
|
||||
-- @param #number StartDelay Delay in seconds before showing the picture, defaults to 0
|
||||
-- @param #number HorizontalAlign Horizontal alignment of the picture, 0: Left, 1: Center, 2: Right
|
||||
-- @param #number VerticalAlign Vertical alignment of the picture, 0: Top, 1: Center, 2: Bottom
|
||||
-- @param #number Size Size of the picture in percent, defaults to 100
|
||||
-- @param #number SizeUnits Size units, 0 for % of original picture size, and 1 for % of window size
|
||||
function UTILS.ShowPictureToGroup(Group, FilePath, Duration, ClearView, StartDelay, HorizontalAlign, VerticalAlign, Size, SizeUnits)
|
||||
ClearView = ClearView or false
|
||||
StartDelay = StartDelay or 0
|
||||
HorizontalAlign = HorizontalAlign or 1
|
||||
VerticalAlign = VerticalAlign or 1
|
||||
Size = Size or 100
|
||||
SizeUnits = SizeUnits or 0
|
||||
|
||||
if ClearView then ClearView = "true" else ClearView = "false" end
|
||||
|
||||
net.dostring_in("mission", string.format("a_out_picture_g(%d, \"%s\", %d, %s, %d, \"%d\", \"%d\", %d, \"%d\")", Group:GetID(), FilePath, Duration or 10, ClearView, StartDelay, HorizontalAlign, VerticalAlign, Size, SizeUnits))
|
||||
end
|
||||
|
||||
--- Show a picture on the screen to Unit
|
||||
-- @param Wrapper.Unit#UNIT Unit Unit to show the picture to
|
||||
-- @param #string FileName File name of the picture
|
||||
-- @param #number Duration Duration in seconds, defaults to 10
|
||||
-- @param #boolean ClearView If true, clears the view before showing the picture, defaults to false
|
||||
-- @param #number StartDelay Delay in seconds before showing the picture, defaults to 0
|
||||
-- @param #number HorizontalAlign Horizontal alignment of the picture, 0: Left, 1: Center, 2: Right
|
||||
-- @param #number VerticalAlign Vertical alignment of the picture, 0: Top, 1: Center, 2: Bottom
|
||||
-- @param #number Size Size of the picture in percent, defaults to 100
|
||||
-- @param #number SizeUnits Size units, 0 for % of original picture size, and 1 for % of window size
|
||||
function UTILS.ShowPictureToUnit(Unit, FilePath, Duration, ClearView, StartDelay, HorizontalAlign, VerticalAlign, Size, SizeUnits)
|
||||
ClearView = ClearView or false
|
||||
StartDelay = StartDelay or 0
|
||||
HorizontalAlign = HorizontalAlign or 1
|
||||
VerticalAlign = VerticalAlign or 1
|
||||
Size = Size or 100
|
||||
SizeUnits = SizeUnits or 0
|
||||
|
||||
if ClearView then ClearView = "true" else ClearView = "false" end
|
||||
|
||||
net.dostring_in("mission", string.format("a_out_picture_u(%d, \"%s\", %d, %s, %d, \"%d\", \"%d\", %d, \"%d\")", Unit:GetID(), FilePath, Duration or 10, ClearView, StartDelay, HorizontalAlign, VerticalAlign, Size, SizeUnits))
|
||||
end
|
||||
|
||||
--- Load a mission file. This will replace the current mission with the one given carrying along the online clients.
|
||||
@ -4629,22 +4723,36 @@ end
|
||||
--- Set the mission briefing for a coalition.
|
||||
-- @param #number Coalition Briefing coalition ID, can be coalition.side.BLUE, coalition.side.RED or coalition.side.NEUTRAL
|
||||
-- @param #string Text Briefing text, can contain newlines, will be converted formatted properly for DCS
|
||||
-- @param #string Picture Picture filename, can be a file in the DEFAULT folder inside the .miz
|
||||
-- @param #string Picture Picture file path, can be a file in the DEFAULT folder inside the .miz
|
||||
function UTILS.SetMissionBriefing(Coalition, Text, Picture)
|
||||
Text = Text or ""
|
||||
Text = Text:gsub("\n", "\\n")
|
||||
Picture = Picture or ""
|
||||
local coalName = string.lower(UTILS.GetCoalitionName(Coalition))
|
||||
net.dostring_in("mission", string.format("a_set_briefing(\"%s\", getValueResourceByKey(\"%s\"), \"%s\")", coalName, Picture, Text))
|
||||
net.dostring_in("mission", string.format("a_set_briefing(\"%s\", \"%s\", \"%s\")", coalName, Picture, Text))
|
||||
end
|
||||
|
||||
--- Show a helper gate at a DCS#Vec3 position
|
||||
-- @param DCS#Vec3 pos The position
|
||||
-- @param number heading Heading in degrees, can be 0..359 degrees
|
||||
-- @param #number heading Heading in degrees, can be 0..359 degrees
|
||||
function UTILS.ShowHelperGate(pos, heading)
|
||||
net.dostring_in("mission",string.format("a_show_helper_gate(%s, %s, %s, %f)", pos.x, pos.y, pos.z, math.rad(heading)))
|
||||
end
|
||||
|
||||
--- Show a helper gate for a unit.
|
||||
-- @param Wrapper.Unit#UNIT Unit The unit to show the gate for
|
||||
-- @param #number Flag Helper gate flag
|
||||
function UTILS.ShowHelperGateForUnit(Unit, Flag)
|
||||
net.dostring_in("mission",string.format("a_show_route_gates_for_unit(%d, \"%d\")", Unit:GetID(), Flag))
|
||||
end
|
||||
|
||||
--- Set the carrier illumination mode. -2: OFF, -1: AUTO, 0: NAVIGATION, 1: AC LAUNCH, 2: AC RECOVERY
|
||||
-- @param #number UnitID Carrier unit ID ( UNIT:GetID() )
|
||||
-- @param #number Mode Illumination mode, can be -2: OFF, -1: AUTO, 0: NAVIGATION, 1: AC LAUNCH, 2: AC RECOVERY
|
||||
function UTILS.SetCarrierIlluminationMode(UnitID, Mode)
|
||||
net.dostring_in("mission",string.format("a_set_carrier_illumination_mode(%d, %d)", UnitID, Mode))
|
||||
end
|
||||
|
||||
--- Shell a zone, zone must ME created
|
||||
-- @param #string name The name of the ME created zone
|
||||
-- @param #number power Equals kg of TNT, e.g. 75
|
||||
|
||||
@ -1931,3 +1931,10 @@ end
|
||||
function UNIT:SetLife(Percent)
|
||||
net.dostring_in("mission",string.format("a_unit_set_life_percentage(%d, %f)", self:GetID(), Percent))
|
||||
end
|
||||
|
||||
--- Set the carrier illumination mode. -2: OFF, -1: AUTO, 0: NAVIGATION, 1: AC LAUNCH, 2: AC RECOVERY
|
||||
-- @param #UNIT self
|
||||
-- @param #number Mode Illumination mode, can be -2: OFF, -1: AUTO, 0: NAVIGATION, 1: AC LAUNCH, 2: AC RECOVERY
|
||||
function UNIT:SetCarrierIlluminationMode(Mode)
|
||||
UTILS.SetCarrierIlluminationMode(self:GetID(), Mode)
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user