function gadget:GetInfo()
	return {
		name = "Random Move Order",
		desc = "Gives a random move order to transported Units when they exit transports.",
		author = "Argh",
		date = "July 30th, 2008",
		license = "(C) 2008, GNU GPL v. 2",
		layer = 1,
		enabled = true,
	}
end

local math_rand = math.random
local GetUnitPosition = Spring.GetUnitPosition
local GiveOrderToUnit = Spring.GiveOrderToUnit
local x,y,z,randomX,randomZ,heading = 0,0,0,0,0,0

if (gadgetHandler:IsSyncedCode()) then
--////////////////////////////////////////////////////////////////////
--////////////////////////////////////////////////////////////////////
--////////////////////////////////////////////////////////////////////
function gadget:UnitUnloaded(unitID, unitDefID, teamID, transportID)
	x,y,z  = GetUnitPosition(unitID)
	heading = Spring.GetUnitHeading(unitID)
	if heading < 1600 and heading > -1600 then heading = 0 end
	if heading < 17000 and heading > 15000 then heading = 1 end
	if heading > 31000 and heading < 32769 or heading < -31000 and heading > -32769 then heading = 2 end
	if heading < -15000 and heading > -17000 then heading = 3 end
	
	if heading == 0 then
		randomX = math_rand(-32,32)
		randomZ = math_rand(-64,0)
		GiveOrderToUnit(unitID,CMD.MOVE,{x - randomX, y, z - randomZ}, 0)
		--Spring.Echo(x - randomX, z - randomZ)
	end
	if heading == 1 then
		randomX = math_rand(-64,0)
		randomZ = math_rand(-32,32)
		GiveOrderToUnit(unitID,CMD.MOVE,{x - randomX, y, z - randomZ}, 0)
	end
	if heading == 2 then
		randomX = math_rand(-32,32)
		randomZ = math_rand(0,64)
		GiveOrderToUnit(unitID,CMD.MOVE,{x - randomX, y, z - randomZ}, 0)
	end
	if heading == 3 then
		randomX = math_rand(0,64)
		randomZ = math_rand(-32,32)
		GiveOrderToUnit(unitID,CMD.MOVE,{x - randomX, y, z - randomZ}, 0)
	end
end
end