summaryrefslogtreecommitdiff
path: root/godot/scripts/ballistics/NetworkedProjectile.gd
blob: a7de71a1405b3a7737b2a822e6311f498e7f56a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
extends RigidBody

var shooter = "WORLD"
var shooter_id = 1


# Called when the node enters the scene tree for the first time.
func _ready():
	pass # Replace with function body.

remotesync func set_nm(id):
	set_network_master(id)

func mp_init(init_info):
	for variable in init_info.keys():
		set(variable, init_info[variable])

remote func update_phys_transform(t, lv, av):
	transform = t
	linear_velocity = lv
	angular_velocity = av
	
func _integrate_forces(_state):
	if is_network_master():
		rpc("update_phys_transform", transform, linear_velocity, angular_velocity)

remotesync func net_remove():
	queue_free()

func net_master_remove():
	if is_network_master():
		rpc("net_remove")

remotesync func net_apply_impulse(impulse_v: Vector3):
	apply_central_impulse(impulse_v)