SetUnitLosState()

SetUnitLosState()

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

SetUnitLosState()

Post by trepan »

fwiw ...

Code: Select all

r5907 | trepan | 2008-05-17 23:13:53 -0300 (Sat, 17 May 2008) | 24 lines
* Added the following LuaSyncedCtrl call-outs:
    - SetUnitLosMask(unitID, allyTeamID, number | table) -> nil
    - SetUnitLosState(unitID, allyTeamID, number | table) -> nil
  - If a mask bit is enabled, than the engine will not update
    the corresponding state bit (think of them as 'lock' bits)
  - If a table is used, entries should be of the form:
    { string = boolean } -- 'false' to clear, 'true' to set
    ex:  SetUnitLosState(3, 2, { los = true, radar = false })
  - The valid strings are 'los', 'radar', 'prevLos', and 'contRadar'
      prevLos:    previous LOS
      contRadar:  continuous radar  (since prevLos contact)
      *** These 2 dictate whether or not a unit type is known
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: SetUnitLosState()

Post by Argh »

Thanks for adding that.

Is there any difference between setting Spring.SetUnitAlwaysVisible to true, and the following, in the case of AllyTeamID 1?

Code: Select all

SetUnitLosMask(1, 1 {los = true})
SetUnitLosState(1, 1, {los = true})
IOW, would setting that mask state to true for AlwaysVisible Units have any impact at all on LOS performance with large numbers of Units, or is it already set to true in that case?
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Re: SetUnitLosState()

Post by Tobi »

It wouldn't have any impact at all.

EDIT: however, using your los=true solution INSTEAD of alwaysVisible=true will have a minor performance decrease.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: SetUnitLosState()

Post by Argh »

Okie doke. I figured it wouldn't improve things much either way.
Post Reply

Return to “Lua Scripts”