fixed cycle count on weapon script
This commit is contained in:
@@ -59,7 +59,10 @@ func _process(_delta):
|
||||
var rot_amount = revolver_chamber_rot_amt * _delta * 10
|
||||
chamber.rotate_object_local(Vector3(0,-1,0),deg_to_rad(rot_amount))
|
||||
revolver_chamber_rot_amt -= rot_amount
|
||||
|
||||
|
||||
if Input.is_action_just_released("shoot"):
|
||||
cycle_count = cycle_count_start
|
||||
|
||||
if weapon_info.weapon_type == 2:
|
||||
if tracker != null:
|
||||
weapon_info.tracker_asset.tracker_indicator_material.emission = TRACKER_ASSIGNED_COLOR
|
||||
@@ -101,6 +104,8 @@ func shoot():
|
||||
if GameGlobals.gun_ammo[weapon_info.gun_name] > 0 and cycle_count > 0:
|
||||
if !anim_player.is_playing():
|
||||
GameGlobals.gun_ammo[weapon_info.gun_name] -= 1
|
||||
if weapon_info.fire_mode != 0:
|
||||
cycle_count -= 1
|
||||
#audio and anims
|
||||
anim_player.play("shoot")
|
||||
|
||||
@@ -267,8 +272,6 @@ func bullet_fire():
|
||||
player.recoil.add_gun_recoil(weapon_info.recoil_amount.x)
|
||||
SignalBus.emit_signal("shot_fired")
|
||||
|
||||
if weapon_info.fire_mode != 0:
|
||||
cycle_count -= 1
|
||||
|
||||
func hitscan_fire():
|
||||
# Fire hitscan
|
||||
|
||||
Reference in New Issue
Block a user