mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Bugfix on hit event
This commit is contained in:
parent
14a48901dc
commit
17118e5784
@ -393,6 +393,7 @@ end
|
|||||||
function DATABASE:OnHit( event )
|
function DATABASE:OnHit( event )
|
||||||
trace.f( self.ClassName, { event } )
|
trace.f( self.ClassName, { event } )
|
||||||
|
|
||||||
|
local InitUnit = nil
|
||||||
local InitUnitName = nil
|
local InitUnitName = nil
|
||||||
local InitGroupName = nil
|
local InitGroupName = nil
|
||||||
local InitPlayerName = nil
|
local InitPlayerName = nil
|
||||||
@ -404,6 +405,7 @@ trace.f( self.ClassName, { event } )
|
|||||||
local InitUnitCategory = nil
|
local InitUnitCategory = nil
|
||||||
local InitUnitType = nil
|
local InitUnitType = nil
|
||||||
|
|
||||||
|
local TargetUnit = nil
|
||||||
local TargetUnitName = nil
|
local TargetUnitName = nil
|
||||||
local TargetGroupName = nil
|
local TargetGroupName = nil
|
||||||
local TargetPlayerName = nil
|
local TargetPlayerName = nil
|
||||||
@ -418,14 +420,16 @@ trace.f( self.ClassName, { event } )
|
|||||||
if event.initiator and event.initiator:getName() then
|
if event.initiator and event.initiator:getName() then
|
||||||
|
|
||||||
if event.initiator and Object.getCategory(event.initiator) == Object.Category.UNIT then
|
if event.initiator and Object.getCategory(event.initiator) == Object.Category.UNIT then
|
||||||
|
|
||||||
|
InitUnit = event.initiator
|
||||||
|
|
||||||
InitUnitName = event.initiator:getName()
|
InitUnitName = InitUnit:getName()
|
||||||
InitGroupName = Unit.getGroup(event.initiator):getName()
|
InitGroupName = Unit.getGroup(InitUnit):getName()
|
||||||
InitPlayerName = event.initiator:getPlayerName()
|
InitPlayerName = InitUnit:getPlayerName()
|
||||||
|
|
||||||
InitCoalition = Unit:getCoalition()
|
InitCoalition = InitUnit:getCoalition()
|
||||||
InitCategory = Unit:getCategory()
|
InitCategory = InitUnit:getCategory()
|
||||||
InitType = event.initiator:getTypeName()
|
InitType = InitUnit:getTypeName()
|
||||||
|
|
||||||
InitUnitCoalition = DATABASECoalition[InitCoalition]
|
InitUnitCoalition = DATABASECoalition[InitCoalition]
|
||||||
InitUnitCategory = DATABASECategory[InitCategory]
|
InitUnitCategory = DATABASECategory[InitCategory]
|
||||||
@ -436,14 +440,16 @@ trace.f( self.ClassName, { event } )
|
|||||||
|
|
||||||
|
|
||||||
if event.target and Object.getCategory(event.target) == Object.Category.UNIT then
|
if event.target and Object.getCategory(event.target) == Object.Category.UNIT then
|
||||||
|
|
||||||
|
TargetUnit = event.target
|
||||||
|
|
||||||
TargetUnitName = event.target:getName()
|
TargetUnitName = TargetUnit:getName()
|
||||||
TargetGroupName = Unit.getGroup(event.target):getName()
|
TargetGroupName = Unit.getGroup(TargetUnit):getName()
|
||||||
TargetPlayerName = event.target:getPlayerName()
|
TargetPlayerName = TargetUnit:getPlayerName()
|
||||||
|
|
||||||
TargetCoalition = Unit.getGroup(event.target):getCoalition()
|
TargetCoalition = TargetUnit:getCoalition()
|
||||||
TargetCategory = Unit.getGroup(event.target):getCategory()
|
TargetCategory = TargetUnit:getCategory()
|
||||||
TargetType = event.target:getTypeName()
|
TargetType = TargetUnit:getTypeName()
|
||||||
|
|
||||||
TargetUnitCoalition = DATABASECoalition[TargetCoalition]
|
TargetUnitCoalition = DATABASECoalition[TargetCoalition]
|
||||||
TargetUnitCategory = DATABASECategory[TargetCategory]
|
TargetUnitCategory = DATABASECategory[TargetCategory]
|
||||||
@ -453,10 +459,10 @@ trace.f( self.ClassName, { event } )
|
|||||||
end
|
end
|
||||||
|
|
||||||
if InitPlayerName ~= nil then -- It is a player that is hitting something
|
if InitPlayerName ~= nil then -- It is a player that is hitting something
|
||||||
self:_AddPlayerFromUnit( event.initiator )
|
self:_AddPlayerFromUnit( InitUnit )
|
||||||
if self.Players[InitPlayerName] then -- This should normally not happen, but i'll test it anyway.
|
if self.Players[InitPlayerName] then -- This should normally not happen, but i'll test it anyway.
|
||||||
if TargetPlayerName ~= nil then -- It is a player hitting another player ...
|
if TargetPlayerName ~= nil then -- It is a player hitting another player ...
|
||||||
self:_AddPlayerFromUnit( event.target )
|
self:_AddPlayerFromUnit( TargetUnit )
|
||||||
self.Players[InitPlayerName].HitPlayers = self.Players[InitPlayerName].HitPlayers + 1
|
self.Players[InitPlayerName].HitPlayers = self.Players[InitPlayerName].HitPlayers + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user