Improved pathfinding logic

This commit is contained in:
Vladislav Khorev committed 2026-05-21 11:48:18 +03:00
1 parent 2659951d8e
commit 3a73f3fbde
36 files changed
+458337 -871

No files matched your search

+41 -5
View File
@@ -84,21 +84,35 @@ game_api.npc_walk_to(0, -4.57412, 0, 6.78495, on_teacher_arrived2)
end
function on_book_pickup()
print("on_book_pickup")
local day = game_api.getIntValue("day")
if (teacher_told_about_book) then
print("on_book_pickup step1")
if not player_hold_book then
if (night_time) or (day >=1) then
game_api.start_dialogue("book_dialog006")
else
game_api.pickup_item("book")
game_api.deactivate_interactive_object("Book001")
player_hold_book = true
game_api.start_dialogue("book_dialog003")
--game_api.set_trigger_zone_enabled(3, true)
end
else
game_api.remove_item("book")
game_api.activate_interactive_object("Book001")
player_hold_book = false
game_api.start_dialogue("book_dialog004")
--game_api.set_trigger_zone_enabled(3, false)
end
else
print("on_book_pickup step2")
game_api.start_dialogue("book_dialog005")
end
end
function on_bookshelf_clicked()
if not player_hold_book then
--[[if not player_hold_book then
game_api.pickup_item("book")
game_api.deactivate_interactive_object("Book001")
player_hold_book = true
@@ -108,7 +122,8 @@ function on_bookshelf_clicked()
game_api.activate_interactive_object("Book001")
player_hold_book = false
game_api.set_trigger_zone_enabled(3, false)
end
end]]
on_book_pickup()
end
@@ -353,11 +368,16 @@ print("Teacher arrived2")
end
function book_dialog_zone001_enter_callback()
print("book_dialog_zone001_enter_callback step 1")
if (game_api.is_darklands()) then
print("book_dialog_zone001_enter_callback step 2")
game_api.start_dialogue("ghost_dialog002")
game_api.set_trigger_zone_enabled(3, false)
else
if (night_time == false) then
print("book_dialog_zone001_enter_callback step 3")
if (player_hold_book) and (night_time == false) then
print("book_dialog_zone001_enter_callback step 4")
game_api.start_dialogue("book_dialog001")
game_api.switch_navigation(5)
end
@@ -365,7 +385,8 @@ function book_dialog_zone001_enter_callback()
end
function book_dialog_zone001_exit_callback()
if (night_time == false) then
print("book_dialog_zone001_exit_callback step 1")
if (player_hold_book) and (night_time == false) then
game_api.switch_navigation(3)
end
end
@@ -376,14 +397,27 @@ print("on_computer_clicked--")
if (day == 1) then
-- TODO: some dialog like I don't need it
print("on_computer_clicked--1")
game_api.start_dialogue("computer_dialog003")
else
if teacher_told_about_book then
print("on_computer_clicked--2")
if (night_time == false) then
print("on_computer_clicked--3")
if (player_hold_book) then
print("on_computer_clicked--4")
game_api.start_cutscene("test_cutscene_02")
else
print("on_computer_clicked--5")
game_api.start_dialogue("book_dialog002")
end
else
print("on_computer_clicked--6")
game_api.start_dialogue("computer_dialog002")
end
else
print("on_computer_clicked--7")
game_api.start_dialogue("computer_dialog001")
end
end
end
@@ -469,6 +503,8 @@ game_api.set_darklands_callbacks(
first_time_darklands = false
end
game_api.set_trigger_zone_enabled(1, false)
game_api.set_npc_enabled(0, false)
game_api.set_npc_enabled(1, false)