mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 19:11:50 +00:00
commit
8ea83ba469
18 changed files with 74 additions and 45 deletions
|
|
@ -108,13 +108,13 @@ static int l_set_skeleton(lua::State* L) {
|
|||
}
|
||||
if (auto entity = get_entity(L, 1)) {
|
||||
std::string skeletonName = lua::require_string(L, 2);
|
||||
auto rigConfig = assets->get<rigging::SkeletonConfig>(skeletonName);
|
||||
auto rigConfig = assets->getShared<rigging::SkeletonConfig>(skeletonName);
|
||||
if (rigConfig == nullptr) {
|
||||
throw std::runtime_error(
|
||||
"skeleton not found '" + skeletonName + "'"
|
||||
);
|
||||
}
|
||||
entity->setRig(rigConfig);
|
||||
entity->setRig(std::move(rigConfig));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -294,14 +294,14 @@ static int l_set_camera(lua::State* L) {
|
|||
|
||||
static int l_get_name(lua::State* L) {
|
||||
if (auto player = get_player(L, 1)) {
|
||||
return lua::pushstring(L, player->getName());
|
||||
return lua::pushwstring(L, player->getName());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int l_set_name(lua::State* L) {
|
||||
if (auto player = get_player(L, 1)) {
|
||||
player->setName(lua::require_string(L, 2));
|
||||
player->setName(lua::require_wstring(L, 2));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -313,7 +313,7 @@ static int l_create(lua::State* L) {
|
|||
}
|
||||
auto& level = require_level();
|
||||
auto player = level.players->create(playerId);
|
||||
player->setName(lua::require_string(L, 1));
|
||||
player->setName(lua::require_wstring(L, 1));
|
||||
return lua::pushinteger(L, player->getId());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue