aboutsummaryrefslogtreecommitdiff
path: root/client/scripts/player.gd
diff options
context:
space:
mode:
Diffstat (limited to 'client/scripts/player.gd')
-rw-r--r--client/scripts/player.gd21
1 files changed, 17 insertions, 4 deletions
diff --git a/client/scripts/player.gd b/client/scripts/player.gd
index 8f53b790..6e07c3aa 100644
--- a/client/scripts/player.gd
+++ b/client/scripts/player.gd
@@ -9,7 +9,9 @@ var position_ = Vector2(0, 0)
var mesh = preload("res://scenes/player.tscn").instantiate()
-func _init(id: int, new_name: String, pos: Vector2, _character: int, new_game: Game):
+var hand: Node3D = null
+
+func _init(id: int, new_name: String, pos: Vector2, _character: int):
add_child(mesh)
position_ = pos
name = new_name
@@ -19,6 +21,17 @@ func update_position(new_position: Vector2, new_rotation: float):
position_ = new_position
rotation.y = new_rotation
-func _process(delta):
- position.x = position_.x
- position.z = position_.y
+func take_item(tile: FullTile):
+ if hand != null:
+ push_error("already holding an item")
+ var i = tile.take_item()
+ if i == null:
+ push_error("tile is null")
+ hand = i
+
+func put_item(tile: FullTile):
+ var i = hand
+ if i == null:
+ push_error("holding nothing")
+ i = null
+ tile.put_item(hand)