diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2024-04-02 13:39:34 +1100 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2024-04-02 13:39:34 +1100 |
commit | 662f12da9624435b1850b424817879f12b7a30b2 (patch) | |
tree | d43af674451d2247b91b2e3b9fa3f3e4b4181423 /source/game/scripting/StarWorldLuaBindings.cpp | |
parent | 40698751e79d119e1ae37ea605b320961d6b597a (diff) |
improvements to universe.sendPacket and world.sendPacket
adds necessary clientsMutex lock, and returns false if sending failed
Diffstat (limited to 'source/game/scripting/StarWorldLuaBindings.cpp')
-rw-r--r-- | source/game/scripting/StarWorldLuaBindings.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/source/game/scripting/StarWorldLuaBindings.cpp b/source/game/scripting/StarWorldLuaBindings.cpp index 8287903..13be5ee 100644 --- a/source/game/scripting/StarWorldLuaBindings.cpp +++ b/source/game/scripting/StarWorldLuaBindings.cpp @@ -390,7 +390,7 @@ namespace LuaBindings { callbacks.registerCallbackWithSignature<List<EntityId>>("players", bind(ServerWorldCallbacks::players, world)); callbacks.registerCallbackWithSignature<LuaString, LuaEngine&>("fidelity", bind(ServerWorldCallbacks::fidelity, world, _1)); callbacks.registerCallbackWithSignature<Maybe<LuaValue>, String, String, LuaVariadic<LuaValue>>("callScriptContext", bind(ServerWorldCallbacks::callScriptContext, world, _1, _2, _3)); - callbacks.registerCallbackWithSignature<void, ConnectionId, String, Json>("sendPacket", bind(ServerWorldCallbacks::sendPacket, serverWorld, _1, _2, _3)); + callbacks.registerCallbackWithSignature<bool, ConnectionId, String, Json>("sendPacket", bind(ServerWorldCallbacks::sendPacket, serverWorld, _1, _2, _3)); callbacks.registerCallbackWithSignature<double>("skyTime", [serverWorld]() { return serverWorld->sky()->epochTime(); @@ -1187,10 +1187,10 @@ namespace LuaBindings { return context->invoke(function, args); } - void ServerWorldCallbacks::sendPacket(WorldServer* world, ConnectionId clientId, String const& packetType, Json const& packetData) { + bool ServerWorldCallbacks::sendPacket(WorldServer* world, ConnectionId clientId, String const& packetType, Json const& packetData) { PacketType type = PacketTypeNames.getLeft(packetType); auto packet = createPacket(type, packetData); - world->sendPacket(clientId, packet); + return world->sendPacket(clientId, packet); } void WorldDebugCallbacks::debugPoint(Vec2F const& arg1, Color const& arg2) { |