add temporary test block
This commit is contained in:
parent
c2aa4e3c26
commit
ee47213dbb
15
res/content/base/blocks/door.json
Normal file
15
res/content/base/blocks/door.json
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"material": "base:wood",
|
||||
"texture-faces": [
|
||||
"door_side",
|
||||
"door_side",
|
||||
"door_top",
|
||||
"door_top",
|
||||
"door",
|
||||
"door"
|
||||
],
|
||||
"light-passing": true,
|
||||
"sky-light-passing": true,
|
||||
"size": [1, 2, 1],
|
||||
"rotation": "pipe"
|
||||
}
|
||||
@ -1,7 +1,4 @@
|
||||
{
|
||||
"items": [
|
||||
"bazalt_breaker"
|
||||
],
|
||||
"blocks": [
|
||||
"dirt",
|
||||
"grass_block",
|
||||
@ -25,6 +22,10 @@
|
||||
"pane",
|
||||
"pipe",
|
||||
"lightbulb",
|
||||
"torch"
|
||||
"torch",
|
||||
"door"
|
||||
],
|
||||
"items": [
|
||||
"bazalt_breaker"
|
||||
]
|
||||
}
|
||||
BIN
res/content/base/textures/blocks/door.png
Normal file
BIN
res/content/base/textures/blocks/door.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.2 KiB |
BIN
res/content/base/textures/blocks/door_side.png
Normal file
BIN
res/content/base/textures/blocks/door_side.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.7 KiB |
BIN
res/content/base/textures/blocks/door_top.png
Normal file
BIN
res/content/base/textures/blocks/door_top.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.4 KiB |
@ -31,6 +31,13 @@ static std::shared_ptr<Label> create_label(wstringsupplier supplier) {
|
||||
return label;
|
||||
}
|
||||
|
||||
template <size_t T>
|
||||
inline std::wstring to_string(std::bitset<T> bs) {
|
||||
std::wstringstream ss;
|
||||
ss << bs;
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
std::shared_ptr<UINode> create_debug_panel(
|
||||
Engine* engine,
|
||||
Level* level,
|
||||
@ -94,6 +101,18 @@ std::shared_ptr<UINode> create_debug_panel(
|
||||
return std::wstring {L"name: void"};
|
||||
}
|
||||
}));
|
||||
panel->add(create_label([=](){
|
||||
auto* indices = level->content->getIndices();
|
||||
if (auto def = indices->getBlockDef(player->selectedVoxel.id)) {
|
||||
return L"light: " + to_string(std::bitset<16>(level->chunks->getLight(
|
||||
player->actualSelectedBlockPosition.x,
|
||||
player->actualSelectedBlockPosition.y,
|
||||
player->actualSelectedBlockPosition.z
|
||||
)));
|
||||
} else {
|
||||
return std::wstring {L"no light: -"};
|
||||
}
|
||||
}));
|
||||
panel->add(create_label([=](){
|
||||
return L"seed: "+std::to_wstring(level->getWorld()->getSeed());
|
||||
}));
|
||||
|
||||
@ -368,6 +368,7 @@ void PlayerController::updateInteraction(){
|
||||
player->selectedVoxel = *vox;
|
||||
selectedBlockId = vox->id;
|
||||
selectedBlockRotation = vox->state.rotation;
|
||||
player->actualSelectedBlockPosition = iend;
|
||||
if (selectedState.segment) {
|
||||
iend = chunks->seekOrigin(
|
||||
iend, indices->getBlockDef(selectedBlockId), selectedState
|
||||
@ -410,6 +411,7 @@ void PlayerController::updateInteraction(){
|
||||
}
|
||||
}
|
||||
if (def && rclick){
|
||||
iend = player->actualSelectedBlockPosition;
|
||||
if (!input.shift && target->rt.funcsset.oninteract) {
|
||||
if (scripting::on_block_interact(player.get(), target, x, y, z))
|
||||
return;
|
||||
@ -420,6 +422,9 @@ void PlayerController::updateInteraction(){
|
||||
z = (iend.z)+(norm.z);
|
||||
} else if (def->rotations.name == "pipe") {
|
||||
state.rotation = BLOCK_DIR_UP;
|
||||
x = iend.x;
|
||||
y = iend.y;
|
||||
z = iend.z;
|
||||
}
|
||||
vox = chunks->get(x, y, z);
|
||||
blockid_t chosenBlock = def->rt.id;
|
||||
|
||||
@ -47,6 +47,7 @@ public:
|
||||
voxel selectedVoxel {0, {}};
|
||||
glm::vec3 cam {};
|
||||
glm::ivec3 selectedBlockPosition {};
|
||||
glm::ivec3 actualSelectedBlockPosition {};
|
||||
|
||||
Player(glm::vec3 position, float speed, std::shared_ptr<Inventory> inv);
|
||||
~Player();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user