function gadget:GetInfo()
	return {
		name = "KnockOver",
		desc = "Destroys Units with the KnockOver tag, if a Unit gets too close (trees, etc.)",
		author = "Argh",
		date = "March 3, 2009",
		license = "(C) 2008, Wolfe Games",
		layer = 1,
		enabled = true,
	}
end

local Gaia = Spring.GetGaiaTeamID()
local sizeX = 0
local GetUnitPosition 
local knockOverTable = {}

local GetUnitDefID = Spring.GetUnitDefID
local DestroyUnit = Spring.DestroyUnit
local GetUnitsInCylinder = Spring.GetUnitsInCylinder
local GetUnitPosition = Spring.GetUnitPosition
local GetUnitTeam = Spring.GetUnitTeam

if (gadgetHandler:IsSyncedCode()) then

function gadget:Initialize()
	for ud,_ in ipairs(UnitDefs) do  -- search all UnitDef entries
		if UnitDefs[ud].customParams.knockover == "yes" then
			table.insert(knockOverTable,ud,0)
		end
	end
end

--////////////////////////////////////////////////////////////////////  SAFE DELAYED COMMANDS
local delayedCalls = {}
function DelayedCall(fun)
	delayedCalls[#delayedCalls+1] = fun 
end

function gadget:GameFrame(f)
	for i=1,#delayedCalls do
		local fun = delayedCalls[i]
		fun()
	end
	delayedCalls = {}
end
--////////////////////////////////////////////////////////////////////

function KnockOver(u,ud,team)
	sizeX = UnitDefs[ud].xsize
	local x, y, z = GetUnitPosition(u)
	unitGroupNum = GetUnitsInCylinder(x, z,sizeX * 6,Gaia)
	for _,me in ipairs (unitGroupNum) do
		if me ~= u and knockOverTable[GetUnitDefID(me)] and Spring.GetUnitIsDead(me) == false then
			DelayedCall(function()
				DestroyUnit(me,true,false)
			end)
		end
	end
end
gadgetHandler:RegisterGlobal("KnockOver", KnockOver)

end