mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Update Intelligence.lua
This commit is contained in:
@@ -51,7 +51,7 @@ INTEL = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
--- Detected item info.
|
--- Detected item info.
|
||||||
-- @type INTEL.DetectedItem
|
-- @type INTEL.Contact
|
||||||
-- @field #string groupname Name of the group.
|
-- @field #string groupname Name of the group.
|
||||||
-- @field Wrapper.Group#GROUP group The contact group.
|
-- @field Wrapper.Group#GROUP group The contact group.
|
||||||
-- @field #string typename Type name of detected item.
|
-- @field #string typename Type name of detected item.
|
||||||
@@ -311,7 +311,7 @@ function INTEL:onafterStatus(From, Event, To)
|
|||||||
if Ncontacts>0 then
|
if Ncontacts>0 then
|
||||||
text="Detected Contacts:"
|
text="Detected Contacts:"
|
||||||
for _,_contact in pairs(self.Contacts) do
|
for _,_contact in pairs(self.Contacts) do
|
||||||
local contact=_contact --#INTEL.DetectedItem
|
local contact=_contact --#INTEL.Contact
|
||||||
local dT=timer.getAbsTime()-contact.Tdetected
|
local dT=timer.getAbsTime()-contact.Tdetected
|
||||||
text=text..string.format("\n- %s (%s): %s, units=%d, T=%d sec", contact.categoryname, contact.attribute, contact.groupname, contact.group:CountAliveUnits(), dT)
|
text=text..string.format("\n- %s (%s): %s, units=%d, T=%d sec", contact.categoryname, contact.attribute, contact.groupname, contact.group:CountAliveUnits(), dT)
|
||||||
if contact.mission then
|
if contact.mission then
|
||||||
@@ -448,7 +448,7 @@ function INTEL:CreateDetectedItems(detectedunitset)
|
|||||||
---
|
---
|
||||||
|
|
||||||
-- Create new contact.
|
-- Create new contact.
|
||||||
local item={} --#INTEL.DetectedItem
|
local item={} --#INTEL.Contact
|
||||||
|
|
||||||
item.groupname=groupname
|
item.groupname=groupname
|
||||||
item.group=group
|
item.group=group
|
||||||
@@ -473,7 +473,7 @@ function INTEL:CreateDetectedItems(detectedunitset)
|
|||||||
|
|
||||||
-- Now check if there some groups could not be detected any more.
|
-- Now check if there some groups could not be detected any more.
|
||||||
for i=#self.Contacts,1,-1 do
|
for i=#self.Contacts,1,-1 do
|
||||||
local item=self.Contacts[i] --#INTEL.DetectedItem
|
local item=self.Contacts[i] --#INTEL.Contact
|
||||||
|
|
||||||
local group=detectedgroupset:FindGroup(item.groupname)
|
local group=detectedgroupset:FindGroup(item.groupname)
|
||||||
|
|
||||||
@@ -500,7 +500,7 @@ 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.
|
||||||
-- @param #INTEL.DetectedItem Contact Detected contact.
|
-- @param #INTEL.Contact Contact Detected contact.
|
||||||
function INTEL:onafterNewContact(From, Event, To, Contact)
|
function INTEL:onafterNewContact(From, Event, To, Contact)
|
||||||
self:I(self.lid..string.format("NEW contact %s", Contact.groupname))
|
self:I(self.lid..string.format("NEW contact %s", Contact.groupname))
|
||||||
table.insert(self.ContactsUnknown, Contact)
|
table.insert(self.ContactsUnknown, Contact)
|
||||||
@@ -511,7 +511,7 @@ 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.
|
||||||
-- @param #INTEL.DetectedItem Contact Detected contact.
|
-- @param #INTEL.Contact Contact Detected contact.
|
||||||
function INTEL:onafterLostContact(From, Event, To, Contact)
|
function INTEL:onafterLostContact(From, Event, To, Contact)
|
||||||
self:I(self.lid..string.format("LOST contact %s", Contact.groupname))
|
self:I(self.lid..string.format("LOST contact %s", Contact.groupname))
|
||||||
table.insert(self.ContactsLost, Contact)
|
table.insert(self.ContactsLost, Contact)
|
||||||
@@ -524,11 +524,11 @@ end
|
|||||||
--- Create detected items.
|
--- Create detected items.
|
||||||
-- @param #INTEL self
|
-- @param #INTEL self
|
||||||
-- @param #string groupname Name of the contact group.
|
-- @param #string groupname Name of the contact group.
|
||||||
-- @return #INTEL.DetectedItem
|
-- @return #INTEL.Contact
|
||||||
function INTEL:GetContactByName(groupname)
|
function INTEL:GetContactByName(groupname)
|
||||||
|
|
||||||
for i,_contact in pairs(self.Contacts) do
|
for i,_contact in pairs(self.Contacts) do
|
||||||
local contact=_contact --#INTEL.DetectedItem
|
local contact=_contact --#INTEL.Contact
|
||||||
if contact.groupname==groupname then
|
if contact.groupname==groupname then
|
||||||
return contact
|
return contact
|
||||||
end
|
end
|
||||||
@@ -539,18 +539,18 @@ end
|
|||||||
|
|
||||||
--- Add a contact to our list.
|
--- Add a contact to our list.
|
||||||
-- @param #INTEL self
|
-- @param #INTEL self
|
||||||
-- @param #INTEL.DetectedItem Contact The contact to be removed.
|
-- @param #INTEL.Contact Contact The contact to be removed.
|
||||||
function INTEL:AddContact(Contact)
|
function INTEL:AddContact(Contact)
|
||||||
table.insert(self.Contacts, Contact)
|
table.insert(self.Contacts, Contact)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Remove a contact from our list.
|
--- Remove a contact from our list.
|
||||||
-- @param #INTEL self
|
-- @param #INTEL self
|
||||||
-- @param #INTEL.DetectedItem Contact The contact to be removed.
|
-- @param #INTEL.Contact Contact The contact to be removed.
|
||||||
function INTEL:RemoveContact(Contact)
|
function INTEL:RemoveContact(Contact)
|
||||||
|
|
||||||
for i,_contact in pairs(self.Contacts) do
|
for i,_contact in pairs(self.Contacts) do
|
||||||
local contact=_contact --#INTEL.DetectedItem
|
local contact=_contact --#INTEL.Contact
|
||||||
|
|
||||||
if contact.groupname==Contact.groupname then
|
if contact.groupname==Contact.groupname then
|
||||||
table.remove(self.Contacts, i)
|
table.remove(self.Contacts, i)
|
||||||
@@ -562,7 +562,7 @@ end
|
|||||||
|
|
||||||
--- Remove a contact from our list.
|
--- Remove a contact from our list.
|
||||||
-- @param #INTEL self
|
-- @param #INTEL self
|
||||||
-- @param #INTEL.DetectedItem Contact The contact to be removed.
|
-- @param #INTEL.Contact Contact The contact to be removed.
|
||||||
-- @return #boolean If true, contact was not detected for at least *dTforget* seconds.
|
-- @return #boolean If true, contact was not detected for at least *dTforget* seconds.
|
||||||
function INTEL:CheckContactLost(Contact)
|
function INTEL:CheckContactLost(Contact)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user