mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge branch 'develop' into FF/Ops
This commit is contained in:
commit
fb070a0c86
@ -7797,7 +7797,7 @@ do -- SET_SCENERY
|
||||
|
||||
end
|
||||
|
||||
---
|
||||
--- [Internal] Determine if an object is to be included in the SET
|
||||
-- @param #SET_SCENERY self
|
||||
-- @param Wrapper.Scenery#SCENERY MScenery
|
||||
-- @return #SET_SCENERY self
|
||||
@ -7805,4 +7805,47 @@ do -- SET_SCENERY
|
||||
self:F2( MScenery )
|
||||
return true
|
||||
end
|
||||
|
||||
--- Count overall initial (Life0) lifepoints of the SET objects.
|
||||
-- @param #SET_SCENERY self
|
||||
-- @return #number LIfe0Points
|
||||
function SET_SCENERY:GetLife0()
|
||||
local life0 = 0
|
||||
self:ForEachScenery(
|
||||
function(obj)
|
||||
local Obj = obj -- Wrapper.Scenery#SCENERY
|
||||
life0 = life0 + Obj:GetLife0()
|
||||
end
|
||||
)
|
||||
return life0
|
||||
end
|
||||
|
||||
--- Count overall current lifepoints of the SET objects.
|
||||
-- @param #SET_SCENERY self
|
||||
-- @return #number LifePoints
|
||||
function SET_SCENERY:GetLife()
|
||||
local life = 0
|
||||
self:ForEachScenery(
|
||||
function(obj)
|
||||
local Obj = obj -- Wrapper.Scenery#SCENERY
|
||||
life = life + Obj:GetLife()
|
||||
end
|
||||
)
|
||||
return life
|
||||
end
|
||||
|
||||
--- Calculate current relative lifepoints of the SET objects, i.e. Life divided by Life0 as percentage value, eg 75 meaning 75% alive.
|
||||
-- **CAVEAT**: Some objects change their life value or "hitpoints" **after** the first hit. Hence we will adjust the Life0 value to 120%
|
||||
-- of the last life value if life exceeds life0 ata any point.
|
||||
-- Thus will will get a smooth percentage decrease, if you use this e.g. as success criteria for a bombing task.
|
||||
-- @param #SET_SCENERY self
|
||||
-- @return #number LifePoints
|
||||
function SET_SCENERY:GetRelativeLife()
|
||||
local life = self:GetLife()
|
||||
local life0 = self:GetLife0()
|
||||
self:T3(string.format("Set Lifepoints: %d life0 | %d life",life0,life))
|
||||
local rlife = math.floor((life / life0) * 100)
|
||||
return rlife
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@ -49,17 +49,19 @@ SOCKET = {
|
||||
-- @field #string BOMBRESULT Range bombing.
|
||||
-- @field #string STRAFERESULT Range strafeing result.
|
||||
-- @field #string LSOGRADE Airboss LSO grade.
|
||||
-- @field #string TTS Text-To-Speech.
|
||||
SOCKET.DataType={
|
||||
TEXT="moose_text",
|
||||
BOMBRESULT="moose_bomb_result",
|
||||
STRAFERESULT="moose_strafe_result",
|
||||
LSOGRADE="moose_lso_grade",
|
||||
TTS="moose_text2speech"
|
||||
}
|
||||
|
||||
|
||||
--- SOCKET class version.
|
||||
-- @field #string version
|
||||
SOCKET.version="0.2.0"
|
||||
SOCKET.version="0.3.0"
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- TODO list
|
||||
@ -140,7 +142,7 @@ end
|
||||
|
||||
--- Send a text message.
|
||||
-- @param #SOCKET self
|
||||
-- @param #string Text Test message.
|
||||
-- @param #string Text Text message.
|
||||
-- @return #SOCKET self
|
||||
function SOCKET:SendText(Text)
|
||||
|
||||
@ -154,4 +156,32 @@ function SOCKET:SendText(Text)
|
||||
return self
|
||||
end
|
||||
|
||||
--- Send a text-to-speech message.
|
||||
-- @param #SOCKET self
|
||||
-- @param #string Text The text message to speek.
|
||||
-- @param #number Provider The TTS provider: 0=Microsoft (default), 1=Google.
|
||||
-- @param #string Voice The specific voice to use, e.g. `"Microsoft David Desktop"` or "`en-US-Standard-A`". If not set, the service will choose a voice based on the other parameters such as culture and gender.
|
||||
-- @param #string Culture The Culture or language code, *e.g.* `"en-US"`.
|
||||
-- @param #string Gender The Gender, *i.e.* "male", "female". Default "female".
|
||||
-- @param #number Volume The volume. Microsoft: [0,100] default 50, Google: [-96, 10] default 0.
|
||||
-- @return #SOCKET self
|
||||
function SOCKET:SendTextToSpeech(Text, Provider, Voice, Culture, Gender, Volume)
|
||||
|
||||
Text=Text or "Hello World!"
|
||||
|
||||
local message={}
|
||||
|
||||
message.command = SOCKET.DataType.TTS
|
||||
message.text = Text
|
||||
message.provider=Provider
|
||||
message.voice = Voice
|
||||
message.culture = Culture
|
||||
message.gender = Gender
|
||||
message.volume = Volume
|
||||
|
||||
self:SendTable(message)
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
|
||||
@ -198,8 +198,47 @@ AIRBASE.Nevada = {
|
||||
-- * AIRBASE.Normandy.Needs_Oar_Point
|
||||
-- * AIRBASE.Normandy.Funtington
|
||||
-- * AIRBASE.Normandy.Tangmere
|
||||
-- * AIRBASE.Normandy.Ford_AF
|
||||
--
|
||||
-- * AIRBASE.Normandy.Ford
|
||||
-- * AIRBASE.Normandy.Argentan
|
||||
-- * AIRBASE.Normandy.Goulet
|
||||
-- * AIRBASE.Normandy.Barville
|
||||
-- * AIRBASE.Normandy.Essay
|
||||
-- * AIRBASE.Normandy.Hauterive
|
||||
-- * AIRBASE.Normandy.Lymington
|
||||
-- * AIRBASE.Normandy.Vrigny
|
||||
-- * AIRBASE.Normandy.Odiham
|
||||
-- * AIRBASE.Normandy.Conches
|
||||
-- * AIRBASE.Normandy.West_Malling
|
||||
-- * AIRBASE.Normandy.Villacoublay
|
||||
-- * AIRBASE.Normandy.Kenley
|
||||
-- * AIRBASE.Normandy.Beauvais_Tille
|
||||
-- * AIRBASE.Normandy.Cormeilles_en_Vexin
|
||||
-- * AIRBASE.Normandy.Creil
|
||||
-- * AIRBASE.Normandy.Guyancourt
|
||||
-- * AIRBASE.Normandy.Lonrai
|
||||
-- * AIRBASE.Normandy.Dinan_Trelivan
|
||||
-- * AIRBASE.Normandy.Heathrow
|
||||
-- * AIRBASE.Normandy.Fecamp_Benouville
|
||||
-- * AIRBASE.Normandy.Farnborough
|
||||
-- * AIRBASE.Normandy.Friston
|
||||
-- * AIRBASE.Normandy.Deanland
|
||||
-- * AIRBASE.Normandy.Triqueville
|
||||
-- * AIRBASE.Normandy.Poix
|
||||
-- * AIRBASE.Normandy.Orly
|
||||
-- * AIRBASE.Normandy.Stoney_Cross
|
||||
-- * AIRBASE.Normandy.Amiens_Glisy
|
||||
-- * AIRBASE.Normandy.Ronai
|
||||
-- * AIRBASE.Normandy.Rouen_Boos
|
||||
-- * AIRBASE.Normandy.Deauville
|
||||
-- * AIRBASE.Normandy.Saint_Aubin
|
||||
-- * AIRBASE.Normandy.Flers
|
||||
-- * AIRBASE.Normandy.Avranches_Le_Val_Saint_Pere
|
||||
-- * AIRBASE.Normandy.Gravesend
|
||||
-- * AIRBASE.Normandy.Beaumont_le_Roger
|
||||
-- * AIRBASE.Normandy.Broglie
|
||||
-- * AIRBASE.Normandy.Bernay_Saint_Martin
|
||||
-- * AIRBASE.Normandy.Saint_Andre_de_lEure
|
||||
--
|
||||
-- @field Normandy
|
||||
AIRBASE.Normandy = {
|
||||
["Saint_Pierre_du_Mont"] = "Saint Pierre du Mont",
|
||||
@ -232,14 +271,46 @@ AIRBASE.Normandy = {
|
||||
["Needs_Oar_Point"] = "Needs Oar Point",
|
||||
["Funtington"] = "Funtington",
|
||||
["Tangmere"] = "Tangmere",
|
||||
["Ford_AF"] = "Ford_AF",
|
||||
["Goulet"] = "Goulet",
|
||||
["Ford"] = "Ford",
|
||||
["Argentan"] = "Argentan",
|
||||
["Vrigny"] = "Vrigny",
|
||||
["Goulet"] = "Goulet",
|
||||
["Barville"] = "Barville",
|
||||
["Essay"] = "Essay",
|
||||
["Hauterive"] = "Hauterive",
|
||||
["Barville"] = "Barville",
|
||||
["Lymington"] = "Lymington",
|
||||
["Vrigny"] = "Vrigny",
|
||||
["Odiham"] = "Odiham",
|
||||
["Conches"] = "Conches",
|
||||
["West_Malling"] = "West Malling",
|
||||
["Villacoublay"] = "Villacoublay",
|
||||
["Kenley"] = "Kenley",
|
||||
["Beauvais_Tille"] = "Beauvais-Tille",
|
||||
["Cormeilles_en_Vexin"] = "Cormeilles-en-Vexin",
|
||||
["Creil"] = "Creil",
|
||||
["Guyancourt"] = "Guyancourt",
|
||||
["Lonrai"] = "Lonrai",
|
||||
["Dinan_Trelivan"] = "Dinan-Trelivan",
|
||||
["Heathrow"] = "Heathrow",
|
||||
["Fecamp_Benouville"] = "Fecamp-Benouville",
|
||||
["Farnborough"] = "Farnborough",
|
||||
["Friston"] = "Friston",
|
||||
["Deanland "] = "Deanland ",
|
||||
["Triqueville"] = "Triqueville",
|
||||
["Poix"] = "Poix",
|
||||
["Orly"] = "Orly",
|
||||
["Stoney_Cross"] = "Stoney Cross",
|
||||
["Amiens_Glisy"] = "Amiens-Glisy",
|
||||
["Ronai"] = "Ronai",
|
||||
["Rouen_Boos"] = "Rouen-Boos",
|
||||
["Deauville"] = "Deauville",
|
||||
["Saint_Aubin"] = "Saint-Aubin",
|
||||
["Flers"] = "Flers",
|
||||
["Avranches_Le_Val_Saint_Pere"] = "Avranches Le Val-Saint-Pere",
|
||||
["Gravesend"] = "Gravesend",
|
||||
["Beaumont_le_Roger"] = "Beaumont-le-Roger",
|
||||
["Broglie"] = "Broglie",
|
||||
["Bernay_Saint_Martin"] = "Bernay Saint Martin",
|
||||
["Saint_Andre_de_lEure"] = "Saint-Andre-de-lEure",
|
||||
}
|
||||
|
||||
--- Airbases of the Persion Gulf Map:
|
||||
|
||||
@ -63,12 +63,18 @@ function SCENERY:GetDCSObject()
|
||||
end
|
||||
|
||||
--- Get current life points from the SCENERY Object.
|
||||
-- **CAVEAT**: Some objects change their life value or "hitpoints" **after** the first hit. Hence we will adjust the life0 value to 120%
|
||||
-- of the last life value if life exceeds life0 (initial life) at any point. Thus will will get a smooth percentage decrease, if you use this e.g. as success
|
||||
-- criteria for a bombing task.
|
||||
--@param #SCENERY self
|
||||
--@return #number life
|
||||
function SCENERY:GetLife()
|
||||
local life = 0
|
||||
if self.SceneryObject then
|
||||
life = self.SceneryObject:getLife()
|
||||
if life > self.Life0 then
|
||||
self.Life0 = math.floor(life * 1.2)
|
||||
end
|
||||
end
|
||||
return life
|
||||
end
|
||||
@ -110,11 +116,13 @@ end
|
||||
--@param #number Radius (optional) Search radius around coordinate, defaults to 100
|
||||
--@return #SCENERY Scenery Object or `nil` if it cannot be found
|
||||
function SCENERY:FindByName(Name, Coordinate, Radius)
|
||||
|
||||
|
||||
local radius = Radius or 100
|
||||
local name = Name or "unknown"
|
||||
local scenery = nil
|
||||
|
||||
BASE:T({name, radius, Coordinate:GetVec2()})
|
||||
|
||||
---
|
||||
-- @param Core.Point#COORDINATE coordinate
|
||||
-- @param #number radius
|
||||
@ -170,6 +178,7 @@ function SCENERY:FindByZoneName( ZoneName )
|
||||
zone = ZONE:FindByName(ZoneName)
|
||||
end
|
||||
local _id = zone:GetProperty('OBJECT ID')
|
||||
BASE:T("Object ID ".._id)
|
||||
if not _id then
|
||||
-- this zone has no object ID
|
||||
BASE:E("**** Zone without object ID: "..ZoneName.." | Type: "..tostring(zone.ClassName))
|
||||
@ -235,4 +244,4 @@ end
|
||||
--@return #SCENERY self
|
||||
function SCENERY:Destroy()
|
||||
return self
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user