Slot selection and non-working auto weapon
This commit is contained in:
parent
22a72e572e
commit
08d0859728
26 changed files with 528 additions and 4 deletions
|
@ -14,7 +14,9 @@ var queue: CommandQueue = CommandQueue.new()
|
|||
# Placeholder UI
|
||||
@onready var ammo_label: Label = $"HUD/Ammo"
|
||||
|
||||
var current_weapon: Weapon
|
||||
var current_weapon:Weapon
|
||||
|
||||
var slot_actions: Array[StringName] = [ "slot_primary", "slot_secondary", "slot_tertiary" ]
|
||||
|
||||
func _ready() -> void:
|
||||
queue.command_pushed.connect(on_queue_command_pushed)
|
||||
|
@ -38,11 +40,23 @@ func _process(_delta: float) -> void:
|
|||
Input.is_action_pressed('shoot')
|
||||
if fire_action:
|
||||
push_copied_command(CommandQueue.Command.FIRE, weapon_sides)
|
||||
|
||||
# Reload logic
|
||||
var reload_action = Input.is_action_just_pressed('reload')
|
||||
if reload_action:
|
||||
if not queue.has_command(CommandQueue.Command.RELOAD):
|
||||
push_copied_command(CommandQueue.Command.RELOAD, weapon_sides)
|
||||
|
||||
# Slot changing logic
|
||||
var slot_action = false
|
||||
var slot_id = 0
|
||||
for slot in slot_actions.size():
|
||||
if Input.is_action_just_pressed(slot_actions[slot]):
|
||||
slot_action = true
|
||||
slot_id = slot
|
||||
if slot_action:
|
||||
weapons.select_slot(slot_id)
|
||||
|
||||
for side in CommandQueue.Side.values():
|
||||
var command = queue.current_command(side)
|
||||
match side:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue