Add celestial callbacks to UniverseClient scripts

This commit is contained in:
Kae 2023-07-20 17:53:57 +10:00
parent 5f86e0f027
commit d0307e7aa7
2 changed files with 4 additions and 1 deletions

View File

@ -207,7 +207,7 @@ bool CelestialMasterDatabase::coordinateValid(CelestialCoordinate const& coordin
Maybe<CelestialCoordinate> CelestialMasterDatabase::findRandomWorld(unsigned tries, unsigned trySpatialRange,
function<bool(CelestialCoordinate)> filter, Maybe<uint64_t> seed) {
//RecursiveMutexLocker locker(m_mutex);
// We don't need this mutex, the other calls are locking anyway.
// We don't need this lock, the other calls are locking anyway.
// Having this here is just stopping other threads from having a go in here until we've found a world.
RandomSource randSource;
if (seed)

View File

@ -22,6 +22,7 @@
#include "StarQuestManager.hpp"
#include "StarPlayerUniverseMap.hpp"
#include "StarWorldTemplate.hpp"
#include "StarCelestialLuaBindings.hpp"
namespace Star {
@ -449,6 +450,8 @@ void UniverseClient::setLuaCallbacks(String const& groupName, LuaCallbacks const
}
void UniverseClient::startLua() {
setLuaCallbacks("celestial", LuaBindings::makeCelestialCallbacks(this));
auto assets = Root::singleton().assets();
for (auto& p : assets->json("/client.config:universeScriptContexts").toObject()) {
auto scriptComponent = make_shared<ScriptComponent>();