---------------------------------------------------------------- function widget:GetInfo() return { name = "Comm Marker", desc = "Marks comms", author = "original mobile anti marker by Niobium, modified by faceless", date = "17th Feb 2009", license = "GNU GPL, v2 or later", layer = 0, enabled = true -- loaded by default? } end ---------------------------------------------------------------- local spGetMyPlayerID = Spring.GetMyPlayerID local spGetPlayerInfo = Spring.GetPlayerInfo local spGetMyAllyTeamID = Spring.GetMyAllyTeamID local spGetUnitDefID = Spring.GetUnitDefID local spGetUnitPosition = Spring.GetUnitPosition local spGetUnitVelocity = Spring.GetUnitVelocity local spMarkerAddPoint = Spring.MarkerAddPoint ---------------------------------------------------------------- local marked = {} ---------------------------------------------------------------- function widget:Initialize() widget:Update() end function widget:Update() local _, _, spec = spGetPlayerInfo(spGetMyPlayerID()) if (spec == true) then spEcho(" Spectator mode. Widget removed.") widgetHandler:RemoveWidget() return false end end function widget:UnitEnteredLos(uID, allyTeam) if (marked[uID]) then return end if (allyTeam == spGetMyAllyTeamID()) then return end local uDefID = spGetUnitDefID(uID) -- if (uDefID == nil) then return end -- Shouldn't need as we have LOS if ((UnitDefs[uDefID].name ~= 'armcom') and (UnitDefs[uDefID].name ~= 'corcom')) then return end local vx, vy, vz = spGetUnitVelocity(uID) if ((vx ~= 0) or (vy ~= 0) or (vz ~= 0)) then local x, y, z = spGetUnitPosition(uID) spMarkerAddPoint(x, y, z, "Comm (Moving)") else local x, y, z = spGetUnitPosition(uID) spMarkerAddPoint(x, y, z, "Comm (Stationary)") end marked[uID] = true end ----------------------------------------------------------------