résolution du bug de swap d'item #94
This commit is contained in:
@@ -24,7 +24,7 @@ func _ready():
|
||||
object_sprite.apply_texture_to_sprite(item.icon, ITEM_SPRITE_SIZE)
|
||||
object_sprite.generate_particles(item.get_particles())
|
||||
|
||||
func pointer_text():
|
||||
func pointer_text() -> String:
|
||||
var name_suffix = ""
|
||||
|
||||
if item is Seed:
|
||||
@@ -41,12 +41,9 @@ func inspector_info() -> Inspector.Info:
|
||||
return item.inspector_info()
|
||||
|
||||
func interact(player : Player) -> bool:
|
||||
var swapped_item = player.pick_item(item)
|
||||
player.pick_item(item)
|
||||
|
||||
if swapped_item:
|
||||
item = swapped_item
|
||||
else :
|
||||
pickup_animation(player)
|
||||
pickup_animation(player)
|
||||
|
||||
return true
|
||||
|
||||
|
||||
@@ -127,6 +127,9 @@ func try_move(move_to : Vector2):
|
||||
|
||||
func pick_item(item : Item) -> Item:
|
||||
play_sfx("pick")
|
||||
if inventory.is_full():
|
||||
drop_item()
|
||||
|
||||
var available_slot_ind = inventory.get_best_available_slot_ind()
|
||||
if available_slot_ind == inventory.current_item_ind && inventory.items[available_slot_ind] != null:
|
||||
var current_item : Item = inventory.get_item()
|
||||
|
||||
Reference in New Issue
Block a user