added multiplayer connection. TODO: Sync Inventory values. Disable moving of other color tiles
This commit is contained in:
parent
e8cd148bc7
commit
3de181134d
13 changed files with 360 additions and 67 deletions
|
|
@ -328,7 +328,10 @@ func _on_insect_placement_cancelled() -> void:
|
|||
for child in placement_visualizer.get_children():
|
||||
child.queue_free()
|
||||
|
||||
func _on_insect_placed(resource: TileResource, is_black: bool, pos: Vector4i) -> void:
|
||||
@rpc("any_peer", "call_local")
|
||||
func place_insect_tile(resource_path: String, is_black: bool, pos: Vector4i) -> void:
|
||||
var resource = load(resource_path)
|
||||
|
||||
var tile_copy = INSECT_TILE.instantiate()
|
||||
var hex_pos = cube_to_world_pos(pos)
|
||||
|
||||
|
|
@ -347,6 +350,12 @@ func _on_insect_placed(resource: TileResource, is_black: bool, pos: Vector4i) ->
|
|||
var tween = get_tree().create_tween()
|
||||
tween.tween_property(tile_copy, "position", target_pos, 1.0).set_ease(Tween.EASE_OUT).set_trans(Tween.TRANS_EXPO)
|
||||
|
||||
|
||||
|
||||
func _on_insect_placed(resource: TileResource, is_black: bool, pos: Vector4i) -> void:
|
||||
var resource_path = resource.resource_path
|
||||
place_insect_tile.rpc(resource_path, is_black, pos)
|
||||
|
||||
func can_move(tile: InsectTile) -> bool:
|
||||
return can_hive_exist_without_tile(tile)
|
||||
|
||||
|
|
@ -415,7 +424,10 @@ func _on_insect_tile_selected(tile: InsectTile) -> void:
|
|||
func get_tile(pos: Vector4i) -> InsectTile:
|
||||
return used_cells.get(pos)
|
||||
|
||||
func _on_insect_tile_moved(tile: InsectTile, target: Vector4i) -> void:
|
||||
@rpc("any_peer", "call_local")
|
||||
func move_insect_tile(tile_coords: Vector4i, target: Vector4i) -> void:
|
||||
var tile: InsectTile = used_cells[tile_coords]
|
||||
|
||||
# Remove from old stack
|
||||
if tile.coordinates.w > 0:
|
||||
var below: Vector4i = tile.coordinates + Vector4i(0, 0, 0, -1)
|
||||
|
|
@ -444,6 +456,9 @@ func _on_insect_tile_moved(tile: InsectTile, target: Vector4i) -> void:
|
|||
used_cells[below].hat = tile
|
||||
|
||||
# Add to new stack
|
||||
|
||||
func _on_insect_tile_moved(tile: InsectTile, target: Vector4i) -> void:
|
||||
move_insect_tile.rpc(tile.coordinates, target)
|
||||
|
||||
func get_same_neighbours(cell1: Vector4i, cell2: Vector4i) -> Array[Vector4i]:
|
||||
var neighbours1 = get_neighbours(cell1).filter(is_cell_not_empty)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue