This commit is contained in:
FlightControl_Master
2017-10-05 11:09:10 +02:00
parent feef4c148e
commit fe47783bfa
7 changed files with 60 additions and 75 deletions

View File

@@ -1132,44 +1132,23 @@ end
TargetCategory = Event.IniCategory
TargetType = Event.IniTypeName
TargetUnitCoalition = _SCORINGCoalition[TargetCoalition]
TargetUnitCategory = _SCORINGCategory[TargetCategory]
TargetUnitType = TargetType
self:T( { TargetUnitName, TargetGroupName, TargetPlayerName, TargetCoalition, TargetCategory, TargetType } )
end
-- Player contains the score and reference data for the player.
for PlayerName, Player in pairs( self.Players ) do
if Player then -- This should normally not happen, but i'll test it anyway.
self:T( "Something got destroyed" )
-- Some variables
local InitUnitName = Player.UnitName
local InitUnitType = Player.UnitType
local InitCoalition = Player.UnitCoalition
local InitCategory = Player.UnitCategory
local InitUnitCoalition = _SCORINGCoalition[InitCoalition]
local InitUnitCategory = _SCORINGCategory[InitCategory]
self:T( { InitUnitName, InitUnitType, InitUnitCoalition, InitCoalition, InitUnitCategory, InitCategory } )
local Destroyed = false
-- What is the player destroying?
if self.HITS[TargetUnitName] then -- Was there a hit for this unit for this player before registered???
self:T( "Something got destroyed" )
local Destroyed = false
-- What is the player destroying?
if self.HITS[Event.IniUnitName] then -- Was there a hit for this unit for this player before registered???
self.DESTROYS[Event.IniUnitName] = self.DESTROYS[Event.IniUnitName] or {}
self.DESTROYS[Event.IniUnitName] = true
self.DESTROYS[Event.TgtUnitName] = self.DESTROYS[Event.TgtUnitName] or {}
local PlayerDestroys = self.DESTROYS[Event.TgtUnitName]
if TargetCoalition then
PlayerDestroys = PlayerDestroys or {}
PlayerDestroys[PlayerName] = true
end
end
end
end
end

View File

@@ -141,15 +141,22 @@ do -- Zone
--- @param #ZONE_GOAL self
-- @param Event#EVENTDATA EventData
-- @param Core.Event#EVENTDATA EventData
function ZONE_GOAL:__Destroyed( EventData )
self:T( { "EventDead", EventData } )
self:E( { "EventDead", EventData } )
self:E( { EventData.IniUnit } )
local Vec3 = EventData.IniDCSUnit:getPosition().p
self:E( { Vec3 = Vec3 } )
local ZoneGoal = self:GetZone()
self:E({ZoneGoal})
if EventData.IniDCSUnit then
if EventData.IniUnit:IsInZone( self:GetZone() ) then
if ZoneGoal:IsVec3InZone(Vec3) then
local PlayerHits = _DATABASE.HITS[EventData.IniUnitName]
if PlayerHits then
for PlayerName, PlayerHit in pairs( PlayerHits ) do
for PlayerName, PlayerHit in pairs( PlayerHits.Players or {} ) do
self.Goal:AddPlayerContribution( PlayerName )
self:DestroyedUnit( EventData.IniUnitName, PlayerName )
end

View File

@@ -16,10 +16,10 @@
do -- ZoneGoal
--- @type ZONE_GOAL_COALITION
-- @extends Core.ZoneGoal#ZONE_GOAL_COALITION
-- @extends Core.ZoneGoal#ZONE_GOAL
--- # ZONE_GOAL_COALITION class, extends @{ZoneGoal#ZONE_GOAL_COALITION}
--- # ZONE_GOAL_COALITION class, extends @{ZoneGoal#ZONE_GOAL}
--
-- ZONE_GOAL_COALITION models processes that have a Goal with a defined achievement involving a Zone for a Coalition.
-- Derived classes implement the ways how the achievements can be realized.
@@ -67,7 +67,7 @@ do -- ZoneGoal
-- @return #ZONE_GOAL_COALITION
function ZONE_GOAL_COALITION:New( Zone, Coalition )
local self = BASE:Inherit( self, ZONE_GOAL_COALITION:New( Zone ) ) -- #ZONE_GOAL_COALITION
local self = BASE:Inherit( self, ZONE_GOAL:New( Zone ) ) -- #ZONE_GOAL_COALITION
self:F( { Zone = Zone, Coalition = Coalition } )
self:SetCoalition( Coalition )
@@ -431,8 +431,6 @@ do -- ZoneGoal
-- @param #ZONE_GOAL_COALITION self
function ZONE_GOAL_COALITION:StatusZone()
self:GetParent( self, ZONE_GOAL_COALITION ).StatusZone( self )
local State = self:GetState()
self:E( { State = self:GetState() } )