Réparation de bug, paufinnage du rayon tracteur et insert de l'outil dans l'histoire

This commit is contained in:
2026-06-14 16:19:36 +02:00
parent 7c66d8b9de
commit 33a8f022e5
30 changed files with 540 additions and 74 deletions

View File

@@ -77,13 +77,7 @@ func _process(delta):
update_inspector(get_current_inspected())
var cursor := default_cursor
if not Pause.pause and player and not action_disabled:
if can_interact:
cursor = action_cursor
elif current_selected_item and current_selected_item.get_pointer():
cursor = current_selected_item.get_pointer()
Input.set_custom_mouse_cursor(cursor)
update_cursor()
if player:
if dragging_inspected:
@@ -157,7 +151,7 @@ func process_player_actions(delta: float):
if Input.is_action_just_pressed("action"):
if inspected is InventoryGuiItemMouseDetector:
GameInfo.game_data.player_data.inventory.set_current_item(inspected.index)
elif can_use_item and not current_selected_item.is_action_need_press_time() and current_selected_item.get_action_is_hold():
elif can_use_item and not current_selected_item.is_action_need_press_time() and current_selected_item.deactivate_interactable():
player.try_use_item(current_selected_item, player.get_global_mouse_position())
elif can_interact:
var interactable = inspected as Interactable
@@ -171,7 +165,7 @@ func process_player_actions(delta: float):
if (
Input.is_action_just_released("action")
and can_use_item
and current_selected_item.get_action_is_hold()
and current_selected_item.deactivate_interactable()
):
if dragging_inspected:
player.try_use_item(current_selected_item, player.get_global_mouse_position())
@@ -247,11 +241,7 @@ func update_inspector(current_inspected):
%ActionText.text = item.name
else:
%Action.visible = false
elif current_selected_item and current_selected_item.use_text() != "" and current_selected_item.get_action_is_hold():
%Action.visible = true
%ActionText.text = current_selected_item.use_text()
%Action.modulate = DEFAULT_ACTION_COLOR
elif can_interact and inspected and inspected is Interactable:
elif can_interact and inspected and inspected is Interactable and (not current_selected_item or not current_selected_item.deactivate_interactable()):
%Action.visible = true
%ActionText.text = inspected.interact_text()
%Action.modulate = DEFAULT_ACTION_COLOR if inspected.interaction_cost(player) == 0 else ENERGY_ACTION_COLOR
@@ -269,6 +259,22 @@ func update_inspector(current_inspected):
else:
%Action.visible = false
func update_cursor():
var cursor := default_cursor
var hotspot : = Vector2(0.,0.)
if not Pause.pause and player and not action_disabled:
if current_selected_item and current_selected_item.get_pointer():
cursor = current_selected_item.get_pointer()
if Input.is_action_pressed("action") and current_selected_item.get_clicked_pointer():
cursor = current_selected_item.get_clicked_pointer()
if current_selected_item.is_pointer_center():
hotspot = Vector2(cursor.get_width()/2., cursor.get_height()/2.)
elif can_interact:
cursor = action_cursor
Input.set_custom_mouse_cursor(cursor,0,hotspot)
func stop_inspect(node: Node):
if not dragging_inspected:
all_inspected.erase(node)