From adc2bb8f49ff90079c6d934c941ca1a30148a1f5 Mon Sep 17 00:00:00 2001 From: "@racascou" Date: Mon, 10 Oct 2022 11:31:12 -0300 Subject: [PATCH] prepare for 4.0 migration (start) --- prototype/controls/camera.gd | 2 +- prototype/controls/selection.gd | 2 +- prototype/game.gd | 4 ++-- prototype/map/maps.gd | 6 +++--- prototype/test/test.gd | 2 +- prototype/ui/minimap.gd | 2 +- prototype/unit/behavior/advance.gd | 20 ++++++++++---------- prototype/unit/behavior/attack.gd | 2 +- prototype/unit/behavior/follow.gd | 10 +++++----- prototype/unit/behavior/move.gd | 4 ++-- prototype/unit/behavior/spawn.gd | 8 ++++---- 11 files changed, 31 insertions(+), 31 deletions(-) diff --git a/prototype/controls/camera.gd b/prototype/controls/camera.gd index 87ed20ac..8a486fff 100644 --- a/prototype/controls/camera.gd +++ b/prototype/controls/camera.gd @@ -120,7 +120,7 @@ func _unhandled_input(event): -func start(): +func map_loaded(): offset = game.map.mid var h = offset.x limit_left = -h diff --git a/prototype/controls/selection.gd b/prototype/controls/selection.gd index 57854af2..1f1a9fc8 100644 --- a/prototype/controls/selection.gd +++ b/prototype/controls/selection.gd @@ -139,7 +139,7 @@ func advance(unit, point): func attack(unit, point): if unit.attacks and game.can_control(unit): var order_point = order(unit, point) - game.unit.attack.start(unit, order_point) + game.unit.attack.point(unit, order_point) func teleport(unit, point): if unit.moves and game.can_control(unit): diff --git a/prototype/game.gd b/prototype/game.gd index 0cd949fd..bf7d9362 100644 --- a/prototype/game.gd +++ b/prototype/game.gd @@ -66,7 +66,7 @@ func build(): ui.main_menu.get_node("container/play_button").play_down() -func start(): +func map_loaded(): if not started: started = true paused = false @@ -85,7 +85,7 @@ func start(): elif test.stress: test.spawn_random_units() else: - unit.spawn.start() + unit.spawn.pawns() ui.get_node("score_board").visible = false yield(get_tree().create_timer(4), "timeout") unit.spawn.leaders() diff --git a/prototype/map/maps.gd b/prototype/map/maps.gd index e9e178b4..3430b3c0 100644 --- a/prototype/map/maps.gd +++ b/prototype/map/maps.gd @@ -15,16 +15,16 @@ func load_map(map_name): game.map = game.maps.get_node(map_name) game.map.mid = Vector2(game.map.size/2, game.map.size/2) game.map.visible = true - game.ui.minimap.start() + game.ui.minimap.map_loaded() func map_loaded(): game.map.fog.visible = game.map.fog_of_war game.map.trees.occluder_light_mask = 2 game.map.walls.occluder_light_mask = 2 - game.camera.start() + game.camera.map_loaded() game.ui.buttons_update() - game.start() + game.map_loaded() func setup_leaders(): diff --git a/prototype/test/test.gd b/prototype/test/test.gd index 800de43d..3f5332a9 100644 --- a/prototype/test/test.gd +++ b/prototype/test/test.gd @@ -57,7 +57,7 @@ func unit_wait_end(unit1): if stress: var o = 2000 var d = Vector2(randf()*o,randf()*o) - if game.unit.moves: game.unit.advance.start(unit1, d) + if game.unit.moves: game.unit.advance.point(unit1, d) func respawn(unit1): diff --git a/prototype/ui/minimap.gd b/prototype/ui/minimap.gd index 477e7ab7..cbb6a1d2 100644 --- a/prototype/ui/minimap.gd +++ b/prototype/ui/minimap.gd @@ -57,7 +57,7 @@ func over_minimap(event): event.position.y > get_viewport().size.y - size ) -func start(): +func map_loaded(): map_sprite = game.map.get_node("zoom_out_sprite") map_tiles = game.map.get_node("tiles") game.ui.minimap.update_map_texture = true diff --git a/prototype/unit/behavior/advance.gd b/prototype/unit/behavior/advance.gd index c219e830..9ee05126 100644 --- a/prototype/unit/behavior/advance.gd +++ b/prototype/unit/behavior/advance.gd @@ -7,7 +7,7 @@ func _ready(): game = get_tree().get_current_scene() -func start(unit, objective, smart_move = false): # move_and_attack +func point(unit, objective, smart_move = false): # move_and_attack game.unit.attack.set_target(unit, null) if objective: unit.objective = objective if (unit.attacks and game.unit.move.in_bounds(unit.objective) and @@ -21,17 +21,17 @@ func start(unit, objective, smart_move = false): # move_and_attack var has_path = (unit.current_path.size() > 0) if not enemies: if not at_objective: move(unit, unit.objective, smart_move) - elif has_path: game.unit.follow.start(unit, unit.current_path, "advance") + elif has_path: game.unit.follow.path(unit, unit.current_path, "advance") else: var target = game.unit.orders.select_target(unit, enemies) if not target: if not at_objective: move(unit, unit.objective, smart_move) - elif has_path: game.unit.follow.start(unit, unit.current_path, "advance") + elif has_path: game.unit.follow.path(unit, unit.current_path, "advance") else: game.unit.attack.set_target(unit, target) var target_position = target.global_position + target.collision_position if game.unit.attack.in_range(unit, target): - game.unit.attack.start(unit, target_position) + game.unit.attack.point(unit, target_position) else: move(unit, target_position, smart_move) @@ -45,24 +45,24 @@ func move(unit, objective, smart_move): func on_collision(unit): if unit.behavior == "advance" and unit.collide_target == unit.target: var target_position = unit.target.global_position + unit.target.collision_position - game.unit.attack.start(unit, target_position) + game.unit.attack.point(unit, target_position) func resume(unit): if unit.behavior == "advance": - start(unit, null) + point(unit, null) func end(unit): if unit.behavior == "advance": if unit.current_destiny != unit.objective: - start(unit, null) + point(unit, null) else: stop(unit) func react(target, attacker): if target.behavior == "stop" or target.behavior == "advance": - start(target, attacker.global_position) + point(target, attacker.global_position) func ally_attacked(target, attacker): @@ -78,8 +78,8 @@ func stop(unit): func on_idle_end(unit): if unit.behavior == "advance" or unit.behavior == "stop": - if unit.attacks: start(unit, unit.global_position) + if unit.attacks: point(unit, unit.global_position) func smart(unit, objective): - start(unit, objective, true) + point(unit, objective, true) diff --git a/prototype/unit/behavior/attack.gd b/prototype/unit/behavior/attack.gd index ee5beab4..92ced19b 100644 --- a/prototype/unit/behavior/attack.gd +++ b/prototype/unit/behavior/attack.gd @@ -7,7 +7,7 @@ func _ready(): game = get_tree().get_current_scene() -func start(unit, point): +func point(unit, point): if unit.attacks and not unit.stunned and game.unit.move.in_bounds(point): if unit.ranged and unit.weapon: unit.weapon.look_at(point) diff --git a/prototype/unit/behavior/follow.gd b/prototype/unit/behavior/follow.gd index 8de8d27c..22090467 100644 --- a/prototype/unit/behavior/follow.gd +++ b/prototype/unit/behavior/follow.gd @@ -69,15 +69,15 @@ func in_limits(p): return ((p.x > 0 and p.y > 0) and (p.x < path_grid.width and p.y < path_grid.height)) -func start(unit, path, cb): +func path(unit, path, cb): if path and path.size(): var next_point = path.pop_front() unit.current_path = path - game.unit[cb].start(unit, next_point) + game.unit[cb].point(unit, next_point) func next(unit): - start(unit, unit.current_path, unit.behavior) + path(unit, unit.current_path, unit.behavior) func draw_path(unit): @@ -111,7 +111,7 @@ func lane(unit): var path = game.map.lanes_paths[lane].duplicate() if unit.team == "red": path.invert() if unit.type != 'leader': - start(unit, path, "advance") + path(unit, path, "advance") else: smart(unit, path, "advance") @@ -121,7 +121,7 @@ func smart(unit, path, cb): var new_path = unit.cut_path(path) var next_point = new_path.pop_front() unit.current_path = new_path - game.unit[cb].start(unit, next_point) + game.unit[cb].point(unit, next_point) diff --git a/prototype/unit/behavior/move.gd b/prototype/unit/behavior/move.gd index 7de5d9b3..85940926 100644 --- a/prototype/unit/behavior/move.gd +++ b/prototype/unit/behavior/move.gd @@ -17,7 +17,7 @@ func setup_timer(unit): unit.add_child(unit.channeling_timer) -func start(unit, destiny): +func point(unit, destiny): if unit.moves and not unit.stunned and in_bounds(destiny): unit.set_behavior("move") move(unit, destiny) @@ -109,5 +109,5 @@ func stand(unit): func smart(unit, point, cb): if not unit.stunned: var path = game.unit.follow.find_path(unit.global_position, point) - if path: game.unit.follow.start(unit, path, cb) + if path: game.unit.follow.path(unit, path, cb) diff --git a/prototype/unit/behavior/spawn.gd b/prototype/unit/behavior/spawn.gd index 2b0db6b3..c0f6e63c 100644 --- a/prototype/unit/behavior/spawn.gd +++ b/prototype/unit/behavior/spawn.gd @@ -85,10 +85,10 @@ func leaders(): func send_leader(leader, path): yield(get_tree(), "idle_frame") - game.unit.follow.start(leader, path, "advance") + game.unit.follow.path(leader, path, "advance") -func start(): +func pawns(): spawn_group_cycle() @@ -133,7 +133,7 @@ func send_pawn(template, lane, team): var unit_template = self[template] pawn = game.maps.create(unit_template, lane, team, "point_random", path.start) game.unit.orders.set_pawn(pawn) - game.unit.follow.start(pawn, path.follow, "advance") + game.unit.follow.path(pawn, path.follow, "advance") @@ -185,4 +185,4 @@ func cemitery_add_leader(leader): var start = path.pop_front() leader = spawn_unit(leader, lane, team, "point_random", start) leader.reset_unit() - game.unit.follow.start(leader, path, "advance") + game.unit.follow.path(leader, path, "advance")