This commit is contained in:
Rendo 2025-11-28 22:02:06 +05:00
commit 02842948ba
4 changed files with 24 additions and 12 deletions

View file

@ -5,13 +5,15 @@ func _ready() -> void:
Session.dynamic_objects_spawner = self
func request_spawn(data: Variant) -> Node:
if data.has_all(["scene","impulse"]):
var projectile: RigidBody3D = load(data.scene).instantiate()
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"]):
projectile.weapon.ammo = data.ammo
projectile.weapon.remaining_ammo = data.remaining_ammo
projectile.slot = data.slot
node.weapon.ammo = data.ammo
node.weapon.remaining_ammo = data.remaining_ammo
node.slot = data.slot
projectile.apply_impulse(data.impulse)
return projectile
return Node.new()
node.apply_impulse(data.impulse)
return node