Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/game/scripting/StarWorldLuaBindings.cpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2025-05-07 04:49:52 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2025-05-07 04:49:52 +1000
commit3a54621bd8a55b672ba986f02ab094bfb4ba6faf (patch)
tree4cba881b3c8518b7be01fc8225a0877406aee16e /source/game/scripting/StarWorldLuaBindings.cpp
parent37fab128ceccfafac99d33e84c768e85aead6d60 (diff)
add world.template, world.setTemplate
Diffstat (limited to 'source/game/scripting/StarWorldLuaBindings.cpp')
-rw-r--r--source/game/scripting/StarWorldLuaBindings.cpp13
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;