fix timetyper and dialog start by click on npc

This commit is contained in:
Vlad 2026-04-14 17:41:28 +06:00
parent 422ff1fbe3
commit db8b9b7a18
2 changed files with 16 additions and 7 deletions

View File

@ -32,7 +32,12 @@ end
function on_npc_interact(npc_index) function on_npc_interact(npc_index)
print("[Lua] NPC interaction! Index: " .. tostring(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 end
print("Lua script loaded successfully!") print("Lua script loaded successfully!")

View File

@ -219,14 +219,14 @@ namespace ZL
dialogueSystem.init(renderer, CONST_ZIP_FILE); dialogueSystem.init(renderer, CONST_ZIP_FILE);
dialogueSystem.loadDatabase("resources/dialogue/sample_dialogues.json"); dialogueSystem.loadDatabase("resources/dialogue/sample_dialogues.json");
dialogueSystem.addTriggerZone({ /*dialogueSystem.addTriggerZone({
"ghost_room_trigger", "ghost_room_trigger",
"test_line_dialogue", "test_line_dialogue",
Eigen::Vector3f(0.0f, 0.0f, -8.5f), Eigen::Vector3f(0.0f, 0.0f, -8.5f),
2.0f, 2.0f,
true, true,
false false
}); });*/
scriptEngine.init(this); scriptEngine.init(this);
@ -487,7 +487,11 @@ namespace ZL
lastTickCount = newTickCount; lastTickCount = newTickCount;
if (player) player->update(delta); //if (player) player->update(delta);
if (player) {
player->update(delta);
dialogueSystem.update(static_cast<int>(delta), player->position);
}
for (auto& npc : npcs) npc->update(delta); for (auto& npc : npcs) npc->update(delta);
// Check if player reached target interactive object // Check if player reached target interactive object
@ -518,9 +522,9 @@ namespace ZL
} }
//for (auto& npc : npcs) npc->update(delta); //for (auto& npc : npcs) npc->update(delta);
if (player) { //if (player) {
dialogueSystem.update(static_cast<int>(delta), player->position); // dialogueSystem.update(static_cast<int>(delta), player->position);
} //}
} }
} }
} }