Use interact button instead of action buttons to pick up object.

This commit is contained in:
blujai831 2025-03-29 02:49:41 -07:00
parent 3463e09994
commit a2ebebd82b
No known key found for this signature in database
GPG Key ID: DDC31A0363AA5E66
3 changed files with 7 additions and 2 deletions

View File

@ -184,6 +184,8 @@ var jump_impetus := false
var action1_impetus := false var action1_impetus := false
## Whether the character is "trying" to perform their secondary action. ## Whether the character is "trying" to perform their secondary action.
var action2_impetus := false var action2_impetus := false
## Whether the character is "trying" to perform a tertiary interaction.
var interact_impetus := false
## Collision shape height. ## Collision shape height.
var height: float: var height: float:
get(): get():
@ -1242,7 +1244,7 @@ func _on_idle_while_holding_state_tick(delta: float) -> void:
force_change_state(&'jump-while-holding') force_change_state(&'jump-while-holding')
elif !impetus.is_zero_approx(): elif !impetus.is_zero_approx():
state = &'walk-while-holding' state = &'walk-while-holding'
elif action1_impetus || action2_impetus: elif action1_impetus || action2_impetus || interact_impetus:
state = &'put-down' state = &'put-down'
func _on_walk_while_holding_state_tick(delta: float) -> void: func _on_walk_while_holding_state_tick(delta: float) -> void:
@ -1258,6 +1260,8 @@ func _on_walk_while_holding_state_tick(delta: float) -> void:
state = &'run-while-holding' state = &'run-while-holding'
elif impetus.is_zero_approx() && top_speed_proximity < 0.03125: elif impetus.is_zero_approx() && top_speed_proximity < 0.03125:
state = &'idle-while-holding' state = &'idle-while-holding'
elif action1_impetus || action2_impetus || interact_impetus:
state = &'put-down'
func _on_run_while_holding_state_tick(delta: float) -> void: func _on_run_while_holding_state_tick(delta: float) -> void:
_do_standard_motion(delta) _do_standard_motion(delta)

View File

@ -15,3 +15,4 @@ func _physics_process(_delta: float) -> void:
character.jump_impetus = Input.is_action_pressed(&'jump') character.jump_impetus = Input.is_action_pressed(&'jump')
character.action1_impetus = Input.is_action_pressed(&'action1') character.action1_impetus = Input.is_action_pressed(&'action1')
character.action2_impetus = Input.is_action_pressed(&'action2') character.action2_impetus = Input.is_action_pressed(&'action2')
character.interact_impetus = Input.is_action_pressed(&'interact')

View File

@ -5,5 +5,5 @@ func _ready() -> void:
func _on_body_entered(body: PhysicsBody3D) -> void: func _on_body_entered(body: PhysicsBody3D) -> void:
if body is Character: if body is Character:
if body.action2_impetus: if body.interact_impetus:
body.pick_up(self) body.pick_up(self)