summaryrefslogtreecommitdiff
path: root/scenes/ballistics/Rocket.gd
diff options
context:
space:
mode:
authorAnson Bridges <bridges.anson@gmail.com>2022-09-07 14:16:17 -0400
committerAnson Bridges <bridges.anson@gmail.com>2022-09-07 14:16:17 -0400
commit366761197034a20d444282431e4a8edeb7882840 (patch)
tree63d7b11eccbb499aef8f5afc3634945c63c14ff5 /scenes/ballistics/Rocket.gd
parentc232b92e2dde1277324d1f89d0e75ae641e4ac3b (diff)
whoops, fixed reorg
Diffstat (limited to 'scenes/ballistics/Rocket.gd')
-rw-r--r--scenes/ballistics/Rocket.gd49
1 files changed, 0 insertions, 49 deletions
diff --git a/scenes/ballistics/Rocket.gd b/scenes/ballistics/Rocket.gd
deleted file mode 100644
index 46ca058..0000000
--- a/scenes/ballistics/Rocket.gd
+++ /dev/null
@@ -1,49 +0,0 @@
-extends "res://scripts/ballistics/NetworkedProjectile.gd"
-
-onready var world = get_tree().get_root().find_node("GAMEWORLD", true, false)
-
-export var lifetime : float = 2.0
-export var strength : int = 80
-
-var life = 0.0
-var cannot_explode = false
-
-func _ready():
- $RocketTrail.emitting = true
-
-func get_init_info():
- return {"linear_velocity" : linear_velocity, "angular_velocity" : angular_velocity, "life" : life, "shooter" : shooter, "shooter_id" : shooter_id}
-
-func _physics_process(delta):
- print(global_transform.basis.x)
- if life < lifetime:
- add_central_force(global_transform.basis.x*strength)
- life += delta
- else:
- rpc("explode")
- $RocketTrail.emitting = false
-
-
-remotesync func explode():
- if cannot_explode:
- return
- cannot_explode = true
- $RocketTrail.emitting = false
- $rocket_mesh.visible = false
- mode = MODE_STATIC
- set_collision_layer_bit(1,0)
- set_collision_mask_bit(1,0)
-
- var expl = preload("res://particles/p_Explosion.tscn").instance()
- world.add_child(expl)
- expl.init(global_transform.origin, Vector3.ZERO)
-
- 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):
- rpc("explode")