From d425e8e15f2252d47fb26d7a6905eee388163440 Mon Sep 17 00:00:00 2001 From: Kae <80987908+Novaenia@users.noreply.github.com> Date: Mon, 30 Oct 2023 08:03:16 +1100 Subject: [PATCH] Add world.isClient & isServer --- source/game/scripting/StarWorldLuaBindings.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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(world)->dungeonId(position); } }); - + if (auto clientWorld = as(world)) { + callbacks.registerCallback("isClient", []() { return true; }); + callbacks.registerCallback("isServer", []() { return false; }); callbacks.registerCallbackWithSignature("clientWindow", bind(ClientWorldCallbacks::clientWindow, clientWorld)); callbacks.registerCallback("players", [clientWorld]() { List playerIds; @@ -370,6 +372,9 @@ namespace LuaBindings { } if (auto serverWorld = as(world)) { + callbacks.registerCallback("isClient", []() { return false; }); + callbacks.registerCallback("isServer", []() { return true; }); + callbacks.registerCallbackWithSignature("breakObject", bind(ServerWorldCallbacks::breakObject, serverWorld, _1, _2)); callbacks.registerCallbackWithSignature("isVisibleToPlayer", bind(ServerWorldCallbacks::isVisibleToPlayer, serverWorld, _1)); callbacks.registerCallbackWithSignature("loadRegion", bind(ServerWorldCallbacks::loadRegion, serverWorld, _1));