-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloading.lua
More file actions
51 lines (42 loc) · 1.08 KB
/
loading.lua
File metadata and controls
51 lines (42 loc) · 1.08 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
-- local pollnet = require("pollnet")
-- local json = require("json")
local buttplug = SMODS.load_file("buttplug.lua")()
-- get system Sleep function
local ffi = require("ffi")
ffi.cdef[[
void Sleep(int ms);
]]
local sleep
if ffi.os == "Windows" then
function sleep(s)
ffi.C.Sleep(s)
end
else
function sleep(s)
ffi.C.poll(nil, 0, s)
end
end
-- Ask for the device list after we connect
table.insert(buttplug.cb.ServerInfo, function()
buttplug.request_device_list()
end)
-- Start scanning if the device list was empty
table.insert(buttplug.cb.DeviceList, function()
if buttplug.count_devices() == 0 then
buttplug.start_scanning()
end
end)
-- Stop scanning after the first device is found
table.insert(buttplug.cb.DeviceAdded, function()
buttplug.stop_scanning()
end)
-- Start scanning if we lose a device
table.insert(buttplug.cb.DeviceRemoved, function()
buttplug.start_scanning()
end)
-- "Simulated" game loop
function _init()
buttplug.connect("lust-balatro-mod", "ws://localhost:12345")
Lust.buttplug = buttplug
end
_init()