Amount check

This commit is contained in:
Rendo 2025-12-12 02:15:02 +05:00
commit 82539c5af8
3 changed files with 15 additions and 2 deletions

View file

@ -7,3 +7,7 @@ class_name WeaponResource
@export var dropped_scene: PackedScene
@export var weapon_system_scene: PackedScene
@export var slot: StringName
func get_gid() -> StringName:
var path_split: PackedStringArray = resource_path.split("/")
return path_split[len(path_split)-1].trim_suffix(".tres")

View file

@ -79,6 +79,12 @@ func get_empty_ability_slot() -> StringName:
return "ability_third"
return "ability_first"
func can_add_ability(ability: StringName, slot: StringName) -> bool:
for ability_slot in ["ability_first","ability_second","ability_third"]:
if slots[ability_slot] != null and slots[ability_slot].registry_entry == ability:
return false
return can_add(slot)
func switch(to: StringName, exit: bool = true):
if slots.has(to) == false or slots[to] == null or slots[to] == current_state or (multiplayer.get_remote_sender_id() != 1 and is_multiplayer_authority() == false):
return