From 9c1fd92d5672568c139ad1690582f1ff14429db1 Mon Sep 17 00:00:00 2001 From: Stephen Leitnick Date: Thu, 30 Nov 2023 08:52:15 -0500 Subject: [PATCH] Use unreliable events --- .github/workflows/ci.yaml | 4 ++-- aftman.toml | 2 +- src/KnitServer.lua | 16 +++++++++++++++- src/wally.toml | 4 ++-- src/wally_bundle.toml | 4 ++-- 5 files changed, 22 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6ad5d912..3b64b387 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -25,9 +25,9 @@ jobs: name: Styling runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: JohnnyMorganz/stylua-action@v3 with: token: ${{ secrets.GITHUB_TOKEN }} - version: v0.18.2 + version: v0.19.1 args: --check ./src diff --git a/aftman.toml b/aftman.toml index 4ea77326..e5b8705a 100644 --- a/aftman.toml +++ b/aftman.toml @@ -1 +1 @@ -tools = { rojo = "rojo-rbx/rojo@7.3.0" , wally = "UpliftGames/wally@0.3.2" , selene = "Kampfkarren/selene@0.25.0" , stylua = "JohnnyMorganz/StyLua@0.18.2" , remodel = "rojo-rbx/remodel@0.11.0" } +tools = { rojo = "rojo-rbx/rojo@7.3.0" , wally = "UpliftGames/wally@0.3.2" , selene = "Kampfkarren/selene@0.26.1" , stylua = "JohnnyMorganz/StyLua@0.19.1" , remodel = "rojo-rbx/remodel@0.11.0" } diff --git a/src/KnitServer.lua b/src/KnitServer.lua index 2863bc9a..eb076417 100644 --- a/src/KnitServer.lua +++ b/src/KnitServer.lua @@ -124,6 +124,11 @@ getmetatable(SIGNAL_MARKER).__tostring = function() return "SIGNAL_MARKER" end +local UNRELIABLE_SIGNAL_MARKER = newproxy(true) +getmetatable(UNRELIABLE_SIGNAL_MARKER).__tostring = function() + return "UNRELIABLE_SIGNAL_MARKER" +end + local PROPERTY_MARKER = newproxy(true) getmetatable(PROPERTY_MARKER).__tostring = function() return "PROPERTY_MARKER" @@ -262,6 +267,13 @@ function KnitServer.CreateSignal() return SIGNAL_MARKER end +--[=[ + DOCS TODO +]=] +function KnitServer.CreateUnreliableSignal() + return SIGNAL_UNRELIABLE_MARKER +end + --[=[ @return PROPERTY_MARKER Returns a marker that will transform the current key into @@ -361,7 +373,9 @@ function KnitServer.Start(options: KnitOptions?) if type(v) == "function" then service.KnitComm:WrapMethod(service.Client, k, inbound, outbound) elseif v == SIGNAL_MARKER then - service.Client[k] = service.KnitComm:CreateSignal(k, inbound, outbound) + service.Client[k] = service.KnitComm:CreateSignal(k, false, inbound, outbound) + elseif v == UNRELIABLE_SIGNAL_MARKER then + service.Client[k] = service.KnitComm:CreateSignal(k, true, inbound, outbound) elseif type(v) == "table" and v[1] == PROPERTY_MARKER then service.Client[k] = service.KnitComm:CreateProperty(k, v[2], inbound, outbound) end diff --git a/src/wally.toml b/src/wally.toml index c3c86bbd..766acced 100644 --- a/src/wally.toml +++ b/src/wally.toml @@ -1,11 +1,11 @@ [package] name = "sleitnick/knit" description = "Knit is a lightweight game framework" -version = "1.5.3" +version = "1.6.0" license = "MIT" registry = "https://github.com/UpliftGames/wally-index" realm = "shared" [dependencies] -Comm = "sleitnick/comm@^0.3" +Comm = "sleitnick/comm@^1" Promise = "evaera/promise@^4" diff --git a/src/wally_bundle.toml b/src/wally_bundle.toml index 8160bad6..bc3a1cd8 100644 --- a/src/wally_bundle.toml +++ b/src/wally_bundle.toml @@ -5,12 +5,12 @@ registry = "https://github.com/UpliftGames/wally-index" realm = "shared" [dependencies] -Comm = "sleitnick/comm@^0.3" +Comm = "sleitnick/comm@^1" Component = "sleitnick/component@^2" EnumList = "sleitnick/enum-list@^2" Input = "sleitnick/input@^2" Option = "sleitnick/option@^1" -Signal = "sleitnick/signal@^1" +Signal = "sleitnick/signal@^2" Streamable = "sleitnick/streamable@^1" TableUtil = "sleitnick/table-util@^1" Timer = "sleitnick/timer@^1"