summaryrefslogtreecommitdiff
path: root/scripts/machines/Cannon.gd
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/machines/Cannon.gd')
-rw-r--r--scripts/machines/Cannon.gd10
1 files changed, 10 insertions, 0 deletions
diff --git a/scripts/machines/Cannon.gd b/scripts/machines/Cannon.gd
index d7c9a18..fcd842b 100644
--- a/scripts/machines/Cannon.gd
+++ b/scripts/machines/Cannon.gd
@@ -21,6 +21,11 @@ export var max_yaw = 15
onready var muzzle = get_node("YawJoint/PitchJoint/Muzzle")
+remote func update_phys_transform(t, lv, av):
+ transform = t
+ linear_velocity = lv
+ angular_velocity = av
+
func get_init_info():
return {"pitch_rot" : $YawJoint/PitchJoint.rotation_degrees.z, "turn_rot" : $YawJoint.rotation_degrees.y, "in_use" : in_use}
@@ -65,6 +70,8 @@ func _physics_process(delta):
$YawJoint/PitchJoint.rotation_degrees.z = max_pitch
elif $YawJoint/PitchJoint.rotation_degrees.z < min_pitch:
$YawJoint/PitchJoint.rotation_degrees.z = min_pitch
+ if is_network_master() and mode == MODE_STATIC:
+ rpc("update_phys_transform", transform, linear_velocity, angular_velocity)
func direction_input(fwd,bwd,left,right,_left,_right):
pitch = fwd - bwd
@@ -73,6 +80,9 @@ func direction_input(fwd,bwd,left,right,_left,_right):
func attack1():
if cooldown > 0:
return
+ rpc("fire")
+
+remotesync func fire():
$YawJoint/PitchJoint/Muzzle/explosion_sound.play()
var expl = preload("res://particles/p_Explosion.tscn").instance()
var cball = preload("res://scenes/ballistics/Cannonball.tscn").instance()