This commit is contained in:
Rendo 2025-12-10 12:31:22 +05:00
commit 553f8ea77a
7 changed files with 55 additions and 7 deletions

View file

@ -81,7 +81,6 @@ func get_empty_ability_slot() -> StringName:
return "ability_third"
return "ability_first"
@rpc("authority","call_remote","reliable")
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
@ -96,8 +95,6 @@ func switch(to: StringName, exit: bool = true):
ammo_updated.emit(current_state.ammo,current_state.remaining_ammo)
switched_to.emit(current_state)
if is_multiplayer_authority():
switch.rpc(to,exit)
func return_to_previous(exit: bool = true):
if last_slot != "":
@ -143,9 +140,17 @@ func check_for_empty() -> void:
return_to_previous(false)
child.queue_free()
func on_ammo_updated() -> void:
if is_multiplayer_authority() == false:
return
if current_state != null:
ammo_updated.emit(current_state.ammo,current_state.remaining_ammo)
remote_ammo_update.rpc(current_state.ammo,current_state.remaining_ammo)
@rpc
func remote_ammo_update(ammo: int, remaining_ammo: int):
ammo_updated.emit(ammo,remaining_ammo)
func disable() -> void:
disabled = true