I've been looking at a way of making radio buttons in mod options that switch lines of sight like in OTA.
I'm trying to find a function that changes the distances units can see.
This is what I've found in the lua synced control documentation:
I'm not really sure what function I need to use, but I think it might be the last one.Unit LOS
Spring.SetUnitCloak
( number unitID,
boolean cloaked | number scriptCloak,
[ number decloakDistance | boolean decloakAbs ] ) -> nil
If the 2nd argument is a number, the value works like this:
1:=normal cloak
2:=for free cloak (cost no E)
3:=for free + no decloaking (except the unit is stunned)
4>=ultimative cloak (no ecost, no decloaking, no stunned decloak)
The decloak distance is only changed if the 3th argument is a number or a boolean.
If the boolean is false it takes the default decloak distance for that unitdef,
if the boolean is true it takes the absolute value of it.
Spring.SetUnitSonarStealth
( number unitID, boolean sonarStealth ) -> nil
Spring.SetUnitStealth
( number unitID, boolean stealth ) -> nil
Spring.SetUnitAlwaysVisible
( number unitID, boolean alwaysVisible ) -> nil
Spring.SetUnitLosMask
( number unitID, number allyTeam, number los | table losTypes ) -> nil
the 3th argument is either the bit-and combination of the following numbers:
LOS_INLOS = 1
LOS_INRADAR = 2
LOS_PREVLOS = 4
LOS_CONTRADAR = 8
or a table of the following form:
losTypes = {
[los = boolean,]
[radar = boolean,]
[prevLos = boolean,]
[contRadar = boolean,]
}
Spring.SetUnitLosState
( number unitID, number allyTeam, number los | table losTypes ) -> nil
see above for more info on the arguments
Spring.SetUnitSensorRadius
( number unitID, string type, number radius ) -> nil | number newRadius
type can be:
"los","airLos","radar","sonar","seismic","radarJammer","sonarJammer"
Spring.SetUnitSensorRadius(unitID, "los", radius)
Even if this is the function I'm looking for, I'm not sure what designation it needs ("los", "airLos", "radar", or "seismic")
because I don't know what each of these exactly affect.
Thanks for help