Fixed bugs regarding switch
This commit is contained in:
parent
de1ab2bb53
commit
162dbc13e8
3 changed files with 6 additions and 4 deletions
|
|
@ -92,7 +92,8 @@ func switch(to: StringName, exit: bool = true):
|
|||
if exit:
|
||||
current_state._exit()
|
||||
if current_state.can_be_previous:
|
||||
last_slot = slots.find_key(current_state)
|
||||
var found = slots.find_key(current_state)
|
||||
last_slot = found if found else ""
|
||||
current_state = slots[to]
|
||||
current_state._enter()
|
||||
|
||||
|
|
@ -119,7 +120,7 @@ func drop(weapon: WeaponSubStateMachine) -> void:
|
|||
dropped_weapon.weapon.ammo = weapon.ammo
|
||||
dropped_weapon.weapon.remaining_ammo = weapon.remaining_ammo
|
||||
dropped_weapon.weapon.slot = weapon.slot
|
||||
Session.dynamic_objects_parent.add_child(dropped_weapon)
|
||||
Session.dynamic_objects_parent.add_child(dropped_weapon,true)
|
||||
dropped_weapon.global_position = camera.global_position
|
||||
dropped_weapon.apply_central_impulse(-camera.global_basis.z * 10 + player.velocity)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue