add Players

This commit is contained in:
MihailRis
2024-11-23 05:14:12 +03:00
parent 5f496eecb2
commit 7027bd6f28
8 changed files with 125 additions and 68 deletions
+3 -2
View File
@@ -2,6 +2,7 @@
#include "lighting/Lighting.hpp"
#include "logic/BlocksController.hpp"
#include "logic/LevelController.hpp"
#include "objects/Players.hpp"
#include "voxels/Block.hpp"
#include "voxels/Chunk.hpp"
#include "voxels/Chunks.hpp"
@@ -350,7 +351,7 @@ static int l_place(lua::State* L) {
"there is no block with index " + std::to_string(id)
);
}
auto player = level->getPlayer(playerid);
auto player = level->players->getPlayer(playerid);
controller->getBlocksController()->placeBlock(
player, *def, int2blockstate(state), x, y, z
);
@@ -367,7 +368,7 @@ static int l_destruct(lua::State* L) {
return 0;
}
auto& def = level->content->getIndices()->blocks.require(voxel->id);
auto player = level->getPlayer(playerid);
auto player = level->players->getPlayer(playerid);
controller->getBlocksController()->breakBlock(player, def, x, y, z);
return 0;
}