mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge branch 'FF/Ops' into FF/OpsDev
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
-- * Detect and lase contacts automatically
|
||||
-- * Targets are lased by threat priority order
|
||||
-- * Use FSM events to link functionality into your scripts
|
||||
-- * Set laser codes and smoke colors per Recce unit
|
||||
-- * Easy set-up
|
||||
--
|
||||
-- # 2 Basic usage
|
||||
@@ -46,7 +47,7 @@
|
||||
--
|
||||
-- local autolaser = AUTOLASE:New(FoxSet,coalition.side.BLUE,"Wolfpack",Pilotset)
|
||||
--
|
||||
-- ## 2.5 Example - Using a fixed laser code for a specific Recce unit:
|
||||
-- ## 2.5 Example - Using a fixed laser code and color for a specific Recce unit:
|
||||
--
|
||||
-- local recce = SPAWN:New("Reaper")
|
||||
-- :InitDelayOff()
|
||||
@@ -55,6 +56,7 @@
|
||||
-- local unit = group:GetUnit(1)
|
||||
-- local name = unit:GetName()
|
||||
-- autolaser:SetRecceLaserCode(name,1688)
|
||||
-- autolaser:SetRecceSmokeColor(name,SMOKECOLOR.Red)
|
||||
-- end
|
||||
-- )
|
||||
-- :InitCleanUp(60)
|
||||
@@ -71,7 +73,7 @@
|
||||
-- @module Functional.Autolase
|
||||
-- @image Designation.JPG
|
||||
--
|
||||
-- Date: Oct 2021
|
||||
-- Date: 24 Oct 2021
|
||||
--
|
||||
--- Class AUTOLASE
|
||||
-- @type AUTOLASE
|
||||
@@ -107,7 +109,7 @@ AUTOLASE = {
|
||||
|
||||
--- AUTOLASE class version.
|
||||
-- @field #string version
|
||||
AUTOLASE.version = "0.0.8"
|
||||
AUTOLASE.version = "0.0.10"
|
||||
|
||||
-------------------------------------------------------------------
|
||||
-- Begin Functional.Autolase.lua
|
||||
@@ -169,6 +171,7 @@ function AUTOLASE:New(RecceSet, Coalition, Alias, PilotSet)
|
||||
self.UnitsByThreat = {}
|
||||
self.RecceNames = {}
|
||||
self.RecceLaserCode = {}
|
||||
self.RecceSmokeColor = {}
|
||||
self.RecceUnitNames= {}
|
||||
self.maxlasing = 4
|
||||
self.CurrentLasing = {}
|
||||
@@ -294,13 +297,15 @@ end
|
||||
-- @param #AUTOLASE self
|
||||
-- @return #AUTOLASE self
|
||||
function AUTOLASE:SetPilotMenu()
|
||||
local pilottable = self.pilotset:GetSetObjects() or {}
|
||||
for _,_unit in pairs (pilottable) do
|
||||
local Unit = _unit -- Wrapper.Unit#UNIT
|
||||
if Unit and Unit:IsAlive() then
|
||||
local Group = Unit:GetGroup()
|
||||
local lasemenu = MENU_GROUP_COMMAND:New(Group,"Autolase Status",nil,self.ShowStatus,self,Group)
|
||||
lasemenu:Refresh()
|
||||
if self.usepilotset then
|
||||
local pilottable = self.pilotset:GetSetObjects() or {}
|
||||
for _,_unit in pairs (pilottable) do
|
||||
local Unit = _unit -- Wrapper.Unit#UNIT
|
||||
if Unit and Unit:IsAlive() then
|
||||
local Group = Unit:GetGroup()
|
||||
local lasemenu = MENU_GROUP_COMMAND:New(Group,"Autolase Status",nil,self.ShowStatus,self,Group)
|
||||
lasemenu:Refresh()
|
||||
end
|
||||
end
|
||||
end
|
||||
return self
|
||||
@@ -330,6 +335,20 @@ function AUTOLASE:GetLaserCode(RecceName)
|
||||
return code
|
||||
end
|
||||
|
||||
--- (Internal) Function to get a smoke color by recce name
|
||||
-- @param #AUTOLASE self
|
||||
-- @param #string RecceName Unit(!) name of the Recce
|
||||
-- @return #AUTOLASE self
|
||||
function AUTOLASE:GetSmokeColor(RecceName)
|
||||
local color = self.smokecolor
|
||||
if self.RecceSmokeColor[RecceName] == nil then
|
||||
self.RecceSmokeColor[RecceName] = color
|
||||
else
|
||||
color = self.RecceLaserCode[RecceName]
|
||||
end
|
||||
return color
|
||||
end
|
||||
|
||||
--- (User) Function enable sending messages via SRS.
|
||||
-- @param #AUTOLASE self
|
||||
-- @param #boolean OnOff Switch usage on and off
|
||||
@@ -374,6 +393,17 @@ function AUTOLASE:SetRecceLaserCode(RecceName, Code)
|
||||
return self
|
||||
end
|
||||
|
||||
--- (User) Function to set a specific smoke color for a Recce.
|
||||
-- @param #AUTOLASE self
|
||||
-- @param #string RecceName (Unit!) Name of the Recce
|
||||
-- @param #number Color The color, e.g. SMOKECOLOR.Red, SMOKECOLOR.Green etc
|
||||
-- @return #AUTOLASE self
|
||||
function AUTOLASE:SetRecceSmokeColor(RecceName, Color)
|
||||
local color = Color or self.smokecolor
|
||||
self.RecceSmokeColor[RecceName] = color
|
||||
return self
|
||||
end
|
||||
|
||||
--- (User) Function to force laser cooldown and cool down time
|
||||
-- @param #AUTOLASE self
|
||||
-- @param #boolean OnOff Switch cool down on (true) or off (false) - defaults to true
|
||||
@@ -812,7 +842,8 @@ function AUTOLASE:onafterMonitor(From, Event, To)
|
||||
}
|
||||
if self.smoketargets then
|
||||
local coord = unit:GetCoordinate()
|
||||
coord:Smoke(self.smokecolor)
|
||||
local color = self:GetSmokeColor(reccename)
|
||||
coord:Smoke(color)
|
||||
end
|
||||
self.lasingindex = self.lasingindex + 1
|
||||
self.CurrentLasing[self.lasingindex] = laserspot
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
-- @module Functional.FOX
|
||||
-- @image Functional_FOX.png
|
||||
|
||||
|
||||
--- FOX class.
|
||||
-- @type FOX
|
||||
-- @field #string ClassName Name of the class.
|
||||
@@ -47,8 +46,7 @@
|
||||
-- @field #number dt10 Time step [sec] for missile position updates if distance to target > 10 km and < 50 km. Default 1 sec.
|
||||
-- @field #number dt05 Time step [sec] for missile position updates if distance to target > 5 km and < 10 km. Default 0.5 sec.
|
||||
-- @field #number dt01 Time step [sec] for missile position updates if distance to target > 1 km and < 5 km. Default 0.1 sec.
|
||||
-- @field #number dt00 Time step [sec] for missile position updates if distance to target < 1 km. Default 0.01 sec.
|
||||
-- @field #boolean
|
||||
-- @field #number dt00 Time step [sec] for missile position updates if distance to target < 1 km. Default 0.01 sec.
|
||||
-- @extends Core.Fsm#FSM
|
||||
|
||||
--- Fox 3!
|
||||
@@ -1813,4 +1811,4 @@ end
|
||||
|
||||
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -19,7 +19,7 @@
|
||||
--
|
||||
-- @module Functional.Mantis
|
||||
-- @image Functional.Mantis.jpg
|
||||
|
||||
--
|
||||
-- Date: July 2021
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
@@ -284,9 +284,11 @@ function SCORING:New( GameName )
|
||||
|
||||
-- Default fratricide penalty level (maximum penalty that can be assigned to a player before he gets kicked).
|
||||
self:SetFratricide( self.ScaleDestroyPenalty * 3 )
|
||||
self.penaltyonfratricide = true
|
||||
|
||||
-- Default penalty when a player changes coalition.
|
||||
self:SetCoalitionChangePenalty( self.ScaleDestroyPenalty )
|
||||
self.penaltyoncoalitionchange = true
|
||||
|
||||
self:SetDisplayMessagePrefix()
|
||||
|
||||
@@ -582,6 +584,23 @@ function SCORING:SetFratricide( Fratricide )
|
||||
return self
|
||||
end
|
||||
|
||||
--- Decide if Fratricide is leading to penalties (true) or not (fals)
|
||||
-- @param #SCORING self
|
||||
-- @param #boolean OnOff Switch for Fratricide
|
||||
-- @return #SCORING
|
||||
function SCORING:SwitchFratricide( OnOff )
|
||||
self.penaltyonfratricide = OnOff
|
||||
return self
|
||||
end
|
||||
|
||||
--- Decide if Coalition Changes is leading to penalties (true) or not (fals)
|
||||
-- @param #SCORING self
|
||||
-- @param #boolean OnOff Switch for Coalition Changes.
|
||||
-- @return #SCORING
|
||||
function SCORING:SwitchTreason( OnOff )
|
||||
self.penaltyoncoalitionchange = OnOff
|
||||
return self
|
||||
end
|
||||
|
||||
--- When a player changes the coalition, he can receive a penalty score.
|
||||
-- Use the method @{#SCORING.SetCoalitionChangePenalty}() to define the penalty when a player changes coalition.
|
||||
@@ -647,14 +666,15 @@ function SCORING:_AddPlayerFromUnit( UnitData )
|
||||
if not self.Players[PlayerName].UnitCoalition then
|
||||
self.Players[PlayerName].UnitCoalition = UnitCoalition
|
||||
else
|
||||
if self.Players[PlayerName].UnitCoalition ~= UnitCoalition then
|
||||
self.Players[PlayerName].Penalty = self.Players[PlayerName].Penalty + 50
|
||||
-- TODO: switch for coalition changes, make penalty alterable
|
||||
if self.Players[PlayerName].UnitCoalition ~= UnitCoalition and self.penaltyoncoalitionchange then
|
||||
self.Players[PlayerName].Penalty = self.Players[PlayerName].Penalty + self.CoalitionChangePenalty or 50
|
||||
self.Players[PlayerName].PenaltyCoalition = self.Players[PlayerName].PenaltyCoalition + 1
|
||||
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' changed coalition from " .. _SCORINGCoalition[self.Players[PlayerName].UnitCoalition] .. " to " .. _SCORINGCoalition[UnitCoalition] ..
|
||||
"(changed " .. self.Players[PlayerName].PenaltyCoalition .. " times the coalition). 50 Penalty points added.",
|
||||
"(changed " .. self.Players[PlayerName].PenaltyCoalition .. " times the coalition). ".. self.CoalitionChangePenalty .."Penalty points added.",
|
||||
MESSAGE.Type.Information
|
||||
):ToAll()
|
||||
self:ScoreCSV( PlayerName, "", "COALITION_PENALTY", 1, -50, self.Players[PlayerName].UnitName, _SCORINGCoalition[self.Players[PlayerName].UnitCoalition], _SCORINGCategory[self.Players[PlayerName].UnitCategory], self.Players[PlayerName].UnitType,
|
||||
self:ScoreCSV( PlayerName, "", "COALITION_PENALTY", 1, -1*self.CoalitionChangePenalty, self.Players[PlayerName].UnitName, _SCORINGCoalition[self.Players[PlayerName].UnitCoalition], _SCORINGCategory[self.Players[PlayerName].UnitCategory], self.Players[PlayerName].UnitType,
|
||||
UnitName, _SCORINGCoalition[UnitCoalition], _SCORINGCategory[UnitCategory], UnitData:GetTypeName() )
|
||||
end
|
||||
end
|
||||
@@ -666,8 +686,9 @@ function SCORING:_AddPlayerFromUnit( UnitData )
|
||||
self.Players[PlayerName].UNIT = UnitData
|
||||
self.Players[PlayerName].ThreatLevel = UnitThreatLevel
|
||||
self.Players[PlayerName].ThreatType = UnitThreatType
|
||||
|
||||
if self.Players[PlayerName].Penalty > self.Fratricide * 0.50 then
|
||||
|
||||
-- TODO: make fratricide switchable
|
||||
if self.Players[PlayerName].Penalty > self.Fratricide * 0.50 and self.penaltyonfratricide then
|
||||
if self.Players[PlayerName].PenaltyWarning < 1 then
|
||||
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "': WARNING! If you continue to commit FRATRICIDE and have a PENALTY score higher than " .. self.Fratricide .. ", you will be COURT MARTIALED and DISMISSED from this mission! \nYour total penalty is: " .. self.Players[PlayerName].Penalty,
|
||||
MESSAGE.Type.Information
|
||||
@@ -676,7 +697,7 @@ function SCORING:_AddPlayerFromUnit( UnitData )
|
||||
end
|
||||
end
|
||||
|
||||
if self.Players[PlayerName].Penalty > self.Fratricide then
|
||||
if self.Players[PlayerName].Penalty > self.Fratricide and self.penaltyonfratricide then
|
||||
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' committed FRATRICIDE, he will be COURT MARTIALED and is DISMISSED from this mission!",
|
||||
MESSAGE.Type.Information
|
||||
):ToAll()
|
||||
@@ -1121,9 +1142,9 @@ function SCORING:_EventOnHit( Event )
|
||||
if InitCoalition then -- A coalition object was hit, probably a static.
|
||||
if InitCoalition == TargetCoalition then
|
||||
-- TODO: Penalty according scale
|
||||
Player.Penalty = Player.Penalty + 10
|
||||
PlayerHit.Penalty = PlayerHit.Penalty + 10
|
||||
PlayerHit.PenaltyHit = PlayerHit.PenaltyHit + 1
|
||||
Player.Penalty = Player.Penalty + 10 --* self.ScaleDestroyPenalty
|
||||
PlayerHit.Penalty = PlayerHit.Penalty + 10 --* self.ScaleDestroyPenalty
|
||||
PlayerHit.PenaltyHit = PlayerHit.PenaltyHit + 1 * self.ScaleDestroyPenalty
|
||||
|
||||
MESSAGE
|
||||
:NewType( self.DisplayMessagePrefix .. "Player '" .. Event.WeaponPlayerName .. "' hit friendly target " ..
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
-- @field #boolean UseEmOnOff Decide if we are using Emission on/off (default) or AlarmState red/green.
|
||||
-- @extends Core.Base#BASE
|
||||
|
||||
|
||||
--- *Good friends are worth defending.* Mr Tushman, Wonder (the Movie)
|
||||
--
|
||||
-- Simple Class for a more intelligent Short Range Air Defense System
|
||||
|
||||
Reference in New Issue
Block a user