From de1ab2bb5362f336669bb0aa6b13a77020a2b0c4 Mon Sep 17 00:00:00 2001 From: Rendo Date: Fri, 12 Dec 2025 14:04:56 +0500 Subject: [PATCH] Cmall fixes --- systems/weapon_system/weapon_system.gd | 12 ++++++------ weapons/gun/intro_state.gd | 1 - weapons/molikman/molik/throw.gd | 16 ++++++++-------- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/systems/weapon_system/weapon_system.gd b/systems/weapon_system/weapon_system.gd index b2c932c..611764e 100644 --- a/systems/weapon_system/weapon_system.gd +++ b/systems/weapon_system/weapon_system.gd @@ -86,14 +86,13 @@ func can_add_ability(ability: StringName, slot: StringName) -> bool: 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): + if slots.has(to) == false or slots[to] == null or slots[to] == current_state or not is_multiplayer_authority(): return - if current_state != null and exit: - current_state._exit() + if current_state != null: + if exit: + current_state._exit() if current_state.can_be_previous: last_slot = slots.find_key(current_state) - else: - last_slot = "" current_state = slots[to] current_state._enter() @@ -128,8 +127,8 @@ func drop(weapon: WeaponSubStateMachine) -> void: slots[slots.find_key(weapon)] = null notify_slots_updated() - weapon.queue_free() return_to_previous(false) + weapon.queue_free() func drop_slot(slot: StringName): if slots.has(slot) == false or slots[slot] == null: @@ -151,6 +150,7 @@ func check_for_empty() -> void: if child == current_state: return_to_previous(false) child.queue_free() + notify_slots_updated() func on_ammo_updated() -> void: diff --git a/weapons/gun/intro_state.gd b/weapons/gun/intro_state.gd index cda16d4..56fd77e 100644 --- a/weapons/gun/intro_state.gd +++ b/weapons/gun/intro_state.gd @@ -3,7 +3,6 @@ extends WeaponState @export var emptyable: bool func _enter() -> void: - machine.animation_player.play(with_morphems("intro")) machine.animation_player.animation_finished.connect(on_animation_finished) diff --git a/weapons/molikman/molik/throw.gd b/weapons/molikman/molik/throw.gd index 9a2e53a..2c0e3d0 100644 --- a/weapons/molikman/molik/throw.gd +++ b/weapons/molikman/molik/throw.gd @@ -12,18 +12,18 @@ func _exit() -> void: func on_animation_finished(animation): if animation == machine.animation_prefix + "throw" or animation == machine.animation_prefix + "shoot": transition.emit("Idle") - + machine.ammo -= 1 + if is_multiplayer_authority(): + var molotov: CharacterBody3D = molik.instantiate() + Session.dynamic_objects_parent.add_child(molotov,true) + molotov.global_transform = machine.player_camera.global_transform + molotov.velocity = -molotov.global_basis.z * 25 + machine.player.velocity + func fire() -> void: if machine.ammo == 0: return - machine.ammo -= 1 + machine.animation_player.stop() machine.animation_player.play(machine.animation_prefix + "shoot") - - if is_multiplayer_authority(): - var molotov: CharacterBody3D = molik.instantiate() - Session.dynamic_objects_parent.add_child(molotov,true) - molotov.global_transform = machine.player_camera.global_transform - molotov.velocity = -molotov.global_basis.z * 25 + machine.player.velocity