casings integrate player velocity, can't pick up already held guns

This commit is contained in:
derek
2024-11-05 16:58:00 -06:00
parent 83e2365892
commit c6f1eccca0
6 changed files with 49 additions and 45 deletions

View File

@@ -7,6 +7,7 @@ extends RigidBody3D
@onready var level_control = get_tree().current_scene
var pickupable = true
var gun_already_held = false
# Called when the node enters the scene tree for the first time.
func _ready():
@@ -18,11 +19,16 @@ func _process(delta):
pass
func picked_up():
level_control.held_guns.append(gun_resource)
var instance_gun = gun_resource.instantiate()
level_control.ammo_current.append(instance_gun.max_ammo)
level_control.ammo_reserve.append(instance_gun.max_ammo * instance_gun.start_mags)
var weapon_id = level_control.held_guns.size() - 1
level_control.player.gun.anim_player.play("swap_out")
level_control.gun_spawn(weapon_id)
for i in level_control.held_guns:
if i == gun_resource:
gun_already_held = true
if !gun_already_held:
level_control.held_guns.append(gun_resource)
var instance_gun = gun_resource.instantiate()
level_control.ammo_current.append(instance_gun.max_ammo)
level_control.ammo_reserve.append(instance_gun.max_ammo * instance_gun.start_mags)
var weapon_id = level_control.held_guns.size() - 1
level_control.player.gun.anim_player.play("swap_out")
level_control.gun_spawn(weapon_id)
queue_free()