diff options
author | FxQnLr <[email protected]> | 2024-04-30 20:47:13 +0200 |
---|---|---|
committer | FxQnLr <[email protected]> | 2024-04-30 20:47:13 +0200 |
commit | d95f49be9dde63de3694a56316fe7e07ad4062e7 (patch) | |
tree | e07af9156af08a15dbb33b6718359a3fc7c004d2 /main.lua | |
parent | ab76e442ab4fb4d41ccbc211f9ac05e19aaefd4b (diff) | |
download | funsaac-d95f49be9dde63de3694a56316fe7e07ad4062e7.tar funsaac-d95f49be9dde63de3694a56316fe7e07ad4062e7.tar.gz funsaac-d95f49be9dde63de3694a56316fe7e07ad4062e7.zip |
Diffstat (limited to 'main.lua')
-rw-r--r-- | main.lua | 28 |
1 files changed, 7 insertions, 21 deletions
@@ -1,29 +1,10 @@ | |||
1 | ---@diagnostic disable: duplicate-set-field | ||
2 | |||
3 | local funsaac = RegisterMod("funsaac", 1) | 1 | local funsaac = RegisterMod("funsaac", 1) |
4 | require("messages") | 2 | require("messages") |
5 | 3 | ||
6 | local client = require("websocket").new("127.0.0.1", 12345, "/") | ||
7 | |||
8 | CONNECTED = false | ||
9 | |||
10 | function client:onmessage(message) | ||
11 | HandleResponse(ResponseContent(message)) | ||
12 | if CONNECTED == true then | ||
13 | self:send(GetMessage(Messages.StartScanning)) | ||
14 | CONNECTED = false | ||
15 | end | ||
16 | end | ||
17 | |||
18 | function client:onopen() | ||
19 | self:send(GetMessage(Messages.RequestServerInfo)) | ||
20 | end | ||
21 | |||
22 | |||
23 | local render_tick = 0 | 4 | local render_tick = 0 |
24 | local s = 0; | 5 | local s = 0; |
25 | local function onRender() | 6 | local function onRender() |
26 | client:update() | 7 | WsClient:update() |
27 | 8 | ||
28 | render_tick = render_tick + 1 | 9 | render_tick = render_tick + 1 |
29 | if render_tick >= 60 then | 10 | if render_tick >= 60 then |
@@ -32,4 +13,9 @@ local function onRender() | |||
32 | end | 13 | end |
33 | end | 14 | end |
34 | 15 | ||
35 | funsaac:AddCallback(ModCallbacks.MC_POST_RENDER, onRender) \ No newline at end of file | 16 | local function onEnemyDamage(_, entity, amount, damage_flags, source, countdown_frames) |
17 | ScalarCmd(1) | ||
18 | end | ||
19 | |||
20 | funsaac:AddCallback(ModCallbacks.MC_POST_RENDER, onRender) | ||
21 | funsaac:AddCallback(ModCallbacks.MC_ENTITY_TAKE_DMG, onEnemyDamage) \ No newline at end of file | ||