19 lines
503 B
GDScript
19 lines
503 B
GDScript
extends MultiplayerSpawner
|
|
|
|
func _ready() -> void:
|
|
spawn_function = request_spawn
|
|
Session.dynamic_objects_spawner = self
|
|
|
|
func request_spawn(data: Variant) -> Node:
|
|
if data.has("scene") == false:
|
|
return Node.new()
|
|
var node = load(data.scene).instantiate()
|
|
if data.has("impulse"):
|
|
if data.has_all(["ammo","remaining_ammo","slot"]):
|
|
node.weapon.ammo = data.ammo
|
|
node.weapon.remaining_ammo = data.remaining_ammo
|
|
node.slot = data.slot
|
|
|
|
node.apply_impulse(data.impulse)
|
|
return node
|
|
|