mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 02:51:49 +00:00
added hud.get_player()
This commit is contained in:
parent
7be1c3f223
commit
e0e052ff1a
2 changed files with 9 additions and 1 deletions
|
|
@ -10,6 +10,7 @@
|
|||
#include "../../../graphics/ui/elements/InventoryView.hpp"
|
||||
#include "../../../items/Inventories.hpp"
|
||||
#include "../../../logic/BlocksController.hpp"
|
||||
#include "../../../objects/Player.hpp"
|
||||
#include "../../../util/stringutil.hpp"
|
||||
#include "../../../voxels/Block.hpp"
|
||||
#include "../../../voxels/Chunks.hpp"
|
||||
|
|
@ -121,6 +122,12 @@ static int l_hud_get_block_inventory(lua_State* L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int l_hud_get_player(lua_State* L) {
|
||||
auto player = scripting::hud->getPlayer();
|
||||
lua_pushinteger(L, player->getId());
|
||||
return 1;
|
||||
}
|
||||
|
||||
const luaL_Reg hudlib [] = {
|
||||
{"open_inventory", lua_wrap_errors<l_hud_open_inventory>},
|
||||
{"close_inventory", lua_wrap_errors<l_hud_close_inventory>},
|
||||
|
|
@ -131,5 +138,6 @@ const luaL_Reg hudlib [] = {
|
|||
{"close", lua_wrap_errors<l_hud_close>},
|
||||
{"pause", lua_wrap_errors<l_hud_pause>},
|
||||
{"resume", lua_wrap_errors<l_hud_resume>},
|
||||
{"get_player", lua_wrap_errors<l_hud_get_player>},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue