diff options
author | ErodeesFleurs <3353309908@qq.com> | 2024-03-22 15:46:30 +0800 |
---|---|---|
committer | ErodeesFleurs <3353309908@qq.com> | 2024-03-22 15:46:30 +0800 |
commit | ec4787d78e3d329082b4887748b2bf92c290ddec (patch) | |
tree | cbbf1323c8909e6fa66030b4f3761ff7ff272303 | |
parent | 9b10964a3ea121c277c63d9bc370215753768df5 (diff) |
world.id() for server
-rw-r--r-- | source/game/scripting/StarWorldLuaBindings.cpp | 5 | ||||
-rw-r--r-- | source/game/scripting/StarWorldLuaBindings.hpp | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/source/game/scripting/StarWorldLuaBindings.cpp b/source/game/scripting/StarWorldLuaBindings.cpp index 7d74a98..cc91ec2 100644 --- a/source/game/scripting/StarWorldLuaBindings.cpp +++ b/source/game/scripting/StarWorldLuaBindings.cpp @@ -375,6 +375,7 @@ namespace LuaBindings { callbacks.registerCallback("isClient", []() { return false; }); callbacks.registerCallback("isServer", []() { return true; }); + callbacks.registerCallbackWithSignature<String>("id", bind(ServerWorldCallbacks::id, serverWorld)); callbacks.registerCallbackWithSignature<bool, EntityId, bool>("breakObject", bind(ServerWorldCallbacks::breakObject, serverWorld, _1, _2)); callbacks.registerCallbackWithSignature<bool, RectF>("isVisibleToPlayer", bind(ServerWorldCallbacks::isVisibleToPlayer, serverWorld, _1)); callbacks.registerCallbackWithSignature<bool, RectF>("loadRegion", bind(ServerWorldCallbacks::loadRegion, serverWorld, _1)); @@ -1086,6 +1087,10 @@ namespace LuaBindings { return world->clientWindow(); } + String ServerWorldCallbacks::id(WorldServer* world) { + return world->worldId(); + } + bool ServerWorldCallbacks::breakObject(WorldServer* world, EntityId arg1, bool arg2) { if (auto entity = world->get<Object>(arg1)) { bool smash = arg2; diff --git a/source/game/scripting/StarWorldLuaBindings.hpp b/source/game/scripting/StarWorldLuaBindings.hpp index 965f025..010affd 100644 --- a/source/game/scripting/StarWorldLuaBindings.hpp +++ b/source/game/scripting/StarWorldLuaBindings.hpp @@ -73,6 +73,7 @@ namespace LuaBindings { } namespace ServerWorldCallbacks { + String id(WorldServer* world); bool breakObject(WorldServer* world, EntityId arg1, bool arg2); bool isVisibleToPlayer(WorldServer* world, RectF const& arg1); bool loadRegion(WorldServer* world, RectF const& arg1); |