added webrtc, pre-4.3 update to fix cyclic dependency
This commit is contained in:
parent
26fec25a6e
commit
e8cd148bc7
45 changed files with 1498 additions and 43 deletions
|
|
@ -115,15 +115,15 @@ func get_empty_neighbours(coords: Vector4i) -> Array[Vector4i]:
|
|||
|
||||
func get_highest_in_stack(coords: Vector4i) -> Vector4i:
|
||||
if not used_cells.has(coords):
|
||||
print("ground")
|
||||
#print("ground")
|
||||
return coords
|
||||
|
||||
var top: InsectTile = used_cells[coords]
|
||||
while top.hat != null:
|
||||
top = top.hat
|
||||
|
||||
print("found top")
|
||||
print(top.coordinates)
|
||||
#print("found top")
|
||||
#print(top.coordinates)
|
||||
return top.coordinates
|
||||
|
||||
func get_neighbours(coords: Vector4i, ground_layer: bool = false) -> Array[Vector4i]:
|
||||
|
|
@ -178,7 +178,7 @@ func get_placeable_positions(button: InsectButton) -> Array[Vector4i]:
|
|||
if not used_cells.has(neighbour):
|
||||
continue
|
||||
|
||||
if used_cells[neighbour].is_black != button.is_black:
|
||||
if used_cells[get_highest_in_stack(neighbour)].is_black != button.is_black:
|
||||
eligible = false
|
||||
break
|
||||
|
||||
|
|
@ -229,7 +229,7 @@ func can_reach(start: Vector4i, target: Vector4i, exclude: Array[Vector4i] = [])
|
|||
var right_coord = Vector4i(right.x + start.x, right.y + start.y, right.z + start.z, start.w)
|
||||
|
||||
if left_coord in exclude or right_coord in exclude:
|
||||
print("excluded?")
|
||||
#print("excluded?")
|
||||
return true
|
||||
|
||||
|
||||
|
|
@ -336,7 +336,7 @@ func _on_insect_placed(resource: TileResource, is_black: bool, pos: Vector4i) ->
|
|||
tile_copy.resource = resource
|
||||
tile_copy.is_black = is_black
|
||||
tile_copy.coordinates = pos
|
||||
print(pos)
|
||||
#print(pos)
|
||||
tile_copy.map_reference = self
|
||||
var target_pos = Vector3(hex_pos.x, 0.0, hex_pos.y)
|
||||
|
||||
|
|
@ -356,7 +356,7 @@ func _on_insect_tile_selected(tile: InsectTile) -> void:
|
|||
return
|
||||
|
||||
if tile.resource.movement_behaviour == null:
|
||||
print("no movement behaviour")
|
||||
#print("no movement behaviour")
|
||||
return
|
||||
|
||||
#if tile.resource.action_behaviour != null:
|
||||
|
|
@ -396,7 +396,7 @@ func _on_insect_tile_selected(tile: InsectTile) -> void:
|
|||
while temp_tile.hat != null:
|
||||
layer += 1
|
||||
temp_tile = temp_tile.hat
|
||||
print(layer)
|
||||
#print(layer)
|
||||
|
||||
space.w = layer
|
||||
|
||||
|
|
@ -464,17 +464,21 @@ func is_position_on_hive(pos: Vector4i) -> bool:
|
|||
|
||||
func can_hive_exist_without_tile(tile: InsectTile) -> bool:
|
||||
if tile.coordinates.w != 0:
|
||||
print("w")
|
||||
return true
|
||||
|
||||
# TODO: BFS-Search from random cell to see if all other cells could still be reached when this
|
||||
# tile would be empty space
|
||||
if get_empty_neighbours(tile.coordinates).size() == 5: # we only have one real neighbour, so can't break anything
|
||||
print("neighbours")
|
||||
return true
|
||||
|
||||
# DO BFS
|
||||
var tiles_reached: Array = []
|
||||
var tiles_available: Array = used_cells.keys().filter(func(coords): return coords != tile.coordinates).filter(func(coords): return coords.w == 0)
|
||||
|
||||
#print(tiles_available)
|
||||
|
||||
if tiles_available.size() <= 1:
|
||||
# If we only have 1 or 2 total tiles, we can always move
|
||||
# 1 tile should never happen
|
||||
|
|
@ -496,7 +500,7 @@ func can_hive_exist_without_tile(tile: InsectTile) -> bool:
|
|||
tiles_reached.push_back(neighbour)
|
||||
queue.push_back(neighbour)
|
||||
|
||||
return tiles_reached.size() == used_cells.size() - 1
|
||||
return tiles_reached.size() == tiles_available.size()
|
||||
|
||||
func _ready() -> void:
|
||||
GameEvents.insect_selected.connect(_on_insect_selected)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue