summaryrefslogtreecommitdiff
path: root/godot/scripts/machines
diff options
context:
space:
mode:
authorAnson Bridges <bridges.anson@gmail.com>2022-09-13 18:15:01 -0400
committerAnson Bridges <bridges.anson@gmail.com>2022-09-13 18:15:01 -0400
commit4068e66756966983973ab20b68ec5382e398548b (patch)
treec2215e65167c7f6aced272da371214985cce16f5 /godot/scripts/machines
parente2f3e4bd7118c8f55d20b29d76cb9a13acf72f8b (diff)
incomplete airplane implementation (needs addl. network sync)
Diffstat (limited to 'godot/scripts/machines')
-rw-r--r--godot/scripts/machines/Cannon.gd10
-rw-r--r--godot/scripts/machines/NetworkedMachineGDS.gd7
2 files changed, 13 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)
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