
AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )


/*---------------------------------------------------------
   Name: Initialize
---------------------------------------------------------*/
function ENT:Initialize()

	self.Entity:SetModel( "models/props_wasteland/prison_lamp001c.mdl" )
	self.Entity:PhysicsInit( SOLID_VPHYSICS )
	self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
	self.Entity:SetSolid( SOLID_VPHYSICS )
	
	local flashlight = ents.Create("effect_flashlight")
		flashlight:SetPos( self.Entity:GetPos() )
		flashlight:SetAngles( self.Entity:GetAngles() )
		flashlight:SetParent( self.Entity )
		flashlight:SetColor( self.Entity:GetVar( "lightr", 255 ), self.Entity:GetVar( "lightg", 255 ), self.Entity:GetVar( "lightb", 255 ), 255 )
	flashlight:Spawn()
	
	local phys = self.Entity:GetPhysicsObject()
	
	if (phys:IsValid()) then
		phys:Wake()
	end
	
end


/*---------------------------------------------------------
   Name: Sets the color of the light
---------------------------------------------------------*/
function ENT:SetLightColor( r, g, b )

	self.Entity:SetVar( "lightr", r )
	self.Entity:SetVar( "lightg", g )
	self.Entity:SetVar( "lightb", b )
	
	self.Entity:SetColor( r, g, b, 255 )

end

/*---------------------------------------------------------
   Name: OnTakeDamage
---------------------------------------------------------*/
function ENT:OnTakeDamage( dmginfo )
	self.Entity:TakePhysicsDamage( dmginfo )
end


/*---------------------------------------------------------
   Name: Use
---------------------------------------------------------*/
function ENT:Use( activator, caller )

end


include('shared.lua')