mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-11 22:11:51 +00:00
add EnumMetadata
This commit is contained in:
parent
d888ddec4c
commit
7749675a61
20 changed files with 156 additions and 206 deletions
|
|
@ -1,3 +1,4 @@
|
|||
#define VC_ENABLE_REFLECTION
|
||||
#include "EngineController.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
|
|
@ -164,7 +165,7 @@ static dv::value create_missing_content_report(
|
|||
auto root = dv::object();
|
||||
auto& contentEntries = root.list("content");
|
||||
for (auto& entry : report->getMissingContent()) {
|
||||
std::string contentName = ContentType_name(entry.type);
|
||||
std::string contentName = ContentTypeMeta.getNameString(entry.type);
|
||||
auto& contentEntry = contentEntries.object();
|
||||
contentEntry["type"] = contentName;
|
||||
contentEntry["name"] = entry.name;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
#define VC_ENABLE_REFLECTION
|
||||
|
||||
#include "util/stringutil.hpp"
|
||||
#include "libentity.hpp"
|
||||
|
||||
|
|
@ -96,8 +98,8 @@ static int l_set_crouching(lua::State* L) {
|
|||
|
||||
static int l_get_body_type(lua::State* L) {
|
||||
if (auto entity = get_entity(L, 1)) {
|
||||
return lua::pushstring(
|
||||
L, to_string(entity->getRigidbody().hitbox.type)
|
||||
return lua::pushlstring(
|
||||
L, BodyTypeMeta.getName(entity->getRigidbody().hitbox.type)
|
||||
);
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -105,9 +107,9 @@ static int l_get_body_type(lua::State* L) {
|
|||
|
||||
static int l_set_body_type(lua::State* L) {
|
||||
if (auto entity = get_entity(L, 1)) {
|
||||
if (auto type = BodyType_from(lua::tostring(L, 2))) {
|
||||
entity->getRigidbody().hitbox.type = *type;
|
||||
} else {
|
||||
if (!BodyTypeMeta.getItem(
|
||||
lua::tostring(L, 2), entity->getRigidbody().hitbox.type
|
||||
)) {
|
||||
throw std::runtime_error(
|
||||
"unknown body type " + util::quote(lua::tostring(L, 2))
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
#define VC_ENABLE_REFLECTION
|
||||
#include "content/Content.hpp"
|
||||
#include "content/ContentLoader.hpp"
|
||||
#include "content/ContentControl.hpp"
|
||||
|
|
@ -311,7 +312,7 @@ static int l_get_textures(lua::State* L) {
|
|||
|
||||
static int l_get_model(lua::State* L) {
|
||||
if (auto def = require_block(L)) {
|
||||
return lua::pushstring(L, to_string(def->model));
|
||||
return lua::pushlstring(L, BlockModelMeta.getName(def->model));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue