Skip to content

Commit 129e60e

Browse files
committed
Only update myTeamID on widget initilization
1 parent b2090d8 commit 129e60e

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

LuaUI/Widgets/unit_smart_nanos.lua

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,12 @@ local myTeamID
7676
--------------------------------------------------------------------------------
7777

7878
function widget:Initialize()
79-
myTeamID = spGetMyTeamID()
80-
8179
if (spGetSpectatingState() or spIsReplay()) and (not spIsCheatingEnabled()) then
82-
Spring.Echo("Smart Nanos widget disabled for spectators")
80+
Spring.Echo("Smart Nanos widget disabled for spectators and cheaters")
8381
widgetHandler:RemoveWidget()
82+
return
8483
end
84+
myTeamID = spGetMyTeamID()
8585

8686
for _,unitID in ipairs(spGetAllUnits()) do
8787
local unitTeam = spGetUnitTeam(unitID)
@@ -107,10 +107,6 @@ function widget:UnitCreated(unitID, unitDefID, unitTeam)
107107
end
108108

109109
function widget:UnitFinished(unitID, unitDefID, unitTeam)
110-
if UnitDefs[unitDefID].customParams.commtype then
111-
myTeamID = spGetMyTeamID()
112-
end
113-
114110
if (unitTeam == myTeamID) then
115111

116112
buildUnits[unitID] = nil

0 commit comments

Comments
 (0)