drag from inventory + fixed some warnings + tractor beam effect on top of rocks

This commit is contained in:
Altaezio
2026-07-02 11:04:01 +02:00
parent 53e86be2ce
commit 45281057f2
3 changed files with 17 additions and 15 deletions

View File

@@ -207,7 +207,7 @@ func change_ambiances_volume(db_change := 0., fade := DEFAULT_FADE_TIME):
# Joue un # Joue un
# - player_name : Nom de la Node dans la scène Godot à jouer # - player_name : Nom de la Node dans la scène Godot à jouer
func play_sfx(sfx_name : String, pitch = 1.): func play_sfx(sfx_name : String, _pitch = 1.):
var player := %Sfx.find_child(sfx_name) as AudioStreamPlayer var player := %Sfx.find_child(sfx_name) as AudioStreamPlayer
if player: if player:
player.play() player.play()

View File

@@ -131,7 +131,6 @@ libraries/ = SubResource("AnimationLibrary_ng3e4")
autoplay = &"default" autoplay = &"default"
[node name="TractorBeam" type="CPUParticles2D" parent="." unique_id=382704689] [node name="TractorBeam" type="CPUParticles2D" parent="." unique_id=382704689]
z_index = -1
position = Vector2(83, 0) position = Vector2(83, 0)
scale = Vector2(0.7, 0.7) scale = Vector2(0.7, 0.7)
emitting = false emitting = false

View File

@@ -149,10 +149,10 @@ func process_player_actions(delta: float):
%ActionProgressBar.value = 0. %ActionProgressBar.value = 0.
if Input.is_action_just_pressed("action"): if Input.is_action_just_pressed("action"):
if inspected is InventoryGuiItemMouseDetector: if can_use_item and not current_selected_item.is_action_need_press_time() and current_selected_item.deactivate_interactable():
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.deactivate_interactable():
player.try_use_item(current_selected_item, player.get_global_mouse_position()) player.try_use_item(current_selected_item, player.get_global_mouse_position())
elif inspected is InventoryGuiItemMouseDetector:
GameInfo.game_data.player_data.inventory.set_current_item(inspected.index)
elif can_interact: elif can_interact:
var interactable = inspected as Interactable var interactable = inspected as Interactable
player.try_interact(interactable) player.try_interact(interactable)
@@ -273,7 +273,7 @@ func update_cursor():
hotspot = Vector2(cursor.get_width() / 2., cursor.get_height() / 2.) hotspot = Vector2(cursor.get_width() / 2., cursor.get_height() / 2.)
elif can_interact: elif can_interact:
cursor = action_cursor cursor = action_cursor
Input.set_custom_mouse_cursor(cursor,0,hotspot) Input.set_custom_mouse_cursor(cursor, Input.CURSOR_ARROW, hotspot)
func stop_inspect(node: Node): func stop_inspect(node: Node):
if not dragging_inspected: if not dragging_inspected:
@@ -296,6 +296,9 @@ func start_dragging():
player.region.save() player.region.save()
else: else:
dragging_inspected = false dragging_inspected = false
GameInfo.game_data.player_data.inventory.set_current_item(inspected.index)
else:
dragging_inspected = false
if dragging_inspected: if dragging_inspected:
all_inspected.clear() all_inspected.clear()
all_inspected.append(inspected) all_inspected.append(inspected)
@@ -306,10 +309,10 @@ func stop_dragging():
dragging_inspected = false dragging_inspected = false
if inspected is ItemObject: if inspected is ItemObject:
inspected.object_sprite.tractor_beam.emitting = false inspected.object_sprite.tractor_beam.emitting = false
if ( if inspected_inventory_slot is InventoryGuiItemMouseDetector:
inspected_inventory_slot is InventoryGuiItemMouseDetector if GameInfo.game_data.player_data.inventory.add_item_at(inspected.item, inspected_inventory_slot.index):
and GameInfo.game_data.player_data.inventory.add_item_at(inspected.item, inspected_inventory_slot.index)
):
all_inspected.clear() all_inspected.clear()
inspected.queue_free() inspected.queue_free()
inspected = null inspect(inspected_inventory_slot)
else:
stop_inspect(inspected)