world.id() for server

This commit is contained in:
ErodeesFleurs 2024-03-22 15:46:30 +08:00
parent 9b10964a3e
commit ec4787d78e
2 changed files with 6 additions and 0 deletions

View File

@ -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;

View File

@ -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);