mirror of
https://github.com/luanti-org/luanti.git
synced 2025-09-15 18:57:08 +00:00
Implement mod communication channels (#6351)
Implement network communication for channels * Implement ModChannel manager server side to route incoming messages from clients to other clients * Add signal handler switch on client & ModChannelMgr on client to handle channels * Add Lua API bindings + client packet sending + unittests * Implement server message sending * Add callback from received message handler to Lua API using registration method
This commit is contained in:
parent
6df312a608
commit
6f1c907204
37 changed files with 1206 additions and 39 deletions
16
games/minimal/mods/experimental/modchannels.lua
Normal file
16
games/minimal/mods/experimental/modchannels.lua
Normal file
|
@ -0,0 +1,16 @@
|
|||
--
|
||||
-- Mod channels experimental handlers
|
||||
--
|
||||
local mod_channel = core.mod_channel_join("experimental_preview")
|
||||
|
||||
core.register_on_modchannel_message(function(channel, sender, message)
|
||||
print("[minimal][modchannels] Server received message `" .. message
|
||||
.. "` on channel `" .. channel .. "` from sender `" .. sender .. "`")
|
||||
|
||||
if mod_channel:is_writeable() then
|
||||
mod_channel:send_all("experimental answers to preview")
|
||||
mod_channel:leave()
|
||||
end
|
||||
end)
|
||||
|
||||
print("[minimal][modchannels] Code loaded!")
|
Loading…
Add table
Add a link
Reference in a new issue