mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
JTAC
This commit is contained in:
parent
ea51622213
commit
a09cd6e667
@ -49,7 +49,7 @@
|
|||||||
--
|
--
|
||||||
--
|
--
|
||||||
--
|
--
|
||||||
-- @field #ARTY
|
-- @field #JTAC
|
||||||
JTAC={
|
JTAC={
|
||||||
ClassName="JTAC",
|
ClassName="JTAC",
|
||||||
Debug=false,
|
Debug=false,
|
||||||
@ -68,12 +68,13 @@ JTAC.version="0.0.1"
|
|||||||
-- TODO list:
|
-- TODO list:
|
||||||
-- TODO: a lot.
|
-- TODO: a lot.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
--- Creates a new JTAC object.
|
--- Creates a new JTAC object.
|
||||||
-- @param #JTAC self
|
-- @param #JTAC self
|
||||||
-- @param Wrapper.Group#GROUP group The GROUP object for which artillery tasks should be assigned.
|
-- @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.
|
-- @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.
|
-- @return #JTAC JTAC object or nil if group does not exist or is not a ground or naval group.
|
||||||
function JTAC:New(group, alias)
|
function JTAC:New(group, alias)
|
||||||
BASE:F2(group)
|
BASE:F2(group)
|
||||||
|
|
||||||
@ -98,6 +99,7 @@ function JTAC:New(group, alias)
|
|||||||
-- Entry.
|
-- Entry.
|
||||||
self:AddTransition("*", "Start", "Ready")
|
self:AddTransition("*", "Start", "Ready")
|
||||||
self:AddTransition("Ready", "LaserOn", "Lasing")
|
self:AddTransition("Ready", "LaserOn", "Lasing")
|
||||||
|
self:AddTransition("Lasing", "Lasing", "Lasing")
|
||||||
self:AddTransition("Lasing", "LaserOff", "Ready")
|
self:AddTransition("Lasing", "LaserOff", "Ready")
|
||||||
|
|
||||||
end
|
end
|
||||||
@ -128,14 +130,18 @@ end
|
|||||||
-- @param #string From From state.
|
-- @param #string From From state.
|
||||||
-- @param #string Event Event.
|
-- @param #string Event Event.
|
||||||
-- @param #string To To state.
|
-- @param #string To To state.
|
||||||
function JTAC:onafterLaserOn(Controllable, From, Event, To)
|
-- @param Wrapper.Unit#UNIT Target Target that should be lased.
|
||||||
|
function JTAC:onafterLaserOn(Controllable, From, Event, To, Target)
|
||||||
--self:_EventFromTo("onafterStart", Event, From, To)
|
--self:_EventFromTo("onafterStart", Event, From, To)
|
||||||
|
|
||||||
-- Debug output.
|
-- Debug output.
|
||||||
local text=string.format("Started JTAC version %s for group %s.", JTAC.version, Controllable:GetName())
|
local text=string.format("JTAC %s lasing target %s.", Controllable:GetName(), Target:GetName())
|
||||||
self:E(JTAC.id..text)
|
self:E(JTAC.id..text)
|
||||||
MESSAGE:New(text, 5):ToAllIf(self.Debug)
|
MESSAGE:New(text, 5):ToAllIf(self.Debug)
|
||||||
|
|
||||||
|
-- Start lasing.
|
||||||
|
Controllable:LaseUnit(Target, self.LaserCode, self.Duration)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -149,10 +155,13 @@ function JTAC:onafterLaserOff(Controllable, From, Event, To)
|
|||||||
--self:_EventFromTo("onafterStart", Event, From, To)
|
--self:_EventFromTo("onafterStart", Event, From, To)
|
||||||
|
|
||||||
-- Debug output.
|
-- Debug output.
|
||||||
local text=string.format("Started JTAC version %s for group %s.", JTAC.version, Controllable:GetName())
|
local text=string.format("JTAC %s stoped lasing.", Controllable:GetName())
|
||||||
self:E(JTAC.id..text)
|
self:E(JTAC.id..text)
|
||||||
MESSAGE:New(text, 5):ToAllIf(self.Debug)
|
MESSAGE:New(text, 5):ToAllIf(self.Debug)
|
||||||
|
|
||||||
|
-- Turn of laser.
|
||||||
|
Controllable:LaseOff()
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user