diff options
| author | Anson Bridges <bridges.anson@gmail.com> | 2022-08-31 17:19:49 -0700 |
|---|---|---|
| committer | Anson Bridges <bridges.anson@gmail.com> | 2022-08-31 17:19:49 -0700 |
| commit | e57103a4f99cdc0693471fe772dc7893ff65e855 (patch) | |
| tree | 790c0767197adf7ffc6e61c4b059cfdff0c62b7b /scripts/machines/Cannon.gd | |
| parent | d3998186c9795f2a85148cd5bcfa1bd5b6226cfb (diff) | |
added local servers
Diffstat (limited to 'scripts/machines/Cannon.gd')
| -rw-r--r-- | scripts/machines/Cannon.gd | 10 |
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() |
