mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
#PLAYERTASKCONTROLLER
* Enable PLAYERTASKCONTROLLER:EnableBuddyLasing(Recce) - buddy lasing precision bombing tasks with a PLAYERRECCE connection
This commit is contained in:
parent
f790c4fb9e
commit
d63ab1138c
@ -94,7 +94,7 @@ PLAYERRECCE = {
|
|||||||
ClassName = "PLAYERRECCE",
|
ClassName = "PLAYERRECCE",
|
||||||
verbose = true,
|
verbose = true,
|
||||||
lid = nil,
|
lid = nil,
|
||||||
version = "0.0.9",
|
version = "0.0.10",
|
||||||
ViewZone = {},
|
ViewZone = {},
|
||||||
ViewZoneVisual = {},
|
ViewZoneVisual = {},
|
||||||
PlayerSet = nil,
|
PlayerSet = nil,
|
||||||
|
|||||||
@ -82,7 +82,7 @@ PLAYERTASK = {
|
|||||||
|
|
||||||
--- PLAYERTASK class version.
|
--- PLAYERTASK class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
PLAYERTASK.version="0.1.3"
|
PLAYERTASK.version="0.1.4"
|
||||||
|
|
||||||
--- Generic task condition.
|
--- Generic task condition.
|
||||||
-- @type PLAYERTASK.Condition
|
-- @type PLAYERTASK.Condition
|
||||||
@ -762,6 +762,8 @@ do
|
|||||||
-- @field #table PlayerInfoMenu
|
-- @field #table PlayerInfoMenu
|
||||||
-- @field #boolean noflaresmokemenu
|
-- @field #boolean noflaresmokemenu
|
||||||
-- @field #boolean TransmitOnlyWithPlayers
|
-- @field #boolean TransmitOnlyWithPlayers
|
||||||
|
-- @field #boolean buddylasing
|
||||||
|
-- @field Ops.PlayerRecce#PLAYERRECCE PlayerRecce
|
||||||
-- @extends Core.Fsm#FSM
|
-- @extends Core.Fsm#FSM
|
||||||
|
|
||||||
---
|
---
|
||||||
@ -937,6 +939,7 @@ do
|
|||||||
-- NONE = "None",
|
-- NONE = "None",
|
||||||
-- POINTEROVERTARGET = "%s, %s, pointer in reach for task %03d, lasing!",
|
-- POINTEROVERTARGET = "%s, %s, pointer in reach for task %03d, lasing!",
|
||||||
-- POINTERTARGETREPORT = "\nPointer in reach: %s\nLasing: %s",
|
-- POINTERTARGETREPORT = "\nPointer in reach: %s\nLasing: %s",
|
||||||
|
-- RECCETARGETREPORT = "\nRecce %s in reach: %s\nLasing: %s",
|
||||||
-- POINTERTARGETLASINGTTS = ". Pointer in reach and lasing.",
|
-- POINTERTARGETLASINGTTS = ". Pointer in reach and lasing.",
|
||||||
-- TARGET = "Target",
|
-- TARGET = "Target",
|
||||||
-- FLASHON = "%s - Flashing directions is now ON!",
|
-- FLASHON = "%s - Flashing directions is now ON!",
|
||||||
@ -1065,6 +1068,8 @@ PLAYERTASKCONTROLLER = {
|
|||||||
PlayerInfoMenu = {},
|
PlayerInfoMenu = {},
|
||||||
noflaresmokemenu = false,
|
noflaresmokemenu = false,
|
||||||
TransmitOnlyWithPlayers = true,
|
TransmitOnlyWithPlayers = true,
|
||||||
|
buddylasing = false,
|
||||||
|
PlayerRecce = nil,
|
||||||
}
|
}
|
||||||
|
|
||||||
---
|
---
|
||||||
@ -1152,6 +1157,7 @@ PLAYERTASKCONTROLLER.Messages = {
|
|||||||
NONE = "None",
|
NONE = "None",
|
||||||
POINTEROVERTARGET = "%s, %s, pointer in reach for task %03d, lasing!",
|
POINTEROVERTARGET = "%s, %s, pointer in reach for task %03d, lasing!",
|
||||||
POINTERTARGETREPORT = "\nPointer in reach: %s\nLasing: %s",
|
POINTERTARGETREPORT = "\nPointer in reach: %s\nLasing: %s",
|
||||||
|
RECCETARGETREPORT = "\nRecce %s in reach: %s\nLasing: %s",
|
||||||
POINTERTARGETLASINGTTS = ". Pointer in reach and lasing.",
|
POINTERTARGETLASINGTTS = ". Pointer in reach and lasing.",
|
||||||
TARGET = "Target",
|
TARGET = "Target",
|
||||||
FLASHON = "%s - Flashing directions is now ON!",
|
FLASHON = "%s - Flashing directions is now ON!",
|
||||||
@ -1213,6 +1219,7 @@ PLAYERTASKCONTROLLER.Messages = {
|
|||||||
NONE = "Keine",
|
NONE = "Keine",
|
||||||
POINTEROVERTARGET = "%s, %s, Marker im Zielbereich für %03d, Laser an!",
|
POINTEROVERTARGET = "%s, %s, Marker im Zielbereich für %03d, Laser an!",
|
||||||
POINTERTARGETREPORT = "\nMarker im Zielbereich: %s\nLaser an: %s",
|
POINTERTARGETREPORT = "\nMarker im Zielbereich: %s\nLaser an: %s",
|
||||||
|
RECCETARGETREPORT = "\nSpäher % im Zielbereich: %s\nLasing: %s",
|
||||||
POINTERTARGETLASINGTTS = ". Marker im Zielbereich, Laser is an.",
|
POINTERTARGETLASINGTTS = ". Marker im Zielbereich, Laser is an.",
|
||||||
TARGET = "Ziel",
|
TARGET = "Ziel",
|
||||||
FLASHON = "%s - Richtungsangaben einblenden ist EIN!",
|
FLASHON = "%s - Richtungsangaben einblenden ist EIN!",
|
||||||
@ -1223,7 +1230,7 @@ PLAYERTASKCONTROLLER.Messages = {
|
|||||||
|
|
||||||
--- PLAYERTASK class version.
|
--- PLAYERTASK class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
PLAYERTASKCONTROLLER.version="0.1.39"
|
PLAYERTASKCONTROLLER.version="0.1.40"
|
||||||
|
|
||||||
--- Constructor
|
--- Constructor
|
||||||
-- @param #PLAYERTASKCONTROLLER self
|
-- @param #PLAYERTASKCONTROLLER self
|
||||||
@ -1303,9 +1310,9 @@ function PLAYERTASKCONTROLLER:New(Name, Coalition, Type, ClientFilter)
|
|||||||
self:AddTransition("*", "TaskRepeatOnFailed", "*")
|
self:AddTransition("*", "TaskRepeatOnFailed", "*")
|
||||||
self:AddTransition("*", "Stop", "Stopped")
|
self:AddTransition("*", "Stop", "Stopped")
|
||||||
|
|
||||||
self:__Start(-1)
|
self:__Start(2)
|
||||||
local starttime = math.random(5,10)
|
local starttime = math.random(5,10)
|
||||||
self:__Status(-starttime)
|
self:__Status(starttime)
|
||||||
|
|
||||||
-- Player leaves
|
-- Player leaves
|
||||||
self:HandleEvent(EVENTS.PlayerLeaveUnit, self._EventHandler)
|
self:HandleEvent(EVENTS.PlayerLeaveUnit, self._EventHandler)
|
||||||
@ -1546,6 +1553,27 @@ function PLAYERTASKCONTROLLER:EnablePrecisionBombing(FlightGroup,LaserCode)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- [User] Allow precision laser-guided bombing on statics and "high-value" ground units (MBT etc) with player units lasing.
|
||||||
|
-- @param #PLAYERTASKCONTROLLER self
|
||||||
|
-- @param Ops.PlayerRecce#PLAYERRECCE Recce (Optional) The PLAYERRECCE object governing the lasing players.
|
||||||
|
-- @return #PLAYERTASKCONTROLLER self
|
||||||
|
function PLAYERTASKCONTROLLER:EnableBuddyLasing(Recce)
|
||||||
|
self:T(self.lid.."EnableBuddyLasing")
|
||||||
|
self.buddylasing = true
|
||||||
|
self.PlayerRecce = Recce
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- [User] Allow precision laser-guided bombing on statics and "high-value" ground units (MBT etc) with player units lasing.
|
||||||
|
-- @param #PLAYERTASKCONTROLLER self
|
||||||
|
-- @return #PLAYERTASKCONTROLLER self
|
||||||
|
function PLAYERTASKCONTROLLER:DisableBuddyLasing()
|
||||||
|
self:T(self.lid.."DisableBuddyLasing")
|
||||||
|
self.buddylasing = false
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- [User] Allow addition of targets with user F10 map markers.
|
--- [User] Allow addition of targets with user F10 map markers.
|
||||||
-- @param #PLAYERTASKCONTROLLER self
|
-- @param #PLAYERTASKCONTROLLER self
|
||||||
-- @param #string Tag (Optional) The tagname to use to identify commands, defaults to "TASK"
|
-- @param #string Tag (Optional) The tagname to use to identify commands, defaults to "TASK"
|
||||||
@ -1583,7 +1611,7 @@ end
|
|||||||
-- @return #string playername
|
-- @return #string playername
|
||||||
-- @return #string ttsplayername
|
-- @return #string ttsplayername
|
||||||
function PLAYERTASKCONTROLLER:_GetPlayerName(Client)
|
function PLAYERTASKCONTROLLER:_GetPlayerName(Client)
|
||||||
self:T(self.lid.."DisablePrecisionBombing")
|
self:T(self.lid.."_GetPlayerName")
|
||||||
local playername = Client:GetPlayerName()
|
local playername = Client:GetPlayerName()
|
||||||
local ttsplayername = nil
|
local ttsplayername = nil
|
||||||
if not self.customcallsigns[playername] then
|
if not self.customcallsigns[playername] then
|
||||||
@ -2225,7 +2253,7 @@ function PLAYERTASKCONTROLLER:_AddTask(Target)
|
|||||||
ttstype = self.gettext:GetEntry("BAITTS",self.locale)
|
ttstype = self.gettext:GetEntry("BAITTS",self.locale)
|
||||||
end
|
end
|
||||||
-- see if we can do precision bombing
|
-- see if we can do precision bombing
|
||||||
if (type == AUFTRAG.Type.BAI or type == AUFTRAG.Type.CAS) and self.precisionbombing then
|
if (type == AUFTRAG.Type.BAI or type == AUFTRAG.Type.CAS) and (self.precisionbombing or self.buddylasing) then
|
||||||
-- threatlevel between 3 and 6 means, it's artillery, tank, modern tank or AAA
|
-- threatlevel between 3 and 6 means, it's artillery, tank, modern tank or AAA
|
||||||
if threat > 2 and threat < 7 then
|
if threat > 2 and threat < 7 then
|
||||||
type = AUFTRAG.Type.PRECISIONBOMBING
|
type = AUFTRAG.Type.PRECISIONBOMBING
|
||||||
@ -2464,6 +2492,36 @@ function PLAYERTASKCONTROLLER:_ActiveTaskInfo(Group, Client, Task)
|
|||||||
text = text .. prectext
|
text = text .. prectext
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if task.Type == AUFTRAG.Type.PRECISIONBOMBING and self.buddylasing then
|
||||||
|
if self.PlayerRecce then
|
||||||
|
local yes = self.gettext:GetEntry("YES",self.locale)
|
||||||
|
local no = self.gettext:GetEntry("NO",self.locale)
|
||||||
|
-- TODO make dist dependent on PlayerRecce Object
|
||||||
|
local reachdist = 8000
|
||||||
|
local inreach = false
|
||||||
|
-- someone close enough?
|
||||||
|
local pset = self.PlayerRecce.PlayerSet:GetAliveSet()
|
||||||
|
for _,_player in pairs(pset) do
|
||||||
|
local player = _player -- Wrapper.Client#CLIENT
|
||||||
|
local pcoord = player:GetCoordinate()
|
||||||
|
if pcoord:Get2DDistance(Coordinate) <= reachdist then
|
||||||
|
inreach = true
|
||||||
|
local callsign = player:GetGroup():GetCustomCallSign(self.ShortCallsign,self.Keepnumber,self.CallsignTranslations)
|
||||||
|
local playername = player:GetPlayerName()
|
||||||
|
local islasing = no
|
||||||
|
if self.PlayerRecce.CanLase[player:GetTypeName()] and self.PlayerRecce.AutoLase[playername] then
|
||||||
|
-- TODO - maybe compare Spot target
|
||||||
|
islasing = yes
|
||||||
|
end
|
||||||
|
local inrtext = inreach == true and yes or no
|
||||||
|
local prectext = self.gettext:GetEntry("RECCETARGETREPORT",self.locale)
|
||||||
|
-- RECCETARGETREPORT = "\nSpäher % im Zielbereich: %s\nLasing: %s",
|
||||||
|
prectext = string.format(prectext,callsign,inrtext,islasing)
|
||||||
|
text = text .. prectext
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
local clienttxt = self.gettext:GetEntry("PILOTS",self.locale)
|
local clienttxt = self.gettext:GetEntry("PILOTS",self.locale)
|
||||||
if clientcount > 0 then
|
if clientcount > 0 then
|
||||||
for _,_name in pairs(clientlist) do
|
for _,_name in pairs(clientlist) do
|
||||||
@ -2758,10 +2816,12 @@ function PLAYERTASKCONTROLLER:_BuildMenus(Client,enforced,fromsuccess)
|
|||||||
local active = MENU_GROUP_DELAYED:New(group,menuactive,topmenu)
|
local active = MENU_GROUP_DELAYED:New(group,menuactive,topmenu)
|
||||||
local info = MENU_GROUP_COMMAND_DELAYED:New(group,menuinfo,active,self._ActiveTaskInfo,self,group,client)
|
local info = MENU_GROUP_COMMAND_DELAYED:New(group,menuinfo,active,self._ActiveTaskInfo,self,group,client)
|
||||||
local mark = MENU_GROUP_COMMAND_DELAYED:New(group,menumark,active,self._MarkTask,self,group,client)
|
local mark = MENU_GROUP_COMMAND_DELAYED:New(group,menumark,active,self._MarkTask,self,group,client)
|
||||||
if self.Type ~= PLAYERTASKCONTROLLER.Type.A2A or self.noflaresmokemenu then
|
if self.Type ~= PLAYERTASKCONTROLLER.Type.A2A then
|
||||||
-- no smoking/flaring here if A2A or designer has set to false
|
if self.noflaresmokemenu ~= true then
|
||||||
local smoke = MENU_GROUP_COMMAND_DELAYED:New(group,menusmoke,active,self._SmokeTask,self,group,client)
|
-- no smoking/flaring here if A2A or designer has set noflaresmokemenu to true
|
||||||
local flare = MENU_GROUP_COMMAND_DELAYED:New(group,menuflare,active,self._FlareTask,self,group,client)
|
local smoke = MENU_GROUP_COMMAND_DELAYED:New(group,menusmoke,active,self._SmokeTask,self,group,client)
|
||||||
|
local flare = MENU_GROUP_COMMAND_DELAYED:New(group,menuflare,active,self._FlareTask,self,group,client)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
local abort = MENU_GROUP_COMMAND_DELAYED:New(group,menuabort,active,self._AbortTask,self,group,client)
|
local abort = MENU_GROUP_COMMAND_DELAYED:New(group,menuabort,active,self._AbortTask,self,group,client)
|
||||||
if self.activehasinfomenu and self.taskinfomenu then
|
if self.activehasinfomenu and self.taskinfomenu then
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user