diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-07-04 19:27:16 +1000 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-07-04 19:27:16 +1000 |
commit | e3461e90531345650fe70ada38d875a68f87f416 (patch) | |
tree | 41b923b02ca8dbac1b075654052c972545aab16e /source/game/StarWorldClient.cpp | |
parent | ab72b03ad8679437ebf01ead65d9f0d3195e6bae (diff) |
Start of Interface callbacks, starting with a bindCanvas function for the whole screen
Diffstat (limited to 'source/game/StarWorldClient.cpp')
-rw-r--r-- | source/game/StarWorldClient.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/source/game/StarWorldClient.cpp b/source/game/StarWorldClient.cpp index 552b6e2..f25c45b 100644 --- a/source/game/StarWorldClient.cpp +++ b/source/game/StarWorldClient.cpp @@ -45,6 +45,8 @@ WorldClient::WorldClient(PlayerPtr mainPlayer) { m_collisionDebug = false; m_inWorld = false; + m_luaRoot = make_shared<LuaRoot>(); + m_mainPlayer = mainPlayer; centerClientWindowOnPlayer(Vec2U(100, 100)); @@ -895,6 +897,10 @@ List<PacketPtr> WorldClient::getOutgoingPackets() { return std::move(m_outgoingPackets); } +void WorldClient::setLuaCallbacks(String const& groupName, LuaCallbacks const& callbacks) { + m_luaRoot->addCallbacks(groupName, callbacks); +} + void WorldClient::update() { if (!inWorld()) return; @@ -1486,7 +1492,7 @@ void WorldClient::initWorld(WorldStartPacket const& startPacket) { m_entityMap = make_shared<EntityMap>(m_worldTemplate->size(), entitySpace.first, entitySpace.second); m_tileArray = make_shared<ClientTileSectorArray>(m_worldTemplate->size()); m_damageManager = make_shared<DamageManager>(this, startPacket.clientId); - m_luaRoot = make_shared<LuaRoot>(); + m_luaRoot->restart(); m_luaRoot->tuneAutoGarbageCollection(m_clientConfig.getFloat("luaGcPause"), m_clientConfig.getFloat("luaGcStepMultiplier")); m_playerStart = startPacket.playerRespawn; m_respawnInWorld = startPacket.respawnInWorld; @@ -1559,7 +1565,8 @@ void WorldClient::clearWorld() { m_tileArray.reset(); m_damageManager.reset(); - m_luaRoot.reset(); + + m_luaRoot->shutdown(); m_particles.reset(); |