summaryrefslogtreecommitdiff
path: root/scripts/ballistics
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/ballistics')
-rw-r--r--scripts/ballistics/Cannonball.gd2
-rw-r--r--scripts/ballistics/NetworkedProjectile.gd9
2 files changed, 9 insertions, 2 deletions
diff --git a/scripts/ballistics/Cannonball.gd b/scripts/ballistics/Cannonball.gd
index 15f35a3..7b56577 100644
--- a/scripts/ballistics/Cannonball.gd
+++ b/scripts/ballistics/Cannonball.gd
@@ -9,7 +9,7 @@ func _physics_process(_delta):
add_force(-1*linear_velocity*drag_constant, Vector3.ZERO)
func get_init_info():
- return {"linear_velocity" : linear_velocity, "angular_velocity" : angular_velocity, "oldvel" : oldvel, "shooter" : shooter}
+ return {"linear_velocity" : linear_velocity, "angular_velocity" : angular_velocity, "oldvel" : oldvel, "shooter" : shooter, "shooter_id" : shooter_id}
func _on_collision(body):
if linear_velocity.length() > 20 and !damage_exceptions.has(body) and body.has_method("damage"):
diff --git a/scripts/ballistics/NetworkedProjectile.gd b/scripts/ballistics/NetworkedProjectile.gd
index 0626e9f..d9304cf 100644
--- a/scripts/ballistics/NetworkedProjectile.gd
+++ b/scripts/ballistics/NetworkedProjectile.gd
@@ -1,7 +1,7 @@
extends RigidBody
-
var shooter = "WORLD"
+var shooter_id = 1
# Called when the node enters the scene tree for the first time.
@@ -20,3 +20,10 @@ remote func update_phys_transform(t, lv, av):
func _integrate_forces(state):
if is_network_master():
rpc("update_phys_transform", transform, linear_velocity, angular_velocity)
+
+remotesync func net_remove():
+ queue_free()
+
+func net_master_remove():
+ if is_network_master():
+ rpc("net_remove")