diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2025-06-03 09:31:18 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-06-03 09:31:18 +1000 |
commit | d575ca382bc9803f4d8711a11043897449cf3146 (patch) | |
tree | a7895951f4687093952f7a30f0bbdc92818947a9 /source/game/scripting/StarPlayerLuaBindings.cpp | |
parent | 4048e211c50af86dc278f13b1b2eb2a9ec00b7bf (diff) | |
parent | 844f76fd55eaa932b6654218d46d0dffdc6db413 (diff) |
Merge pull request #257 from Emmaker/main
Add codex binds to player table [skip ci]
Diffstat (limited to 'source/game/scripting/StarPlayerLuaBindings.cpp')
-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..ff0b877 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, Maybe<bool> markRead) { + player->codexes()->learnCodex(codexId, markRead.value(false)); + }); + + callbacks.registerCallback("getCodexes", [player]() -> Json { + return player->codexes()->toJson(); + }); + return callbacks; } |