diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-10-30 08:03:16 +1100 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-10-30 08:03:16 +1100 |
commit | d425e8e15f2252d47fb26d7a6905eee388163440 (patch) | |
tree | 883c4e237da8b6245742fd1487202010811c30d6 /source/game/scripting/StarWorldLuaBindings.cpp | |
parent | 3b0a3efc194c48326ab067d5cc7a498104b18259 (diff) |
Add world.isClient & isServer
Diffstat (limited to 'source/game/scripting/StarWorldLuaBindings.cpp')
-rw-r--r-- | source/game/scripting/StarWorldLuaBindings.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/source/game/scripting/StarWorldLuaBindings.cpp b/source/game/scripting/StarWorldLuaBindings.cpp index dc1c5be..1a21bad 100644 --- a/source/game/scripting/StarWorldLuaBindings.cpp +++ b/source/game/scripting/StarWorldLuaBindings.cpp @@ -354,8 +354,10 @@ namespace LuaBindings { return as<WorldClient>(world)->dungeonId(position); } }); - + if (auto clientWorld = as<WorldClient>(world)) { + callbacks.registerCallback("isClient", []() { return true; }); + callbacks.registerCallback("isServer", []() { return false; }); callbacks.registerCallbackWithSignature<RectI>("clientWindow", bind(ClientWorldCallbacks::clientWindow, clientWorld)); callbacks.registerCallback("players", [clientWorld]() { List<EntityId> playerIds; @@ -370,6 +372,9 @@ namespace LuaBindings { } if (auto serverWorld = as<WorldServer>(world)) { + callbacks.registerCallback("isClient", []() { return false; }); + callbacks.registerCallback("isServer", []() { return true; }); + 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)); |