-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcl_init.lua
35 lines (33 loc) · 1.08 KB
/
cl_init.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
--@name Expression 2 emulator
--@includedata ./LICENSE
local print_prefix_color = Color(255, 63, 63)
local print_prefix = string.format("[%s] ", chip():entIndex())
local print_color = Color(152, 212, 255)
net.receive('hint', function(length)
local text_len = net.readUInt(8)
local text = net.readData(text_len)
local duration = net.readDouble()
pcall(notification.addLegacy, print_prefix..text, NOTIFY.GENERIC, duration)
end)
net.receive('print', function(length)
local message_type = net.readUInt(8)
local text_len = net.readUInt(8)
local text = net.readData(text_len)
pcall(printMessage, message_type, print_prefix..text)
end)
local name = "generic"
local name_prefix = string.format("%s ]\n[ ", chip():getChipName())
net.receive('name', function(length)
local name_len = net.readUInt(8)
name = net.readData(name_len)
setName(name_prefix..name)
end)
--@include ./cl_egp3.lua
local egp = dofile('./cl_egp3.lua')
local screen = egp.new(chip():getLinkedComponents()[1])
hook.add('render', '', function()
local ent = render.getScreenEntity()
if ent == screen.entity then
screen:draw()
end
end)