Skip to content

Commit e4be735

Browse files
committed
ye
1 parent 2a1cce8 commit e4be735

119 files changed

Lines changed: 4872 additions & 4740 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
```toml
1515
[dependencies]
16-
Lync = "axp3cter/lync@1.4.3"
16+
Lync = "axp3cter/lync@1.5.0"
1717
```
1818

1919
**npm (roblox-ts)**
@@ -163,7 +163,7 @@ end
163163
| | What it does |
164164
|:---------|:------------|
165165
| `Lync.start()` | Sets up transport. Server creates remotes, client connects. Call once after all definitions. |
166-
| `Lync.VERSION` | `"1.4.3"` |
166+
| `Lync.VERSION` | `"1.5.0"` |
167167

168168
## Packets
169169

@@ -228,6 +228,45 @@ packet:send(data) -- send to server
228228

229229
`Lync.defineNamespace(name, config)` returns a Namespace. Takes a `packets` table and/or a `queries` table. All names get auto-prefixed with `"YourNamespace."` so nothing collides.
230230

231+
The config takes `PacketConfig` and `QueryConfig` objects (same shape you'd pass to `definePacket` / `defineQuery`). The namespace creates and owns the packets/queries internally.
232+
233+
```luau
234+
local Combat = Lync.defineNamespace("Combat", {
235+
packets = {
236+
Hit = {
237+
value = Lync.struct({ targetId = Lync.u16, damage = Lync.f32, headshot = Lync.bool }),
238+
rateLimit = { maxPerSecond = 30, burstAllowance = 5 },
239+
validate = function(data, player)
240+
if data.damage > 200 then return false, "damage" end
241+
return true
242+
end,
243+
},
244+
Death = { value = Lync.u16 },
245+
},
246+
queries = {
247+
Stats = {
248+
request = Lync.nothing,
249+
response = Lync.struct({ kills = Lync.u16, deaths = Lync.u16 }),
250+
timeout = 3,
251+
},
252+
},
253+
})
254+
255+
-- Access by short name directly on the namespace
256+
Combat.Hit:send(data, player)
257+
Combat.Death:listen(function(targetId, sender) end)
258+
Combat.Stats:listen(function(request, player) return { kills = 10, deaths = 2 } end)
259+
260+
-- Or via the typed sub-tables
261+
Combat.packets.Hit:send(data, player)
262+
Combat.queries.Stats:request(nil)
263+
```
264+
265+
| Config field | Type | What it does |
266+
|:-------------|:-----|:-------------|
267+
| `packets` | `{ [string]: PacketConfig }?` | Map of short name → packet config. Each entry becomes a Packet on the namespace. |
268+
| `queries` | `{ [string]: QueryConfig }?` | Map of short name → query config. Each entry becomes a Query on the namespace. |
269+
231270
Access packets and queries by their short name on the returned object: `ns.PacketName`, `ns.QueryName`. Or use the typed sub-tables: `ns.packets.PacketName`, `ns.queries.QueryName`.
232271

233272
| Method | What it does |

bench/Receive.client.luau

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
--!optimize 2
33
-- Client-side bench receiver.
44

5-
local ReplicatedStorage = game:GetService ("ReplicatedStorage")
5+
local ReplicatedStorage = game:GetService("ReplicatedStorage")
66

7-
local LyncFolder = ReplicatedStorage:WaitForChild ("Lync")
8-
local Lync = require (LyncFolder)
9-
local Scenarios = require (LyncFolder:WaitForChild ("bench"):WaitForChild ("Scenarios"))
7+
local LyncFolder = ReplicatedStorage:WaitForChild("Lync")
8+
local Lync = require(LyncFolder)
9+
local Scenarios = require(LyncFolder:WaitForChild("bench"):WaitForChild("Scenarios"))
1010

11-
Lync.start ()
11+
Lync.start()
1212

1313
for name, packet in Scenarios.allPackets do
14-
packet:listen (function (): () end)
14+
packet:listen(function(): () end)
1515
end
1616

17-
task.wait (1)
18-
Scenarios.Ready:send (true)
17+
task.wait(1)
18+
Scenarios.Ready:send(true)

0 commit comments

Comments
 (0)