From 70bca0d142d1300026e72de24836f0595b9ba95b Mon Sep 17 00:00:00 2001 From: funkyfranky Date: Wed, 15 May 2019 16:47:38 +0200 Subject: [PATCH] SC --- .../Moose/Functional/Scoring.lua | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/Moose Development/Moose/Functional/Scoring.lua b/Moose Development/Moose/Functional/Scoring.lua index e8eaa5b3e..cfc7664bb 100644 --- a/Moose Development/Moose/Functional/Scoring.lua +++ b/Moose Development/Moose/Functional/Scoring.lua @@ -1347,6 +1347,7 @@ function SCORING:_EventOnDeadOrCrash( Event ) -- Write CSV penalty. Destroyed = true self:ScoreCSV( PlayerName, TargetPlayerName, "DESTROY_PENALTY", 1, ThreatPenalty, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType ) + else --- @@ -1469,6 +1470,7 @@ function SCORING:_EventOnDeadOrCrash( Event ) self:ScoreCSV( PlayerName, "", "DESTROY_SCORE", 1, Score, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, "", "Scenery", TargetUnitType ) end end + end -- Delete now the hit cache if the target was destroyed. @@ -1992,7 +1994,9 @@ function SCORING:LoadCSV(filename) -- Create player array if necessary. self.CSVdata[result.PlayerName]=self.CSVdata[result.PlayerName] or {} - if self.Players[PlayerName] == nil then -- I believe this is the place where a Player gets a life in a mission when he enters a unit ... + local Player=self.Players[PlayerName] --#SCORING.PlayerData + + if Player == nil then -- I believe this is the place where a Player gets a life in a mission when he enters a unit ... self.Players[PlayerName] = {} self.Players[PlayerName].Hit = {} self.Players[PlayerName].Destroy = {} @@ -2005,6 +2009,23 @@ function SCORING:LoadCSV(filename) self.Players[PlayerName].PenaltyWarning = 0 end + -- Restore player scores. + if result.ScoreType then + if result.ScoreType:find("PENALTY") then + + -- Penalty + Player.Penalty=Player.Penalty+result.Score + + -- Coalition change penalty. + if result.ScoreType:find("COALITION_PENALTY") then + Player.PenaltyCoalition=Player.PenaltyCoalition+1 + end + end + if result.ScoreType:find("SCORE") then + Player.Score=Player.Score+result.Score + end + end + --self.Players[PlayerName].Score=self.Players[PlayerName].Score+result.Score -- Add result to table.