diff options
author | grbr404 <166065505+grbr404@users.noreply.github.com> | 2025-05-09 17:57:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-05-09 17:57:28 +0200 |
commit | 682267e765f6d7c8314e31056e68c498819d524c (patch) | |
tree | 2e160bda754116278090542714d7978d9e588d97 /source/game/scripting | |
parent | 3fc211bcb8dcddd90d50b081553750573bddea7d (diff) | |
parent | 3a54621bd8a55b672ba986f02ab094bfb4ba6faf (diff) |
Merge branch 'OpenStarbound:main' into main
Diffstat (limited to 'source/game/scripting')
-rw-r--r-- | source/game/scripting/StarWorldLuaBindings.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/source/game/scripting/StarWorldLuaBindings.cpp b/source/game/scripting/StarWorldLuaBindings.cpp index b2c94a4..2d952ea 100644 --- a/source/game/scripting/StarWorldLuaBindings.cpp +++ b/source/game/scripting/StarWorldLuaBindings.cpp @@ -371,6 +371,12 @@ namespace LuaBindings { return playerIds; }); + callbacks.registerCallback("template", [clientWorld]() { + return clientWorld->currentTemplate()->store(); + }); + callbacks.registerCallback("setTemplate", [clientWorld](Json worldTemplate) { + clientWorld->setTemplate(worldTemplate); + }); } if (auto serverWorld = as<WorldServer>(world)) { @@ -455,6 +461,13 @@ namespace LuaBindings { }); return serverWorld->enqueuePlacement(std::move(distributions), id); }); + callbacks.registerCallback("template", [serverWorld]() { + return serverWorld->worldTemplate()->store(); + }); + callbacks.registerCallback("setTemplate", [serverWorld](Json worldTemplate) { + auto newTemplate = make_shared<WorldTemplate>(worldTemplate); + serverWorld->setTemplate(newTemplate); + }); } return callbacks; |