drag from inventory + fixed some warnings + tractor beam effect on top of rocks
This commit is contained in:
@@ -149,10 +149,10 @@ func process_player_actions(delta: float):
|
||||
%ActionProgressBar.value = 0.
|
||||
|
||||
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.deactivate_interactable():
|
||||
if 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 inspected is InventoryGuiItemMouseDetector:
|
||||
GameInfo.game_data.player_data.inventory.set_current_item(inspected.index)
|
||||
elif can_interact:
|
||||
var interactable = inspected as Interactable
|
||||
player.try_interact(interactable)
|
||||
@@ -261,7 +261,7 @@ func update_inspector(current_inspected):
|
||||
|
||||
func update_cursor():
|
||||
var cursor := default_cursor
|
||||
var hotspot : = Vector2(0.,0.)
|
||||
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()
|
||||
@@ -270,10 +270,10 @@ func update_cursor():
|
||||
cursor = current_selected_item.get_clicked_pointer()
|
||||
|
||||
if current_selected_item.is_pointer_center():
|
||||
hotspot = Vector2(cursor.get_width()/2., cursor.get_height()/2.)
|
||||
hotspot = Vector2(cursor.get_width() / 2., cursor.get_height() / 2.)
|
||||
elif can_interact:
|
||||
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):
|
||||
if not dragging_inspected:
|
||||
@@ -294,6 +294,9 @@ func start_dragging():
|
||||
inspected_inventory_slot = inspected
|
||||
inspected = dropped_item_object
|
||||
player.region.save()
|
||||
else:
|
||||
dragging_inspected = false
|
||||
GameInfo.game_data.player_data.inventory.set_current_item(inspected.index)
|
||||
else:
|
||||
dragging_inspected = false
|
||||
if dragging_inspected:
|
||||
@@ -306,10 +309,10 @@ func stop_dragging():
|
||||
dragging_inspected = false
|
||||
if inspected is ItemObject:
|
||||
inspected.object_sprite.tractor_beam.emitting = false
|
||||
if (
|
||||
inspected_inventory_slot is InventoryGuiItemMouseDetector
|
||||
and GameInfo.game_data.player_data.inventory.add_item_at(inspected.item, inspected_inventory_slot.index)
|
||||
):
|
||||
all_inspected.clear()
|
||||
inspected.queue_free()
|
||||
inspected = null
|
||||
if inspected_inventory_slot is InventoryGuiItemMouseDetector:
|
||||
if GameInfo.game_data.player_data.inventory.add_item_at(inspected.item, inspected_inventory_slot.index):
|
||||
all_inspected.clear()
|
||||
inspected.queue_free()
|
||||
inspect(inspected_inventory_slot)
|
||||
else:
|
||||
stop_inspect(inspected)
|
||||
|
||||
Reference in New Issue
Block a user