don't build over collidable/essential inner blocks
parent
797c23e8c5
commit
3ce8df35dc
|
@ -66,6 +66,10 @@ void item_use(ecs_world_t *ecs, ItemDrop *it, Position p, uint64_t udata) {
|
||||||
return;
|
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));
|
world_chunk_replace_block(l.chunk_id, l.id, blocks_find(desc->place.kind + (asset_id)udata));
|
||||||
it->quantity--;
|
it->quantity--;
|
||||||
}break;
|
}break;
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
typedef enum {
|
typedef enum {
|
||||||
BLOCK_FLAG_COLLISION = (1 << 1),
|
BLOCK_FLAG_COLLISION = (1 << 1),
|
||||||
BLOCK_FLAG_HAZARD = (1 << 2),
|
BLOCK_FLAG_HAZARD = (1 << 2),
|
||||||
|
BLOCK_FLAG_ESSENTIAL = (1 << 3),
|
||||||
} block_flags;
|
} block_flags;
|
||||||
|
|
||||||
int32_t blocks_setup(void);
|
int32_t blocks_setup(void);
|
||||||
|
|
Loading…
Reference in New Issue