Commit 10d177ce authored by nwwdles's avatar nwwdles

combattextnames: position text in center on lack of LOS

parent a7d0bf06
......@@ -24,6 +24,7 @@
CombatTextNames = {}
CombatTextNames.Settings = {
ResetPositionOnLOS = false,
Colors = {
INCOMING_DAMAGE = {r = 255, g = 0, b = 0},
OUTGOING_DAMAGE = {r = 235, g = 235, b = 235},
......@@ -159,6 +160,11 @@ function CombatTextNames.Initialize()
CombatTextNames.HookPointGainTextScaler(
EA_System_PointGainEntry.SetupText)
if CombatTextNames.Settings.ResetPositionOnLOS then
EA_System_EventTracker.Update = CombatTextNames.HookLOSPositioner(
EA_System_EventTracker.Update)
end
-- REPLACEMENTS
EA_System_EventText.AddCombatEventText = CombatTextNames.AddCombatEventText
EA_System_EventEntry.SetupText = CombatTextNames.SetupText
......@@ -269,7 +275,22 @@ function CombatTextNames.SetupText(self, hitTargetObjectNumber, hitAmount,
LabelSetTextColor(self:GetName(), color.r, color.g, color.b)
end
-- positioning
function CombatTextNames.HookLOSPositioner(fn)
return function(self, elapsedTime)
WindowClearAnchors(self.m_Anchor)
AttachWindowToWorldObject(self.m_Anchor, self.m_TargetObject)
MoveWindowToWorldObject(self.m_Anchor, self.m_TargetObject,
self.m_AttachHeight)
if not WindowGetShowing(self.m_Anchor) then
DetachWindowFromWorldObject(self.m_Anchor, self.m_TargetObject)
WindowSetShowing(self.m_Anchor, true)
WindowClearAnchors(self.m_Anchor)
WindowAddAnchor(self.m_Anchor, "center", "Root", "center", 0, 0)
end
fn(self, elapsedTime)
end
end
function CombatTextNames.InitializeAnimationData(self, displayType)
local baseAnimation = CombatTextNames.Settings.Animation.Friendly
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment