SetUnitLosState, SetUnitLosMask

SetUnitLosState, SetUnitLosMask

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Post Reply
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

SetUnitLosState, SetUnitLosMask

Post by Argh »

Can anybody explain to me why these are not valid callouts?

It's in Spring, it's been in there forever. They aren't documented in the Wiki, and they don't seem to work, Spring threw an error:

Code: Select all

ERROR: expected number or table
stack traceback:
	[C]: in function 'SetUnitLosState'
	[string "LuaRules/Gadgets/neutralizer.lua"]:41: in function 'GameFrame'
	[string "LuaGadgets/gadgets.lua"]:926: in function <[string "LuaGadgets/gadgets.lua"]:924>
	(tail call): ?
Which I presume means that it didn't find that function. Or did I just not provide the correct arguments to the callout?
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: SetUnitLosState, SetUnitLosMask

Post by jK »

wrong arguments and no, it wasn't in forever ...
User avatar
Pxtl
Posts: 6112
Joined: 23 Oct 2004, 01:43

Re: SetUnitLosState, SetUnitLosMask

Post by Pxtl »

Path: /trunk/rts/
Rev: 5907 - Go to most recent revision
Last modification: Rev 5907 - trepan - 2008-05-18 04:13:53 +0200 (Sun, 18 May 2008)
Log message:
* 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
* Replaced LOS_INTEAM with the LOS_xxx_MASK bits
* Changed the losStatus array from 'int' to 'unsigned short'
* Minimap and UnitDrawer now rely on the losStatus for unit
visibility, and do not take the allyTeam shortcut

It looks like english, but I couldn't say for sure.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: SetUnitLosState, SetUnitLosMask

Post by Argh »

Er, yeah, that's what I needed, thanks Pxtl. That's not English, it's coder-speak for, "do this stuff, stupid".

I was thinking I'd try implementing a new LOS system in Lua that wasn't frame-bound, in case anybody's wondering, see how that works. I'll get to it Sunday, I have IRL stuff to take care of today / tonight / Saturday.
User avatar
Pxtl
Posts: 6112
Joined: 23 Oct 2004, 01:43

Re: SetUnitLosState, SetUnitLosMask

Post by Pxtl »

.... oh, I get it, this sets visibility. Neat!
Post Reply

Return to “Engine”