mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge pull request #966 from FlightControl-Master/FF/Develop
DESIGNATE Class fix
This commit is contained in:
commit
ea51622213
@ -89,11 +89,14 @@ function MENU_INDEX:PrepareCoalition( CoalitionSide )
|
||||
self.Coalition[CoalitionSide].Menus = self.Coalition[CoalitionSide].Menus or {}
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
-- @param Wrapper.Group#GROUP Group
|
||||
function MENU_INDEX:PrepareGroup( Group )
|
||||
if Group and Group:IsAlive() then
|
||||
local GroupName = Group:GetName()
|
||||
self.Group[GroupName] = self.Group[GroupName] or {}
|
||||
self.Group[GroupName].Menus = self.Group[GroupName].Menus or {}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -133,9 +136,11 @@ end
|
||||
|
||||
|
||||
function MENU_INDEX:HasGroupMenu( Group, Path )
|
||||
|
||||
local MenuGroupName = Group:GetName()
|
||||
return self.Group[MenuGroupName].Menus[Path]
|
||||
if Group and Group:IsAlive() then
|
||||
local MenuGroupName = Group:GetName()
|
||||
return self.Group[MenuGroupName].Menus[Path]
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
function MENU_INDEX:SetGroupMenu( Group, Path, Menu )
|
||||
|
||||
@ -798,6 +798,7 @@ function SET_GROUP:GetAliveSet()
|
||||
|
||||
-- Clean the Set before returning with only the alive Groups.
|
||||
for GroupName, GroupObject in pairs( self.Set ) do
|
||||
local GroupObject=GroupObject --Wrapper.Group#GROUP
|
||||
if GroupObject then
|
||||
if GroupObject:IsAlive() then
|
||||
AliveSet:Add( GroupName, GroupObject )
|
||||
|
||||
@ -175,7 +175,7 @@ do -- DESIGNATE
|
||||
-- Smoke will fire for 5 minutes.
|
||||
-- Each available recce within range will smoke a target.
|
||||
-- Smoking can be requested while lasing targets.
|
||||
-- Smoke will appear “around” the targets, because of accuracy limitations.
|
||||
-- Smoke will appear "around" the targets, because of accuracy limitations.
|
||||
--
|
||||
--
|
||||
-- Have FUN!
|
||||
@ -952,7 +952,8 @@ do -- DESIGNATE
|
||||
local MissionMenu = nil
|
||||
|
||||
if self.Mission then
|
||||
MissionMenu = self.Mission:GetRootMenu( AttackGroup )
|
||||
--MissionMenu = self.Mission:GetRootMenu( AttackGroup )
|
||||
MissionMenu = self.Mission:GetMenu( AttackGroup )
|
||||
end
|
||||
|
||||
local MenuTime = timer.getTime()
|
||||
|
||||
163
Moose Development/Moose/Functional/JTAC.lua
Normal file
163
Moose Development/Moose/Functional/JTAC.lua
Normal file
@ -0,0 +1,163 @@
|
||||
--- **Functional** - (R2.4) JTAC
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- JTAC mimic
|
||||
--
|
||||
-- ## Features:
|
||||
--
|
||||
-- * Feature 1
|
||||
-- * Feature 2
|
||||
--
|
||||
-- ====
|
||||
--
|
||||
-- # Demo Missions
|
||||
--
|
||||
-- ### [MOOSE - ALL Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS)
|
||||
--
|
||||
-- ====
|
||||
--
|
||||
-- # YouTube Channel
|
||||
--
|
||||
-- ### [MOOSE YouTube Channel](https://www.youtube.com/channel/UCjrA9j5LQoWsG4SpS8i79Qg)
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- ### Author: **[funkyfranky](https://forums.eagle.ru/member.php?u=115026)**
|
||||
--
|
||||
-- ### Contributions: [FlightControl](https://forums.eagle.ru/member.php?u=89536)
|
||||
--
|
||||
-- ====
|
||||
-- @module Functional.Jtac
|
||||
-- @image JTAC.JPG
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--- JTAC class
|
||||
-- @type JTAC
|
||||
-- @field #string ClassName Name of the class.
|
||||
|
||||
--- Easy assignment of JTAC.
|
||||
--
|
||||
-- A new ARTY object can be created with the @{#ARTY.New}(*group*) contructor.
|
||||
-- The parameter *group* has to be a MOOSE Group object and defines ARTY group.
|
||||
--
|
||||
-- The ARTY FSM process can be started by the @{#ARTY.Start}() command.
|
||||
--
|
||||
-- ## The ARTY Process
|
||||
--
|
||||
-- 
|
||||
--
|
||||
--
|
||||
--
|
||||
-- @field #ARTY
|
||||
JTAC={
|
||||
ClassName="JTAC",
|
||||
Debug=false,
|
||||
}
|
||||
|
||||
--- Some ID to identify who we are in output of the DCS.log file.
|
||||
-- @field #string id
|
||||
JTAC.id="JTAC | "
|
||||
|
||||
--- Arty script version.
|
||||
-- @field #string version
|
||||
JTAC.version="0.0.1"
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
-- TODO list:
|
||||
-- TODO: a lot.
|
||||
|
||||
|
||||
--- Creates a new JTAC object.
|
||||
-- @param #JTAC self
|
||||
-- @param Wrapper.Group#GROUP group The GROUP object for which artillery tasks should be assigned.
|
||||
-- @param alias (Optional) Alias name the group will be calling itself when sending messages. Default is the group name.
|
||||
-- @return #ARTY ARTY object or nil if group does not exist or is not a ground or naval group.
|
||||
function JTAC:New(group, alias)
|
||||
BASE:F2(group)
|
||||
|
||||
-- Inherits from FSM_CONTROLLABLE
|
||||
local self=BASE:Inherit(self, FSM_CONTROLLABLE:New()) -- #JTAC
|
||||
|
||||
-- Check that group is present.
|
||||
if group then
|
||||
self:T(JTAC.id..string.format("JTAC script version %s. Added group %s.", JTAC.version, group:GetName()))
|
||||
else
|
||||
self:E(JTAC.id.."ERROR: Requested JTAC group does not exist! (Has to be a MOOSE group.)")
|
||||
return nil
|
||||
end
|
||||
|
||||
-- Set the controllable for the FSM.
|
||||
self:SetControllable(group)
|
||||
|
||||
---------------
|
||||
-- Transitions:
|
||||
---------------
|
||||
|
||||
-- Entry.
|
||||
self:AddTransition("*", "Start", "Ready")
|
||||
self:AddTransition("Ready", "LaserOn", "Lasing")
|
||||
self:AddTransition("Lasing", "LaserOff", "Ready")
|
||||
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- FSM Start Event
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
--- After "Start" event.
|
||||
-- @param #JTAC self
|
||||
-- @param Wrapper.Controllable#CONTROLLABLE Controllable Controllable of the group.
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
function JTAC:onafterStart(Controllable, From, Event, To)
|
||||
--self:_EventFromTo("onafterStart", Event, From, To)
|
||||
|
||||
-- Debug output.
|
||||
local text=string.format("Started JTAC version %s for group %s.", JTAC.version, Controllable:GetName())
|
||||
self:E(JTAC.id..text)
|
||||
MESSAGE:New(text, 5):ToAllIf(self.Debug)
|
||||
|
||||
end
|
||||
|
||||
--- After "LaserOn" event.
|
||||
-- @param #JTAC self
|
||||
-- @param Wrapper.Controllable#CONTROLLABLE Controllable Controllable of the group.
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
function JTAC:onafterLaserOn(Controllable, From, Event, To)
|
||||
--self:_EventFromTo("onafterStart", Event, From, To)
|
||||
|
||||
-- Debug output.
|
||||
local text=string.format("Started JTAC version %s for group %s.", JTAC.version, Controllable:GetName())
|
||||
self:E(JTAC.id..text)
|
||||
MESSAGE:New(text, 5):ToAllIf(self.Debug)
|
||||
|
||||
end
|
||||
|
||||
|
||||
--- After "LaserOff" event.
|
||||
-- @param #JTAC self
|
||||
-- @param Wrapper.Controllable#CONTROLLABLE Controllable Controllable of the group.
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
function JTAC:onafterLaserOff(Controllable, From, Event, To)
|
||||
--self:_EventFromTo("onafterStart", Event, From, To)
|
||||
|
||||
-- Debug output.
|
||||
local text=string.format("Started JTAC version %s for group %s.", JTAC.version, Controllable:GetName())
|
||||
self:E(JTAC.id..text)
|
||||
MESSAGE:New(text, 5):ToAllIf(self.Debug)
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -426,6 +426,7 @@ end
|
||||
|
||||
--- Gets the commandcenter menu structure governed by the HQ command center.
|
||||
-- @param #COMMANDCENTER self
|
||||
-- @param Wrapper.Group#Group TaskGroup Task Group.
|
||||
-- @return Core.Menu#MENU_COALITION
|
||||
function COMMANDCENTER:GetMenu( TaskGroup )
|
||||
|
||||
|
||||
@ -611,13 +611,14 @@ function MISSION:RemoveTaskMenu( Task )
|
||||
end
|
||||
|
||||
|
||||
--- Gets the root mission menu for the TaskGroup.
|
||||
--- Gets the root mission menu for the TaskGroup. Obsolete?! Originally no reference to TaskGroup parameter!
|
||||
-- @param #MISSION self
|
||||
-- @param Wrapper.Group#GROUP TaskGroup Task group.
|
||||
-- @return Core.Menu#MENU_COALITION self
|
||||
function MISSION:GetRootMenu( TaskGroup ) -- R2.2
|
||||
|
||||
local CommandCenter = self:GetCommandCenter()
|
||||
local CommandCenterMenu = CommandCenter:GetMenu()
|
||||
local CommandCenterMenu = CommandCenter:GetMenu( TaskGroup )
|
||||
|
||||
local MissionName = self:GetText()
|
||||
--local MissionMenu = CommandCenterMenu:GetMenu( MissionName )
|
||||
@ -629,6 +630,7 @@ end
|
||||
|
||||
--- Gets the mission menu for the TaskGroup.
|
||||
-- @param #MISSION self
|
||||
-- @param Wrapper.Group#GROUP TaskGroup Task group.
|
||||
-- @return Core.Menu#MENU_COALITION self
|
||||
function MISSION:GetMenu( TaskGroup ) -- R2.1 -- Changed Menu Structure
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user