mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-11-21 01:49:44 +00:00
remove EnTT from Entities.cpp
This commit is contained in:
parent
0ae335599a
commit
7ef07a75cd
11 changed files with 215 additions and 223 deletions
|
|
@ -28,7 +28,7 @@ static const EntityDef* require_entity_def(lua::State* L) {
|
|||
}
|
||||
|
||||
static int l_exists(lua::State* L) {
|
||||
return lua::pushboolean(L, get_entity(L, 1).has_value());
|
||||
return lua::pushboolean(L, get_entity(L, 1) != nullptr);
|
||||
}
|
||||
|
||||
static int l_def_index(lua::State* L) {
|
||||
|
|
@ -138,8 +138,7 @@ static int l_get_all_in_box(lua::State* L) {
|
|||
auto found = level->entities->getAllInside(AABB(pos, pos + size));
|
||||
lua::createtable(L, found.size(), 0);
|
||||
for (size_t i = 0; i < found.size(); i++) {
|
||||
const auto& entity = found[i];
|
||||
lua::pushinteger(L, entity.getUID());
|
||||
lua::pushinteger(L, found[i]->getUID());
|
||||
lua::rawseti(L, i + 1);
|
||||
}
|
||||
return 1;
|
||||
|
|
@ -151,8 +150,7 @@ static int l_get_all_in_radius(lua::State* L) {
|
|||
auto found = level->entities->getAllInRadius(pos, radius);
|
||||
lua::createtable(L, found.size(), 0);
|
||||
for (size_t i = 0; i < found.size(); i++) {
|
||||
const auto& entity = found[i];
|
||||
lua::pushinteger(L, entity.getUID());
|
||||
lua::pushinteger(L, found[i]->getUID());
|
||||
lua::rawseti(L, i + 1);
|
||||
}
|
||||
return 1;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
|
||||
#include "frontend/hud.hpp"
|
||||
#include "objects/Entities.hpp"
|
||||
#include "objects/Entity.hpp"
|
||||
|
|
@ -13,7 +11,7 @@ namespace scripting {
|
|||
extern Hud* hud;
|
||||
}
|
||||
|
||||
inline std::optional<Entity> get_entity(lua::State* L, int idx) {
|
||||
inline Entity* get_entity(lua::State* L, int idx) {
|
||||
auto id = lua::tointeger(L, idx);
|
||||
auto level = scripting::controller->getLevel();
|
||||
return level->entities->get(id);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue