forked from unfa/liblast
Fixed weapon spread being different between puppets
parent
e476dd23fb
commit
a8c34bf896
|
@ -27,17 +27,7 @@ var spread = spread_min
|
||||||
|
|
||||||
#enum Trigger {TRIGGER_PRIMARY, TRIGGER_SECONDARY}
|
#enum Trigger {TRIGGER_PRIMARY, TRIGGER_SECONDARY}
|
||||||
|
|
||||||
@rpc(any, sync, reliable) func shoot():
|
@rpc(any, sync, reliable) func shoot(spread_offset:=Vector3.ZERO):
|
||||||
#spread = min (spread + spread_boost, spread_max)
|
|
||||||
spread = min(spread + spread_boost, spread_max)
|
|
||||||
|
|
||||||
var spread_offset = Vector3.ZERO
|
|
||||||
|
|
||||||
spread_offset.x = randf_range(-1,1)
|
|
||||||
spread_offset.y = randf_range(-1,1)
|
|
||||||
spread_offset.z = randf_range(-1,1)
|
|
||||||
|
|
||||||
spread_offset = spread_offset.normalized() * randf_range(spread_min, spread)
|
|
||||||
|
|
||||||
var space_state = get_world_3d().direct_space_state
|
var space_state = get_world_3d().direct_space_state
|
||||||
|
|
||||||
|
@ -119,8 +109,17 @@ var spread = spread_min
|
||||||
func trigger(index: int, active: bool) -> void:
|
func trigger(index: int, active: bool) -> void:
|
||||||
#print("Weapon " + str(name) + ", Trigger " + str(index) + ", active: " + str(active))
|
#print("Weapon " + str(name) + ", Trigger " + str(index) + ", active: " + str(active))
|
||||||
if index == 0 and active and $Handgun/AnimationPlayer.is_playing() == false:
|
if index == 0 and active and $Handgun/AnimationPlayer.is_playing() == false:
|
||||||
|
spread = min(spread + spread_boost, spread_max)
|
||||||
|
|
||||||
|
var spread_offset = Vector3.ZERO
|
||||||
|
|
||||||
rpc(&'shoot')
|
spread_offset.x = randf_range(-1,1)
|
||||||
|
spread_offset.y = randf_range(-1,1)
|
||||||
|
spread_offset.z = randf_range(-1,1)
|
||||||
|
|
||||||
|
spread_offset = spread_offset.normalized() * randf_range(spread_min, spread)
|
||||||
|
|
||||||
|
rpc(&'shoot', spread_offset)
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready():
|
func _ready():
|
||||||
|
|
Loading…
Reference in New Issue