full multiplayer plus new models

This commit is contained in:
2023-11-19 18:47:52 +11:00
parent 422c163dcd
commit edbb3261c6
126 changed files with 2343 additions and 492 deletions

View File

@@ -26,7 +26,7 @@ func point_is_build_location(point_id):
return !non_build_locations.has(point_id)
func test_path_if_point_toggled(point_id):
func test_path_if_point_toggled(point_id) -> bool:
if astar.is_point_disabled(point_id):
astar.set_point_disabled(point_id, false)
else:
@@ -60,6 +60,29 @@ func networked_spawn_wall(pos : Vector3, name_id : int):
tower_path.add_child(base)
func build_random_maze(block_limit):
var untested_point_ids = []
for index in (grid_size.x * grid_size.y):
untested_point_ids.append(index)
if block_limit <= 0 or block_limit > untested_point_ids.size():
block_limit = untested_point_ids.size()
for index in block_limit:
var random_point = untested_point_ids.pick_random()
untested_point_ids.erase(random_point)
if test_path_if_point_toggled(random_point):
networked_toggle_point.rpc(random_point)
func place_random_towers(tower_limit):
var untowered_bases = tower_bases.duplicate()
if tower_limit <= 0 or tower_limit > untowered_bases.size():
tower_limit = untowered_bases.size()
for index in tower_limit:
var random_base = untowered_bases.pick_random() as TowerBase
untowered_bases.erase(random_base)
random_base.add_card(Data.cards.pick_random())
func find_path() -> bool:
var path = astar.get_point_path(astar.get_point_count() - 2, astar.get_point_count() - 1)
if !path.is_empty():