mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge remote-tracking branch 'refs/remotes/origin/master' into Create-ESCORT-class
This commit is contained in:
commit
6dc1b1a810
@ -3289,7 +3289,7 @@ function GROUP:New( DCSGroup )
|
||||
end
|
||||
|
||||
|
||||
--- Create a new GROUP from an existing DCSGroup in the mission.
|
||||
--- Create a new GROUP from an existing group name.
|
||||
-- @param self
|
||||
-- @param GroupName The name of the DCS Group.
|
||||
-- @return #GROUP self
|
||||
@ -3301,12 +3301,30 @@ function GROUP:NewFromName( GroupName )
|
||||
if self.DCSGroup then
|
||||
self.GroupName = self.DCSGroup:getName()
|
||||
self.GroupID = self.DCSGroup:getID()
|
||||
self.Controller = DCSGroup:getController()
|
||||
self.Controller = self.DCSGroup:getController()
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Create a new GROUP from an existing DCSUnit in the mission.
|
||||
-- @param self
|
||||
-- @param DCSUnit The DCSUnit.
|
||||
-- @return #GROUP self
|
||||
function GROUP:NewFromDCSUnit( DCSUnit )
|
||||
local self = BASE:Inherit( self, BASE:New() )
|
||||
self:T( DCSUnit )
|
||||
|
||||
self.DCSGroup = DCSUnit:getGroup()
|
||||
if self.DCSGroup then
|
||||
self.GroupName = self.DCSGroup:getName()
|
||||
self.GroupID = self.DCSGroup:getID()
|
||||
self.Controller = self.DCSGroup:getController()
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Gets the DCSGroup of the GROUP.
|
||||
-- @param self
|
||||
-- @return #Group The DCSGroup.
|
||||
@ -4138,18 +4156,22 @@ function DATABASE:OnDeadOrCrash( event )
|
||||
end
|
||||
|
||||
if InitCoalition == TargetCoalition then
|
||||
PlayerData.Penalty = PlayerData.Penalty + 25
|
||||
PlayerData.Kill[TargetCategory][TargetType].Penalty = PlayerData.Kill[TargetCategory][TargetType].Penalty + 25
|
||||
PlayerData.Kill[TargetCategory][TargetType].PenaltyKill = PlayerData.Kill[TargetCategory][TargetType].PenaltyKill + 1
|
||||
MESSAGE:New( "Player '" .. PlayerName .. "' killed a friendly " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " ..
|
||||
PlayerData.Kill[TargetCategory][TargetType].PenaltyKill .. " times. Penalty: -" .. PlayerData.Kill[TargetCategory][TargetType].Penalty,
|
||||
"Game Status: Penalty", 20, "/PENALTY" .. PlayerName .. "/" .. InitUnitName ):ToAll()
|
||||
PlayerData.Kill[TargetCategory][TargetType].PenaltyKill .. " times. Penalty: -" .. PlayerData.Kill[TargetCategory][TargetType].Penalty ..
|
||||
". Score Total:" .. PlayerData.Score - PlayerData.Penalty,
|
||||
"", 5, "/PENALTY" .. PlayerName .. "/" .. InitUnitName ):ToAll()
|
||||
self:ScoreAdd( PlayerName, "KILL_PENALTY", 1, -125, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
|
||||
else
|
||||
PlayerData.Score = PlayerData.Score + 10
|
||||
PlayerData.Kill[TargetCategory][TargetType].Score = PlayerData.Kill[TargetCategory][TargetType].Score + 10
|
||||
PlayerData.Kill[TargetCategory][TargetType].ScoreKill = PlayerData.Kill[TargetCategory][TargetType].ScoreKill + 1
|
||||
MESSAGE:New( "Player '" .. PlayerName .. "' killed an enemy " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " ..
|
||||
PlayerData.Kill[TargetCategory][TargetType].ScoreKill .. " times. Score: " .. PlayerData.Kill[TargetCategory][TargetType].Score,
|
||||
"Game Status: Score", 20, "/SCORE" .. PlayerName .. "/" .. InitUnitName ):ToAll()
|
||||
PlayerData.Kill[TargetCategory][TargetType].ScoreKill .. " times. Score: " .. PlayerData.Kill[TargetCategory][TargetType].Score ..
|
||||
". Score Total:" .. PlayerData.Score - PlayerData.Penalty,
|
||||
"", 5, "/SCORE" .. PlayerName .. "/" .. InitUnitName ):ToAll()
|
||||
self:ScoreAdd( PlayerName, "KILL_SCORE", 1, 10, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
|
||||
end
|
||||
end
|
||||
@ -4212,8 +4234,10 @@ function DATABASE:_AddPlayerFromUnit( UnitData )
|
||||
-- end
|
||||
self.Players[PlayerName].HitPlayers = {}
|
||||
self.Players[PlayerName].HitUnits = {}
|
||||
self.Players[PlayerName].Score = 0
|
||||
self.Players[PlayerName].Penalty = 0
|
||||
self.Players[PlayerName].PenaltyCoalition = 0
|
||||
self.Players[PlayerName].PenaltyWarning = 0
|
||||
end
|
||||
|
||||
if not self.Players[PlayerName].UnitCoalition then
|
||||
@ -4223,8 +4247,11 @@ function DATABASE:_AddPlayerFromUnit( UnitData )
|
||||
self.Players[PlayerName].Penalty = self.Players[PlayerName].Penalty + 50
|
||||
self.Players[PlayerName].PenaltyCoalition = self.Players[PlayerName].PenaltyCoalition + 1
|
||||
MESSAGE:New( "Player '" .. PlayerName .. "' changed coalition from " .. DATABASECoalition[self.Players[PlayerName].UnitCoalition] .. " to " .. DATABASECoalition[UnitCoalition] ..
|
||||
"(changed " .. self.Players[PlayerName].PenaltyCoalition .. " times the coalition). 50 Penalty points added.",
|
||||
"Game Status: Penalty", 20, "/PENALTYCOALITION" .. PlayerName ):ToAll()
|
||||
"(changed " .. self.Players[PlayerName].PenaltyCoalition .. " times the coalition). 50 Penalty points added.",
|
||||
"",
|
||||
2,
|
||||
"/PENALTYCOALITION" .. PlayerName
|
||||
):ToAll()
|
||||
self:ScoreAdd( PlayerName, "COALITION_PENALTY", 1, -50, self.Players[PlayerName].UnitName, DATABASECoalition[self.Players[PlayerName].UnitCoalition], DATABASECategory[self.Players[PlayerName].UnitCategory], self.Players[PlayerName].UnitType,
|
||||
UnitName, DATABASECoalition[UnitCoalition], DATABASECategory[UnitCategory], UnitData:getTypeName() )
|
||||
end
|
||||
@ -4233,8 +4260,29 @@ function DATABASE:_AddPlayerFromUnit( UnitData )
|
||||
self.Players[PlayerName].UnitCoalition = UnitCoalition
|
||||
self.Players[PlayerName].UnitCategory = UnitCategory
|
||||
self.Players[PlayerName].UnitType = UnitTypeName
|
||||
end
|
||||
|
||||
if self.Players[PlayerName].Penalty > 100 then
|
||||
if self.Players[PlayerName].PenaltyWarning < 1 then
|
||||
MESSAGE:New( "Player '" .. PlayerName .. "': WARNING! If you continue to commit FRATRICIDE and have a PENALTY score higher than 150, you will be COURT MARTIALED and DISMISSED from this mission! \nYour total penalty is: " .. self.Players[PlayerName].Penalty,
|
||||
"",
|
||||
30,
|
||||
"/PENALTYCOALITION" .. PlayerName
|
||||
):ToAll()
|
||||
self.Players[PlayerName].PenaltyWarning = self.Players[PlayerName].PenaltyWarning + 1
|
||||
end
|
||||
end
|
||||
|
||||
if self.Players[PlayerName].Penalty > 150 then
|
||||
ClientGroup = GROUP:NewFromDCSUnit( UnitData )
|
||||
ClientGroup:Destroy()
|
||||
MESSAGE:New( "Player '" .. PlayerName .. "' committed FRATRICIDE, he will be COURT MARTIALED and is DISMISSED from this mission!",
|
||||
"",
|
||||
10,
|
||||
"/PENALTYCOALITION" .. PlayerName
|
||||
):ToAll()
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -4253,11 +4301,12 @@ function DATABASE:_AddMissionTaskScore( PlayerUnit, MissionName, Score )
|
||||
self:T( PlayerName )
|
||||
self:T( self.Players[PlayerName].Mission[MissionName] )
|
||||
|
||||
self.Players[PlayerName].Score = self.Players[PlayerName].Score + Score
|
||||
self.Players[PlayerName].Mission[MissionName].ScoreTask = self.Players[PlayerName].Mission[MissionName].ScoreTask + Score
|
||||
|
||||
MESSAGE:New( "Player '" .. PlayerName .. "' has finished another Task in Mission '" .. MissionName .. "'. " ..
|
||||
Score .. " Score points added.",
|
||||
"Game Status: Task Completion", 20, "/SCORETASK" .. PlayerName ):ToAll()
|
||||
"", 20, "/SCORETASK" .. PlayerName ):ToAll()
|
||||
|
||||
_Database:ScoreAdd( PlayerName, "TASK_" .. MissionName:gsub( ' ', '_' ), 1, Score, PlayerUnit:getName() )
|
||||
end
|
||||
@ -4270,10 +4319,11 @@ function DATABASE:_AddMissionScore( MissionName, Score )
|
||||
for PlayerName, PlayerData in pairs( self.Players ) do
|
||||
|
||||
if PlayerData.Mission[MissionName] then
|
||||
PlayerData.Score = PlayerData.Score + Score
|
||||
PlayerData.Mission[MissionName].ScoreMission = PlayerData.Mission[MissionName].ScoreMission + Score
|
||||
MESSAGE:New( "Player '" .. PlayerName .. "' has finished Mission '" .. MissionName .. "'. " ..
|
||||
Score .. " Score points added.",
|
||||
"Game Status: Mission Completion", 20, "/SCOREMISSION" .. PlayerName ):ToAll()
|
||||
"", 20, "/SCOREMISSION" .. PlayerName ):ToAll()
|
||||
_Database:ScoreAdd( PlayerName, "MISSION_" .. MissionName:gsub( ' ', '_' ), 1, Score )
|
||||
end
|
||||
end
|
||||
@ -4387,18 +4437,28 @@ function DATABASE:OnHit( event )
|
||||
end
|
||||
local Score = 0
|
||||
if InitCoalition == TargetCoalition then
|
||||
self.Players[InitPlayerName].Penalty = self.Players[InitPlayerName].Penalty + 10
|
||||
self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].Penalty = self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].Penalty + 10
|
||||
self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].PenaltyHit = self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].PenaltyHit + 1
|
||||
MESSAGE:New( "Player '" .. InitPlayerName .. "' hit a friendly " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " ..
|
||||
self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].PenaltyHit .. " times. Penalty: -" .. self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].Penalty,
|
||||
"Game Status: Penalty", 20, "/PENALTY" .. InitPlayerName .. "/" .. InitUnitName ):ToAll()
|
||||
self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].PenaltyHit .. " times. Penalty: -" .. self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].Penalty ..
|
||||
". Score Total:" .. self.Players[InitPlayerName].Score - self.Players[InitPlayerName].Penalty,
|
||||
"",
|
||||
2,
|
||||
"/PENALTY" .. InitPlayerName .. "/" .. InitUnitName
|
||||
):ToAll()
|
||||
self:ScoreAdd( InitPlayerName, "HIT_PENALTY", 1, -25, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
|
||||
else
|
||||
self.Players[InitPlayerName].Score = self.Players[InitPlayerName].Score + 10
|
||||
self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].Score = self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].Score + 1
|
||||
self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].ScoreHit = self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].ScoreHit + 1
|
||||
MESSAGE:New( "Player '" .. InitPlayerName .. "' hit a target " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " ..
|
||||
self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].ScoreHit .. " times. Score: " .. self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].Score,
|
||||
"Game Status: Score", 20, "/SCORE" .. InitPlayerName .. "/" .. InitUnitName ):ToAll()
|
||||
self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].ScoreHit .. " times. Score: " .. self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].Score ..
|
||||
". Score Total:" .. self.Players[InitPlayerName].Score - self.Players[InitPlayerName].Penalty,
|
||||
"",
|
||||
2,
|
||||
"/SCORE" .. InitPlayerName .. "/" .. InitUnitName
|
||||
):ToAll()
|
||||
self:ScoreAdd( InitPlayerName, "HIT_SCORE", 1, 1, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
|
||||
end
|
||||
end
|
||||
@ -6124,11 +6184,16 @@ MESSAGE = {
|
||||
-- MessageClient1 = MESSAGE:New( "Congratulations, you've just hit a target", "Score", 25, "Score" )
|
||||
-- MessageClient2 = MESSAGE:New( "Congratulations, you've just killed a target", "Score", 25, "Score" )
|
||||
function MESSAGE:New( MessageText, MessageCategory, MessageDuration, MessageID )
|
||||
trace.f(self.ClassName, { MessageText, MessageCategory, MessageDuration, MessageID } )
|
||||
|
||||
local self = BASE:Inherit( self, BASE:New() )
|
||||
|
||||
self.MessageCategory = MessageCategory
|
||||
self:T( { MessageText, MessageCategory, MessageDuration, MessageID } )
|
||||
|
||||
-- When no messagecategory is given, we don't show it as a title...
|
||||
if MessageCategory and MessageCategory ~= "" then
|
||||
self.MessageCategory = MessageCategory .. "\n"
|
||||
else
|
||||
self.MessageCategory = ""
|
||||
end
|
||||
|
||||
self.MessageDuration = MessageDuration
|
||||
self.MessageID = MessageID
|
||||
self.MessageTime = timer.getTime()
|
||||
@ -6160,13 +6225,13 @@ end
|
||||
-- MessageClient1:ToClient( ClientGroup )
|
||||
-- MessageClient2:ToClient( ClientGroup )
|
||||
function MESSAGE:ToClient( Client )
|
||||
trace.f(self.ClassName )
|
||||
self:T( Client )
|
||||
|
||||
if Client and Client:GetClientGroupID() then
|
||||
|
||||
local ClientGroupID = Client:GetClientGroupID()
|
||||
trace.i( self.ClassName, self.MessageCategory .. '\n' .. self.MessageText:gsub("\n$",""):gsub("\n$","") .. " / " .. self.MessageDuration )
|
||||
trigger.action.outTextForGroup( ClientGroupID, self.MessageCategory .. '\n' .. self.MessageText:gsub("\n$",""):gsub("\n$",""), self.MessageDuration )
|
||||
trace.i( self.ClassName, self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$","") .. " / " .. self.MessageDuration )
|
||||
trigger.action.outTextForGroup( ClientGroupID, self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$",""), self.MessageDuration )
|
||||
end
|
||||
|
||||
return self
|
||||
@ -6183,7 +6248,7 @@ end
|
||||
-- MessageBLUE = MESSAGE:New( "To the BLUE Players: You receive a penalty because you've killed one of your own units", "Penalty", 25, "Score" )
|
||||
-- MessageBLUE:ToBlue()
|
||||
function MESSAGE:ToBlue()
|
||||
trace.f(self.ClassName )
|
||||
self:T()
|
||||
|
||||
self:ToCoalition( coalition.side.BLUE )
|
||||
|
||||
@ -6201,7 +6266,7 @@ end
|
||||
-- MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25, "Score" )
|
||||
-- MessageRED:ToRed()
|
||||
function MESSAGE:ToRed( )
|
||||
trace.f(self.ClassName )
|
||||
self:T()
|
||||
|
||||
self:ToCoalition( coalition.side.RED )
|
||||
|
||||
@ -6220,11 +6285,11 @@ end
|
||||
-- MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25, "Score" )
|
||||
-- MessageRED:ToCoalition( coalition.side.RED )
|
||||
function MESSAGE:ToCoalition( CoalitionSide )
|
||||
trace.f(self.ClassName )
|
||||
self:T( CoalitionSide )
|
||||
|
||||
if CoalitionSide then
|
||||
trace.i(self.ClassName, self.MessageCategory .. '\n' .. self.MessageText:gsub("\n$",""):gsub("\n$","") .. " / " .. self.MessageDuration )
|
||||
trigger.action.outTextForCoalition( CoalitionSide, self.MessageCategory .. '\n' .. self.MessageText:gsub("\n$",""):gsub("\n$",""), self.MessageDuration )
|
||||
trace.i(self.ClassName, self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$","") .. " / " .. self.MessageDuration )
|
||||
trigger.action.outTextForCoalition( CoalitionSide, self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$",""), self.MessageDuration )
|
||||
end
|
||||
|
||||
return self
|
||||
@ -6241,7 +6306,7 @@ end
|
||||
-- MessageAll = MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", "End of Mission", 25, "Win" )
|
||||
-- MessageAll:ToAll()
|
||||
function MESSAGE:ToAll()
|
||||
trace.f(self.ClassName )
|
||||
self:T()
|
||||
|
||||
self:ToCoalition( coalition.side.RED )
|
||||
self:ToCoalition( coalition.side.BLUE )
|
||||
@ -6259,9 +6324,8 @@ MESSAGEQUEUE = {
|
||||
}
|
||||
|
||||
function MESSAGEQUEUE:New( RefreshInterval )
|
||||
trace.f( self.ClassName, { RefreshInterval } )
|
||||
|
||||
local self = BASE:Inherit( self, BASE:New() )
|
||||
self:T( { RefreshInterval } )
|
||||
|
||||
self.RefreshInterval = RefreshInterval
|
||||
|
||||
|
||||
@ -288,18 +288,22 @@ function DATABASE:OnDeadOrCrash( event )
|
||||
end
|
||||
|
||||
if InitCoalition == TargetCoalition then
|
||||
PlayerData.Penalty = PlayerData.Penalty + 25
|
||||
PlayerData.Kill[TargetCategory][TargetType].Penalty = PlayerData.Kill[TargetCategory][TargetType].Penalty + 25
|
||||
PlayerData.Kill[TargetCategory][TargetType].PenaltyKill = PlayerData.Kill[TargetCategory][TargetType].PenaltyKill + 1
|
||||
MESSAGE:New( "Player '" .. PlayerName .. "' killed a friendly " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " ..
|
||||
PlayerData.Kill[TargetCategory][TargetType].PenaltyKill .. " times. Penalty: -" .. PlayerData.Kill[TargetCategory][TargetType].Penalty,
|
||||
"Game Status: Penalty", 20, "/PENALTY" .. PlayerName .. "/" .. InitUnitName ):ToAll()
|
||||
PlayerData.Kill[TargetCategory][TargetType].PenaltyKill .. " times. Penalty: -" .. PlayerData.Kill[TargetCategory][TargetType].Penalty ..
|
||||
". Score Total:" .. PlayerData.Score - PlayerData.Penalty,
|
||||
"", 5, "/PENALTY" .. PlayerName .. "/" .. InitUnitName ):ToAll()
|
||||
self:ScoreAdd( PlayerName, "KILL_PENALTY", 1, -125, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
|
||||
else
|
||||
PlayerData.Score = PlayerData.Score + 10
|
||||
PlayerData.Kill[TargetCategory][TargetType].Score = PlayerData.Kill[TargetCategory][TargetType].Score + 10
|
||||
PlayerData.Kill[TargetCategory][TargetType].ScoreKill = PlayerData.Kill[TargetCategory][TargetType].ScoreKill + 1
|
||||
MESSAGE:New( "Player '" .. PlayerName .. "' killed an enemy " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " ..
|
||||
PlayerData.Kill[TargetCategory][TargetType].ScoreKill .. " times. Score: " .. PlayerData.Kill[TargetCategory][TargetType].Score,
|
||||
"Game Status: Score", 20, "/SCORE" .. PlayerName .. "/" .. InitUnitName ):ToAll()
|
||||
PlayerData.Kill[TargetCategory][TargetType].ScoreKill .. " times. Score: " .. PlayerData.Kill[TargetCategory][TargetType].Score ..
|
||||
". Score Total:" .. PlayerData.Score - PlayerData.Penalty,
|
||||
"", 5, "/SCORE" .. PlayerName .. "/" .. InitUnitName ):ToAll()
|
||||
self:ScoreAdd( PlayerName, "KILL_SCORE", 1, 10, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
|
||||
end
|
||||
end
|
||||
@ -362,8 +366,10 @@ function DATABASE:_AddPlayerFromUnit( UnitData )
|
||||
-- end
|
||||
self.Players[PlayerName].HitPlayers = {}
|
||||
self.Players[PlayerName].HitUnits = {}
|
||||
self.Players[PlayerName].Score = 0
|
||||
self.Players[PlayerName].Penalty = 0
|
||||
self.Players[PlayerName].PenaltyCoalition = 0
|
||||
self.Players[PlayerName].PenaltyWarning = 0
|
||||
end
|
||||
|
||||
if not self.Players[PlayerName].UnitCoalition then
|
||||
@ -373,8 +379,11 @@ function DATABASE:_AddPlayerFromUnit( UnitData )
|
||||
self.Players[PlayerName].Penalty = self.Players[PlayerName].Penalty + 50
|
||||
self.Players[PlayerName].PenaltyCoalition = self.Players[PlayerName].PenaltyCoalition + 1
|
||||
MESSAGE:New( "Player '" .. PlayerName .. "' changed coalition from " .. DATABASECoalition[self.Players[PlayerName].UnitCoalition] .. " to " .. DATABASECoalition[UnitCoalition] ..
|
||||
"(changed " .. self.Players[PlayerName].PenaltyCoalition .. " times the coalition). 50 Penalty points added.",
|
||||
"Game Status: Penalty", 20, "/PENALTYCOALITION" .. PlayerName ):ToAll()
|
||||
"(changed " .. self.Players[PlayerName].PenaltyCoalition .. " times the coalition). 50 Penalty points added.",
|
||||
"",
|
||||
2,
|
||||
"/PENALTYCOALITION" .. PlayerName
|
||||
):ToAll()
|
||||
self:ScoreAdd( PlayerName, "COALITION_PENALTY", 1, -50, self.Players[PlayerName].UnitName, DATABASECoalition[self.Players[PlayerName].UnitCoalition], DATABASECategory[self.Players[PlayerName].UnitCategory], self.Players[PlayerName].UnitType,
|
||||
UnitName, DATABASECoalition[UnitCoalition], DATABASECategory[UnitCategory], UnitData:getTypeName() )
|
||||
end
|
||||
@ -383,8 +392,29 @@ function DATABASE:_AddPlayerFromUnit( UnitData )
|
||||
self.Players[PlayerName].UnitCoalition = UnitCoalition
|
||||
self.Players[PlayerName].UnitCategory = UnitCategory
|
||||
self.Players[PlayerName].UnitType = UnitTypeName
|
||||
end
|
||||
|
||||
if self.Players[PlayerName].Penalty > 100 then
|
||||
if self.Players[PlayerName].PenaltyWarning < 1 then
|
||||
MESSAGE:New( "Player '" .. PlayerName .. "': WARNING! If you continue to commit FRATRICIDE and have a PENALTY score higher than 150, you will be COURT MARTIALED and DISMISSED from this mission! \nYour total penalty is: " .. self.Players[PlayerName].Penalty,
|
||||
"",
|
||||
30,
|
||||
"/PENALTYCOALITION" .. PlayerName
|
||||
):ToAll()
|
||||
self.Players[PlayerName].PenaltyWarning = self.Players[PlayerName].PenaltyWarning + 1
|
||||
end
|
||||
end
|
||||
|
||||
if self.Players[PlayerName].Penalty > 150 then
|
||||
ClientGroup = GROUP:NewFromDCSUnit( UnitData )
|
||||
ClientGroup:Destroy()
|
||||
MESSAGE:New( "Player '" .. PlayerName .. "' committed FRATRICIDE, he will be COURT MARTIALED and is DISMISSED from this mission!",
|
||||
"",
|
||||
10,
|
||||
"/PENALTYCOALITION" .. PlayerName
|
||||
):ToAll()
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -403,11 +433,12 @@ function DATABASE:_AddMissionTaskScore( PlayerUnit, MissionName, Score )
|
||||
self:T( PlayerName )
|
||||
self:T( self.Players[PlayerName].Mission[MissionName] )
|
||||
|
||||
self.Players[PlayerName].Score = self.Players[PlayerName].Score + Score
|
||||
self.Players[PlayerName].Mission[MissionName].ScoreTask = self.Players[PlayerName].Mission[MissionName].ScoreTask + Score
|
||||
|
||||
MESSAGE:New( "Player '" .. PlayerName .. "' has finished another Task in Mission '" .. MissionName .. "'. " ..
|
||||
Score .. " Score points added.",
|
||||
"Game Status: Task Completion", 20, "/SCORETASK" .. PlayerName ):ToAll()
|
||||
"", 20, "/SCORETASK" .. PlayerName ):ToAll()
|
||||
|
||||
_Database:ScoreAdd( PlayerName, "TASK_" .. MissionName:gsub( ' ', '_' ), 1, Score, PlayerUnit:getName() )
|
||||
end
|
||||
@ -420,10 +451,11 @@ function DATABASE:_AddMissionScore( MissionName, Score )
|
||||
for PlayerName, PlayerData in pairs( self.Players ) do
|
||||
|
||||
if PlayerData.Mission[MissionName] then
|
||||
PlayerData.Score = PlayerData.Score + Score
|
||||
PlayerData.Mission[MissionName].ScoreMission = PlayerData.Mission[MissionName].ScoreMission + Score
|
||||
MESSAGE:New( "Player '" .. PlayerName .. "' has finished Mission '" .. MissionName .. "'. " ..
|
||||
Score .. " Score points added.",
|
||||
"Game Status: Mission Completion", 20, "/SCOREMISSION" .. PlayerName ):ToAll()
|
||||
"", 20, "/SCOREMISSION" .. PlayerName ):ToAll()
|
||||
_Database:ScoreAdd( PlayerName, "MISSION_" .. MissionName:gsub( ' ', '_' ), 1, Score )
|
||||
end
|
||||
end
|
||||
@ -537,18 +569,28 @@ function DATABASE:OnHit( event )
|
||||
end
|
||||
local Score = 0
|
||||
if InitCoalition == TargetCoalition then
|
||||
self.Players[InitPlayerName].Penalty = self.Players[InitPlayerName].Penalty + 10
|
||||
self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].Penalty = self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].Penalty + 10
|
||||
self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].PenaltyHit = self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].PenaltyHit + 1
|
||||
MESSAGE:New( "Player '" .. InitPlayerName .. "' hit a friendly " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " ..
|
||||
self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].PenaltyHit .. " times. Penalty: -" .. self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].Penalty,
|
||||
"Game Status: Penalty", 20, "/PENALTY" .. InitPlayerName .. "/" .. InitUnitName ):ToAll()
|
||||
self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].PenaltyHit .. " times. Penalty: -" .. self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].Penalty ..
|
||||
". Score Total:" .. self.Players[InitPlayerName].Score - self.Players[InitPlayerName].Penalty,
|
||||
"",
|
||||
2,
|
||||
"/PENALTY" .. InitPlayerName .. "/" .. InitUnitName
|
||||
):ToAll()
|
||||
self:ScoreAdd( InitPlayerName, "HIT_PENALTY", 1, -25, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
|
||||
else
|
||||
self.Players[InitPlayerName].Score = self.Players[InitPlayerName].Score + 10
|
||||
self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].Score = self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].Score + 1
|
||||
self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].ScoreHit = self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].ScoreHit + 1
|
||||
MESSAGE:New( "Player '" .. InitPlayerName .. "' hit a target " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " ..
|
||||
self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].ScoreHit .. " times. Score: " .. self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].Score,
|
||||
"Game Status: Score", 20, "/SCORE" .. InitPlayerName .. "/" .. InitUnitName ):ToAll()
|
||||
self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].ScoreHit .. " times. Score: " .. self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].Score ..
|
||||
". Score Total:" .. self.Players[InitPlayerName].Score - self.Players[InitPlayerName].Penalty,
|
||||
"",
|
||||
2,
|
||||
"/SCORE" .. InitPlayerName .. "/" .. InitUnitName
|
||||
):ToAll()
|
||||
self:ScoreAdd( InitPlayerName, "HIT_SCORE", 1, 1, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
|
||||
end
|
||||
end
|
||||
|
||||
@ -46,7 +46,7 @@ function GROUP:New( DCSGroup )
|
||||
end
|
||||
|
||||
|
||||
--- Create a new GROUP from an existing DCSGroup in the mission.
|
||||
--- Create a new GROUP from an existing group name.
|
||||
-- @param self
|
||||
-- @param GroupName The name of the DCS Group.
|
||||
-- @return #GROUP self
|
||||
@ -58,12 +58,30 @@ function GROUP:NewFromName( GroupName )
|
||||
if self.DCSGroup then
|
||||
self.GroupName = self.DCSGroup:getName()
|
||||
self.GroupID = self.DCSGroup:getID()
|
||||
self.Controller = DCSGroup:getController()
|
||||
self.Controller = self.DCSGroup:getController()
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Create a new GROUP from an existing DCSUnit in the mission.
|
||||
-- @param self
|
||||
-- @param DCSUnit The DCSUnit.
|
||||
-- @return #GROUP self
|
||||
function GROUP:NewFromDCSUnit( DCSUnit )
|
||||
local self = BASE:Inherit( self, BASE:New() )
|
||||
self:T( DCSUnit )
|
||||
|
||||
self.DCSGroup = DCSUnit:getGroup()
|
||||
if self.DCSGroup then
|
||||
self.GroupName = self.DCSGroup:getName()
|
||||
self.GroupID = self.DCSGroup:getID()
|
||||
self.Controller = self.DCSGroup:getController()
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Gets the DCSGroup of the GROUP.
|
||||
-- @param self
|
||||
-- @return #Group The DCSGroup.
|
||||
|
||||
@ -37,11 +37,16 @@ MESSAGE = {
|
||||
-- MessageClient1 = MESSAGE:New( "Congratulations, you've just hit a target", "Score", 25, "Score" )
|
||||
-- MessageClient2 = MESSAGE:New( "Congratulations, you've just killed a target", "Score", 25, "Score" )
|
||||
function MESSAGE:New( MessageText, MessageCategory, MessageDuration, MessageID )
|
||||
trace.f(self.ClassName, { MessageText, MessageCategory, MessageDuration, MessageID } )
|
||||
|
||||
local self = BASE:Inherit( self, BASE:New() )
|
||||
|
||||
self.MessageCategory = MessageCategory
|
||||
self:T( { MessageText, MessageCategory, MessageDuration, MessageID } )
|
||||
|
||||
-- When no messagecategory is given, we don't show it as a title...
|
||||
if MessageCategory and MessageCategory ~= "" then
|
||||
self.MessageCategory = MessageCategory .. "\n"
|
||||
else
|
||||
self.MessageCategory = ""
|
||||
end
|
||||
|
||||
self.MessageDuration = MessageDuration
|
||||
self.MessageID = MessageID
|
||||
self.MessageTime = timer.getTime()
|
||||
@ -73,13 +78,13 @@ end
|
||||
-- MessageClient1:ToClient( ClientGroup )
|
||||
-- MessageClient2:ToClient( ClientGroup )
|
||||
function MESSAGE:ToClient( Client )
|
||||
trace.f(self.ClassName )
|
||||
self:T( Client )
|
||||
|
||||
if Client and Client:GetClientGroupID() then
|
||||
|
||||
local ClientGroupID = Client:GetClientGroupID()
|
||||
trace.i( self.ClassName, self.MessageCategory .. '\n' .. self.MessageText:gsub("\n$",""):gsub("\n$","") .. " / " .. self.MessageDuration )
|
||||
trigger.action.outTextForGroup( ClientGroupID, self.MessageCategory .. '\n' .. self.MessageText:gsub("\n$",""):gsub("\n$",""), self.MessageDuration )
|
||||
trace.i( self.ClassName, self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$","") .. " / " .. self.MessageDuration )
|
||||
trigger.action.outTextForGroup( ClientGroupID, self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$",""), self.MessageDuration )
|
||||
end
|
||||
|
||||
return self
|
||||
@ -96,7 +101,7 @@ end
|
||||
-- MessageBLUE = MESSAGE:New( "To the BLUE Players: You receive a penalty because you've killed one of your own units", "Penalty", 25, "Score" )
|
||||
-- MessageBLUE:ToBlue()
|
||||
function MESSAGE:ToBlue()
|
||||
trace.f(self.ClassName )
|
||||
self:T()
|
||||
|
||||
self:ToCoalition( coalition.side.BLUE )
|
||||
|
||||
@ -114,7 +119,7 @@ end
|
||||
-- MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25, "Score" )
|
||||
-- MessageRED:ToRed()
|
||||
function MESSAGE:ToRed( )
|
||||
trace.f(self.ClassName )
|
||||
self:T()
|
||||
|
||||
self:ToCoalition( coalition.side.RED )
|
||||
|
||||
@ -133,11 +138,11 @@ end
|
||||
-- MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25, "Score" )
|
||||
-- MessageRED:ToCoalition( coalition.side.RED )
|
||||
function MESSAGE:ToCoalition( CoalitionSide )
|
||||
trace.f(self.ClassName )
|
||||
self:T( CoalitionSide )
|
||||
|
||||
if CoalitionSide then
|
||||
trace.i(self.ClassName, self.MessageCategory .. '\n' .. self.MessageText:gsub("\n$",""):gsub("\n$","") .. " / " .. self.MessageDuration )
|
||||
trigger.action.outTextForCoalition( CoalitionSide, self.MessageCategory .. '\n' .. self.MessageText:gsub("\n$",""):gsub("\n$",""), self.MessageDuration )
|
||||
trace.i(self.ClassName, self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$","") .. " / " .. self.MessageDuration )
|
||||
trigger.action.outTextForCoalition( CoalitionSide, self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$",""), self.MessageDuration )
|
||||
end
|
||||
|
||||
return self
|
||||
@ -154,7 +159,7 @@ end
|
||||
-- MessageAll = MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", "End of Mission", 25, "Win" )
|
||||
-- MessageAll:ToAll()
|
||||
function MESSAGE:ToAll()
|
||||
trace.f(self.ClassName )
|
||||
self:T()
|
||||
|
||||
self:ToCoalition( coalition.side.RED )
|
||||
self:ToCoalition( coalition.side.BLUE )
|
||||
@ -172,9 +177,8 @@ MESSAGEQUEUE = {
|
||||
}
|
||||
|
||||
function MESSAGEQUEUE:New( RefreshInterval )
|
||||
trace.f( self.ClassName, { RefreshInterval } )
|
||||
|
||||
local self = BASE:Inherit( self, BASE:New() )
|
||||
self:T( { RefreshInterval } )
|
||||
|
||||
self.RefreshInterval = RefreshInterval
|
||||
|
||||
|
||||
@ -831,7 +831,7 @@ end
|
||||
|
||||
--- Get the index from a given group.
|
||||
-- The function will search the name of the group for a #, and will return the number behind the #-mark.
|
||||
function SPAWN:_GetGroupIndexFromGroup( SpawnGroup )
|
||||
function SPAWN:GetSpawnIndexFromGroup( SpawnGroup )
|
||||
self:T( { self.SpawnTemplatePrefix, self.SpawnAliasPrefix, SpawnGroup } )
|
||||
|
||||
local IndexString = string.match( SpawnGroup:GetName(), "#.*$" ):sub( 2 )
|
||||
@ -1137,7 +1137,7 @@ function SPAWN:_OnLand( event )
|
||||
self.Landed = true
|
||||
self:T( "self.Landed = true" )
|
||||
if self.Landed and self.RepeatOnLanding then
|
||||
local SpawnGroupIndex = self:_GetGroupIndexFromGroup( SpawnGroup )
|
||||
local SpawnGroupIndex = self:GetSpawnIndexFromGroup( SpawnGroup )
|
||||
self:T( { "Landed:", "ReSpawn:", SpawnGroup:GetName(), SpawnGroupIndex } )
|
||||
self:ReSpawn( SpawnGroupIndex )
|
||||
end
|
||||
@ -1158,7 +1158,7 @@ function SPAWN:_OnLand( event )
|
||||
if SpawnGroup then
|
||||
self:T( { "EngineShutDown event: " .. event.initiator:getName(), event } )
|
||||
if self.Landed and self.RepeatOnEngineShutDown then
|
||||
local SpawnGroupIndex = self:_GetGroupIndexFromGroup( SpawnGroup )
|
||||
local SpawnGroupIndex = self:GetSpawnIndexFromGroup( SpawnGroup )
|
||||
self:T( { "EngineShutDown: ", "ReSpawn:", SpawnGroup:GetName(), SpawnGroupIndex } )
|
||||
self:ReSpawn( SpawnGroupIndex )
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user