1
--local big = require("bigfont")
2
local m = peripheral.find("monitor")
3
m.setTextScale(1)
4
term.redirect(m)
5
term.setBackgroundColor(colors.black)
6
term.clear()
7
8
local shades = {
9
colors.toBlit(colors.red),
10
colors.toBlit(colors.purple),
11
colors.toBlit(colors.magenta),
12
colors.toBlit(colors.pink)
13
}
14
15
local mt = {
16
__len = function(self)
17
return #self.string
18
end,
19
__index = function(self, i)
20
if tonumber(i) then
21
return self.string:sub(i, i)
22
else
23
return self.string[i]
24
end
25
end,
26
__newindex = function(self, i, v)
27
rawset(self, "string", self.string:sub(1, i-1)..v..self.string:sub(i+1, -1))
28
end
29
}
30
31
local book = {
32
"",
33
" cccccccc",
34
" cccccccccccc",
35
" eecccccccccccccc",
36
" cceeeecccccccccccccc",
37
" cccccceeeecccccccccccccc",
38
" cccccccccceeeeccccccccccccccc",
39
" ccccccccccccceeeeccccccccccccccc",
40
" cc00ccccccccccceeeeccccccccccc00",
41
" cc0000ccccccccccceeeeccccccc00000",
42
" cc0000cccccccccccee44ccc00000000",
43
" cc0000ccccccccccc444400000000ccc",
44
" cc0000cccccccccc444400000ccc",
45
" cc0000cccccc000044e00ccc",
46
" cc0000000000000eeecc",
47
" cc00000000000cee",
48
" cc0000000ccc",
49
" cccccccc"
50
}
51
52
local function getBook()
53
local out = {}
54
table.foreachi(book, function(i, v)
55
out[i] = setmetatable({string = v}, mt)
56
end)
57
return out
58
end
59
60
local function esc()
61
--[[local exit = false
62
while not exit do
63
local _, k = os.pullEvent("key")
64
if k == keys.space then
65
return
66
end
67
end]]
68
sleep(10)
69
end
70
71
local function run()
72
local sx, sy = term.getSize()
73
local offset = math.random(0, 100)
74
while true do
75
local book = getBook()
76
for i = 1, #book do
77
for j = 1, #book[i] do
78
local sin1 = math.sin((i+(j*(math.cos(offset/100)))+offset)/4)-0.5
79
local shi1 = math.floor(sin1*7.2)+1
80
local sin2 = math.sin(((i*(math.cos(offset/150)+1))-j+(offset/2))/5)-0.5
81
local shi2 = math.floor(sin2*5)+2
82
if sin1 > 0 and book[i][j] ~= " " and shi1 > 1 and shi1 >= shi2 then
83
book[i][j] = shades[shi1]
84
end
85
if sin2 > 0 and book[i][j] ~= " " and shi2 >= shi1 then
86
book[i][j] = shades[shi2]
87
end
88
end
89
term.setCursorPos(1, i)
90
term.blit((" "):rep(#book[i]), (" "):rep(#book[i]), book[i].string)
91
end
92
offset = offset+1
93
sleep()
94
end
95
end
96
term.setTextColor(colors.lime)
97
term.setCursorPos(38, 2)
98
big.bigWrite("Home of the \1645")
99
term.setCursorPos(38, 5)
100
big.bigWrite("Enchanted Book.")
101
local sx, sy = term.getSize()
102
local ax, ay, bx, by, cx, cy
103
if sy == 19 then
104
ax, ay = 46, 10
105
bx, by = 40, 17
106
cx, cy = 45, 15
107
else
108
ax, ay = 30, 21
109
bx, by = 40, 14
110
cx, cy = 45, 12
111
end
112
term.setCursorPos(ax, ay)
113
term.setBackgroundColor(colors.gray)
114
big.bigWrite("books.kst")
115
paintutils.drawLine(ax-1,ay,ax-1,ay+2,colors.gray)
116
term.setBackgroundColor(colors.black)
117
term.setCursorPos(bx, by)
118
term.write("Located @ 2F Coconut Mall | -30 80 -280")
119
term.setCursorPos(cx, cy)
120
term.write("Tools, Tome Gacha, and MORE")
121
if sy > 19 then
122
term.setCursorPos(44, 16)
123
term.write("`/sethome books` while there!")
124
term.setCursorPos(8, sy)
125
term.setTextColor(colors.gray)
126
term.write("books.kst is a supporter of open waterways and a member of the SCWPS.")
127
end
128
129
parallel.waitForAny(esc, run)
130
--run()
131
--term.redirect(term.native())
132
term.clear()