question about const

question about const

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

Moderator: Moderators

Post Reply
Broker
Posts: 156
Joined: 02 Jul 2012, 13:16

question about const

Post by Broker »

Hi all!!

how can i understand that constructor builds building?

like this:

[code]
local bQueue = Spring.GetFullBuildQueue(unit)
if bQueue then const=true
[/code]


i try it but not working.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: question about const

Post by zwzsg »

Personnaly I used to use something like that:

Code: Select all

local vx,_,vz=Spring.GetUnitVelocity(u)
if vx==0 and vz==0 and not Spring.GetUnitIsBuilding(u) then
-- idle
The Spring.GetUnitIsBuilding tells me if it is currently using its nanolathe.
The Velocity tells me it is going somewhere, so maybe on its way to the build zone.
However, latest Spring version broke it: Unit getting stuck no longer have a null speed.
Post Reply

Return to “Lua Scripts”