Add world.isClient & isServer
This commit is contained in:
parent
3b0a3efc19
commit
d425e8e15f
@ -354,8 +354,10 @@ namespace LuaBindings {
|
|||||||
return as<WorldClient>(world)->dungeonId(position);
|
return as<WorldClient>(world)->dungeonId(position);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (auto clientWorld = as<WorldClient>(world)) {
|
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.registerCallbackWithSignature<RectI>("clientWindow", bind(ClientWorldCallbacks::clientWindow, clientWorld));
|
||||||
callbacks.registerCallback("players", [clientWorld]() {
|
callbacks.registerCallback("players", [clientWorld]() {
|
||||||
List<EntityId> playerIds;
|
List<EntityId> playerIds;
|
||||||
@ -370,6 +372,9 @@ namespace LuaBindings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (auto serverWorld = as<WorldServer>(world)) {
|
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, EntityId, bool>("breakObject", bind(ServerWorldCallbacks::breakObject, serverWorld, _1, _2));
|
||||||
callbacks.registerCallbackWithSignature<bool, RectF>("isVisibleToPlayer", bind(ServerWorldCallbacks::isVisibleToPlayer, serverWorld, _1));
|
callbacks.registerCallbackWithSignature<bool, RectF>("isVisibleToPlayer", bind(ServerWorldCallbacks::isVisibleToPlayer, serverWorld, _1));
|
||||||
callbacks.registerCallbackWithSignature<bool, RectF>("loadRegion", bind(ServerWorldCallbacks::loadRegion, serverWorld, _1));
|
callbacks.registerCallbackWithSignature<bool, RectF>("loadRegion", bind(ServerWorldCallbacks::loadRegion, serverWorld, _1));
|
||||||
|
Loading…
Reference in New Issue
Block a user