mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Updated scoring and made it better.
Implemented also a fracitide function. Anybody committing fracitide above 150 penalty points, gets destroyed and cannot join anymore.
This commit is contained in:
@@ -288,17 +288,21 @@ 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,
|
||||
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,
|
||||
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
|
||||
@@ -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
|
||||
@@ -386,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
|
||||
|
||||
|
||||
@@ -406,6 +433,7 @@ 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 .. "'. " ..
|
||||
@@ -423,6 +451,7 @@ 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.",
|
||||
@@ -540,20 +569,24 @@ 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,
|
||||
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,
|
||||
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
|
||||
|
||||
@@ -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,12 +37,11 @@ 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 )
|
||||
self:T( { MessageText, MessageCategory, MessageDuration, MessageID } )
|
||||
|
||||
local self = BASE:Inherit( self, BASE:New() )
|
||||
self:T( { MessageText, MessageCategory, MessageDuration, MessageID } )
|
||||
|
||||
-- When no messagecategory is given, we don't show it as a title...
|
||||
if MessageCategory or MessageCategory ~= "" then
|
||||
if MessageCategory and MessageCategory ~= "" then
|
||||
self.MessageCategory = MessageCategory .. "\n"
|
||||
else
|
||||
self.MessageCategory = ""
|
||||
@@ -179,7 +178,6 @@ MESSAGEQUEUE = {
|
||||
|
||||
function MESSAGEQUEUE:New( RefreshInterval )
|
||||
local self = BASE:Inherit( self, BASE:New() )
|
||||
|
||||
self:T( { RefreshInterval } )
|
||||
|
||||
self.RefreshInterval = RefreshInterval
|
||||
|
||||
Reference in New Issue
Block a user