FINISHED DAMN DROP SYSTEM
This commit is contained in:
parent
3302fcfc96
commit
100afe5e51
17 changed files with 151 additions and 25 deletions
|
|
@ -1,5 +0,0 @@
|
|||
extends Node3D
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
Session.dynamic_objects_container = self
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://be7l33prlm8gh
|
||||
|
|
@ -7,4 +7,29 @@ enum TEAMS {
|
|||
UNASSIGNED
|
||||
}
|
||||
|
||||
var dynamic_objects_container: Node3D
|
||||
var dynamic_objects_spawner: MultiplayerSpawner
|
||||
|
||||
func spawn(data: Dictionary) -> void:
|
||||
spawn_internal.rpc_id(1,data)
|
||||
|
||||
@rpc("any_peer","call_local","reliable")
|
||||
func spawn_internal(data: Dictionary) -> void:
|
||||
if multiplayer.is_server() == false:
|
||||
printerr(str(multiplayer.get_remote_sender_id())+" tried to spawn internally on "+str(multiplayer.get_unique_id()))
|
||||
return
|
||||
|
||||
var object = dynamic_objects_spawner.spawn(data)
|
||||
|
||||
if data.has("position"):
|
||||
object.global_position = data.position
|
||||
|
||||
func despawn(path: NodePath):
|
||||
despawn_internal.rpc_id(1,path)
|
||||
|
||||
@rpc("any_peer","call_local","reliable")
|
||||
func despawn_internal(path: NodePath) -> void:
|
||||
if multiplayer.is_server() == false:
|
||||
printerr(str(multiplayer.get_remote_sender_id())+" tried to despawn internally on "+str(multiplayer.get_unique_id()))
|
||||
return
|
||||
|
||||
get_node(path).queue_free()
|
||||
|
|
|
|||
17
scripts/multiplayer/spawn_system/dyn_objects_spawner.gd
Normal file
17
scripts/multiplayer/spawn_system/dyn_objects_spawner.gd
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
extends MultiplayerSpawner
|
||||
|
||||
func _ready() -> void:
|
||||
spawn_function = request_spawn
|
||||
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_all(["ammo","remaining_ammo","slot"]):
|
||||
projectile.weapon.ammo = data.ammo
|
||||
projectile.weapon.remaining_ammo = data.remaining_ammo
|
||||
projectile.slot = data.slot
|
||||
|
||||
projectile.apply_impulse(data.impulse)
|
||||
return projectile
|
||||
return Node.new()
|
||||
|
|
@ -0,0 +1 @@
|
|||
uid://bqjv6l7hh0lix
|
||||
Loading…
Add table
Add a link
Reference in a new issue