mirror of
https://github.com/PixelGuys/Cubyz.git
synced 2025-09-08 03:29:48 -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",
|
.texture3 = "cubyz:duckweed/3",
|
||||||
.item = .{
|
.item = .{
|
||||||
.texture = "duckweed.png",
|
.texture = "duckweed.png",
|
||||||
|
.tags = .{.fluidPlaceable},
|
||||||
},
|
},
|
||||||
.lodReplacement = "cubyz:air",
|
.lodReplacement = "cubyz:air",
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
.texture = "cubyz:lily_pad",
|
.texture = "cubyz:lily_pad",
|
||||||
.item = .{
|
.item = .{
|
||||||
.texture = "lily_pad.png",
|
.texture = "lily_pad.png",
|
||||||
|
.tags = .{.fluidPlaceable},
|
||||||
},
|
},
|
||||||
.lodReplacement = "cubyz:air",
|
.lodReplacement = "cubyz:air",
|
||||||
}
|
}
|
||||||
|
@ -917,8 +917,9 @@ pub const MeshSelection = struct { // MARK: MeshSelection
|
|||||||
while(total_tMax < closestDistance) {
|
while(total_tMax < closestDistance) {
|
||||||
const block = mesh_storage.getBlock(voxelPos[0], voxelPos[1], voxelPos[2]) orelse break;
|
const block = mesh_storage.getBlock(voxelPos[0], voxelPos[1], voxelPos[2]) orelse break;
|
||||||
if(block.typ != 0) blk: {
|
if(block.typ != 0) blk: {
|
||||||
|
const fluidPlaceable = item != null and item.? == .baseItem and item.?.baseItem.hasTag(.fluidPlaceable);
|
||||||
for(block.blockTags()) |tag| {
|
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)));
|
const relativePlayerPos: Vec3f = @floatCast(pos - @as(Vec3d, @floatFromInt(voxelPos)));
|
||||||
if(block.mode().rayIntersection(block, item, relativePlayerPos, _dir)) |intersection| {
|
if(block.mode().rayIntersection(block, item, relativePlayerPos, _dir)) |intersection| {
|
||||||
@ -1047,6 +1048,9 @@ pub const MeshSelection = struct { // MARK: MeshSelection
|
|||||||
currentBlockProgress = 0;
|
currentBlockProgress = 0;
|
||||||
}
|
}
|
||||||
const block = mesh_storage.getBlock(selectedPos[0], selectedPos[1], selectedPos[2]) orelse return;
|
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)));
|
const relPos: Vec3f = @floatCast(lastPos - @as(Vec3d, @floatFromInt(selectedPos)));
|
||||||
|
|
||||||
main.items.Inventory.Sync.ClientSide.mutex.lock();
|
main.items.Inventory.Sync.ClientSide.mutex.lock();
|
||||||
|
@ -25,6 +25,7 @@ pub const Tag = enum(u32) {
|
|||||||
air = 0,
|
air = 0,
|
||||||
fluid = 1,
|
fluid = 1,
|
||||||
sbbChild = 2,
|
sbbChild = 2,
|
||||||
|
fluidPlaceable = 3,
|
||||||
_,
|
_,
|
||||||
|
|
||||||
pub fn resetTags() void {
|
pub fn resetTags() void {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user