summaryrefslogtreecommitdiff
path: root/client/player
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-09-16 13:40:31 +0200
committermetamuffin <metamuffin@disroot.org>2024-09-16 13:42:21 +0200
commitfa199ee0a597ab7b94e866f2f160c29c671b83f7 (patch)
tree5f2a8666befcda433d5137127c61213a4531fc7b /client/player
parent83a98dd32ca3f7955d12285e653b512c8818ccbc (diff)
downloadhurrycurry-fa199ee0a597ab7b94e866f2f160c29c671b83f7.tar
hurrycurry-fa199ee0a597ab7b94e866f2f160c29c671b83f7.tar.bz2
hurrycurry-fa199ee0a597ab7b94e866f2f160c29c671b83f7.tar.zst
add item animations on removal
Diffstat (limited to 'client/player')
-rw-r--r--client/player/player.gd23
1 files changed, 8 insertions, 15 deletions
diff --git a/client/player/player.gd b/client/player/player.gd
index f418337b..6af1dd0c 100644
--- a/client/player/player.gd
+++ b/client/player/player.gd
@@ -90,33 +90,26 @@ func update_username_tag(state):
tag.visible = state
func set_item(i: Item):
- i.owned_by = hand_base
- if hand != null:
- hand.queue_free()
- if i == null:
- push_error("tile is null")
+ if hand != null: hand.remove()
+ character.holding = i != null
hand = i
- character.holding = true
+ if hand != null: hand.owned_by = hand_base
-func remove_item() -> Item:
+func remove_item():
var i = hand
- if i == null:
- push_error("holding nothing")
+ if i == null: push_error("holding nothing")
hand = null
character.holding = false
return i
func progress(position__: float, speed: float, warn: bool):
- if hand != null:
- hand.progress(position__, speed, warn)
+ if hand != null: hand.progress(position__, speed, warn)
func finish():
- if hand != null:
- hand.finish()
+ if hand != null: hand.finish()
func take_item(tile: Tile):
- if hand != null:
- push_error("already holding an item")
+ if hand != null: push_error("already holding an item")
var i = tile.take_item()
i.take()
set_item(i)