MultiplayerSpawner

package
v0.0.0-...-568b220 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 10, 2025 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Package MultiplayerSpawner provides methods for working with MultiplayerSpawner object instances.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Advanced

type Advanced = class

Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.

type Any

type Any interface {
	gd.IsClass
	AsMultiplayerSpawner() Instance
}

type Expanded

type Expanded [1]gdclass.MultiplayerSpawner

func (Expanded) Spawn

func (self Expanded) Spawn(data any) Node.Instance

Requests a custom spawn, with [param data] passed to [member spawn_function] on all peers. Returns the locally spawned node instance already inside the scene tree, and added as a child of the node pointed by [member spawn_path]. [b]Note:[/b] Spawnable scenes are spawned automatically. [method spawn] is only needed for custom spawns.

type Extension

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension

func (*Extension[T]) AsMultiplayerSpawner

func (self *Extension[T]) AsMultiplayerSpawner() Instance

func (*Extension[T]) AsNode

func (self *Extension[T]) AsNode() Node.Instance

func (*Extension[T]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

type ID

type ID Object.ID

ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

type Instance

type Instance [1]gdclass.MultiplayerSpawner

Spawnable scenes can be configured in the editor or through code (see [method add_spawnable_scene]). Also supports custom node spawns through [method spawn], calling [member spawn_function] on all peers. Internally, [MultiplayerSpawner] uses [method MultiplayerAPI.object_configuration_add] to notify spawns passing the spawned node as the [code]object[/code] and itself as the [code]configuration[/code], and [method MultiplayerAPI.object_configuration_remove] to notify despawns in a similar way.

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) AddSpawnableScene

func (self Instance) AddSpawnableScene(path string)

Adds a scene path to spawnable scenes, making it automatically replicated from the multiplayer authority to other peers when added as children of the node pointed by [member spawn_path].

func (Instance) AsMultiplayerSpawner

func (self Instance) AsMultiplayerSpawner() Instance

func (Instance) AsNode

func (self Instance) AsNode() Node.Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) ClearSpawnableScenes

func (self Instance) ClearSpawnableScenes()

Clears all spawnable scenes. Does not despawn existing instances on remote peers.

func (Instance) GetSpawnableScene

func (self Instance) GetSpawnableScene(index int) string

Returns the spawnable scene path by index.

func (Instance) GetSpawnableSceneCount

func (self Instance) GetSpawnableSceneCount() int

Returns the count of spawnable scene paths.

func (Instance) ID

func (self Instance) ID() ID

func (Instance) OnDespawned

func (self Instance) OnDespawned(cb func(node Node.Instance), flags ...Signal.Flags)

func (Instance) OnSpawned

func (self Instance) OnSpawned(cb func(node Node.Instance), flags ...Signal.Flags)

func (*Instance) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

func (Instance) SetSpawnFunction

func (self Instance) SetSpawnFunction(value Callable.Function)

func (Instance) SetSpawnLimit

func (self Instance) SetSpawnLimit(value int)

func (Instance) SetSpawnPath

func (self Instance) SetSpawnPath(value string)

func (Instance) Spawn

func (self Instance) Spawn() Node.Instance

Requests a custom spawn, with [param data] passed to [member spawn_function] on all peers. Returns the locally spawned node instance already inside the scene tree, and added as a child of the node pointed by [member spawn_path]. [b]Note:[/b] Spawnable scenes are spawned automatically. [method spawn] is only needed for custom spawns.

func (Instance) SpawnFunction

func (self Instance) SpawnFunction() Callable.Function

func (Instance) SpawnLimit

func (self Instance) SpawnLimit() int

func (Instance) SpawnPath

func (self Instance) SpawnPath() string

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL