2024-03-14 22:13:33 +01:00
|
|
|
extends ActionBehaviour
|
|
|
|
|
class_name ActionBehaviourPillbug
|
2024-03-15 03:24:32 +01:00
|
|
|
|
2024-03-29 02:51:06 +01:00
|
|
|
func do_action(source_tile: InsectTile, action_tile: InsectTile, map: HexGrid) -> void:
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
func get_targets(source_pos: Vector4i, map: HexGrid) -> Array[InsectTile]:
|
2024-03-15 03:24:32 +01:00
|
|
|
var neighbours = map.get_neighbours(source_pos)
|
|
|
|
|
var possible_action_targets: Array[InsectTile] = []
|
2024-03-29 02:51:06 +01:00
|
|
|
|
2024-03-15 03:24:32 +01:00
|
|
|
for neighbour in neighbours:
|
|
|
|
|
var tile = map.get_tile(neighbour)
|
|
|
|
|
if tile != null:
|
2024-03-29 02:51:06 +01:00
|
|
|
if not tile.is_in_stack() and tile.can_move():
|
|
|
|
|
possible_action_targets.push_back(tile)
|
|
|
|
|
|
|
|
|
|
#GameEvents.insect_tiles_selected_for_action.emit(source_pos, possible_action_targets)
|
2024-03-15 03:24:32 +01:00
|
|
|
|
2024-03-29 02:51:06 +01:00
|
|
|
return possible_action_targets
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 2nd level has to be clear (move through narrow gap rule)
|
|
|
|
|
# We could do the following: Get neighbours in 2nd level of source (pillbug) and target
|
|
|
|
|
# we we have two overlapping/same neighbours, we have a narrow gap and can't move the target
|