diff --git a/code/game/src/items.c b/code/game/src/items.c index c96ebd6..02be5c4 100644 --- a/code/game/src/items.c +++ b/code/game/src/items.c @@ -65,7 +65,11 @@ void item_use(ecs_world_t *ecs, ItemDrop *it, Position p, uint64_t udata) { } else { return; } - } + } + // NOTE(zaklaus): This is an inner layer block, we can't build over it if it has a collision! + else if (l.block_id > 0 && blocks_get_flags(l.block_id) & (BLOCK_FLAG_COLLISION|BLOCK_FLAG_ESSENTIAL)) { + return; + } world_chunk_replace_block(l.chunk_id, l.id, blocks_find(desc->place.kind + (asset_id)udata)); it->quantity--; }break; diff --git a/code/game/src/world/blocks.h b/code/game/src/world/blocks.h index 3bb836f..2e1c077 100644 --- a/code/game/src/world/blocks.h +++ b/code/game/src/world/blocks.h @@ -5,6 +5,7 @@ typedef enum { BLOCK_FLAG_COLLISION = (1 << 1), BLOCK_FLAG_HAZARD = (1 << 2), + BLOCK_FLAG_ESSENTIAL = (1 << 3), } block_flags; int32_t blocks_setup(void);