Browse Source

:beetle: Fix player moving while onboard

Prevent action to be triggered if on a vehicle.
DricomDragon 1 year ago
parent
commit
563d19c2b2
1 changed files with 7 additions and 0 deletions
  1. 7 0
      godot/component/entity/walker/walker.gd

+ 7 - 0
godot/component/entity/walker/walker.gd

@@ -46,6 +46,7 @@ func trigger_direction(dir: Vector2) -> void:
 	_look_forward(target_world_direction)
 	target_velocity = target_world_direction.normalized() * speed
 
+
 ## Return true if inside a vehicle
 func is_onboard() -> bool:
 	return _vehicle != null
@@ -86,10 +87,16 @@ func _get_on_driver_seat() -> void:
 
 
 func _on_dir_changed(dir: Vector2) -> void:
+	if is_onboard():
+		return
+
 	trigger_direction(dir)
 
 
 func _on_main_action(pressed: bool) -> void:
+	if is_onboard():
+		return
+
 	if pressed:
 		trigger_jump()