Public feed
#381519
local unitList = {"armrock","armflea","armjeth","armfav","tawf013","armjanus","armsam","armaak","armyork","armroy","corstorm","corcrash","corfav","corwolv","corlevlr","cormist","corsent","coraak"}
-- Edit the above list to customize the units that will be set on hold position.
local holdUnits = {}
function widget:GetInfo()
return {
name = "DontMove",
desc = "Sets units defined in cmd_dontmove.lua on hold position.",
author = "quantum",
date = "Jan 8, 2007",
license = "GNU GPL, v2 or later",
layer = 0,
enabled = false -- loaded by default?
}
end
include("spring.h.lua")
function widget:Initialize()
for i, v in pairs(unitList) do --Rearrange unitlist for better performance.
holdUnits[v] = true
end
end
function widget:UnitFromFactory(unitID, unitDefID, unitTeam)
local ud = UnitDefs[unitDefID]
if ((ud ~= nil) and (unitTeam == Spring.GetMyTeamID())) then
for i, v in pairs(holdUnits) do
if (holdUnits[ud.name]) then
Spring.GiveOrderToUnit(unitID, CMD_MOVE_STATE, { 0 }, {})
end
end
end
end