Add world.isClient & isServer

This commit is contained in:
Kae 2023-10-30 08:03:16 +11:00
parent 3b0a3efc19
commit d425e8e15f

View File

@ -356,6 +356,8 @@ namespace LuaBindings {
});
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));