Struct gdnative_bindings_lily::MultiplayerAPI [−][src]
pub struct MultiplayerAPI { /* fields omitted */ }
Expand description
core class MultiplayerAPI
inherits Reference
(reference counted).
Official documentation
See the documentation of this class in the Godot engine’s official documentation. The method descriptions are generated from it and typically contain code samples in GDScript, not Rust.
Memory management
The lifetime of this object is automatically managed through reference counting.
Class hierarchy
MultiplayerAPI inherits methods from:
Safety
All types in the Godot API have “interior mutability” in Rust parlance.
To enforce that the official thread-safety guidelines are
followed, the typestate pattern is used in the Ref
and TRef
smart pointers,
and the Instance
API. The typestate Access
in these types tracks whether the
access is unique, shared, or exclusive to the current thread. For more information,
see the type-level documentation on Ref
.
Implementations
Constants
Creates a new instance of this object.
This is a reference-counted type. The returned object is automatically managed
by Ref
.
Clears the current MultiplayerAPI network state (you shouldn’t call this unless you know what you are doing).
Returns the peer IDs of all connected peers of this MultiplayerAPI’s [member network_peer].
The peer object to handle the RPC system (effectively enabling networking when set). Depending on the peer itself, the MultiplayerAPI will become a network server (check with [method is_network_server]) and will set root node’s network mode to master, or it will become a regular peer with root node set to puppet. 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 MultiplayerAPI’s signals.
Returns the unique peer ID of this MultiplayerAPI’s [member network_peer].
Returns the sender’s peer ID for the RPC currently being executed. Note: If not inside an RPC this method will return 0.
Returns true
if there is a [member network_peer] set.
Returns true
if this MultiplayerAPI’s [member network_peer] is in server mode (listening for connections).
If true
(or if the [member network_peer] has [member PacketPeer.allow_object_decoding] set to true
), the MultiplayerAPI will allow encoding and decoding of object during RPCs/RSETs.
Warning: Deserialized objects can contain code which gets executed. Do not use this option if the serialized object comes from untrusted sources to avoid potential security threats such as remote code execution.
If true
, the MultiplayerAPI’s [member network_peer] refuses new incoming connections.
Method used for polling the MultiplayerAPI. You only need to worry about this if you are using [member Node.custom_multiplayer] override or you set [member SceneTree.multiplayer_poll] to false
. By default, SceneTree will poll its MultiplayerAPI for you.
Note: This method results in RPCs and RSETs being called, so they will be executed in the same context of this function (e.g. _process
, physics
, Thread).
Sends the given raw bytes
to a specific peer identified by id
(see [method NetworkedMultiplayerPeer.set_target_peer]). Default ID is 0
, i.e. broadcast to all peers.
Default Arguments
id
-0
mode
-2
If true
(or if the [member network_peer] has [member PacketPeer.allow_object_decoding] set to true
), the MultiplayerAPI will allow encoding and decoding of object during RPCs/RSETs.
Warning: Deserialized objects can contain code which gets executed. Do not use this option if the serialized object comes from untrusted sources to avoid potential security threats such as remote code execution.
The peer object to handle the RPC system (effectively enabling networking when set). Depending on the peer itself, the MultiplayerAPI will become a network server (check with [method is_network_server]) and will set root node’s network mode to master, or it will become a regular peer with root node set to puppet. 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 MultiplayerAPI’s signals.
If true
, the MultiplayerAPI’s [member network_peer] refuses new incoming connections.
Sets the base root node to use for RPCs. Instead of an absolute path, a relative path will be used to find the node upon which the RPC should be executed. This effectively allows to have different branches of the scene tree to be managed by different MultiplayerAPI, allowing for example to run both client and server in the same scene.
Methods from Deref<Target = Reference>
Trait Implementations
type RefKind = RefCounted
type RefKind = RefCounted
Creates an explicitly null reference of Self
as a method argument. This makes type
inference easier for the compiler compared to Option
. Read more
Creates a new instance of Self
using a zero-argument constructor, as a Unique
reference. Read more
Performs a dynamic reference downcast to target type. Read more
Performs a static reference upcast to a supertype that is guaranteed to be valid. Read more
Creates a persistent reference to the same Godot object with shared thread access. Read more
unsafe fn assume_thread_local(&self) -> Ref<Self, ThreadLocal> where
Self: GodotObject<RefKind = RefCounted>,
unsafe fn assume_thread_local(&self) -> Ref<Self, ThreadLocal> where
Self: GodotObject<RefKind = RefCounted>,
Creates a persistent reference to the same Godot object with thread-local thread access. Read more
Creates a persistent reference to the same Godot object with unique access. Read more
Recovers a instance ID previously returned by Object::get_instance_id
if the object is
still alive. See also TRef::try_from_instance_id
. Read more
Auto Trait Implementations
impl RefUnwindSafe for MultiplayerAPI
impl !Send for MultiplayerAPI
impl !Sync for MultiplayerAPI
impl Unpin for MultiplayerAPI
impl UnwindSafe for MultiplayerAPI