Adjusted map, added key to set exploration goal

pull/5/head
Yan Wittmann 2025-01-14 11:35:16 +01:00
parent 28c9b857bd
commit a75eb4aa1d
10 changed files with 34 additions and 8 deletions

View File

@ -1 +1 @@
{"frames":[{"duration":0.1}],"height":320,"filename":"tilemaps.aseprite","layers":[{"name":"ground","cels":[{"frame":0,"image":"tilemaps/tilemap_ground.png"}]},{"name":"objects","cels":[{"frame":0,"image":"tilemaps/tilemap_objects.png"}]},{"name":"temperature","cels":[{"frame":0,"image":"tilemaps/tilemap_temperature.png"}]},{"name":"player","cels":[{"frame":0,"image":"tilemaps/tilemap_player.png"}]}],"width":320}
{"filename":"tilemaps.aseprite","width":320,"frames":[{"duration":0.1}],"layers":[{"cels":[{"frame":0,"image":"tilemaps\\tilemap_ground.png"}],"name":"ground"},{"cels":[{"frame":0,"image":"tilemaps\\tilemap_objects.png"}],"name":"objects"},{"cels":[{"frame":0,"image":"tilemaps\\tilemap_temperature.png"}],"name":"temperature"},{"cels":[{"frame":0,"image":"tilemaps\\tilemap_player.png"}],"name":"player"}],"height":320}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@ -35,6 +35,12 @@ texture = ExtResource("1_ukrsa")
4:0/0 = 0
4:0/0/custom_data_0 = true
4:0/0/custom_data_2 = 3
0:1/0 = 0
0:1/0/custom_data_0 = true
0:1/0/custom_data_2 = 8
0:2/0 = 0
0:2/0/custom_data_0 = true
0:2/0/custom_data_2 = 400
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_x77e4"]
texture = ExtResource("2_15xge")

File diff suppressed because one or more lines are too long

View File

@ -65,7 +65,14 @@ func _process(delta: float) -> void:
if Input.is_action_just_pressed("key_1"):
get_tree().reload_current_scene()
if Input.is_action_just_pressed("key_2"):
handle_result_game_state( {"game_state_win": true} )
var exploration_task: TaskPlannedExploration = player.behavior_tree.find_task_by_name("TaskPlannedExploration")
if exploration_task:
exploration_task.current_goal = world.tilemap_ground.local_to_cell(world.get_local_mouse_position())
player.behavior_tree.blackboard["cached_paths"] = {}
player.behavior_tree.blackboard["path"] = []
else:
print("[ERROR] TaskPlannedExploration not found")
push_error("TaskPlannedExploration not found")
if intro_image.is_visible():
intro_image.set_scale(calculate_scale(intro_image.texture.get_size()))

View File

@ -8,7 +8,7 @@ extends Node
@export var food_critical_threshold: int = 50
@export var food_base_threshold: int = 150
# temperature
@export var temperature_set_buff_value: int = 250
@export var temperature_set_buff_value: int = 150
@export var temperature_damage: int = 1
@export var temperature_endure: int = 50
# viewing

View File

@ -36,3 +36,6 @@ func game_tick() -> void:
behavior_tree.internal_run(blackboard)
if Task.print_behavior_tree_evaluation:
print(" ==> [active state=", blackboard["current_task"], "] [status=", behavior_tree.status, "] [blackboard=", blackboard, "]")
func find_task_by_name(name: String) -> Task:
return behavior_tree.find_task_by_name(name)

View File

@ -121,3 +121,13 @@ func find_closest_item(blackboard: Dictionary, item_types: Array[Vector2i], memo
result.status = SUCCESS
result.closest_item = closest_item
return result
func find_task_by_name(name: String) -> Task:
for c in get_children():
if c.name == name:
return c
if c.get_child_count() > 0:
var found: Task = c.find_task_by_name(name)
if found != null:
return found
return null

View File

@ -20,7 +20,7 @@ func run(blackboard: Dictionary) -> void:
var closest_part: Vector2i = result.closest_item
blackboard["closest_part"] = closest_part
var path: Array[Vector2i] = navigation.cached_path_allow_neighbors(blackboard, "path_to_boat_part", closest_part, player.view_distance)
var path: Array[Vector2i] = navigation.cached_path_allow_neighbors(blackboard, "path_to_boat_part", closest_part, player.view_distance * 1.5)
if path.size() > 0:
blackboard["path"] = path
status_reason = "Found path to closest boat part"