From db8b9b7a1831e860a8c9679ce6c70408a8dd69e7 Mon Sep 17 00:00:00 2001 From: Vlad Date: Tue, 14 Apr 2026 17:41:28 +0600 Subject: [PATCH] fix timetyper and dialog start by click on npc --- resources/start.lua | 7 ++++++- src/Game.cpp | 16 ++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/resources/start.lua b/resources/start.lua index 6135227..168b3fe 100644 --- a/resources/start.lua +++ b/resources/start.lua @@ -32,7 +32,12 @@ end function on_npc_interact(npc_index) print("[Lua] NPC interaction! Index: " .. tostring(npc_index)) - game_api.receive_npc_gift(npc_index) + + if npc_index == 1 then + game_api.start_dialogue("test_line_dialogue") + else + game_api.receive_npc_gift(npc_index) + end end print("Lua script loaded successfully!") \ No newline at end of file diff --git a/src/Game.cpp b/src/Game.cpp index 3876585..c641866 100644 --- a/src/Game.cpp +++ b/src/Game.cpp @@ -219,14 +219,14 @@ namespace ZL dialogueSystem.init(renderer, CONST_ZIP_FILE); dialogueSystem.loadDatabase("resources/dialogue/sample_dialogues.json"); - dialogueSystem.addTriggerZone({ + /*dialogueSystem.addTriggerZone({ "ghost_room_trigger", "test_line_dialogue", Eigen::Vector3f(0.0f, 0.0f, -8.5f), 2.0f, true, false - }); + });*/ scriptEngine.init(this); @@ -487,7 +487,11 @@ namespace ZL lastTickCount = newTickCount; - if (player) player->update(delta); + //if (player) player->update(delta); + if (player) { + player->update(delta); + dialogueSystem.update(static_cast(delta), player->position); + } for (auto& npc : npcs) npc->update(delta); // Check if player reached target interactive object @@ -518,9 +522,9 @@ namespace ZL } //for (auto& npc : npcs) npc->update(delta); - if (player) { - dialogueSystem.update(static_cast(delta), player->position); - } + //if (player) { + // dialogueSystem.update(static_cast(delta), player->position); + //} } } }