summaryrefslogtreecommitdiffstats
path: root/game/client/experiments.cc
diff options
context:
space:
mode:
authoruntodesu <kirill@untode.su>2025-09-12 16:16:06 +0500
committeruntodesu <kirill@untode.su>2025-09-12 16:16:06 +0500
commitfc80fa024fc93dac6ea89461ef36f455c5e468a2 (patch)
tree7c4ea8f03b6778572d59784dc28b600e3f8f2268 /game/client/experiments.cc
parent12947aafcc6a6eb362cc454e2149796ec9265743 (diff)
parent522a7514012da86f7b9643179f0763746f3b232e (diff)
downloadvoxelius-fc80fa024fc93dac6ea89461ef36f455c5e468a2.tar.bz2
voxelius-fc80fa024fc93dac6ea89461ef36f455c5e468a2.zip
Merge pull request #15 from untodesu/metavoxels
Metavoxels
Diffstat (limited to 'game/client/experiments.cc')
-rw-r--r--game/client/experiments.cc13
1 files changed, 8 insertions, 5 deletions
diff --git a/game/client/experiments.cc b/game/client/experiments.cc
index 2b9fe89..8b0b526 100644
--- a/game/client/experiments.cc
+++ b/game/client/experiments.cc
@@ -22,7 +22,7 @@
static void on_glfw_mouse_button(const io::GlfwMouseButtonEvent& event)
{
if(!globals::gui_screen && session::is_ingame()) {
- if((event.action == GLFW_PRESS) && (world::player_target::voxel != NULL_VOXEL_ID)) {
+ if((event.action == GLFW_PRESS) && world::player_target::voxel) {
if(event.button == GLFW_MOUSE_BUTTON_LEFT) {
experiments::attack();
return;
@@ -68,14 +68,17 @@ void experiments::update_late(void)
void experiments::attack(void)
{
- globals::dimension->set_voxel(NULL_VOXEL_ID, world::player_target::coord);
+ globals::dimension->set_voxel(nullptr, world::player_target::coord);
}
void experiments::interact(void)
{
- if(auto info = world::item_registry::find(gui::hotbar::slots[gui::hotbar::active_slot])) {
- if(info->place_voxel != NULL_VOXEL_ID) {
- globals::dimension->set_voxel(info->place_voxel, world::player_target::coord + world::player_target::normal);
+ auto active_item = gui::hotbar::slots[gui::hotbar::active_slot];
+
+ if(active_item) {
+ if(auto place_voxel = active_item->get_place_voxel()) {
+ globals::dimension->set_voxel(place_voxel, world::player_target::coord + world::player_target::normal);
+ return;
}
}
}