mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-06 03:21:49 +00:00
refactor players
This commit is contained in:
parent
7f41f95013
commit
bd2acd5766
13 changed files with 101 additions and 151 deletions
|
|
@ -350,9 +350,9 @@ static int l_place(lua::State* L) {
|
|||
"there is no block with index " + std::to_string(id)
|
||||
);
|
||||
}
|
||||
auto player = level->getObject<Player>(playerid);
|
||||
auto player = level->getPlayer(playerid);
|
||||
controller->getBlocksController()->placeBlock(
|
||||
player ? player.get() : nullptr, *def, int2blockstate(state), x, y, z
|
||||
player, *def, int2blockstate(state), x, y, z
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -367,10 +367,8 @@ static int l_destruct(lua::State* L) {
|
|||
return 0;
|
||||
}
|
||||
auto& def = level->content->getIndices()->blocks.require(voxel->id);
|
||||
auto player = level->getObject<Player>(playerid);
|
||||
controller->getBlocksController()->breakBlock(
|
||||
player ? player.get() : nullptr, def, x, y, z
|
||||
);
|
||||
auto player = level->getPlayer(playerid);
|
||||
controller->getBlocksController()->breakBlock(player, def, x, y, z);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@
|
|||
|
||||
using namespace scripting;
|
||||
|
||||
inline std::shared_ptr<Player> get_player(lua::State* L, int idx) {
|
||||
return level->getObject<Player>(lua::tointeger(L, idx));
|
||||
inline Player* get_player(lua::State* L, int idx) {
|
||||
return level->getPlayer(lua::tointeger(L, idx));
|
||||
}
|
||||
|
||||
static int l_get_pos(lua::State* L) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue