Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function widget:GetInfo()
- return {
- name = "ClearFactoryQueue",
- desc = "Clears the entire build queue of all selected factories.",
- author = "FlorisXIV",
- date = "2013-07-04",
- license = "Dunno about licenses, use this in any way you like.",
- layer = 0,
- enabled = true
- }
- end
- --includes
- include("keysym.h.lua")
- function widget:Initialize()
- if (Spring.GetSpectatingState() or Spring.IsReplay()) then
- widgetHandler:RemoveWidget()
- end
- end
- local function clearFactory()
- selectedUnits = Spring.GetSelectedUnits()
- for _, unitID in ipairs( selectedUnits ) do
- ud = UnitDefs[ Spring.GetUnitDefID(unitID)]
- if ( ud.isFactory ) then
- buildQueue = Spring.GetFactoryCommands (unitID)
- for _, buildCommand in ipairs( buildQueue) do
- Spring.GiveOrderToUnit( unitID, CMD.REMOVE, { buildCommand.tag } , {"ctrl"} )
- end
- end
- end
- end
- function widget:KeyPress(key, modifier, isRepeat)
- if( key == KEYSYMS.SEMICOLON ) then
- clearFactory()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment