Chelimbalo/scripts/multiplayer/spawn_system/dyn_objects_spawner.gd
2025-11-28 22:02:06 +05:00

19 lines
505 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