diff options
author | metamuffin <metamuffin@disroot.org> | 2024-12-25 19:58:35 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-12-25 19:58:35 +0100 |
commit | 64082ef5ca1bc6baeff23930d85e154e90b3c69f (patch) | |
tree | af290a98682ddee37a0076d11f31abe560abbcee /client | |
parent | bd74a4e0c0e4e42717c2931eab3febfae219ac9c (diff) | |
download | hurrycurry-64082ef5ca1bc6baeff23930d85e154e90b3c69f.tar hurrycurry-64082ef5ca1bc6baeff23930d85e154e90b3c69f.tar.bz2 hurrycurry-64082ef5ca1bc6baeff23930d85e154e90b3c69f.tar.zst |
map-specific two-handed mode
Diffstat (limited to 'client')
-rw-r--r-- | client/game.gd | 2 | ||||
-rw-r--r-- | client/player/player.gd | 37 |
2 files changed, 25 insertions, 14 deletions
diff --git a/client/game.gd b/client/game.gd index 9502d2fc..6c152d8a 100644 --- a/client/game.gd +++ b/client/game.gd @@ -53,6 +53,7 @@ var tile_collide: Array = [] var tile_interact: Array = [] var maps: Array = [] var bot_algos: Array +var hand_count = 0 var text_message_history: Array[TextMessage] = [] var join_state: JoinState = JoinState.SPECTATING @@ -95,6 +96,7 @@ func handle_packet(p): tile_interact = p["data"]["tile_interact"] maps = p["data"]["maps"] bot_algos = p["data"]["bot_algos"] + hand_count = p["data"]["hand_count"] tile_index_by_name.clear() for id in tile_names.size(): diff --git a/client/player/player.gd b/client/player/player.gd index 39b9fb3e..031cba29 100644 --- a/client/player/player.gd +++ b/client/player/player.gd @@ -42,15 +42,14 @@ var marker_target = Vector3(0, 0, 0) var clear_timer: Timer = Timer.new() var hand = [null, null] -var hand_base = [Node3D.new(), Node3D.new()] +var hand_base var character_idx: int var is_customer: bool var current_item_message = null var _anim_angle: float = 0.0 -var hand_base_position = [DEFAULT_HAND_BASE_POSITION_LEFT, DEFAULT_HAND_BASE_POSITION_RIGHT] -const DEFAULT_HAND_BASE_POSITION_BOTH: Vector3 = Vector3(0, .425, .4) +const DEFAULT_HAND_BASE_POSITION_CENTER: Vector3 = Vector3(0, .425, .4) const DEFAULT_HAND_BASE_POSITION_LEFT: Vector3 = Vector3(.3, .425, .4) const DEFAULT_HAND_BASE_POSITION_RIGHT: Vector3 = Vector3(-.3, .425, .4) @@ -64,12 +63,22 @@ func _init(_id: int, new_name: String, pos: Vector2, new_character_idx: int, new game = new_game username = new_name - hand_base[0].name = "HandBaseLeft" - hand_base[1].name = "HandBaseRight" - hand_base[0].position = hand_base_position[0] - hand_base[1].position = hand_base_position[1] - movement_base.add_child(hand_base[0]) - movement_base.add_child(hand_base[1]) + if game.hand_count == 1: + var center = Node3D.new() + center.name = "HandBaseCenter" + center.position = DEFAULT_HAND_BASE_POSITION_CENTER + hand_base = [center] + else: + var left = Node3D.new() + var right = Node3D.new() + left.name = "HandBaseLeft" + right.name = "HandBaseRight" + left.position = DEFAULT_HAND_BASE_POSITION_LEFT + right.position = DEFAULT_HAND_BASE_POSITION_RIGHT + hand_base = [left, right] + + for h in hand_base: + movement_base.add_child(h) movement_base.add_child(chat_bubble) movement_base.add_child(item_bubble) @@ -103,11 +112,11 @@ func update_username_tag(state): func set_item(i: Item, h: int): if hand[h] != null: hand[h].remove() - if i != null: - @warning_ignore("static_called_on_instance") - hand_base_position[0] = DEFAULT_HAND_BASE_POSITION_LEFT - Vector3(0.,i.height() * 0.5, 0.) - @warning_ignore("static_called_on_instance") - hand_base_position[1] = DEFAULT_HAND_BASE_POSITION_RIGHT - Vector3(0.,i.height() * 0.5, 0.) + # if i != null: + # @warning_ignore("static_called_on_instance") + # hand_base_position[h] = DEFAULT_HAND_BASE_POSITION_LEFT - Vector3(0.,i.height() * 0.5, 0.) + # @warning_ignore("static_called_on_instance") + # hand_base_position[1] = DEFAULT_HAND_BASE_POSITION_RIGHT - Vector3(0.,i.height() * 0.5, 0.) character.holding = i != null hand[h] = i if hand[h] != null: hand[h].owned_by = hand_base[h] |