Page 2 of 2
Re: build que?
Posted: 28 Jan 2012, 03:45
by smoth
knorke wrote:smoth wrote:so what does any of this mean?
[1]
1712
this might be x!
yeah I am thinking the same thing
My guesses
[id]
-25 cmdID?
[tag]
5
[options]
[coded]
32 - unitdefidMaybe?
[shift]
true
[params]definitely coordinates
[1]
1872
[2]
132.29370117188
[3]
1568
[4]
Re: build que?
Posted: 28 Jan 2012, 05:14
by Pako
http://springrts.com/wiki/Lua_CMDs
Negative CMD ID is a build command as negative unitDefID and parameters are mappos + heading.
Re: build que?
Posted: 28 Jan 2012, 17:54
by smoth
First, said "tags" are unique command identifiers, so each command that gets inserted into a unit's command queue gets its unique "tag" number. (It is used to sync command queue operations, also it makes things much easier.)
To receive those "tags" you can do the following:
local cmdQueue = Spring.GetUnitCommands(unitID);
if (#cmdQueue>0) then
local cmdTag = cmdQueue[1].tag
..
end
tags.
Re: build que?
Posted: 28 Jan 2012, 19:14
by smoth
yay so this covers mobile builders, NOT factories!
so for factories
Code: Select all
local buildQueue = spGetFullBuildQueue(unitID)
Code: Select all
============ table: 1 =============
[142]
1
============ table: 2 =============
[66]
1
============ table: 3 =============
[65]
1
============ table: 4 =============
[88]
10
============ table: 5 =============
[126]
25
================================
which is :
[126] - [unitID]
25 - queue count
also this is in order..
Don't worry guys, I will make a small guide in the wiki about this after I am done.
Re: build que?
Posted: 30 Jan 2012, 06:17
by smoth
what a waste of a fing weekend. will wiki the knowledge up after I have rested up with work.
for later wikification:
Code: Select all
local function AlterQueue(teamID, factoryID, researchItems)
local upgrades = researchItems.upgrades
local facCmds = spGetFactoryCommands(factoryID)
if facCmds then -- nil check
for i = 1, #facCmds do
local cmd = facCmds[i]
local newBuildID = upgrades[-cmd.id]
if newBuildID then
-- ctrl in options here forces it to use factory build queue
spGiveOrderToUnit(factoryID, CMD.REMOVE, {cmd.tag}, {"ctrl"})
spGiveOrderToUnit(factoryID, CMD.INSERT, {i, -newBuildID, 0}, {"ctrl", "alt"})
end
end
end
end
Code: Select all
spEditUnitCmdDesc(unitID,f,{disabled=true,hidden=true})
apparently people can make buttons of their own to issue the command id still
be sure to ultramegacockblockwith:
Code: Select all
function gadget:AllowCommand(unitID, unitDefID, teamID, cmd, param, opt, tag, synced)
if cmd < 0 then
if lockedUnits[teamID][-cmd] then --list of shit he cannot build for that team.
return false
end
end
build commands for units have fing negative values to tell them apart from regular commands.
I would like some waffles.
Re: build que?
Posted: 18 Apr 2012, 14:42
by idntgvadmn
did this ever get uploaded to the wiki? A guide looks promising.
Re: build que?
Posted: 18 Apr 2012, 15:08
by smoth
not yet, I have a few bits to figure out but I can post it later if desired.