diff --git a/Embedded/Moose_Embedded.lua b/Embedded/Moose_Embedded.lua index c003f0bd0..cad4a7aa6 100644 --- a/Embedded/Moose_Embedded.lua +++ b/Embedded/Moose_Embedded.lua @@ -15340,6 +15340,7 @@ end -- * @{#MISSILETRAINER.InitBearingOnOff}: Sets by default the display of bearing information of missiles ON of OFF. -- * @{#MISSILETRAINER.InitMenusOnOff}: Allows to configure the options through the radio menu. -- +-- -- @module MissileTrainer -- @author FlightControl @@ -15357,8 +15358,9 @@ MISSILETRAINER = { -- When a missile is fired a SCHEDULER is set off that follows the missile. When near a certain a client player, the missile will be destroyed. -- @param #MISSILETRAINER -- @param #number Distance The distance in meters when a tracked missile needs to be destroyed when close to a player. +-- @param #string MissileTrainerBriefing (Optional) Parameter to provide players with a briefing text for the training. -- @return #MISSILETRAINER -function MISSILETRAINER:New( Distance ) +function MISSILETRAINER:New( Distance, MissileTrainerBriefing ) local self = BASE:Inherit( self, BASE:New() ) self:F( Distance ) @@ -15369,6 +15371,10 @@ function MISSILETRAINER:New( Distance ) self.MessageLastTime = timer.getTime() self.Distance = Distance / 1000 + + if MissileTrainerBriefing then + self.MissileTrainerBriefing = MissileTrainerBriefing + end _EVENTDISPATCHER:OnShot( self._EventShot, self ) @@ -15380,14 +15386,14 @@ function MISSILETRAINER:New( Distance ) local function _Alive( Client ) - Client:Message( "Hello trainee, welcome to the Missile Trainer.\nGood luck!", 15, "HELLO WORLD", "Trainer" ) + if self.MissileTrainerBriefing then + Client:Message( self.MissileTrainerBriefing, 15, "HELLO WORLD", "Trainer" ) + end - - if self.MenusOnOff == true then - Client:Message( "Use the 'Radio Menu' -> 'Other (F10)' -> 'Missile Trainer' menu options to change the Missile Trainer settings (for all players).", 15, "MENU", "Trainer" ) + Client:Message( "Missile Trainer: Use the 'Radio Menu' -> 'Other (F10)' -> 'Missile Trainer' menu options to change the Missile Trainer settings (for all players).", 15, "MENU", "Trainer" ) - Client.MainMenu = MENU_CLIENT:New( Client, "Missile Trainer", nil ) -- Menu#MENU_CLIENT + Client.MainMenu = MENU_CLIENT:New( Client, "Missile Trainer", nil ) Client.MenuMessages = MENU_CLIENT:New( Client, "Messages", Client.MainMenu ) Client.MenuOn = MENU_CLIENT_COMMAND:New( Client, "Messages On", Client.MenuMessages, self._MenuMessages, { MenuSelf = self, MessagesOnOff = true } ) diff --git a/Moose/MissileTrainer.lua b/Moose/MissileTrainer.lua index 6fbe9a58e..909e3e361 100644 --- a/Moose/MissileTrainer.lua +++ b/Moose/MissileTrainer.lua @@ -82,8 +82,9 @@ MISSILETRAINER = { -- When a missile is fired a SCHEDULER is set off that follows the missile. When near a certain a client player, the missile will be destroyed. -- @param #MISSILETRAINER -- @param #number Distance The distance in meters when a tracked missile needs to be destroyed when close to a player. +-- @param #string MissileTrainerBriefing (Optional) Parameter to provide players with a briefing text for the training. -- @return #MISSILETRAINER -function MISSILETRAINER:New( Distance ) +function MISSILETRAINER:New( Distance, MissileTrainerBriefing ) local self = BASE:Inherit( self, BASE:New() ) self:F( Distance ) @@ -94,6 +95,10 @@ function MISSILETRAINER:New( Distance ) self.MessageLastTime = timer.getTime() self.Distance = Distance / 1000 + + if MissileTrainerBriefing then + self.MissileTrainerBriefing = MissileTrainerBriefing + end _EVENTDISPATCHER:OnShot( self._EventShot, self ) @@ -105,14 +110,14 @@ function MISSILETRAINER:New( Distance ) local function _Alive( Client ) - Client:Message( "Hello trainee, welcome to the Missile Trainer.\nGood luck!", 15, "HELLO WORLD", "Trainer" ) + if self.MissileTrainerBriefing then + Client:Message( self.MissileTrainerBriefing, 15, "HELLO WORLD", "Trainer" ) + end - - if self.MenusOnOff == true then - Client:Message( "Use the 'Radio Menu' -> 'Other (F10)' -> 'Missile Trainer' menu options to change the Missile Trainer settings (for all players).", 15, "MENU", "Trainer" ) + Client:Message( "Missile Trainer: Use the 'Radio Menu' -> 'Other (F10)' -> 'Missile Trainer' menu options to change the Missile Trainer settings (for all players).", 15, "MENU", "Trainer" ) - Client.MainMenu = MENU_CLIENT:New( Client, "Missile Trainer", nil ) -- Menu#MENU_CLIENT + Client.MainMenu = MENU_CLIENT:New( Client, "Missile Trainer", nil ) Client.MenuMessages = MENU_CLIENT:New( Client, "Messages", Client.MainMenu ) Client.MenuOn = MENU_CLIENT_COMMAND:New( Client, "Messages On", Client.MenuMessages, self._MenuMessages, { MenuSelf = self, MessagesOnOff = true } ) diff --git a/Test Missions/Moose_Test_MISSILETRAINER/Moose_Test_MISSILETRAINER.lua b/Test Missions/Moose_Test_MISSILETRAINER/Moose_Test_MISSILETRAINER.lua index 03d19e4ec..c8d4596ff 100644 --- a/Test Missions/Moose_Test_MISSILETRAINER/Moose_Test_MISSILETRAINER.lua +++ b/Test Missions/Moose_Test_MISSILETRAINER/Moose_Test_MISSILETRAINER.lua @@ -6,15 +6,15 @@ Include.File("MissileTrainer") -- This is an example of a global local Trainer = MISSILETRAINER - :New( 200 ) + :New( 200, "Trainer: Welcome to the missile training, trainee! Missiles will be fired at you. Try to evade them. Good luck!" ) :InitMessagesOnOff(true) - :InitAlertsToAll(true) -- I'll correct it below ... + :InitAlertsToAll(true) :InitAlertsHitsOnOff(true) - :InitAlertsLaunchesOnOff(false) + :InitAlertsLaunchesOnOff(false) -- I'll put it on below ... :InitBearingOnOff(true) :InitRangeOnOff(true) :InitTrackingOnOff(true) :InitTrackingToAll(true) :InitMenusOnOff(false) ---Trainer:InitAlertsToAll(true) -- Now alerts are also on +Trainer:InitAlertsToAll(true) -- Now alerts are also on diff --git a/Test Missions/Moose_Test_MISSILETRAINER/Moose_Test_MISSILETRAINER.miz b/Test Missions/Moose_Test_MISSILETRAINER/Moose_Test_MISSILETRAINER.miz index 1b10c6b63..0382b39da 100644 Binary files a/Test Missions/Moose_Test_MISSILETRAINER/Moose_Test_MISSILETRAINER.miz and b/Test Missions/Moose_Test_MISSILETRAINER/Moose_Test_MISSILETRAINER.miz differ