diff options
-rwxr-xr-x | source/game/scripting/StarPlayerLuaBindings.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/source/game/scripting/StarPlayerLuaBindings.cpp b/source/game/scripting/StarPlayerLuaBindings.cpp index ea2bae5..0f8bdfc 100755 --- a/source/game/scripting/StarPlayerLuaBindings.cpp +++ b/source/game/scripting/StarPlayerLuaBindings.cpp @@ -13,6 +13,7 @@ #include "StarJsonExtra.hpp" #include "StarUniverseClient.hpp" #include "StarTeamClient.hpp" +#include "StarPlayerCodexes.hpp" namespace Star { @@ -743,6 +744,31 @@ LuaCallbacks LuaBindings::makePlayerCallbacks(Player* player) { player->log()->removeScannedObject(objectName); }); + // codex bindings + callbacks.registerCallback("isCodexKnown", [player](String const& codexId) -> bool { + return player->codexes()->codexKnown(codexId); + }); + + callbacks.registerCallback("isCodexRead", [player](String const& codexId) -> bool { + return player->codexes()->codexRead(codexId); + }); + + callbacks.registerCallback("markCodexRead", [player](String const& codexId) -> bool { + return player->codexes()->markCodexRead(codexId); + }); + + callbacks.registerCallback("markCodexUnread", [player](String const& codexId) -> bool { + return player->codexes()->markCodexUnread(codexId); + }); + + callbacks.registerCallback("learnCodex", [player](String const& codexId, bool markRead) { + player->codexes()->learnCodex(codexId, markRead); + }); + + callbacks.registerCallback("getCodexes", [player]() -> Json { + return player->codexes()->toJson(); + }); + return callbacks; } |