fixed cycle count on weapon script

This commit is contained in:
Derek
2025-03-11 22:25:51 -05:00
parent 64ec7b12b6
commit a6ee53ed3e
6 changed files with 18 additions and 20 deletions

View File

@@ -358,7 +358,7 @@ func _physics_process(delta):
SENSITIVITY = start_sensitivity
if remaining_stamina < level_control.gamemode.max_stamina and !Input.is_action_pressed("slow_down"):
if level_control.gamemode.stamina_regen == true:
remaining_stamina = clamp(remaining_stamina + (delta * level_control.gamemode.stamina_drain/Engine.time_scale), 0, level_control.gamemode.max_stamina)
remaining_stamina = clamp(remaining_stamina + (delta * level_control.gamemode.stamina_gain/Engine.time_scale), 0, level_control.gamemode.max_stamina)
# Reloading
@@ -381,10 +381,6 @@ func _physics_process(delta):
if Input.is_action_pressed("shoot"):
if gun != null:
gun.shoot()
if Input.is_action_just_released("shoot"):
if gun != null:
gun.cycle_count = gun.cycle_count_start
# Gun folding out of the way
if gun_ray.is_colliding():
@@ -619,9 +615,9 @@ func grab_moveable(body):
body.gravity_scale = 0
moveable_holder.add_child(body)
body.global_position = moveable_holder.global_position
for i in body.get_children():
if i.get_class() == "CollisionShape3D":
i.collision_layer = true
#for i in body.get_children():
#if i.get_class() == "CollisionShape3D":
#i.collision_layer = true
held_item = body
func hold_item(_delta):
@@ -633,9 +629,9 @@ func hold_item(_delta):
func release_moveable():
held_item.gravity_scale = held_item_cache["gravity_scale"]
for i in held_item.get_children():
if i.get_class() == "CollisionShape3D":
i.disabled = false
#for i in held_item.get_children():
#if i.get_class() == "CollisionShape3D":
#i.disabled = false
get_tree().current_scene.add_child(held_item)
held_item = null