blob: 9adf98c0b718780809db75a18fdd10b1fbcb43c3 [file] [log] [blame]
Serge Bazanski18c1a262022-07-07 14:24:53 +02001local node = ThreadNode:extend('nodes.at', {
2 threadFile = 'nodes/at_thread.lua',
3 threadChannel = 'at',
4
5 api = 'http://at.hackerspace.pl/api',
6})
7
8local bigFont = love.graphics.newFont('fonts/Lato-Light.ttf', 80)
9local textFont = love.graphics.newFont('fonts/Lato-Light.ttf', 50)
10local smallFont = love.graphics.newFont('fonts/Lato-Light.ttf', 30)
11
12function node:render()
13 love.graphics.setColor( 0, 0, 0 )
14 love.graphics.rectangle("fill", 0, 0, love.graphics.getWidth(), love.graphics.getHeight())
15
16 if self.state then
17 love.graphics.setColor( 1.0, 1.0, 1.0, 0.4 )
18 love.graphics.setFont(bigFont)
19 love.graphics.printf('Currently at hackerspace:', 50, 100, love.graphics.getWidth() - 100, 'center')
20
21 usersList = (table.concat(lume.map(self.state.users, function(v) return v.login end), ', ') or 'nobody...') .. '\n'
22
23 if self.state.unknown > 0 then
24 usersList = usersList .. '\n...and ' .. tostring(self.state.unknown) .. ' unknown creatures'
25 end
26
27 if self.state.kektops > 0 then
28 usersList = usersList .. '\n...and ' .. tostring(self.state.kektops) .. ' kektops'
29 end
30
31 if self.state.esps > 0 then
32 usersList = usersList .. '\n...and ' .. tostring(self.state.esps) .. ' ESPs'
33 end
34
35 love.graphics.setColor( 1.0, 1.0, 1.0 )
36 love.graphics.setFont(textFont)
37 love.graphics.printf(usersList, 50, 220, love.graphics.getWidth() - 100, 'center')
38 else
39 love.graphics.setColor( 1.0, 1.0, 1.0, 0.4 )
40
41 love.graphics.setFont(smallFont)
42 love.graphics.printf("Loading at...", 0, love.graphics.getHeight() - 200, love.graphics.getWidth(), 'center')
43 end
44end
45
46return node