From 9ca30fc00c50bd6b22f1894f67273c9346881fac Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Sun, 30 Jun 2024 16:00:49 +0200 Subject: [PATCH 1/7] Fixes --- Moose Development/Moose/Core/Message.lua | 34 +++++-------------- Moose Development/Moose/Ops/ATIS.lua | 2 +- Moose Development/Moose/Sound/SoundOutput.lua | 2 +- 3 files changed, 10 insertions(+), 28 deletions(-) diff --git a/Moose Development/Moose/Core/Message.lua b/Moose Development/Moose/Core/Message.lua index f5f278b55..9d6824cee 100644 --- a/Moose Development/Moose/Core/Message.lua +++ b/Moose Development/Moose/Core/Message.lua @@ -177,40 +177,22 @@ end -- -- -- Send the 2 messages created with the @{New} method to the Client Group. -- -- Note that the Message of MessageClient2 is overwriting the Message of MessageClient1. --- ClientGroup = Group.getByName( "ClientGroup" ) +-- Client = CLIENT:FindByName("UnitNameOfMyClient") -- --- MessageClient1 = MESSAGE:New( "Congratulations, you've just hit a target", "Score", 25, "Score" ):ToClient( ClientGroup ) --- MessageClient2 = MESSAGE:New( "Congratulations, you've just killed a target", "Score", 25, "Score" ):ToClient( ClientGroup ) +-- MessageClient1 = MESSAGE:New( "Congratulations, you've just hit a target", "Score", 25, "Score" ):ToClient( Client ) +-- MessageClient2 = MESSAGE:New( "Congratulations, you've just killed a target", "Score", 25, "Score" ):ToClient( Client ) -- or --- MESSAGE:New( "Congratulations, you've just hit a target", "Score", 25 ):ToClient( ClientGroup ) --- MESSAGE:New( "Congratulations, you've just killed a target", "Score", 25 ):ToClient( ClientGroup ) +-- MESSAGE:New( "Congratulations, you've just hit a target", "Score", 25 ):ToClient( Client ) +-- MESSAGE:New( "Congratulations, you've just killed a target", "Score", 25 ):ToClient( Client ) -- or -- MessageClient1 = MESSAGE:New( "Congratulations, you've just hit a target", "Score", 25 ) -- MessageClient2 = MESSAGE:New( "Congratulations, you've just killed a target", "Score", 25 ) --- MessageClient1:ToClient( ClientGroup ) --- MessageClient2:ToClient( ClientGroup ) +-- MessageClient1:ToClient( Client ) +-- MessageClient2:ToClient( Client ) -- function MESSAGE:ToClient( Client, Settings ) self:F( Client ) - - if Client and Client:GetClientGroupID() then - - if self.MessageType then - local Settings = Settings or ( Client and _DATABASE:GetPlayerSettings( Client:GetPlayerName() ) ) or _SETTINGS -- Core.Settings#SETTINGS - self.MessageDuration = Settings:GetMessageTime( self.MessageType ) - self.MessageCategory = "" -- self.MessageType .. ": " - end - - local Unit = Client:GetClient() - - if self.MessageDuration ~= 0 then - local ClientGroupID = Client:GetClientGroupID() - self:T( self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$","") .. " / " .. self.MessageDuration ) - --trigger.action.outTextForGroup( ClientGroupID, self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$",""), self.MessageDuration , self.ClearScreen) - trigger.action.outTextForUnit( Unit:GetID(), self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$",""), self.MessageDuration , self.ClearScreen) - end - end - + self:ToUnit(Client, Settings) return self end diff --git a/Moose Development/Moose/Ops/ATIS.lua b/Moose Development/Moose/Ops/ATIS.lua index 565b25a70..2ca3b7036 100644 --- a/Moose Development/Moose/Ops/ATIS.lua +++ b/Moose Development/Moose/Ops/ATIS.lua @@ -2935,7 +2935,7 @@ function ATIS:onafterReport( From, Event, To, Text ) self:T( "SRS TTS: " .. text ) -- Play text-to-speech report. - local duration = STTS.getSpeechTime(text,0.95) + local duration = MSRS.getSpeechTime(text,0.95) self.msrsQ:NewTransmission(text,duration,self.msrs,nil,2) --self.msrs:PlayText( text ) self.SRSText = text diff --git a/Moose Development/Moose/Sound/SoundOutput.lua b/Moose Development/Moose/Sound/SoundOutput.lua index 408be7b96..537255dac 100644 --- a/Moose Development/Moose/Sound/SoundOutput.lua +++ b/Moose Development/Moose/Sound/SoundOutput.lua @@ -356,7 +356,7 @@ do -- Text-To-Speech local self=BASE:Inherit(self, BASE:New()) -- #SOUNDTEXT self:SetText(Text) - self:SetDuration(Duration or STTS.getSpeechTime(Text)) + self:SetDuration(Duration or MSRS.getSpeechTime(Text)) --self:SetGender() --self:SetCulture() From 8e0446c594cba28d487703d2d12a37de2e9f7c93 Mon Sep 17 00:00:00 2001 From: Frank Date: Tue, 2 Jul 2024 15:52:44 +0200 Subject: [PATCH 2/7] Update Range.lua - Fixed RANGE.MenuF10Root --- Moose Development/Moose/Functional/Range.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Moose Development/Moose/Functional/Range.lua b/Moose Development/Moose/Functional/Range.lua index 3472132b5..8c949c12e 100644 --- a/Moose Development/Moose/Functional/Range.lua +++ b/Moose Development/Moose/Functional/Range.lua @@ -3352,7 +3352,7 @@ function RANGE:_AddF10Commands( _unitName ) ------------------- -- _rangePath = missionCommands.addSubMenuForGroup(_gid, self.rangename, RANGE.MenuF10Root) - _rangePath = MENU_GROUP:New( group, "On the Range" ) + _rangePath = MENU_GROUP:New( group, "On the Range", RANGE.MenuF10Root ) else From edf7f4677c2c0d7c3fdee329b16a6dced5a9436c Mon Sep 17 00:00:00 2001 From: Frank Date: Wed, 3 Jul 2024 09:46:51 +0200 Subject: [PATCH 3/7] Update Range.lua - Fixed name of mission menu - Improved AddBombingTargetGroup to be passed as string --- Moose Development/Moose/Functional/Range.lua | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Moose Development/Moose/Functional/Range.lua b/Moose Development/Moose/Functional/Range.lua index 8c949c12e..4141388ab 100644 --- a/Moose Development/Moose/Functional/Range.lua +++ b/Moose Development/Moose/Functional/Range.lua @@ -1665,12 +1665,16 @@ end --- Add all units of a group as bombing targets. -- @param #RANGE self --- @param Wrapper.Group#GROUP group Group of bombing targets. +-- @param Wrapper.Group#GROUP group Group of bombing targets. Can also be given as group name. -- @param #number goodhitrange Max distance from unit which is considered as a good hit. -- @param #boolean randommove If true, unit will move randomly within the range. Default is false. -- @return #RANGE self function RANGE:AddBombingTargetGroup( group, goodhitrange, randommove ) self:F( { group = group, goodhitrange = goodhitrange, randommove = randommove } ) + + if group and type(group)=="string" then + group=GROUP:FindByName(group) + end if group then @@ -3351,8 +3355,9 @@ function RANGE:_AddF10Commands( _unitName ) -- MISSION LEVEL -- ------------------- + -- Main F10 menu: F10// -- _rangePath = missionCommands.addSubMenuForGroup(_gid, self.rangename, RANGE.MenuF10Root) - _rangePath = MENU_GROUP:New( group, "On the Range", RANGE.MenuF10Root ) + _rangePath = MENU_GROUP:New( group, self.rangename, RANGE.MenuF10Root ) else @@ -3365,8 +3370,10 @@ function RANGE:_AddF10Commands( _unitName ) -- RANGE.MenuF10[_gid]=missionCommands.addSubMenuForGroup(_gid, "On the Range") RANGE.MenuF10[_gid] = MENU_GROUP:New( group, "On the Range" ) end + -- _rangePath = missionCommands.addSubMenuForGroup(_gid, self.rangename, RANGE.MenuF10[_gid]) _rangePath = MENU_GROUP:New( group, self.rangename, RANGE.MenuF10[_gid] ) + end local _statsPath = MENU_GROUP:New( group, "Statistics", _rangePath ) From 42979093b89f84727b28d5cebb7dd0ed222c5a6e Mon Sep 17 00:00:00 2001 From: Frank Date: Wed, 3 Jul 2024 17:45:21 +0200 Subject: [PATCH 4/7] Update Range.lua - Added `RANGE:SetMenuRoot` --- Moose Development/Moose/Functional/Range.lua | 40 ++++++++++++++------ 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/Moose Development/Moose/Functional/Range.lua b/Moose Development/Moose/Functional/Range.lua index 4141388ab..121e13965 100644 --- a/Moose Development/Moose/Functional/Range.lua +++ b/Moose Development/Moose/Functional/Range.lua @@ -106,6 +106,7 @@ -- @field Sound.SRS#MSRS instructmsrs SRS wrapper for range instructor. -- @field Sound.SRS#MSRSQUEUE instructsrsQ SRS queue for range instructor. -- @field #number Coalition Coalition side for the menu, if any. +-- @field Core.Menu#MENU_MISSION menuF10root Specific user defined root F10 menu. -- @extends Core.Fsm#FSM --- *Don't only practice your art, but force your way into its secrets; art deserves that, for it and knowledge can raise man to the Divine.* - Ludwig van Beethoven @@ -927,6 +928,16 @@ end -- User Functions ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +--- Set the root F10 menu under which the range F10 menu is created. +-- @param #RANGE self +-- @param Core.Menu#MENU_MISSION menu The root F10 menu. +-- @return #RANGE self +function RANGE:SetMenuRoot(menu) + self.menuF10root=menu + return self +end + + --- Set maximal strafing altitude. Player entering a strafe pit above that altitude are not registered for a valid pass. -- @param #RANGE self -- @param #number maxalt Maximum altitude in meters AGL. Default is 914 m = 3000 ft. @@ -3347,17 +3358,21 @@ function RANGE:_AddF10Commands( _unitName ) self.MenuAddedTo[_gid] = true -- Range root menu path. - local _rangePath = nil - - if RANGE.MenuF10Root then + local _rootMenu = nil + if self.menuF10root then + ------------------- -- MISSION LEVEL -- - ------------------- + ------------------- + + _rootMenu = MENU_GROUP:New( group, self.rangename, self.menuF10root ) + self:T2(self.lid..string.format("Creating F10 menu for group %s", group:GetName())) + + elseif RANGE.MenuF10Root then -- Main F10 menu: F10// - -- _rangePath = missionCommands.addSubMenuForGroup(_gid, self.rangename, RANGE.MenuF10Root) - _rangePath = MENU_GROUP:New( group, self.rangename, RANGE.MenuF10Root ) + _rootMenu = MENU_GROUP:New( group, self.rangename, RANGE.MenuF10Root ) else @@ -3367,14 +3382,17 @@ function RANGE:_AddF10Commands( _unitName ) -- Main F10 menu: F10/On the Range// if RANGE.MenuF10[_gid] == nil then - -- RANGE.MenuF10[_gid]=missionCommands.addSubMenuForGroup(_gid, "On the Range") - RANGE.MenuF10[_gid] = MENU_GROUP:New( group, "On the Range" ) + self:T2(self.lid..string.format("Creating F10 menu 'On the Range' for group %s", group:GetName())) + else + self:T2(self.lid..string.format("F10 menu 'On the Range' already EXISTS for group %s", group:GetName())) end - -- _rangePath = missionCommands.addSubMenuForGroup(_gid, self.rangename, RANGE.MenuF10[_gid]) - _rangePath = MENU_GROUP:New( group, self.rangename, RANGE.MenuF10[_gid] ) - + _rootMenu=RANGE.MenuF10[_gid] or MENU_GROUP:New( group, "On the Range" ) + end + + -- Range menu + local _rangePath = MENU_GROUP:New( group, self.rangename, _rootMenu ) local _statsPath = MENU_GROUP:New( group, "Statistics", _rangePath ) local _markPath = MENU_GROUP:New( group, "Mark Targets", _rangePath ) From 84dd1fa21c2c0846c183f25917fac6b25d75e4c5 Mon Sep 17 00:00:00 2001 From: Frank Date: Wed, 3 Jul 2024 23:17:37 +0200 Subject: [PATCH 5/7] Update Range.lua - Fixe F10 menu bug --- Moose Development/Moose/Functional/Range.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Moose Development/Moose/Functional/Range.lua b/Moose Development/Moose/Functional/Range.lua index 121e13965..87604b1b9 100644 --- a/Moose Development/Moose/Functional/Range.lua +++ b/Moose Development/Moose/Functional/Range.lua @@ -3366,13 +3366,15 @@ function RANGE:_AddF10Commands( _unitName ) -- MISSION LEVEL -- ------------------- - _rootMenu = MENU_GROUP:New( group, self.rangename, self.menuF10root ) + --_rootMenu = MENU_GROUP:New( group, self.rangename, self.menuF10root ) + _rootMenu = self.menuF10root self:T2(self.lid..string.format("Creating F10 menu for group %s", group:GetName())) elseif RANGE.MenuF10Root then -- Main F10 menu: F10// - _rootMenu = MENU_GROUP:New( group, self.rangename, RANGE.MenuF10Root ) + --_rootMenu = MENU_GROUP:New( group, self.rangename, RANGE.MenuF10Root ) + _rootMenu = RANGE.MenuF10Root else From 55a9c7e020b1392674ef584f82321189c11bc5ae Mon Sep 17 00:00:00 2001 From: Frank Date: Fri, 5 Jul 2024 17:53:50 +0200 Subject: [PATCH 6/7] Update Event.lua #2143 --- Moose Development/Moose/Core/Event.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Moose Development/Moose/Core/Event.lua b/Moose Development/Moose/Core/Event.lua index 78b69202a..98086d0d8 100644 --- a/Moose Development/Moose/Core/Event.lua +++ b/Moose Development/Moose/Core/Event.lua @@ -1346,7 +1346,7 @@ function EVENT:onEvent( Event ) -- Weapon. if Event.weapon then Event.Weapon = Event.weapon - Event.WeaponName = Event.Weapon:getTypeName() + Event.WeaponName = Event.weapon.getTypeName and Event.weapon:getTypeName() or "Unknown Weapon" Event.WeaponUNIT = CLIENT:Find( Event.Weapon, '', true ) -- Sometimes, the weapon is a player unit! Event.WeaponPlayerName = Event.WeaponUNIT and Event.Weapon.getPlayerName and Event.Weapon:getPlayerName() --Event.WeaponPlayerName = Event.WeaponUNIT and Event.Weapon:getPlayerName() From 29a4f7c160dd09ea9e9482103d0162e4517b52b1 Mon Sep 17 00:00:00 2001 From: Frank Date: Fri, 5 Jul 2024 21:35:55 +0200 Subject: [PATCH 7/7] Update Event.lua #2143 Try with isExist --- Moose Development/Moose/Core/Event.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Moose Development/Moose/Core/Event.lua b/Moose Development/Moose/Core/Event.lua index 98086d0d8..0f5320ff8 100644 --- a/Moose Development/Moose/Core/Event.lua +++ b/Moose Development/Moose/Core/Event.lua @@ -1346,7 +1346,7 @@ function EVENT:onEvent( Event ) -- Weapon. if Event.weapon then Event.Weapon = Event.weapon - Event.WeaponName = Event.weapon.getTypeName and Event.weapon:getTypeName() or "Unknown Weapon" + Event.WeaponName = Event.weapon:isExist() and Event.weapon:getTypeName() or "Unknown Weapon" Event.WeaponUNIT = CLIENT:Find( Event.Weapon, '', true ) -- Sometimes, the weapon is a player unit! Event.WeaponPlayerName = Event.WeaponUNIT and Event.Weapon.getPlayerName and Event.Weapon:getPlayerName() --Event.WeaponPlayerName = Event.WeaponUNIT and Event.Weapon:getPlayerName()