summaryrefslogtreecommitdiff
path: root/scenes/ballistics
diff options
context:
space:
mode:
Diffstat (limited to 'scenes/ballistics')
-rw-r--r--scenes/ballistics/Rocket.gd21
-rw-r--r--scenes/ballistics/Rocket.tscn30
2 files changed, 13 insertions, 38 deletions
diff --git a/scenes/ballistics/Rocket.gd b/scenes/ballistics/Rocket.gd
index d21b9f6..171a49e 100644
--- a/scenes/ballistics/Rocket.gd
+++ b/scenes/ballistics/Rocket.gd
@@ -12,7 +12,7 @@ func _ready():
$RocketTrail.emitting = true
func get_init_info():
- return {"linear_velocity" : linear_velocity, "angular_velocity" : angular_velocity, "life" : life, "shooter" : shooter}
+ return {"linear_velocity" : linear_velocity, "angular_velocity" : angular_velocity, "life" : life, "shooter" : shooter, "shooter_id" : shooter_id}
remote func update_phys_transform(t, lv, av):
transform = t
@@ -24,10 +24,10 @@ func _physics_process(delta):
add_central_force(global_transform.basis.x*strength)
life += delta
else:
- explode()
+ rpc("explode")
$RocketTrail.emitting = false
-func explode():
+remotesync func explode():
if cannot_explode:
return
cannot_explode = true
@@ -41,15 +41,12 @@ func explode():
world.add_child(expl)
expl.init(global_transform.origin, Vector3.ZERO)
-
- for body in $BlastArea.get_overlapping_bodies():
- if body.has_method("damage") and body.is_network_master():
- body.rpc("damage", 50, "explosive", shooter, "using 'rocket'")
- print((5000*(global_transform.origin - body.global_transform.origin).normalized()))
- body.apply_central_impulse((5000*(global_transform.origin - body.global_transform.origin).normalized()))
- body.rpc("apply_central_impulse", (5000*(global_transform.origin - body.global_transform.origin).normalized()))
-
+ if is_network_master():
+ for body in $BlastArea.get_overlapping_bodies():
+ if body.has_method("damage"):
+ body.rpc("damage", 20, "explosive", [shooter_id, shooter], "using 'rocket'")
+ body.rpc_id(body.get_network_master(), "net_apply_impulse", (500*(body.global_transform.origin - global_transform.origin).normalized()))
$AnimationPlayer.play("explode")
func _on_collision(body):
- explode()
+ rpc("explode")
diff --git a/scenes/ballistics/Rocket.tscn b/scenes/ballistics/Rocket.tscn
index 03e807e..4b8e05d 100644
--- a/scenes/ballistics/Rocket.tscn
+++ b/scenes/ballistics/Rocket.tscn
@@ -1,6 +1,6 @@
-[gd_scene load_steps=14 format=2]
+[gd_scene load_steps=9 format=2]
-[ext_resource path="res://work/RocketMaterial.material" type="Material" id=1]
+[ext_resource path="res://materials/RocketMaterial.material" type="Material" id=1]
[ext_resource path="res://particles/RocketTrail.tscn" type="PackedScene" id=2]
[ext_resource path="res://scenes/ballistics/Rocket.gd" type="Script" id=3]
[ext_resource path="res://sounds/explode.wav" type="AudioStream" id=4]
@@ -23,27 +23,6 @@ surfaces/0 = {
[sub_resource type="BoxShape" id=2]
extents = Vector3( 0.111378, 0.254987, 0.104516 )
-[sub_resource type="Gradient" id=6]
-offsets = PoolRealArray( 0, 0.180645, 0.554839, 1 )
-colors = PoolColorArray( 1, 0.140625, 0, 1, 1, 0.906855, 0.148387, 1, 1, 1, 1, 1, 0, 0, 0, 1 )
-
-[sub_resource type="GradientTexture" id=7]
-gradient = SubResource( 6 )
-
-[sub_resource type="Curve" id=4]
-_data = [ Vector2( 0, 0 ), 0.0, 0.0, 0, 0, Vector2( 0.140449, 0.409091 ), 0.0, 0.0, 0, 0 ]
-
-[sub_resource type="CurveTexture" id=5]
-curve = SubResource( 4 )
-
-[sub_resource type="ParticlesMaterial" id=8]
-spread = 2.23
-gravity = Vector3( 0, 1, 0 )
-initial_velocity = 19.8
-damping = 13.78
-scale_curve = SubResource( 5 )
-color_ramp = SubResource( 7 )
-
[sub_resource type="Animation" id=3]
resource_name = "explode"
tracks/0/type = "method"
@@ -57,7 +36,7 @@ tracks/0/keys = {
"transitions": PoolRealArray( 1 ),
"values": [ {
"args": [ ],
-"method": "queue_free"
+"method": "net_remove"
} ]
}
tracks/1/type = "method"
@@ -95,8 +74,7 @@ shape = SubResource( 2 )
[node name="RocketTrail" parent="." instance=ExtResource( 2 )]
transform = Transform( -1, 8.74228e-08, 0, -8.74228e-08, -1, 0, 0, 0, 1, 0.0857886, 0, 0 )
-emitting = false
-process_material = SubResource( 8 )
+visibility_aabb = AABB( -78.3554, -22.7817, -31.4143, 156.711, 45.5634, 62.8285 )
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
anims/explode = SubResource( 3 )