It can be old or new, but lets give some credit to the widgets the make our gaming easier!
I nominate See All Commands, version 1.0 (the old version), coded by tombom.
This widget, when on, lets you see everything that you and your allies have been ordered to do! Extremely helpful, I use this in every game!
Source:
Code: Select all
local team = Spring.GetMyTeamID()
local ally = (1>0)
function widget:GetInfo()
return {
name = "ShowAllCommands",
desc = "Acts like CTRL-A SHIFT all the time",
author = "tombom",
date = "Jul 22, 2007",
license = "GNU GPL, v2 or later",
layer = 0,
enabled = false -- loaded by default?
}
end
function widget:DrawWorld()
local mx, my = Spring.GetMouseState()
local type, data = Spring.TraceScreenRay(mx, my)
if (ally) then
local allyList = Spring.GetTeamList()
for i, v in pairs(allyList) do
local units = Spring.GetTeamUnits(v)
for q, s in pairs(units) do
if (q ~= nil) then
Spring.DrawUnitCommands(s)
end
end
end
elseif (team) then
local units = Spring.GetTeamUnits(team)
for i, v in pairs(units) do
if (i ~= nil) then
Spring.DrawUnitCommands(v)
end
end
end
if (type == 'unit') then
Spring.DrawUnitCommands(data)
end
end
function widget:TextCommand(command)
if (string.find(command, 'team ') == 1) then
team = tonumber(string.sub(command, 5))
end
if (string.find(command, 'viewally ') == 1) then
ally = tonumber(string.sub(command, 9))
end
end