introduce local player
This commit is contained in:
@@ -55,10 +55,15 @@ static int l_new_world(lua::State* L) {
|
||||
auto name = lua::require_string(L, 1);
|
||||
auto seed = lua::require_string(L, 2);
|
||||
auto generator = lua::require_string(L, 3);
|
||||
int64_t localPlayer = 0;
|
||||
if (lua::gettop(L) >= 4) {
|
||||
localPlayer = lua::tointeger(L, 4);
|
||||
}
|
||||
if (level != nullptr) {
|
||||
throw std::runtime_error("world must be closed before");
|
||||
}
|
||||
auto controller = engine->getController();
|
||||
controller->setLocalPlayer(localPlayer);
|
||||
controller->createWorld(name, seed, generator);
|
||||
return 0;
|
||||
}
|
||||
@@ -71,6 +76,7 @@ static int l_open_world(lua::State* L) {
|
||||
throw std::runtime_error("world must be closed before");
|
||||
}
|
||||
auto controller = engine->getController();
|
||||
controller->setLocalPlayer(0);
|
||||
controller->openWorld(name, false);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user