mirror of
https://github.com/PixelGuys/Cubyz.git
synced 2025-08-03 03:06:55 -04:00
Speed boost when breaking a block based on leftover damage (#1658)
This makes the DPS statistic more accurate and reduces the impact from off-by-one errors as described in #1643 fixes #1656 @ikabod-kee please check this out
This commit is contained in:
parent
19fe9508d5
commit
5a80a2d281
@ -1045,8 +1045,6 @@ pub const MeshSelection = struct { // MARK: MeshSelection
|
||||
mesh_storage.removeBreakingAnimation(lastSelectedBlockPos);
|
||||
lastSelectedBlockPos = selectedPos;
|
||||
currentBlockProgress = 0;
|
||||
currentSwingProgress = 0;
|
||||
currentSwingTime = 0;
|
||||
}
|
||||
const block = mesh_storage.getBlock(selectedPos[0], selectedPos[1], selectedPos[2]) orelse return;
|
||||
const relPos: Vec3f = @floatCast(lastPos - @as(Vec3d, @floatFromInt(selectedPos)));
|
||||
@ -1084,6 +1082,7 @@ pub const MeshSelection = struct { // MARK: MeshSelection
|
||||
|
||||
return;
|
||||
} else {
|
||||
currentSwingProgress += (currentBlockProgress - 1)*block.blockHealth()/damage*currentSwingTime;
|
||||
mesh_storage.removeBreakingAnimation(lastSelectedBlockPos);
|
||||
currentBlockProgress = 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user