Merge pull request #6779 from WalasPrime/rpc_docs

Documentation of RPC-related methods and classes
This commit is contained in:
Rémi Verschelde 2016-10-17 09:58:34 +02:00 committed by GitHub
commit 345f82d4ca

View file

@ -22262,8 +22262,10 @@
</class> </class>
<class name="NetworkedMultiplayerENet" inherits="NetworkedMultiplayerPeer" category="Core"> <class name="NetworkedMultiplayerENet" inherits="NetworkedMultiplayerPeer" category="Core">
<brief_description> <brief_description>
PacketPeer implementation using the ENet library.
</brief_description> </brief_description>
<description> <description>
A connection (or a listening server) that should be passed to [method SceneTree.set_network_peer]. Socket events can be handled by connecting to [SceneTree] signals.
</description> </description>
<methods> <methods>
<method name="close_connection"> <method name="close_connection">
@ -22618,6 +22620,7 @@
Nodes can also process input events. When set, the [method _input] function will be called for each input that the program receives. In many cases, this can be overkill (unless used for simple projects), and the [method _unhandled_input] function might be preferred; it is called when the input event was not handled by anyone else (typically, GUI [Control] nodes), ensuring that the node only receives the events that were meant for it. Nodes can also process input events. When set, the [method _input] function will be called for each input that the program receives. In many cases, this can be overkill (unless used for simple projects), and the [method _unhandled_input] function might be preferred; it is called when the input event was not handled by anyone else (typically, GUI [Control] nodes), ensuring that the node only receives the events that were meant for it.
To keep track of the scene hierarchy (especially when instancing scenes into other scenes), an "owner" can be set for the node with [method set_owner]. This keeps track of who instanced what. This is mostly useful when writing editors and tools, though. To keep track of the scene hierarchy (especially when instancing scenes into other scenes), an "owner" can be set for the node with [method set_owner]. This keeps track of who instanced what. This is mostly useful when writing editors and tools, though.
Finally, when a node is freed with [method free] or [method queue_free], it will also free all its children. Finally, when a node is freed with [method free] or [method queue_free], it will also free all its children.
[b]Networking with nodes:[/b] After connecting to a server (or making one, see [NetworkedMultiplayerENet]) it is possible to use the built-in RPC (remote procedure call) system to easily communicate over the network. By calling [method rpc] with a method name, it will be called locally, and in all connected peers (peers = clients and the server that accepts connections), with behaviour varying depending on the network mode ([method set_network_mode]) on the receiving peer. To identify which [Node] receives the RPC call Godot will use it's [NodePath] (make sure node names are the same on all peers).
</description> </description>
<methods> <methods>
<method name="_enter_tree" qualifiers="virtual"> <method name="_enter_tree" qualifiers="virtual">
@ -23055,6 +23058,7 @@
<argument index="0" name="method" type="String"> <argument index="0" name="method" type="String">
</argument> </argument>
<description> <description>
Send a remote procedure call request to all peers on the network (and locally), optionally sending additional data as arguments. Call request will be received by nodes with the same [NodePath].
</description> </description>
</method> </method>
<method name="rpc_config"> <method name="rpc_config">
@ -23063,6 +23067,7 @@
<argument index="1" name="mode" type="int"> <argument index="1" name="mode" type="int">
</argument> </argument>
<description> <description>
Change the method's RPC mode (one of RPC_MODE_* constants).
</description> </description>
</method> </method>
<method name="rpc_id" qualifiers="vararg"> <method name="rpc_id" qualifiers="vararg">
@ -23071,12 +23076,14 @@
<argument index="1" name="method" type="String"> <argument index="1" name="method" type="String">
</argument> </argument>
<description> <description>
Send a [method rpc] to a specific peer identified by [i]peer_id[/i].
</description> </description>
</method> </method>
<method name="rpc_unreliable" qualifiers="vararg"> <method name="rpc_unreliable" qualifiers="vararg">
<argument index="0" name="method" type="String"> <argument index="0" name="method" type="String">
</argument> </argument>
<description> <description>
Send a [method rpc] using an unreliable protocol.
</description> </description>
</method> </method>
<method name="rpc_unreliable_id" qualifiers="vararg"> <method name="rpc_unreliable_id" qualifiers="vararg">
@ -23085,6 +23092,7 @@
<argument index="1" name="method" type="String"> <argument index="1" name="method" type="String">
</argument> </argument>
<description> <description>
Send a [method rpc] to a specific peer identified by [i]peer_id[/i] using an unreliable protocol.
</description> </description>
</method> </method>
<method name="rset"> <method name="rset">
@ -23093,6 +23101,7 @@
<argument index="1" name="value" type="Variant"> <argument index="1" name="value" type="Variant">
</argument> </argument>
<description> <description>
Remotely change property's value on other peers (and locally).
</description> </description>
</method> </method>
<method name="rset_config"> <method name="rset_config">
@ -23101,6 +23110,7 @@
<argument index="1" name="mode" type="int"> <argument index="1" name="mode" type="int">
</argument> </argument>
<description> <description>
Change the property's RPC mode (one of RPC_MODE_* constants).
</description> </description>
</method> </method>
<method name="rset_id"> <method name="rset_id">
@ -23111,6 +23121,7 @@
<argument index="2" name="value" type="Variant"> <argument index="2" name="value" type="Variant">
</argument> </argument>
<description> <description>
Remotely change property's value on a specific peer identified by [i]peer_id[/i].
</description> </description>
</method> </method>
<method name="rset_unreliable"> <method name="rset_unreliable">
@ -23119,6 +23130,7 @@
<argument index="1" name="value" type="Variant"> <argument index="1" name="value" type="Variant">
</argument> </argument>
<description> <description>
Remotely change property's value on other peers (and locally) using an unreliable protocol.
</description> </description>
</method> </method>
<method name="rset_unreliable_id"> <method name="rset_unreliable_id">
@ -23129,6 +23141,7 @@
<argument index="2" name="value" type="Variant"> <argument index="2" name="value" type="Variant">
</argument> </argument>
<description> <description>
Remotely change property's value on a specific peer identified by [i]peer_id[/i] using an unreliable protocol.
</description> </description>
</method> </method>
<method name="set_display_folded"> <method name="set_display_folded">
@ -23162,6 +23175,7 @@
<argument index="0" name="mode" type="int"> <argument index="0" name="mode" type="int">
</argument> </argument>
<description> <description>
Change the networking mode of the [Node], where [i]mode[/i] is one of the constants NETWORK_MODE_*. Master nodes will only call gdscript methods defined as [i]master func[/i] if a RPC call is received (slave nodes will only call [i]slave func[/i]; both will call [i]remote func[/i] if the call is not local, and [i]sync func[/i] in any case). Inherit mode looks at the parent node to determine the value (root node depends on the [SceneTree] having a networking peer set with [method SceneTree.set_network_peer])
</description> </description>
</method> </method>
<method name="set_owner"> <method name="set_owner">
@ -35261,6 +35275,7 @@
<return type="bool"> <return type="bool">
</return> </return>
<description> <description>
Returns true if this SceneTree's [NetworkedMultiplayerPeer] is in server mode (listening for connections).
</description> </description>
</method> </method>
<method name="is_paused" qualifiers="const"> <method name="is_paused" qualifiers="const">
@ -35357,6 +35372,7 @@
<argument index="0" name="peer" type="NetworkedMultiplayerPeer"> <argument index="0" name="peer" type="NetworkedMultiplayerPeer">
</argument> </argument>
<description> <description>
Set the peer object to handle the RPC system (effectively enabling networking). Depending on the peer itself, the SceneTree will become a network server (check with [method is_network_server()]) and will set root node's network mode to master (see NETWORK_MODE_* constants in [Node]), or it will become a regular peer with root node set to slave. All child nodes are set to inherit the network mode by default. Handling of networking-related events (connection, disconnection, new clients) is done by connecting to SceneTree's signals.
</description> </description>
</method> </method>
<method name="set_pause"> <method name="set_pause">