Skip to content

Commit

Permalink
fix buildable area
Browse files Browse the repository at this point in the history
  • Loading branch information
Kvel2D committed Feb 8, 2025
1 parent cef46e0 commit e3b4070
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/map/map.gd
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,23 @@ func pos_is_on_ground(pos: Vector2) -> bool:
return tile_exists


# NOTE: if "allow_shared_build_space" option is enabled,
# then need to make all local team's players buildable areas
# visible.
func _set_buildable_area_visible(value: bool):
var local_player: Player = PlayerManager.get_local_player()
var buildable_area: BuildableArea = _get_buildable_area(local_player)

buildable_area.visible = value
var local_team: Team = local_player.get_team()
var allow_shared_build_space: bool = local_team.get_allow_shared_build_space()

var player_list: Array[Player] = []
if allow_shared_build_space:
player_list = local_team.get_players()
else:
player_list.append(local_player)

for the_player in player_list:
var buildable_area: BuildableArea = _get_buildable_area(the_player)
buildable_area.visible = value


#########################
Expand Down

0 comments on commit e3b4070

Please sign in to comment.