update the files, prep for fixing obstacles
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 4.4 KiB |
+20
-3
@@ -23,6 +23,10 @@ var action_points: int = 2
|
||||
var target_rotation: float = 0.0
|
||||
var rotation_speed: float = 10.0
|
||||
|
||||
# Action
|
||||
var _is_processing_action = false
|
||||
var _is_highlighting = false
|
||||
|
||||
@export var movement_range: int = 1
|
||||
@export var use_diagonal_movement: bool = false:
|
||||
set(value):
|
||||
@@ -809,7 +813,12 @@ func highlight_cells_if_authorized(cells_to_highlight: Array):
|
||||
func highlight_movement_range():
|
||||
if not is_multiplayer_authority() or is_bot or is_in_group("Bots"):
|
||||
return
|
||||
|
||||
|
||||
# Prevent recursive highlighting
|
||||
if _is_highlighting:
|
||||
return
|
||||
_is_highlighting = true
|
||||
|
||||
clear_highlights()
|
||||
var cells_to_highlight = []
|
||||
|
||||
@@ -852,7 +861,9 @@ func highlight_movement_range():
|
||||
if can_reach_cell(test_pos, blocked_cells):
|
||||
cells_to_highlight.append(test_pos)
|
||||
|
||||
# At the end of the function:
|
||||
highlight_cells_if_authorized(cells_to_highlight)
|
||||
_is_highlighting = false
|
||||
|
||||
# Helper function to check if a cell can be reached given the blocked cells
|
||||
func can_reach_cell(target_pos: Vector2i, blocked_cells: Array) -> bool:
|
||||
@@ -1187,8 +1198,12 @@ func sync_playerboard(new_playerboard: Array):
|
||||
_after_action_completed()
|
||||
|
||||
func _after_action_completed():
|
||||
# Guard against recursive calls
|
||||
if _is_processing_action:
|
||||
return
|
||||
_is_processing_action = true
|
||||
|
||||
# Clear the highlights after placing the tiles. ( Quickfix for Clientside )
|
||||
# Clear the highlights after placing the tiles. (Quickfix for Clientside)
|
||||
clear_highlights()
|
||||
|
||||
if multiplayer.get_unique_id() == get_multiplayer_authority():
|
||||
@@ -1209,6 +1224,8 @@ func _after_action_completed():
|
||||
# Add sync for playerboard
|
||||
if is_multiplayer_authority():
|
||||
main.rpc("sync_playerboard", get_multiplayer_authority(), playerboard)
|
||||
|
||||
_is_processing_action = false
|
||||
|
||||
func consume_action_points(points: int):
|
||||
if not is_instance_valid(self) or not is_multiplayer_authority():
|
||||
@@ -1227,7 +1244,7 @@ func consume_action_points(points: int):
|
||||
|
||||
if action_points <= 0:
|
||||
if main.turn_based_mode:
|
||||
main.request_end_turn()
|
||||
main.request_next_turn()
|
||||
else:
|
||||
action_points = 2
|
||||
has_performed_action = false
|
||||
|
||||
Reference in New Issue
Block a user