mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 19:11:50 +00:00
add Players
This commit is contained in:
parent
5f496eecb2
commit
7027bd6f28
8 changed files with 125 additions and 68 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include "items/Inventory.hpp"
|
||||
#include "objects/Entities.hpp"
|
||||
#include "objects/Player.hpp"
|
||||
#include "objects/Players.hpp"
|
||||
#include "physics/Hitbox.hpp"
|
||||
#include "window/Camera.hpp"
|
||||
#include "world/Level.hpp"
|
||||
|
|
@ -12,7 +13,7 @@
|
|||
using namespace scripting;
|
||||
|
||||
inline Player* get_player(lua::State* L, int idx) {
|
||||
return level->getPlayer(lua::tointeger(L, idx));
|
||||
return level->players->getPlayer(lua::tointeger(L, idx));
|
||||
}
|
||||
|
||||
static int l_get_pos(lua::State* L) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue