feat: added the knife

This commit is contained in:
DottsGit
2026-06-06 02:22:27 -04:00
parent 90876611f4
commit 18b8b3ee99
6 changed files with 211 additions and 2 deletions
+12 -1
View File
@@ -4,7 +4,7 @@ class_name WeaponManager
var player: CharacterBody3D
var camera: Camera3D
var active_slot: int = 1 # 1: Primary 1, 2: Primary 2, 3: Special
var active_slot: int = 1 # 1: Primary 1, 2: Primary 2, 3: Special, 4: Melee
var weapons: Dictionary = {} # slot_index: Node3D
func _ready() -> void:
@@ -26,6 +26,8 @@ func _build_loadout() -> void:
_spawn_weapon(1, l["primary_1"])
_spawn_weapon(2, l["primary_2"])
_spawn_weapon(3, l["special"])
if l.has("melee"):
_spawn_weapon(4, l["melee"])
_equip_slot(1)
@@ -80,3 +82,12 @@ func _input(event: InputEvent) -> void:
_equip_slot(2)
elif event.is_action_pressed("weapon_3"):
_equip_slot(3)
elif event.is_action_pressed("weapon_4"):
_equip_slot(4)
elif event.is_action_pressed("melee"):
if active_slot != 4:
var prev = active_slot
_equip_slot(4)
if weapons.has(4):
if weapons[4].has_method("do_quick_melee"):
weapons[4].do_quick_melee(prev)