mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-06 19:41:51 +00:00
move built-in components to separate cpp files
This commit is contained in:
parent
b4cf00a8f1
commit
848de01448
5 changed files with 202 additions and 190 deletions
23
src/logic/scripting/lua/libentity.hpp
Normal file
23
src/logic/scripting/lua/libentity.hpp
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#ifndef LOGIC_SCRIPTING_LUA_LIBENTITY_HPP_
|
||||
#define LOGIC_SCRIPTING_LUA_LIBENTITY_HPP_
|
||||
|
||||
#include "api_lua.hpp"
|
||||
|
||||
#include "../../LevelController.hpp"
|
||||
#include "../../../frontend/hud.hpp"
|
||||
#include "../../../world/Level.hpp"
|
||||
#include "../../../objects/Entities.hpp"
|
||||
|
||||
#include <optional>
|
||||
|
||||
namespace scripting {
|
||||
extern Hud* hud;
|
||||
}
|
||||
|
||||
inline std::optional<Entity> get_entity(lua::State* L, int idx) {
|
||||
auto id = lua::tointeger(L, idx);
|
||||
auto level = scripting::controller->getLevel();
|
||||
return level->entities->get(id);
|
||||
}
|
||||
|
||||
#endif // LOGIC_SCRIPTING_LUA_LIBENTITY_HPP_
|
||||
Loading…
Add table
Add a link
Reference in a new issue