Bomb fix
This commit is contained in:
parent
b4f6f65f2b
commit
02842948ba
4 changed files with 24 additions and 12 deletions
|
|
@ -13,6 +13,14 @@ var player_nodes: Dictionary[int,Player] = {}
|
|||
|
||||
var dynamic_objects_spawner: MultiplayerSpawner
|
||||
|
||||
## Spawns dynamic object at game scene [br]
|
||||
## Dictionary keys: [br]
|
||||
## (Required) scene - path/uuid to scene [br]
|
||||
## (Optional) position - position to spawn [br]
|
||||
## (Optional) impulse - impulse to apply [br]
|
||||
## (Optional but required for each other) [br]
|
||||
## ammo, remaining_ammo, slot - data for dropped weapon [br]
|
||||
## for more, see dyn_objects_spawner.gd
|
||||
func spawn(data: Dictionary) -> void:
|
||||
spawn_internal.rpc_id(1,data)
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue