mirror of
https://github.com/minetest/minetest_docs.git
synced 2024-07-07 08:35:16 +02:00
document client side modchannels
This commit is contained in:
parent
a8865e0cde
commit
de5722890c
@ -1,34 +1,81 @@
|
||||
= Modchannels
|
||||
|
||||
allows ssm(server side mods) comunication to csm(client side mods) and vice versa.
|
||||
allows server side mods(SSMs) comunication to client side mods(CSMs) and vice versa.
|
||||
|
||||
== minetest.x api
|
||||
== Server Side API
|
||||
|
||||
=== minetest.mod_channel_join(channel_name)
|
||||
=== Functions
|
||||
|
||||
==== minetest.mod_channel_join(channel_name)
|
||||
|
||||
* `channel_name`: string, modchannel name
|
||||
* returns ref for use with <<methods>>
|
||||
* returns ref for use with <<Methods>>
|
||||
* creates channel if not existing and joins the server on that channel
|
||||
* listen for messages on this channel with `minetest.register_on_modchannel_message`
|
||||
|
||||
=== minetest.register_on_modchannel_message(function(channel_name, sender, message))
|
||||
==== minetest.register_on_modchannel_message(function(channel_name, sender, message))
|
||||
|
||||
* `channel_name`: string, modchannel name (already joined)
|
||||
* `sender`: string, empty if from a ssm, player name if from a client
|
||||
* `message`: string, message
|
||||
|
||||
== methods
|
||||
=== Methods
|
||||
|
||||
=== leave()
|
||||
==== leave()
|
||||
|
||||
* server leaves the channel, no more messages from this channel on `minetest.register_on_modchannel_message`
|
||||
* set the ref to nil afterwords to free resources
|
||||
|
||||
=== is_writeable()
|
||||
==== is_writeable()
|
||||
|
||||
* returns boolean, true if the channel is writeable
|
||||
|
||||
=== send_all(message)
|
||||
==== send_all(message)
|
||||
|
||||
* `message`: string, limited to 65535 characters
|
||||
* sends to all ssm and csm on the channel
|
||||
* message will drop if channel is not writable or invalid
|
||||
|
||||
== Client Side API
|
||||
|
||||
=== Functions
|
||||
|
||||
==== minetest.mod_channel_join(channel_name)
|
||||
|
||||
* `channel_name`: string, modchannel name
|
||||
* returns ref for use with <<Methods>>
|
||||
* creates channel if not existing and joins the server on that channel
|
||||
* listen for messages on this channel with `minetest.register_on_modchannel_message`
|
||||
|
||||
==== minetest.register_on_modchannel_message(function(channel_name, sender, message))
|
||||
|
||||
* `channel_name`: string, modchannel name (already joined and recieved acknowledgement)
|
||||
* `sender`: string, empty if from a ssm, player name if from a client
|
||||
* `message`: string, message
|
||||
|
||||
==== minetest.register_on_modchannel_signal(function(channel_name, signal))
|
||||
* `channel_name`: string, channel name that the signal has come in on
|
||||
* `signal`: integer, 0 - 5
|
||||
[start=0]
|
||||
. join_ok
|
||||
. join_failed
|
||||
. leave_ok
|
||||
. leave_failed
|
||||
. event_on_not_joined_channel
|
||||
. state_changed
|
||||
|
||||
=== Methods
|
||||
|
||||
==== leave()
|
||||
|
||||
* server leaves the channel, no more messages from this channel on `minetest.register_on_modchannel_message`
|
||||
* set the ref to nil afterwords to free resources
|
||||
|
||||
==== is_writeable()
|
||||
|
||||
* returns boolean, true if the channel is writeable
|
||||
|
||||
==== send_all(message)
|
||||
|
||||
* `message`: string, limited to 65535 characters
|
||||
* sends to all ssm and csm on the channel
|
||||
|
Loading…
Reference in New Issue
Block a user