function widget:GetInfo()
	return {
		name = "Streetlamps",
		desc = "Shows a streetlamp's light if it's dark outside",
		author = "Argh",
		date = "December 17th, 2008",
		license = "Public Domain, or the least-restrictive rights in your country of residence.",
		layer = -2,
		enabled = true
		}
end

--------------------------------------------------------------------------------
--------------------------------------------------------------------------------

local StreetLampList = {}	

--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--
-- Variable Declarations
--
local glResetState = gl.ResetState
local GL_SRC_ALPHA = GL.SRC_ALPHA
local GL_ONE = GL.ONE
local glTexCoord = gl.TexCoord
local glVertex = gl.Vertex
local glCreateList = gl.CreateList
local glBeginEnd = gl.BeginEnd
local GL_QUADS = GL.QUADS
local GetVisibleUnits = Spring.GetVisibleUnits
local GetUnitTeam = Spring.GetUnitTeam
local GetUnitRadius = Spring.GetUnitRadius
local GetUnitBasePosition = Spring.GetUnitBasePosition
local GetUnitHeading = Spring.GetUnitHeading
local GetUnitDefID = Spring.GetUnitDefID
local IsUnitSelected = Spring.IsUnitSelected
local GetTeamColor = Spring.GetTeamColor
local IsUnitVisible = Spring.IsUnitVisible
local GetGroundNormal = Spring.GetGroundNormal
local glLineWidth = gl.LineWidth
local glDepthTest = gl.DepthTest
local glPolygonOffset = gl.PolygonOffset
local glColor = gl.Color
local glTexture = gl.Texture
local GL_LEQUAL = GL.LEQUAL
local glBlending = gl.Blending
local glDepthMask = gl.DepthMask
local glDrawListAtUnit = gl.DrawListAtUnit
local UnitIDList, id, teamID, r, g, b
local radius, direction, directionTwo
local texture =   "Bitmaps/groundfx/BrightFlash.tga"

--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
function widget:Initialize()

Spring.SendCommands("luaui disablewidget P.U.R.E. Team Display (SELECTED)")

	for ud,_ in pairs(UnitDefs) do
		if UnitDefs[ud].customParams.streetlamp == 'yes' then
			table.insert(StreetLampList,ud,1)
		end
	end	

	streetLamp = glCreateList(function()
	    glBeginEnd(GL_QUADS, function()
			glTexCoord(0.04,0.04)
			glVertex(-1,1,-0.3)
			glTexCoord(0.96,0.04)
			glVertex(1,1,-0.3)
			glTexCoord(0.96,0.96)
			glVertex(1,1,1.7)
			glTexCoord(0.04,0.96)
			glVertex(-1,1,1.7)
	    end)
	end)
end

function widget:Shutdown()
	gl.DeleteList(streetLamp)
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------


function widget:DrawWorldPreUnit()
	glBlending(GL_SRC_ALPHA, GL_ONE)
	glDepthTest(false)
	glDepthMask(false)
	glTexture(texture)
	glColor(0.7,0.8,1.0,0.5)
	for i=1,#WG.visible do
		local unitID = WG.visible[i]
		id = GetUnitDefID(unitID)
		if StreetLampList[id] then
			direction = GetUnitHeading(unitID)
			if direction < 0 then 
				directionTwo = direction * -1 
			else 
				directionTwo = direction 
			end
			glDrawListAtUnit(unitID, streetLamp, true, 48, 1.0, 48, directionTwo/182, 0, direction, 0)
		end				
	end
  	--glResetState()
end	
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------