1groundlight = class:new()
2
3function groundlight:init(x, y, dir, r)
4	self.x = x
5	self.y = y
6	self.dir = dir
7	self.r = r
8
9	self.lighted = false
10	self.timer = 0
11end
12
13function groundlight:link()
14	self.outtable = {}
15	if #self.r > 2 then
16		for j, w in pairs(outputs) do
17			for i, v in pairs(objects[w]) do
18				if tonumber(self.r[4]) == v.cox and tonumber(self.r[5]) == v.coy then
19					v:addoutput(self)
20				end
21			end
22		end
23	end
24end
25
26function groundlight:update(dt)
27	if self.timer > 0 then
28		self.timer = self.timer - dt
29		if self.timer <= 0 then
30			self.timer = 0
31			self:input("off")
32		end
33	end
34end
35
36function groundlight:draw()
37	if self.lighted then
38		love.graphics.setColor(255, 122, 66, 255)
39	else
40		love.graphics.setColor(60, 188, 252, 255)
41	end
42
43	love.graphics.drawq(entityquads[42+self.dir].image, entityquads[42+self.dir].quad, math.floor((self.x-1-xscroll)*16*scale), ((self.y-1)*16-8)*scale, 0, scale, scale)
44end
45
46function groundlight:input(t)
47	if t == "on" then
48		self.lighted = true
49	elseif t == "off" then
50		self.lighted = false
51	elseif t == "toggle" then
52		self.lighted = true
53		self.timer = groundlightdelay
54	end
55end