Skip to content

Consider spSetUnitUseAirlos(unitID, true) for the "reveal shooter" thing #5697

@sprunk

Description

@sprunk

Shooters hidden in holes etc are revealed if in airlos. This is currently done by checking if it is in airlos and setting los bitmasks.

local aLos = Spring.IsPosInAirLos(x, 0, z, allyTeamID)
local los = Spring.IsPosInLos(x, 0, z, allyTeamID)
-- Don't reveal units which are already in LOS. Waste of time to do so.
if aLos and not los then
if buildRevealUnitDef[unitDefID] or (noDecloakUnits[unitDefID] and Spring.GetUnitIsCloaked(unitID)) then
return
end
revealedUnits[allyTeamID][unitID] = immobileUnits[unitDefID] and STATIC_SHOW_TIME or MOBILE_SHOW_TIME
Spring.SetUnitLosMask(unitID, allyTeamID, 15) -- Prevents engine slow update from modifying state.
Spring.SetUnitLosState(unitID, allyTeamID, 15) -- Sets the unit to be fully visible.

Spring.SetUnitUseAirlos(unitID, bool) now exists, consider simplifying the above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendStuff that makes code easier to work with, without affecting the end userskill: LuaProgramming in Lua.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions