2023-06-13 21:36:01 +02:00
|
|
|
class_name GetRandomDestinationAction
|
2023-06-12 16:48:35 +02:00
|
|
|
extends ActionLeaf
|
|
|
|
|
2023-06-12 18:50:58 +02:00
|
|
|
func tick(actor: Node, blackboard: Blackboard):
|
2023-06-12 16:48:35 +02:00
|
|
|
var rand_cell: Vector2i = actor.tile_map.get_random_top_cell()
|
2023-06-18 20:30:25 +02:00
|
|
|
actor.tile_map.reset_and_set_destination_cell(rand_cell)
|
2023-06-12 16:48:35 +02:00
|
|
|
|
2023-06-12 18:50:58 +02:00
|
|
|
var destination = actor.tile_map.map_to_local(rand_cell)
|
|
|
|
destination.y += actor.Y_SPAWN_OFFSET
|
|
|
|
|
|
|
|
blackboard.set_value("destination", destination)
|
2023-06-12 16:48:35 +02:00
|
|
|
|
|
|
|
return SUCCESS
|