2024-03-14 22:13:33 +01:00
|
|
|
extends ActionBehaviour
|
|
|
|
|
class_name ActionBehaviourMosquito
|
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
|
|
|
|
|
|
2024-03-15 03:24:32 +01:00
|
|
|
# GameEvents.insect_tiles_selected_for_action
|
2024-03-29 02:51:06 +01:00
|
|
|
func get_targets(source_pos: Vector4i, map: HexGrid) -> Array[InsectTile]:
|
|
|
|
|
# if on the hive, i.e. layer > 0, we always move like a beetle
|
|
|
|
|
# so we can't use our action unless we're on layer 0
|
|
|
|
|
# TODO: Update movement selection
|
|
|
|
|
if source_pos.w > 0:
|
|
|
|
|
map.debug_label(Vector3(source_pos.x, source_pos.y, source_pos.z), "TODO: Implement Beetle Movement")
|
|
|
|
|
return []
|
|
|
|
|
|
2024-03-15 03:24:32 +01:00
|
|
|
var neighbours = map.get_neighbours(source_pos)
|
|
|
|
|
# Filter out other mosquitos
|
|
|
|
|
var possible_action_targets: Array[InsectTile] = []
|
|
|
|
|
for neighbour in neighbours:
|
|
|
|
|
var tile = map.get_tile(neighbour)
|
|
|
|
|
if tile != null:
|
|
|
|
|
# TODO: Find better way to see what tile we have...
|
2024-03-29 02:51:06 +01:00
|
|
|
if not tile.resource.movement_behaviour is MovementBehaviourMosquito:
|
|
|
|
|
possible_action_targets.push_back(tile)
|
2024-03-15 03:24:32 +01:00
|
|
|
|
2024-03-29 02:51:06 +01:00
|
|
|
#GameEvents.insect_tiles_selected_for_action.emit(source_pos, possible_action_targets)
|
|
|
|
|
|
|
|
|
|
return possible_action_targets
|