Merge branch 'main' into item-models
This commit is contained in:
commit
d3def8e741
@ -23,6 +23,9 @@ entities.exists(uid: int) -> bool
|
||||
-- Returns entity definition index by UID
|
||||
entities.get_def(uid: int) -> int
|
||||
|
||||
-- Returns entity 'hitbox' property value
|
||||
entities.def_hitbox(id: int) -> vec3
|
||||
|
||||
-- Returns entity definition name by index (string ID).
|
||||
entities.def_name(id: int) -> str
|
||||
|
||||
|
||||
@ -99,4 +99,4 @@
|
||||
| save-skeleton-pose | поза скелета сущности | false |
|
||||
| save-skeleton-textures | динамически назначенные текстуры | false |
|
||||
| save-body-velocity | скорость движения тела | true |
|
||||
| save-body-settings | измененные настройки тела <br>(type, damping, crouching) | false |
|
||||
| save-body-settings | измененные настройки тела <br>(type, damping, crouching) | true |
|
||||
|
||||
@ -26,6 +26,9 @@ entities.get_def(uid: int) -> int
|
||||
-- Возвращает имя определения сущности по индексу (строковый ID).
|
||||
entities.def_name(id: int) -> str
|
||||
|
||||
-- Возвращает значение свойства 'hitbox' сущности
|
||||
entities.def_hitbox(id: int) -> vec3
|
||||
|
||||
-- Возвращает индекс определения сущности по имени (числовой ID).
|
||||
entities.def_index(name: str) -> int
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
<!-- content is generated in script -->
|
||||
</panel>
|
||||
<button pos='15,430' size='440,40' onclick='menu:back()'>@Back</button>
|
||||
<button pos='460,430' size='440,40' onclick='core.open_folder("user:content")'>@Open content folder</button>
|
||||
|
||||
<panel id='content_info' pos='485,15' size='440,406' color='0' max-length='406' scrollable='true'>
|
||||
<label>@Creator</label>
|
||||
|
||||
@ -111,18 +111,22 @@ console.add_command(
|
||||
end
|
||||
)
|
||||
console.add_command(
|
||||
"blocks.fill id:str x:num~pos.x y:num~pos.y z:num~pos.z w:int h:int d:int",
|
||||
"blocks.fill id:str x1:int~pos.x y1:int~pos.y z1:int~pos.z "..
|
||||
"x2:int~pos.x y2:int~pos.y z2:int~pos.z",
|
||||
"Fill specified zone with blocks",
|
||||
function(args, kwargs)
|
||||
local name, x, y, z, w, h, d = unpack(args)
|
||||
local name, x1,y1,z1, x2,y2,z2 = unpack(args)
|
||||
local id = block.index(name)
|
||||
for ly = 0, h - 1 do
|
||||
for lz = 0, d - 1 do
|
||||
for lx = 0, w - 1 do
|
||||
block.set(x + lx, y + ly, z + lz, id)
|
||||
for y=y1,y2 do
|
||||
for z=z1,z2 do
|
||||
for x=x1,x2 do
|
||||
block.set(x, y, z, id)
|
||||
end
|
||||
end
|
||||
end
|
||||
local w = math.floor(math.abs(x2-x1+1) + 0.5)
|
||||
local h = math.floor(math.abs(y2-y1+1) + 0.5)
|
||||
local d = math.floor(math.abs(z2-z1+1) + 0.5)
|
||||
return tostring(w * h * d) .. " blocks set"
|
||||
end
|
||||
)
|
||||
@ -151,22 +155,24 @@ console.add_command(
|
||||
)
|
||||
|
||||
console.add_command(
|
||||
"fragment.save x:int y:int z:int w:int h:int d:int name:str='untitled' crop:bool=false",
|
||||
"fragment.save x1:int~pos.x y1:int~pos.y z1:int~pos.z "..
|
||||
"x2:int~pos.x y2:int~pos.y z2:int~pos.z "..
|
||||
"name:str='untitled' crop:bool=false",
|
||||
"Save fragment",
|
||||
function(args, kwargs)
|
||||
local x = args[1]
|
||||
local y = args[2]
|
||||
local z = args[3]
|
||||
local x1 = args[1]
|
||||
local y1 = args[2]
|
||||
local z1 = args[3]
|
||||
|
||||
local w = args[4]
|
||||
local h = args[5]
|
||||
local d = args[6]
|
||||
local x2 = args[4]
|
||||
local y2 = args[5]
|
||||
local z2 = args[6]
|
||||
|
||||
local name = args[7]
|
||||
local crop = args[8]
|
||||
|
||||
local fragment = generation.create_fragment(
|
||||
{x, y, z}, {x + w, y + h, z + d}, crop, false
|
||||
{x1, y1, z1}, {x2, y2, z2}, crop, false
|
||||
)
|
||||
local filename = 'export:'..name..'.vox'
|
||||
generation.save_fragment(fragment, filename, crop)
|
||||
|
||||
@ -40,6 +40,7 @@ menu.Save and Quit to Menu=Сохранить и Выйти в Меню
|
||||
menu.Settings=Настройки
|
||||
menu.Contents Menu=Меню контентпаков
|
||||
menu.Open data folder=Открыть папку данных
|
||||
menu.Open content folder=Открыть папку [content]
|
||||
|
||||
world.Seed=Зерно
|
||||
world.Name=Название
|
||||
|
||||
@ -44,6 +44,8 @@ std::unique_ptr<Content> ContentBuilder::build() {
|
||||
def.rt.hitboxes[i].push_back(aabb);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
def.rt.hitboxes->emplace_back(AABB(glm::vec3(1.0f)));
|
||||
}
|
||||
|
||||
blockDefsIndices.push_back(&def);
|
||||
|
||||
@ -34,6 +34,14 @@ static int l_def_name(lua::State* L) {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int l_def_hitbox(lua::State* L) {
|
||||
if (auto def = require_entity_def(L)) {
|
||||
return lua::pushvec(L, def->hitbox);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int l_defs_count(lua::State* L) {
|
||||
return lua::pushinteger(L, indices->entities.count());
|
||||
}
|
||||
@ -202,6 +210,7 @@ const luaL_Reg entitylib[] = {
|
||||
{"exists", lua::wrap<l_exists>},
|
||||
{"def_index", lua::wrap<l_def_index>},
|
||||
{"def_name", lua::wrap<l_def_name>},
|
||||
{"def_hitbox", lua::wrap<l_def_hitbox>},
|
||||
{"get_def", lua::wrap<l_get_def>},
|
||||
{"defs_count", lua::wrap<l_defs_count>},
|
||||
{"spawn", lua::wrap<l_spawn>},
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
#include "EntityDef.hpp"
|
||||
|
||||
|
||||
void EntityDef::cloneTo(EntityDef& dst) {
|
||||
dst.components = components;
|
||||
dst.bodyType = bodyType;
|
||||
@ -8,5 +10,4 @@ void EntityDef::cloneTo(EntityDef& dst) {
|
||||
dst.skeletonName = skeletonName;
|
||||
dst.blocking = blocking;
|
||||
dst.save = save;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ struct EntityDef {
|
||||
} skeleton;
|
||||
struct {
|
||||
bool velocity = true;
|
||||
bool settings = false;
|
||||
bool settings = true;
|
||||
} body;
|
||||
} save {};
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@ std::unique_ptr<VoxelFragment> VoxelFragment::create(
|
||||
bool entities
|
||||
) {
|
||||
auto start = glm::min(a, b);
|
||||
auto size = glm::abs(a - b);
|
||||
auto size = glm::abs(a - b) + 1;
|
||||
|
||||
if (crop) {
|
||||
VoxelsVolume volume(size.x, size.y, size.z);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user