summaryrefslogtreecommitdiff
path: root/godot/scripts/machines/Cannon.gd
diff options
context:
space:
mode:
Diffstat (limited to 'godot/scripts/machines/Cannon.gd')
-rw-r--r--godot/scripts/machines/Cannon.gd10
1 files changed, 6 insertions, 4 deletions
diff --git a/godot/scripts/machines/Cannon.gd b/godot/scripts/machines/Cannon.gd
index 15807bf..437a20b 100644
--- a/godot/scripts/machines/Cannon.gd
+++ b/godot/scripts/machines/Cannon.gd
@@ -1,4 +1,4 @@
-extends "res://bin/networked_machine.gdns"
+extends "res://scripts/machines/NetworkedMachineGDS.gd"
var world_ballistics = null
@@ -33,13 +33,13 @@ func mp_init(init_info):
# Called when the node enters the scene tree for the first time.
func _ready():
- if get_parent().name != "MACHINES":
+ if get_parent().name != "MACHINES": #if cannon is aboard ship
add_collision_exception_with(get_parent())
mode = RigidBody.MODE_STATIC
world_ballistics = world.get_node("BALLISTICS")
func on_new_control():
- $YawJoint/PitchJoint/Camera.current = true
+ if is_network_master(): world.cam.attach(self, "STATIC", "./YawJoint/PitchJoint/CameraPoint")
func _physics_process(delta):
if cooldown > 0:
@@ -72,8 +72,10 @@ remotesync func fire():
add_collision_exception_with(cball)
cball.global_transform.origin = muzzle.global_transform.origin
cball.linear_velocity = muzzle.global_transform.basis.x*ball_speed
+ cball.shooter = user.name + " (" + world.players_info[user.get_network_master()][0] + ")"
+ cball.shooter_id = user.get_network_master()
cooldown = fire_rate
if mode == RigidBody.MODE_STATIC:
get_parent().apply_impulse($YawJoint/PitchJoint.global_transform.origin - get_parent().global_transform.origin, -5*cball.mass*ball_speed*muzzle.global_transform.basis.x)
else:
- apply_impulse($YawJoint/PitchJoint.global_transform.origin - global_transform.origin, -1*cball.mass*ball_speed*muzzle.global_transform.basis.x)
+ if is_network_master(): apply_impulse($YawJoint/PitchJoint.global_transform.origin - global_transform.origin, -1*cball.mass*ball_speed*muzzle.global_transform.basis.x)