diff options
Diffstat (limited to 'client/player/player.gd')
-rw-r--r-- | client/player/player.gd | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/client/player/player.gd b/client/player/player.gd index 223d2c88..39b9fb3e 100644 --- a/client/player/player.gd +++ b/client/player/player.gd @@ -50,6 +50,7 @@ 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_LEFT: Vector3 = Vector3(.3, .425, .4) const DEFAULT_HAND_BASE_POSITION_RIGHT: Vector3 = Vector3(-.3, .425, .4) @@ -100,42 +101,42 @@ func update_username_tag(state): tag.text = username tag.visible = state -func set_item(i: Item, h): - if hand[G.hand_to_index(h)] != null: hand[G.hand_to_index(h)].remove() +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.) character.holding = i != null - hand[G.hand_to_index(h)] = i - if hand[G.hand_to_index(h)] != null: hand[G.hand_to_index(h)].owned_by = hand_base[G.hand_to_index(h)] + hand[h] = i + if hand[h] != null: hand[h].owned_by = hand_base[h] -func remove_item(h): - var i = hand[G.hand_to_index(h)] +func remove_item(h: int): + var i = hand[h] if i == null: push_error("holding nothing") - hand[G.hand_to_index(h)] = null + hand[h] = null character.holding = false return i -func progress(position__: float, speed: float, warn: bool, h): - if hand[G.hand_to_index(h)] != null: hand[G.hand_to_index(h)].progress(position__, speed, warn) +func progress(position__: float, speed: float, warn: bool, h: int): + if hand[h] != null: hand[h].progress(position__, speed, warn) -func finish(h): - if hand[G.hand_to_index(h)] != null: hand[G.hand_to_index(h)].finish() +func finish(h: int): + if hand[h] != null: hand[h].finish() -func take_item(tile: Tile, h): - if hand[G.hand_to_index(h)] != null: push_error("already holding an item") +func take_item(tile: Tile, h: int): + if hand[h] != null: push_error("already holding an item") var i = tile.take_item() i.take() set_item(i, h) -func put_item(tile: Tile, h): +func put_item(tile: Tile, h: int): var i = remove_item(h) i.put() tile.put_item(i) -func pass_to(player: Player, hfrom, hto): +func pass_to(player: Player, hfrom: int, hto: int): var i = remove_item(hfrom) i.player_owned_timer = 0 if player.hand != null: |