Enumerationmigueldeicaza.swiftgodot 0.45.0SwiftGodot
RPCMode
MultiplayerAPI.swift:29enum RPCMode
Cases
case disabled
Used with
rpcConfig(method:config:)
to disable a method or property for all RPC calls, making it unavailable. Default for all methods.case anyPeer
Used with
rpcConfig(method:config:)
to set a method to be callable remotely by any peer. Analogous to the@rpc("any_peer")
annotation. Calls are accepted from all remote peers, no matter if they are node’s authority or not.
Other members in extension
View members
Hide members
This section is hidden by default because it contains too many (21) members.
Types
class Signal1
Signal support.
class Signal2
Signal support.
Type members
static func createDefaultInterface(
) -> MultiplayerAPI? Returns a new instance of the default MultiplayerAPI.
static func getDefaultInterface(
) -> StringName Returns the default MultiplayerAPI implementation class name. This is usually
"SceneMultiplayer"
whenSceneMultiplayer
is available. SeesetDefaultInterface(interfaceName:)
.static func setDefaultInterface(interfaceName: StringName
) Sets the default MultiplayerAPI implementation class. This method can be used by modules and extensions to configure which implementation will be used by
SceneTree
when the engine starts.class var godotClassName: StringName
Instance members
var connectedToServer: SimpleSignal
Emitted when this MultiplayerAPI’s
multiplayerPeer
successfully connected to a server. Only emitted on clients.var connectionFailed: SimpleSignal
Emitted when this MultiplayerAPI’s
multiplayerPeer
fails to establish a connection to a server. Only emitted on clients.var multiplayerPeer: MultiplayerPeer?
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
isServer
) and will set root node’s network mode to authority, or it will become a regular client peer. 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.var peerConnected: Signal1
Emitted when this MultiplayerAPI’s
multiplayerPeer
connects with a new peer. ID is the peer ID of the new peer. Clients get notified when other clients connect to the same server. Upon connecting to a server, a client also receives this signal for the server (with ID being 1).var peerDisconnected: Signal2
Emitted when this MultiplayerAPI’s
multiplayerPeer
disconnects from a peer. Clients get notified when other clients disconnect from the same server.var serverDisconnected: SimpleSignal
Emitted when this MultiplayerAPI’s
multiplayerPeer
disconnects from server. Only emitted on clients.func getPeers(
) -> PackedInt32Array Returns the peer IDs of all connected peers of this MultiplayerAPI’s
multiplayerPeer
.func getRemoteSenderId(
) -> Int32 Returns the sender’s peer ID for the RPC currently being executed.
func getUniqueId(
) -> Int32 Returns the unique peer ID of this MultiplayerAPI’s
multiplayerPeer
.func hasMultiplayerPeer(
) -> Bool Returns
true
if there is amultiplayerPeer
set.func isServer(
) -> Bool Returns
true
if this MultiplayerAPI’smultiplayerPeer
is valid and in server mode (listening for connections).func objectConfigurationAdd(object: Object?, configuration: Variant
) -> GodotError Notifies the MultiplayerAPI of a new
configuration
for the givenobject
. This method is used internally bySceneTree
to configure the root path for this MultiplayerAPI (passingnull
and a validNodePath
asconfiguration
). This method can be further used by MultiplayerAPI implementations to provide additional features, refer to specific implementation (e.g.SceneMultiplayer
) for details on how they use it.func objectConfigurationRemove(object: Object?, configuration: Variant
) -> GodotError Notifies the MultiplayerAPI to remove a
configuration
for the givenobject
. This method is used internally bySceneTree
to configure the root path for this MultiplayerAPI (passingnull
and an emptyNodePath
asconfiguration
). This method can be further used by MultiplayerAPI implementations to provide additional features, refer to specific implementation (e.g.SceneMultiplayer
) for details on how they use it.func poll(
) -> GodotError Method used for polling the MultiplayerAPI. You only need to worry about this if you set
multiplayerPoll
tofalse
. By default,SceneTree
will poll its MultiplayerAPI(s) for you.func rpc(peer: Int32, object: Object?, method: StringName, arguments: GArray
) -> GodotError Sends an RPC to the target
peer
. The givenmethod
will be called on the remoteobject
with the providedarguments
. The RPC may also be called locally depending on the implementation and RPC configuration. SeeNode/rpc(method:)
andrpcConfig(method:config:)
.
Citizens in SwiftGodot
Conformances
protocol CaseIterable
A type that provides a collection of all of its values.
protocol CustomDebugStringConvertible
A type with a customized textual representation suitable for debugging purposes.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol RawRepresentable<RawValue>
A type that can be converted to and from an associated raw value.
Type members
Instance members
var debugDescription: String
A textual representation of this instance, suitable for debugging
Type features
static func != (lhs: Self, rhs: Self
) -> Bool Returns a Boolean value indicating whether two values are not equal.