Major refactor to include tactical combat feed
This commit is contained in:
@@ -8,9 +8,9 @@ require("PGBase")
|
||||
---@field BuildTime number Game time that this unit was built.
|
||||
---@field AliveTime number Game time that this unit became "alive".
|
||||
---@field DeathTime number Game time that this unit was killed.
|
||||
---@field GameObjectWrapper table|nil The FoC GameObjectWrapper object.
|
||||
---@field GameObjectTypeWrapper table The FoC GameObjectTypeWrapper object.
|
||||
---@field Icon string Name of the icon for this object.
|
||||
---@field KillerId integer|nil The Player ID that killed this unit.
|
||||
---@field GameObject GameObject|nil The FoC GameObjectWrapper object.
|
||||
---@field GameObjectType GameObjectType The FoC GameObjectTypeWrapper object.
|
||||
UnitClass = {}
|
||||
UnitClass.__index = UnitClass
|
||||
|
||||
@@ -27,9 +27,9 @@ function UnitClass:New(objectType, playerId)
|
||||
self.BuildTime = GetCurrentTime()
|
||||
self.AliveTime = -1
|
||||
self.DeathTime = -1
|
||||
self.GameObjectWrapper = nil
|
||||
self.GameObjectTypeWrapper = objectType
|
||||
self.Icon = "I_BUTTON_COMMAND_BAR_PIRATE_SYMBOL.TGA"
|
||||
self.KillerId = nil
|
||||
self.GameObject = nil
|
||||
self.GameObjectType = objectType
|
||||
|
||||
return self
|
||||
end
|
||||
@@ -61,18 +61,20 @@ function UnitClass:SetAlive(object)
|
||||
end
|
||||
|
||||
self.AliveTime = GetCurrentTime()
|
||||
self.GameObjectWrapper = object
|
||||
self.GameObject = object
|
||||
ScriptMessage("Unit Spawned: %s", self:Debug())
|
||||
end
|
||||
|
||||
---Sets the unit as dead.
|
||||
function UnitClass:SetDead()
|
||||
---@param killerId integer The Player ID that killed this unit.
|
||||
function UnitClass:SetDead(killerId)
|
||||
if self.DeathTime >= 0 then
|
||||
-- Do not override once set
|
||||
return
|
||||
end
|
||||
|
||||
self.DeathTime = GetCurrentTime()
|
||||
self.KillerId = killerId
|
||||
ScriptMessage("Unit Killed: %s", self:Debug())
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user