From 4068e66756966983973ab20b68ec5382e398548b Mon Sep 17 00:00:00 2001 From: Anson Bridges Date: Tue, 13 Sep 2022 18:15:01 -0400 Subject: incomplete airplane implementation (needs addl. network sync) --- godot/scripts/machines/Cannon.gd | 10 ++++++---- godot/scripts/machines/NetworkedMachineGDS.gd | 7 +++++++ 2 files changed, 13 insertions(+), 4 deletions(-) (limited to 'godot/scripts/machines') 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) diff --git a/godot/scripts/machines/NetworkedMachineGDS.gd b/godot/scripts/machines/NetworkedMachineGDS.gd index 5ce5cbe..3f2d420 100644 --- a/godot/scripts/machines/NetworkedMachineGDS.gd +++ b/godot/scripts/machines/NetworkedMachineGDS.gd @@ -5,6 +5,7 @@ var user = null var world = null func _ready(): + print("net machine loads world") world = get_tree().get_root().find_node("GAMEWORLD", true, false) remote func update_phys_transform(t, lv, av): @@ -52,3 +53,9 @@ func attack2(): func direction_input(_fwd,_bwd,_left,_right,_left2,_right2): pass + +func misc_input(_ctrl,_space,_shift): + pass + +func mouse_input(_m1,_m3,_m2): #used for long-press actions + pass -- cgit v1.2.3