feat: make Decorator listen to block interactions

This commit is contained in:
MihailRis
2024-11-05 03:46:41 +03:00
parent f5bc6fc136
commit 77ae35e364
5 changed files with 36 additions and 21 deletions
+1 -1
View File
@@ -25,7 +25,7 @@ LevelFrontend::LevelFrontend(
"block-previews"
);
controller->getBlocksController()->listenBlockInteraction(
[=](Player* player, glm::ivec3 pos, const Block& def, BlockInteraction type) {
[=](auto player, const auto& pos, const auto& def, BlockInteraction type) {
auto material = level->content->findBlockMaterial(def.material);
if (material == nullptr) {
return;
+3 -2
View File
@@ -46,8 +46,9 @@ LevelScreen::LevelScreen(Engine* engine, std::unique_ptr<Level> levelPtr)
worldRenderer = std::make_unique<WorldRenderer>(engine, frontend.get(), controller->getPlayer());
hud = std::make_unique<Hud>(engine, frontend.get(), controller->getPlayer());
decorator =
std::make_unique<Decorator>(*level, *worldRenderer->particles, *assets);
decorator = std::make_unique<Decorator>(
*controller, *worldRenderer->particles, *assets
);
keepAlive(settings.graphics.backlight.observe([=](bool) {
controller->getLevel()->chunks->saveAndClear();