fixed overlays
This commit is contained in:
parent
b20121cba4
commit
eaafc94d0a
4 changed files with 9 additions and 8 deletions
|
|
@ -107,10 +107,10 @@ func setup_persistent_effect(game_state):
|
|||
func on_turn_changed():
|
||||
# print("TURN CHANGED ==================", attached_piece, " | ", remaining_turns, )
|
||||
|
||||
if attached_piece.stored_game_state.isPlayerTurn() and attached_piece and remaining_turns > 0:
|
||||
if stored_game_state.isPlayerTurn() and attached_piece and remaining_turns > 0:
|
||||
var piece = attached_piece
|
||||
var flow = stored_board_flow
|
||||
var state = attached_piece.stored_game_state
|
||||
var state = stored_game_state
|
||||
|
||||
# print("Debug values:")
|
||||
# print("- Piece: ", piece, " is null? ", piece == null)
|
||||
|
|
@ -123,7 +123,7 @@ func on_turn_changed():
|
|||
|
||||
func remove_effect():
|
||||
if attached_piece:
|
||||
var game_state = attached_piece.stored_game_state
|
||||
var game_state = stored_game_state
|
||||
if game_state.is_connected("turn_changed", on_turn_changed):
|
||||
game_state.disconnect("turn_changed", on_turn_changed)
|
||||
super.remove_effect()
|
||||
|
|
|
|||
|
|
@ -107,10 +107,10 @@ func setup_persistent_effect(game_state):
|
|||
|
||||
func on_turn_changed():
|
||||
|
||||
if attached_piece.stored_game_state.isPlayerTurn() and attached_piece and remaining_turns > 0:
|
||||
if stored_game_state.isPlayerTurn() and attached_piece and remaining_turns > 0:
|
||||
var piece = attached_piece
|
||||
var flow = attached_piece.stored_board_flow
|
||||
var state = attached_piece.stored_game_state
|
||||
var flow = stored_board_flow
|
||||
var state = stored_game_state
|
||||
|
||||
# print("Debug values:")
|
||||
# print("- Piece: ", piece, " is null? ", piece == null)
|
||||
|
|
@ -123,7 +123,7 @@ func on_turn_changed():
|
|||
|
||||
func remove_effect():
|
||||
if attached_piece:
|
||||
var game_state = attached_piece.stored_game_state
|
||||
var game_state = stored_game_state
|
||||
if game_state.is_connected("turn_changed", Callable(self, "on_turn_changed")):
|
||||
game_state.disconnect("turn_changed", Callable(self, "on_turn_changed"))
|
||||
super.remove_effect()
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ func add_overlay(overlay: Node) -> void:
|
|||
|
||||
func remove_overlay(overlay_name: String) -> void:
|
||||
for overlay in overlay_nodes:
|
||||
if overlay.name == overlay_name:
|
||||
if overlay != null and overlay.name == overlay_name:
|
||||
remove_child(overlay)
|
||||
overlay_nodes.erase(overlay)
|
||||
overlay.queue_free()
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ func apply_effect(piece: Pawn = null) -> void:
|
|||
|
||||
var container = piece.get_parent() as PieceContainer
|
||||
if container:
|
||||
|
||||
game.updatePoints(piece)
|
||||
container.remove_piece()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue