space-game001/src/ScriptEngine.h
2026-06-05 21:17:51 +03:00

59 lines
1.6 KiB
C++

#pragma once
#include <string>
#include <memory>
#include <unordered_map>
#include "quest/QuestJournal.h"
namespace ZL {
class Location;
class Inventory;
class ScriptEngine {
public:
ScriptEngine();
~ScriptEngine();
// Must be called once, after the Game's NPCs are ready.
void init(Location* game, Inventory* inventory, const std::string& scriptPath);
// Execute a Lua script file. Logs errors to stderr.
void runScript(const std::string& path);
void callItemPickupCallback(const std::string& objectName);
void callActivateFunction(const std::string& functionName);
void callNpcInteractCallback(int npcIndex);
void callTriggerEnterCallback(const std::string& zoneId);
void callTriggerExitCallback(const std::string& zoneId);
// Fired when the player (moving) physically bumps into a standing NPC.
void callNpcBumpedByPlayerCallback(int npcIndex);
// Fired when a moving NPC physically bumps into the standing player.
void callNpcBumpsPlayerCallback(int npcIndex);
void setGlobalStore(std::unordered_map<std::string, int>* store);
void setGlobalFloatStore(std::unordered_map<std::string, float>* store);
void setQuestJournal(Quest::QuestJournal* journal);
void callLocationEnterCallback();
void callLocationExitCallback();
void callDarklandsEnterCallback();
void callDarklandsExitCallback();
void callTriggerNightEnterCallback();
void callCutsceneCompleteCallback(const std::string& cutsceneId);
void callChatOpenCallback(int chatIndex);
private:
struct Impl;
std::unique_ptr<Impl> impl;
};
} // namespace ZL