Skip to content

Commit

Permalink
Fixed multiple cards being popped from stacks in wrong orientation.
Browse files Browse the repository at this point in the history
This was due to Room.transfer_stack_contents() not taking into
account the new stacks's rotation when adding the pieces to it.
  • Loading branch information
drwhut committed Apr 6, 2023
1 parent 75fea7b commit ab0b7e7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion game/Scripts/Game/3D/Room.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2096,11 +2096,15 @@ remotesync func transfer_stack_contents(stack1_name: String, stack2_name: String
var index = stack1.pop_index()
contents.push_back(stack1.remove_piece(index))

var stack_facing_up = stack1.transform.basis.y.y > 0.0
var add_to = Stack.STACK_TOP if stack_facing_up else Stack.STACK_BOTTOM

while not contents.empty():
var piece_meta = contents.pop_back()
var piece_entry = piece_meta["piece_entry"]
var piece_transform = piece_meta["transform"]
stack2.add_piece(piece_entry, piece_transform, Stack.STACK_TOP)
piece_transform.basis = stack1.transform.basis * piece_transform.basis
stack2.add_piece(piece_entry, piece_transform, add_to)

func _ready():
_srv_undo_state_creation_disable()
Expand Down

0 comments on commit ab0b7e7

Please sign in to comment.