mirror of
https://github.com/PixelGuys/Cubyz.git
synced 2025-08-03 03:06:55 -04:00
Place certain blocks on water (#1672)
Fixes #1218 --------- Co-authored-by: IntegratedQuantum <43880493+IntegratedQuantum@users.noreply.github.com>
This commit is contained in:
parent
32760169f7
commit
f2dc3faec2
@ -19,6 +19,7 @@
|
||||
.texture3 = "cubyz:duckweed/3",
|
||||
.item = .{
|
||||
.texture = "duckweed.png",
|
||||
.tags = .{.fluidPlaceable},
|
||||
},
|
||||
.lodReplacement = "cubyz:air",
|
||||
}
|
||||
|
@ -12,6 +12,7 @@
|
||||
.texture = "cubyz:lily_pad",
|
||||
.item = .{
|
||||
.texture = "lily_pad.png",
|
||||
.tags = .{.fluidPlaceable},
|
||||
},
|
||||
.lodReplacement = "cubyz:air",
|
||||
}
|
||||
|
@ -917,8 +917,9 @@ pub const MeshSelection = struct { // MARK: MeshSelection
|
||||
while(total_tMax < closestDistance) {
|
||||
const block = mesh_storage.getBlock(voxelPos[0], voxelPos[1], voxelPos[2]) orelse break;
|
||||
if(block.typ != 0) blk: {
|
||||
const fluidPlaceable = item != null and item.? == .baseItem and item.?.baseItem.hasTag(.fluidPlaceable);
|
||||
for(block.blockTags()) |tag| {
|
||||
if(tag == .fluid or tag == .air) break :blk; // TODO: Buckets could select fluids
|
||||
if(tag == .fluid and !fluidPlaceable or tag == .air) break :blk; // TODO: Buckets could select fluids
|
||||
}
|
||||
const relativePlayerPos: Vec3f = @floatCast(pos - @as(Vec3d, @floatFromInt(voxelPos)));
|
||||
if(block.mode().rayIntersection(block, item, relativePlayerPos, _dir)) |intersection| {
|
||||
@ -1047,6 +1048,9 @@ pub const MeshSelection = struct { // MARK: MeshSelection
|
||||
currentBlockProgress = 0;
|
||||
}
|
||||
const block = mesh_storage.getBlock(selectedPos[0], selectedPos[1], selectedPos[2]) orelse return;
|
||||
if(block.hasTag(.fluid) or block.hasTag(.air)) {
|
||||
return;
|
||||
}
|
||||
const relPos: Vec3f = @floatCast(lastPos - @as(Vec3d, @floatFromInt(selectedPos)));
|
||||
|
||||
main.items.Inventory.Sync.ClientSide.mutex.lock();
|
||||
|
@ -25,6 +25,7 @@ pub const Tag = enum(u32) {
|
||||
air = 0,
|
||||
fluid = 1,
|
||||
sbbChild = 2,
|
||||
fluidPlaceable = 3,
|
||||
_,
|
||||
|
||||
pub fn resetTags() void {
|
||||
|
Loading…
x
Reference in New Issue
Block a user