From 991d6f2bcb753edb1e026b7158b8a3da1cb8fdd8 Mon Sep 17 00:00:00 2001 From: ikabod-kee Date: Sun, 1 Jun 2025 20:30:24 -0400 Subject: [PATCH 01/12] Multitude of Changes Added modifiers to ingots, modified pickaxe and default swing speeds. --- assets/cubyz/items/copper_ingot.zig.zon | 6 ++ assets/cubyz/items/gold_ingot.zig.zon | 6 ++ assets/cubyz/items/iron_ingot.zig.zon | 6 ++ assets/cubyz/items/silver_ingot.zig.zon | 6 ++ assets/cubyz/items/uranium_ingot.zig.zon | 6 ++ assets/cubyz/tools/pickaxe.zig.zon | 73 ++++++++++-------------- src/items.zig | 2 +- src/renderer.zig | 2 +- 8 files changed, 62 insertions(+), 45 deletions(-) diff --git a/assets/cubyz/items/copper_ingot.zig.zon b/assets/cubyz/items/copper_ingot.zig.zon index 9e084f08c..22fc9cd2f 100644 --- a/assets/cubyz/items/copper_ingot.zig.zon +++ b/assets/cubyz/items/copper_ingot.zig.zon @@ -9,5 +9,11 @@ .colors = .{ 0xffa24e37, 0xffb65f3f, 0xffd57e4b, 0xffee9168, 0xfff2b17e, }, + .modifiers = .{ + .{ + .id = "heavy", + .strength = 0.075, + }, + }, }, } diff --git a/assets/cubyz/items/gold_ingot.zig.zon b/assets/cubyz/items/gold_ingot.zig.zon index 2fbf4a129..49bdd7db6 100644 --- a/assets/cubyz/items/gold_ingot.zig.zon +++ b/assets/cubyz/items/gold_ingot.zig.zon @@ -9,5 +9,11 @@ .colors = .{ 0xffbc7132, 0xffda972b, 0xfff2cd53, 0xfff2cd53, 0xfffae39e, }, + .modifiers = .{ + .{ + .id = "heavy", + .strength = 0.25, + }, + }, }, } diff --git a/assets/cubyz/items/iron_ingot.zig.zon b/assets/cubyz/items/iron_ingot.zig.zon index fcdbf500e..dc957a285 100644 --- a/assets/cubyz/items/iron_ingot.zig.zon +++ b/assets/cubyz/items/iron_ingot.zig.zon @@ -9,5 +9,11 @@ .colors = .{ 0xff616163, 0xff797777, 0xff9c9c9c, 0xffb4b4b4, 0xffd9d9d9, }, + .modifiers = .{ + .{ + .id = "heavy", + .strength = 0.1, + }, + }, }, } diff --git a/assets/cubyz/items/silver_ingot.zig.zon b/assets/cubyz/items/silver_ingot.zig.zon index 9d0eb4622..99d9587e5 100644 --- a/assets/cubyz/items/silver_ingot.zig.zon +++ b/assets/cubyz/items/silver_ingot.zig.zon @@ -9,5 +9,11 @@ .colors = .{ 0xff67727f, 0xff89919e, 0xffbdc2c6, 0xffe4e6e6, 0xfffcfcfc, }, + .modifiers = .{ + .{ + .id = "heavy", + .strength = 0.125, + }, + }, }, } diff --git a/assets/cubyz/items/uranium_ingot.zig.zon b/assets/cubyz/items/uranium_ingot.zig.zon index fe86917c7..14fb9709f 100644 --- a/assets/cubyz/items/uranium_ingot.zig.zon +++ b/assets/cubyz/items/uranium_ingot.zig.zon @@ -9,5 +9,11 @@ .colors = .{ 0xff395533, 0xff466e45, 0xff5d8a5f, 0xff6da367, 0xff74c761, }, + .modifiers = .{ + .{ + .id = "heavy", + .strength = 0.2, + }, + }, }, } diff --git a/assets/cubyz/tools/pickaxe.zig.zon b/assets/cubyz/tools/pickaxe.zig.zon index c813cbada..6abeb8c07 100644 --- a/assets/cubyz/tools/pickaxe.zig.zon +++ b/assets/cubyz/tools/pickaxe.zig.zon @@ -17,28 +17,28 @@ .parameters = .{ .{ .source = .density, - .destination = .swingTime, + .destination = .damage, .matrix = .{ - 2.5, 2.0, 1.5, 1.0, 0x0, - 2.0, 2.0, 1.5, 0x0, 0x0, - 1.5, 1.5, 1.0, 0x0, 0x0, - 1.0, 0x0, 0x0, 1.0, 0x0, - 0x0, 0x0, 0x0, 0x0, 1.0, + 2.0, 2.0, 1.5, 1.0, 0x0, + 2.0, 1.5, 1.0, 0x0, 0x0, + 1.5, 1.0, 0.6, 0x0, 0x0, + 1.0, 0x0, 0x0, 0.4, 0x0, + 0x0, 0x0, 0x0, 0x0, 0.2, }, - .factor = 0.25, - .method = .average, + .factor = 0.2, + .method = .sum, }, .{ .source = .density, .destination = .damage, .matrix = .{ - 2.5, 2.0, 1.5, 1.0, 0x0, + 2.0, 2.0, 1.5, 1.0, 0x0, 2.0, 1.5, 1.0, 0x0, 0x0, - 1.5, 1.0, 0.5, 0x0, 0x0, - 1.0, 0x0, 0x0, 0.0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0.0, + 1.5, 1.0, 0.3, 0x0, 0x0, + 1.0, 0x0, 0x0, 0.2, 0x0, + 0x0, 0x0, 0x0, 0x0, 0.1, }, - .factor = 0.8, + .factor = 0.3, .method = .average, }, .{ @@ -46,52 +46,39 @@ .destination = .maxDurability, .matrix = .{ 0.5, 1.0, 1.0, 1.0, 0x0, - 1.0, 2.0, 1.5, 0x0, 0x0, - 1.0, 1.5, 1.5, 0x0, 0x0, + 1.0, 1.0, 1.0, 0x0, 0x0, + 1.0, 1.0, 1.0, 0x0, 0x0, 1.0, 0x0, 0x0, 1.0, 0x0, 0x0, 0x0, 0x0, 0x0, 0.5, }, - .factor = 120, - .method = .average, + .factor = 15, + .method = .sum, }, .{ .source = .hardness, - .destination = .damage, - .matrix = .{ - 0.0, 0.0, 0.0, 0.0, 0x0, - 0.0, 0.0, 0.0, 0x0, 0x0, - 0.0, 0.0, 0.0, 0x0, 0x0, - 1.0, 0x0, 0x0, 0.0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0.0, - }, - .factor = 0.7, - .method = .average, - }, - .{ - .source = .elasticity, .destination = .maxDurability, .matrix = .{ - 0.0, 1.0, 0.5, 0.5, 0x0, - 1.0, 2.0, 1.0, 0x0, 0x0, - 0.5, 1.0, 2.0, 0x0, 0x0, - 0.5, 0x0, 0x0, 2.0, 0x0, + 0.5, 1.0, 1.0, 1.0, 0x0, + 1.0, 2.5, 1.5, 0x0, 0x0, + 1.0, 1.5, 1.5, 0x0, 0x0, + 1.0, 0x0, 0x0, 1.5, 0x0, 0x0, 0x0, 0x0, 0x0, 1.5, }, - .factor = 120, + .factor = 20, .method = .average, }, .{ - .source = .elasticity, - .destination = .swingTime, + .source = .hardness, + .destination = .damage, .matrix = .{ - 0.0, 0.5, 2.0, 2.5, 0x0, - 0.5, 1.5, 0.5, 0x0, 0x0, - 2.0, 0.5, 0.0, 0x0, 0x0, - 2.5, 0x0, 0x0, 0.0, 0x0, + 0.0, 0.0, 0.1, 0.0, 0x0, + 0.0, 0.0, 0.0, 0x0, 0x0, + 0.1, 0.0, 0.0, 0x0, 0x0, + 1.0, 0x0, 0x0, 0.0, 0x0, 0x0, 0x0, 0x0, 0x0, 0.0, }, - .factor = -1.0, - .method = .average, + .factor = 1.0, + .method = .sum, }, }, } diff --git a/src/items.zig b/src/items.zig index 626825fbc..894450520 100644 --- a/src/items.zig +++ b/src/items.zig @@ -408,7 +408,7 @@ const ToolPhysics = struct { // MARK: ToolPhysics tool.getProperty(property.destination orelse continue).* += sum; } if(tool.damage < 1) tool.damage = 1/(2 - tool.damage); - if(tool.swingTime < 1) tool.swingTime = 1/(2 - tool.swingTime); + if(tool.swingTime < 1) tool.swingTime = 1/(3 - tool.swingTime); for(0..25) |i| { const material = (tool.craftingGrid[i] orelse continue).material() orelse continue; outer: for(material.modifiers) |newMod| { diff --git a/src/renderer.zig b/src/renderer.zig index e6d3619d4..04d6e2b95 100644 --- a/src/renderer.zig +++ b/src/renderer.zig @@ -1062,7 +1062,7 @@ pub const MeshSelection = struct { // MARK: MeshSelection } damage -= block.blockResistance(); if(damage > 0) { - const swingTime = if(isTool) stack.item.?.tool.swingTime else 0.5; + const swingTime = if(isTool) stack.item.?.tool.swingTime else 0.33; if(currentSwingTime != swingTime) { currentSwingProgress = 0; currentSwingTime = swingTime; From 69fb7b50cd72a40b7b620e8213f96ad7e6e2b2e4 Mon Sep 17 00:00:00 2001 From: ikabod-kee Date: Tue, 3 Jun 2025 09:37:40 -0400 Subject: [PATCH 02/12] Update pickaxe.zig.zon --- assets/cubyz/tools/pickaxe.zig.zon | 48 +++++++----------------------- 1 file changed, 11 insertions(+), 37 deletions(-) diff --git a/assets/cubyz/tools/pickaxe.zig.zon b/assets/cubyz/tools/pickaxe.zig.zon index 6abeb8c07..b25f22b97 100644 --- a/assets/cubyz/tools/pickaxe.zig.zon +++ b/assets/cubyz/tools/pickaxe.zig.zon @@ -19,61 +19,35 @@ .source = .density, .destination = .damage, .matrix = .{ - 2.0, 2.0, 1.5, 1.0, 0x0, - 2.0, 1.5, 1.0, 0x0, 0x0, - 1.5, 1.0, 0.6, 0x0, 0x0, - 1.0, 0x0, 0x0, 0.4, 0x0, - 0x0, 0x0, 0x0, 0x0, 0.2, - }, - .factor = 0.2, - .method = .sum, - }, - .{ - .source = .density, - .destination = .damage, - .matrix = .{ - 2.0, 2.0, 1.5, 1.0, 0x0, - 2.0, 1.5, 1.0, 0x0, 0x0, - 1.5, 1.0, 0.3, 0x0, 0x0, - 1.0, 0x0, 0x0, 0.2, 0x0, - 0x0, 0x0, 0x0, 0x0, 0.1, - }, - .factor = 0.3, - .method = .average, - }, - .{ - .source = .hardness, - .destination = .maxDurability, - .matrix = .{ - 0.5, 1.0, 1.0, 1.0, 0x0, + 1.0, 1.0, 1.0, 1.0, 0x0, 1.0, 1.0, 1.0, 0x0, 0x0, 1.0, 1.0, 1.0, 0x0, 0x0, 1.0, 0x0, 0x0, 1.0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0.5, + 0x0, 0x0, 0x0, 0x0, 1.0, }, - .factor = 15, + .factor = 0.25, .method = .sum, }, .{ .source = .hardness, .destination = .maxDurability, .matrix = .{ - 0.5, 1.0, 1.0, 1.0, 0x0, - 1.0, 2.5, 1.5, 0x0, 0x0, - 1.0, 1.5, 1.5, 0x0, 0x0, - 1.0, 0x0, 0x0, 1.5, 0x0, - 0x0, 0x0, 0x0, 0x0, 1.5, + 1.0, 1.0, 1.0, 1.0, 0x0, + 1.0, 1.0, 1.0, 0x0, 0x0, + 1.0, 1.0, 1.0, 0x0, 0x0, + 1.0, 0x0, 0x0, 1.0, 0x0, + 0x0, 0x0, 0x0, 0x0, 1.0, }, .factor = 20, - .method = .average, + .method = .sum, }, .{ .source = .hardness, .destination = .damage, .matrix = .{ - 0.0, 0.0, 0.1, 0.0, 0x0, + 0.0, 0.0, 0.0, 0.0, 0x0, + 0.0, 0.0, 0.0, 0x0, 0x0, 0.0, 0.0, 0.0, 0x0, 0x0, - 0.1, 0.0, 0.0, 0x0, 0x0, 1.0, 0x0, 0x0, 0.0, 0x0, 0x0, 0x0, 0x0, 0x0, 0.0, }, From 4a39423b8849fd2c020859459fb80dfc40c81b27 Mon Sep 17 00:00:00 2001 From: ikabod-kee Date: Tue, 3 Jun 2025 10:42:31 -0400 Subject: [PATCH 03/12] Make the Swing Times faster! --- src/items.zig | 2 +- src/renderer.zig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/items.zig b/src/items.zig index 894450520..8ba1bcc7f 100644 --- a/src/items.zig +++ b/src/items.zig @@ -408,7 +408,7 @@ const ToolPhysics = struct { // MARK: ToolPhysics tool.getProperty(property.destination orelse continue).* += sum; } if(tool.damage < 1) tool.damage = 1/(2 - tool.damage); - if(tool.swingTime < 1) tool.swingTime = 1/(3 - tool.swingTime); + if(tool.swingTime < 1) tool.swingTime = 1/(5 - tool.swingTime); for(0..25) |i| { const material = (tool.craftingGrid[i] orelse continue).material() orelse continue; outer: for(material.modifiers) |newMod| { diff --git a/src/renderer.zig b/src/renderer.zig index 04d6e2b95..2e19526c1 100644 --- a/src/renderer.zig +++ b/src/renderer.zig @@ -1062,7 +1062,7 @@ pub const MeshSelection = struct { // MARK: MeshSelection } damage -= block.blockResistance(); if(damage > 0) { - const swingTime = if(isTool) stack.item.?.tool.swingTime else 0.33; + const swingTime = if(isTool) stack.item.?.tool.swingTime else 0.20; if(currentSwingTime != swingTime) { currentSwingProgress = 0; currentSwingTime = swingTime; From 36533147e68b31d6b891665ad3bafe640ff62c43 Mon Sep 17 00:00:00 2001 From: ikabod-kee Date: Tue, 3 Jun 2025 10:57:07 -0400 Subject: [PATCH 04/12] Increased Durability Factor + Slightly Slower Swing Time --- assets/cubyz/tools/pickaxe.zig.zon | 2 +- src/items.zig | 2 +- src/renderer.zig | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/assets/cubyz/tools/pickaxe.zig.zon b/assets/cubyz/tools/pickaxe.zig.zon index b25f22b97..63ef2a39b 100644 --- a/assets/cubyz/tools/pickaxe.zig.zon +++ b/assets/cubyz/tools/pickaxe.zig.zon @@ -38,7 +38,7 @@ 1.0, 0x0, 0x0, 1.0, 0x0, 0x0, 0x0, 0x0, 0x0, 1.0, }, - .factor = 20, + .factor = 25, .method = .sum, }, .{ diff --git a/src/items.zig b/src/items.zig index 8ba1bcc7f..599eeabee 100644 --- a/src/items.zig +++ b/src/items.zig @@ -408,7 +408,7 @@ const ToolPhysics = struct { // MARK: ToolPhysics tool.getProperty(property.destination orelse continue).* += sum; } if(tool.damage < 1) tool.damage = 1/(2 - tool.damage); - if(tool.swingTime < 1) tool.swingTime = 1/(5 - tool.swingTime); + if(tool.swingTime < 1) tool.swingTime = 1/(4 - tool.swingTime); for(0..25) |i| { const material = (tool.craftingGrid[i] orelse continue).material() orelse continue; outer: for(material.modifiers) |newMod| { diff --git a/src/renderer.zig b/src/renderer.zig index 2e19526c1..120600937 100644 --- a/src/renderer.zig +++ b/src/renderer.zig @@ -1062,7 +1062,7 @@ pub const MeshSelection = struct { // MARK: MeshSelection } damage -= block.blockResistance(); if(damage > 0) { - const swingTime = if(isTool) stack.item.?.tool.swingTime else 0.20; + const swingTime = if(isTool) stack.item.?.tool.swingTime else 0.25; if(currentSwingTime != swingTime) { currentSwingProgress = 0; currentSwingTime = swingTime; From 0825e9d2ab201f2825ae35304a2eb872ab9124b8 Mon Sep 17 00:00:00 2001 From: ikabod-kee Date: Tue, 3 Jun 2025 11:36:08 -0400 Subject: [PATCH 05/12] Changed Block Health and Resistance Now accounts for new pickaxe thresholds. --- assets/cubyz/blocks/copper_ore.zig.zon | 4 ++-- assets/cubyz/blocks/silver_ore.zig.zon | 2 +- assets/cubyz/blocks/uranium_ore.zig.zon | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/assets/cubyz/blocks/copper_ore.zig.zon b/assets/cubyz/blocks/copper_ore.zig.zon index 73b8ba049..e7a7f9466 100644 --- a/assets/cubyz/blocks/copper_ore.zig.zon +++ b/assets/cubyz/blocks/copper_ore.zig.zon @@ -1,7 +1,7 @@ .{ .tags = .{.stone}, - .blockHealth = 35, - .blockResistance = 2, + .blockHealth = 30, + .blockResistance = 3, .ore = .{ .veins = 5, .size = 15, diff --git a/assets/cubyz/blocks/silver_ore.zig.zon b/assets/cubyz/blocks/silver_ore.zig.zon index 6fdab152c..d433d3d65 100644 --- a/assets/cubyz/blocks/silver_ore.zig.zon +++ b/assets/cubyz/blocks/silver_ore.zig.zon @@ -1,7 +1,7 @@ .{ .tags = .{.stone}, .blockHealth = 60, - .blockResistance = 7.0, + .blockResistance = 7, .ore = .{ .veins = 3, .size = 15, diff --git a/assets/cubyz/blocks/uranium_ore.zig.zon b/assets/cubyz/blocks/uranium_ore.zig.zon index 64413ee13..6ecc1ecdd 100644 --- a/assets/cubyz/blocks/uranium_ore.zig.zon +++ b/assets/cubyz/blocks/uranium_ore.zig.zon @@ -1,7 +1,7 @@ .{ .tags = .{.stone}, - .blockHealth = 40, - .blockResistance = 17.5, + .blockHealth = 100, + .blockResistance = 25, .ore = .{ .veins = 1.5, .size = 15, From 875d509ac0e8267f726694575caaf751845c05fc Mon Sep 17 00:00:00 2001 From: ikabod-kee Date: Tue, 3 Jun 2025 11:53:41 -0400 Subject: [PATCH 06/12] Handle and Tool Head Separation --- assets/cubyz/tools/pickaxe.zig.zon | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/assets/cubyz/tools/pickaxe.zig.zon b/assets/cubyz/tools/pickaxe.zig.zon index 63ef2a39b..5f5182757 100644 --- a/assets/cubyz/tools/pickaxe.zig.zon +++ b/assets/cubyz/tools/pickaxe.zig.zon @@ -21,9 +21,9 @@ .matrix = .{ 1.0, 1.0, 1.0, 1.0, 0x0, 1.0, 1.0, 1.0, 0x0, 0x0, - 1.0, 1.0, 1.0, 0x0, 0x0, - 1.0, 0x0, 0x0, 1.0, 0x0, - 0x0, 0x0, 0x0, 0x0, 1.0, + 1.0, 1.0, 0.5, 0x0, 0x0, + 1.0, 0x0, 0x0, 0.5, 0x0, + 0x0, 0x0, 0x0, 0x0, 0.5, }, .factor = 0.25, .method = .sum, @@ -34,9 +34,9 @@ .matrix = .{ 1.0, 1.0, 1.0, 1.0, 0x0, 1.0, 1.0, 1.0, 0x0, 0x0, - 1.0, 1.0, 1.0, 0x0, 0x0, - 1.0, 0x0, 0x0, 1.0, 0x0, - 0x0, 0x0, 0x0, 0x0, 1.0, + 1.0, 1.0, 2.0, 0x0, 0x0, + 1.0, 0x0, 0x0, 2.0, 0x0, + 0x0, 0x0, 0x0, 0x0, 2.0, }, .factor = 25, .method = .sum, From 49dae71d3c06a0ee03c0753e3bddfcd9499a547d Mon Sep 17 00:00:00 2001 From: ikabod-kee Date: Tue, 3 Jun 2025 12:09:32 -0400 Subject: [PATCH 07/12] Changed multiplier from 2x to 3x --- assets/cubyz/tools/pickaxe.zig.zon | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/assets/cubyz/tools/pickaxe.zig.zon b/assets/cubyz/tools/pickaxe.zig.zon index 5f5182757..03efcdf4a 100644 --- a/assets/cubyz/tools/pickaxe.zig.zon +++ b/assets/cubyz/tools/pickaxe.zig.zon @@ -21,9 +21,9 @@ .matrix = .{ 1.0, 1.0, 1.0, 1.0, 0x0, 1.0, 1.0, 1.0, 0x0, 0x0, - 1.0, 1.0, 0.5, 0x0, 0x0, - 1.0, 0x0, 0x0, 0.5, 0x0, - 0x0, 0x0, 0x0, 0x0, 0.5, + 1.0, 1.0, 0.3333, 0x0, 0x0, + 1.0, 0x0, 0x0, 0.3333, 0x0, + 0x0, 0x0, 0x0, 0x0, 0.3333, }, .factor = 0.25, .method = .sum, @@ -34,9 +34,9 @@ .matrix = .{ 1.0, 1.0, 1.0, 1.0, 0x0, 1.0, 1.0, 1.0, 0x0, 0x0, - 1.0, 1.0, 2.0, 0x0, 0x0, - 1.0, 0x0, 0x0, 2.0, 0x0, - 0x0, 0x0, 0x0, 0x0, 2.0, + 1.0, 1.0, 3.0, 0x0, 0x0, + 1.0, 0x0, 0x0, 3.0, 0x0, + 0x0, 0x0, 0x0, 0x0, 3.0, }, .factor = 25, .method = .sum, From 1b60cd7864757135417b2cb73f6745a27cfbe689 Mon Sep 17 00:00:00 2001 From: ikabod-kee Date: Tue, 3 Jun 2025 12:18:56 -0400 Subject: [PATCH 08/12] Changed default swing time back to 0.2 --- src/items.zig | 2 +- src/renderer.zig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/items.zig b/src/items.zig index 599eeabee..8ba1bcc7f 100644 --- a/src/items.zig +++ b/src/items.zig @@ -408,7 +408,7 @@ const ToolPhysics = struct { // MARK: ToolPhysics tool.getProperty(property.destination orelse continue).* += sum; } if(tool.damage < 1) tool.damage = 1/(2 - tool.damage); - if(tool.swingTime < 1) tool.swingTime = 1/(4 - tool.swingTime); + if(tool.swingTime < 1) tool.swingTime = 1/(5 - tool.swingTime); for(0..25) |i| { const material = (tool.craftingGrid[i] orelse continue).material() orelse continue; outer: for(material.modifiers) |newMod| { diff --git a/src/renderer.zig b/src/renderer.zig index 120600937..2e19526c1 100644 --- a/src/renderer.zig +++ b/src/renderer.zig @@ -1062,7 +1062,7 @@ pub const MeshSelection = struct { // MARK: MeshSelection } damage -= block.blockResistance(); if(damage > 0) { - const swingTime = if(isTool) stack.item.?.tool.swingTime else 0.25; + const swingTime = if(isTool) stack.item.?.tool.swingTime else 0.20; if(currentSwingTime != swingTime) { currentSwingProgress = 0; currentSwingTime = swingTime; From 790c6006180018b5325e1075c299cbeff3c91f4b Mon Sep 17 00:00:00 2001 From: ikabod-kee Date: Tue, 3 Jun 2025 14:09:48 -0400 Subject: [PATCH 09/12] Brittle Modifier, Stone is Brittle, Tip, Etc. --- assets/cubyz/blocks/stone.zig.zon | 12 ++++++++++++ assets/cubyz/tools/pickaxe.zig.zon | 8 ++++---- src/tool/modifiers/_list.zig | 1 + src/tool/modifiers/brittle.zig | 28 ++++++++++++++++++++++++++++ 4 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 src/tool/modifiers/brittle.zig diff --git a/assets/cubyz/blocks/stone.zig.zon b/assets/cubyz/blocks/stone.zig.zon index 48e084727..1c23f9b27 100644 --- a/assets/cubyz/blocks/stone.zig.zon +++ b/assets/cubyz/blocks/stone.zig.zon @@ -25,6 +25,18 @@ .amount = 2, }, }, + .{ + .id = "brittle", + .strength = 0.33, + .restriction = .{ + .id = .not, + .child = .{ + .id = .encased, + .tag = .precious, + .amount = 4, + }, + }, + }, }, }, }, diff --git a/assets/cubyz/tools/pickaxe.zig.zon b/assets/cubyz/tools/pickaxe.zig.zon index 03efcdf4a..57b50b4e9 100644 --- a/assets/cubyz/tools/pickaxe.zig.zon +++ b/assets/cubyz/tools/pickaxe.zig.zon @@ -21,9 +21,9 @@ .matrix = .{ 1.0, 1.0, 1.0, 1.0, 0x0, 1.0, 1.0, 1.0, 0x0, 0x0, - 1.0, 1.0, 0.3333, 0x0, 0x0, - 1.0, 0x0, 0x0, 0.3333, 0x0, - 0x0, 0x0, 0x0, 0x0, 0.3333, + 1.0, 1.0, 0.3, 0x0, 0x0, + 1.0, 0x0, 0x0, 0.3, 0x0, + 0x0, 0x0, 0x0, 0x0, 0.3, }, .factor = 0.25, .method = .sum, @@ -35,7 +35,7 @@ 1.0, 1.0, 1.0, 1.0, 0x0, 1.0, 1.0, 1.0, 0x0, 0x0, 1.0, 1.0, 3.0, 0x0, 0x0, - 1.0, 0x0, 0x0, 3.0, 0x0, + 0.3, 0x0, 0x0, 3.0, 0x0, 0x0, 0x0, 0x0, 0x0, 3.0, }, .factor = 25, diff --git a/src/tool/modifiers/_list.zig b/src/tool/modifiers/_list.zig index 2d05043d6..4e628863e 100644 --- a/src/tool/modifiers/_list.zig +++ b/src/tool/modifiers/_list.zig @@ -1,4 +1,5 @@ pub const bad_at = @import("bad_at.zig"); +pub const brittle = @import("brittle.zig"); pub const durable = @import("durable.zig"); pub const fragile = @import("fragile.zig"); pub const good_at = @import("good_at.zig"); diff --git a/src/tool/modifiers/brittle.zig b/src/tool/modifiers/brittle.zig new file mode 100644 index 000000000..55faac77b --- /dev/null +++ b/src/tool/modifiers/brittle.zig @@ -0,0 +1,28 @@ +const std = @import("std"); + +const main = @import("main"); +const Tool = main.items.Tool; + +pub const Data = packed struct(u128) {strength: f32, pad: u96 = undefined}; + +pub const priority = 1; + +pub fn loadData(zon: main.ZonElement) Data { + return .{.strength = std.math.clamp(zon.get(f32, "strength", 0), 0, 1)}; +} + +pub fn combineModifiers(data1: Data, data2: Data) ?Data { + return .{.strength = 1.0 - 1.0/std.math.hypot(1.0/(1.0 - data1.strength), 1.0/(1.0 - data2.strength))}; +} + +pub fn changeToolParameters(tool: *Tool, data: Data) void { + tool.maxDurability *= 1 - data.strength; +} + +pub fn changeBlockDamage(damage: f32, _: main.blocks.Block, _: Data) f32 { + return damage; +} + +pub fn printTooltip(outString: *main.List(u8), data: Data) void { + outString.writer().print("#ccddff**Brittle**#888C8D *Decreases durability by **{d:.0}%", .{data.strength*100}) catch unreachable; +} From 85a4354bedc7904fe664cdd15e9ef3e36e091662 Mon Sep 17 00:00:00 2001 From: ikabod-kee Date: Tue, 3 Jun 2025 17:44:26 -0400 Subject: [PATCH 10/12] Nerfing! --- assets/cubyz/blocks/stone.zig.zon | 2 +- assets/cubyz/items/diamond.zig.zon | 2 +- assets/cubyz/tools/pickaxe.zig.zon | 14 +++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/assets/cubyz/blocks/stone.zig.zon b/assets/cubyz/blocks/stone.zig.zon index 1c23f9b27..d8754fbe3 100644 --- a/assets/cubyz/blocks/stone.zig.zon +++ b/assets/cubyz/blocks/stone.zig.zon @@ -32,7 +32,7 @@ .id = .not, .child = .{ .id = .encased, - .tag = .precious, + .tag = .metal, .amount = 4, }, }, diff --git a/assets/cubyz/items/diamond.zig.zon b/assets/cubyz/items/diamond.zig.zon index bd5f0655b..55d38a727 100644 --- a/assets/cubyz/items/diamond.zig.zon +++ b/assets/cubyz/items/diamond.zig.zon @@ -17,7 +17,7 @@ .child = .{ .id = .encased, .tag = .precious, - .amount = 4, + .amount = 5, }, }, }, diff --git a/assets/cubyz/tools/pickaxe.zig.zon b/assets/cubyz/tools/pickaxe.zig.zon index 57b50b4e9..d4f2ddef4 100644 --- a/assets/cubyz/tools/pickaxe.zig.zon +++ b/assets/cubyz/tools/pickaxe.zig.zon @@ -21,11 +21,11 @@ .matrix = .{ 1.0, 1.0, 1.0, 1.0, 0x0, 1.0, 1.0, 1.0, 0x0, 0x0, - 1.0, 1.0, 0.3, 0x0, 0x0, - 1.0, 0x0, 0x0, 0.3, 0x0, - 0x0, 0x0, 0x0, 0x0, 0.3, + 1.0, 1.0, 0.0, 0x0, 0x0, + 1.0, 0x0, 0x0, 0.0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0.0, }, - .factor = 0.25, + .factor = 0.15, .method = .sum, }, .{ @@ -34,9 +34,9 @@ .matrix = .{ 1.0, 1.0, 1.0, 1.0, 0x0, 1.0, 1.0, 1.0, 0x0, 0x0, - 1.0, 1.0, 3.0, 0x0, 0x0, - 0.3, 0x0, 0x0, 3.0, 0x0, - 0x0, 0x0, 0x0, 0x0, 3.0, + 1.0, 1.0, 2.0, 0x0, 0x0, + 0.2, 0x0, 0x0, 2.0, 0x0, + 0x0, 0x0, 0x0, 0x0, 2.0, }, .factor = 25, .method = .sum, From 5b91e0758c194efc2efce15768c8aeeea92e2c61 Mon Sep 17 00:00:00 2001 From: ikabod-kee Date: Wed, 4 Jun 2025 15:26:21 -0400 Subject: [PATCH 11/12] Removed Optional Slots --- assets/cubyz/tools/pickaxe.zig.zon | 73 +++++++++++++++++++++++------- 1 file changed, 56 insertions(+), 17 deletions(-) diff --git a/assets/cubyz/tools/pickaxe.zig.zon b/assets/cubyz/tools/pickaxe.zig.zon index d4f2ddef4..8f6e64adf 100644 --- a/assets/cubyz/tools/pickaxe.zig.zon +++ b/assets/cubyz/tools/pickaxe.zig.zon @@ -8,38 +8,51 @@ 1, 1, 1, 1, 0, }, .optional = .{ - 1, 1, 0, 0, 0, - 1, 0, 1, 0, 0, - 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, .parameters = .{ + .{ + .source = .density, + .destination = .swingTime, + .matrix = .{ + 2.5, 2.0, 1.5, 1.0, 0x0, + 2.0, 2.0, 1.5, 0x0, 0x0, + 1.5, 1.5, 1.0, 0x0, 0x0, + 1.0, 0x0, 0x0, 1.0, 0x0, + 0x0, 0x0, 0x0, 0x0, 1.0, + }, + .factor = 0.25, + .method = .average, + }, .{ .source = .density, .destination = .damage, .matrix = .{ - 1.0, 1.0, 1.0, 1.0, 0x0, - 1.0, 1.0, 1.0, 0x0, 0x0, - 1.0, 1.0, 0.0, 0x0, 0x0, + 2.5, 2.0, 1.5, 1.0, 0x0, + 2.0, 1.5, 1.0, 0x0, 0x0, + 1.5, 1.0, 0.5, 0x0, 0x0, 1.0, 0x0, 0x0, 0.0, 0x0, 0x0, 0x0, 0x0, 0x0, 0.0, }, - .factor = 0.15, - .method = .sum, + .factor = 0.8, + .method = .average, }, .{ .source = .hardness, .destination = .maxDurability, .matrix = .{ - 1.0, 1.0, 1.0, 1.0, 0x0, - 1.0, 1.0, 1.0, 0x0, 0x0, - 1.0, 1.0, 2.0, 0x0, 0x0, - 0.2, 0x0, 0x0, 2.0, 0x0, - 0x0, 0x0, 0x0, 0x0, 2.0, + 0.5, 1.0, 1.0, 1.0, 0x0, + 1.0, 2.0, 1.5, 0x0, 0x0, + 1.0, 1.5, 1.5, 0x0, 0x0, + 1.0, 0x0, 0x0, 1.0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0.5, }, - .factor = 25, - .method = .sum, + .factor = 120, + .method = .average, }, .{ .source = .hardness, @@ -51,8 +64,34 @@ 1.0, 0x0, 0x0, 0.0, 0x0, 0x0, 0x0, 0x0, 0x0, 0.0, }, - .factor = 1.0, - .method = .sum, + .factor = 0.7, + .method = .average, + }, + .{ + .source = .elasticity, + .destination = .maxDurability, + .matrix = .{ + 0.0, 1.0, 0.5, 0.5, 0x0, + 1.0, 2.0, 1.0, 0x0, 0x0, + 0.5, 1.0, 2.0, 0x0, 0x0, + 0.5, 0x0, 0x0, 2.0, 0x0, + 0x0, 0x0, 0x0, 0x0, 1.5, + }, + .factor = 120, + .method = .average, + }, + .{ + .source = .elasticity, + .destination = .swingTime, + .matrix = .{ + 0.0, 0.5, 2.0, 2.5, 0x0, + 0.5, 1.5, 0.5, 0x0, 0x0, + 2.0, 0.5, 0.0, 0x0, 0x0, + 2.5, 0x0, 0x0, 0.0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0.0, + }, + .factor = -1.0, + .method = .average, }, }, } From 1ad4581d2b59bbd7f5794514806ca8ed903531cd Mon Sep 17 00:00:00 2001 From: ikabod-kee Date: Wed, 4 Jun 2025 15:31:19 -0400 Subject: [PATCH 12/12] Fixed! --- assets/cubyz/tools/pickaxe.zig.zon | 67 +++++++----------------------- 1 file changed, 14 insertions(+), 53 deletions(-) diff --git a/assets/cubyz/tools/pickaxe.zig.zon b/assets/cubyz/tools/pickaxe.zig.zon index 8f6e64adf..9374286b6 100644 --- a/assets/cubyz/tools/pickaxe.zig.zon +++ b/assets/cubyz/tools/pickaxe.zig.zon @@ -15,44 +15,31 @@ 0, 0, 0, 0, 0, }, .parameters = .{ - .{ - .source = .density, - .destination = .swingTime, - .matrix = .{ - 2.5, 2.0, 1.5, 1.0, 0x0, - 2.0, 2.0, 1.5, 0x0, 0x0, - 1.5, 1.5, 1.0, 0x0, 0x0, - 1.0, 0x0, 0x0, 1.0, 0x0, - 0x0, 0x0, 0x0, 0x0, 1.0, - }, - .factor = 0.25, - .method = .average, - }, .{ .source = .density, .destination = .damage, .matrix = .{ - 2.5, 2.0, 1.5, 1.0, 0x0, - 2.0, 1.5, 1.0, 0x0, 0x0, - 1.5, 1.0, 0.5, 0x0, 0x0, + 1.0, 1.0, 1.0, 1.0, 0x0, + 1.0, 1.0, 1.0, 0x0, 0x0, + 1.0, 1.0, 0.0, 0x0, 0x0, 1.0, 0x0, 0x0, 0.0, 0x0, 0x0, 0x0, 0x0, 0x0, 0.0, }, - .factor = 0.8, - .method = .average, + .factor = 0.15, + .method = .sum, }, .{ .source = .hardness, .destination = .maxDurability, .matrix = .{ - 0.5, 1.0, 1.0, 1.0, 0x0, - 1.0, 2.0, 1.5, 0x0, 0x0, - 1.0, 1.5, 1.5, 0x0, 0x0, - 1.0, 0x0, 0x0, 1.0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0.5, + 1.0, 1.0, 1.0, 1.0, 0x0, + 1.0, 1.0, 1.0, 0x0, 0x0, + 1.0, 1.0, 2.0, 0x0, 0x0, + 0.2, 0x0, 0x0, 2.0, 0x0, + 0x0, 0x0, 0x0, 0x0, 2.0, }, - .factor = 120, - .method = .average, + .factor = 25, + .method = .sum, }, .{ .source = .hardness, @@ -64,34 +51,8 @@ 1.0, 0x0, 0x0, 0.0, 0x0, 0x0, 0x0, 0x0, 0x0, 0.0, }, - .factor = 0.7, - .method = .average, - }, - .{ - .source = .elasticity, - .destination = .maxDurability, - .matrix = .{ - 0.0, 1.0, 0.5, 0.5, 0x0, - 1.0, 2.0, 1.0, 0x0, 0x0, - 0.5, 1.0, 2.0, 0x0, 0x0, - 0.5, 0x0, 0x0, 2.0, 0x0, - 0x0, 0x0, 0x0, 0x0, 1.5, - }, - .factor = 120, - .method = .average, - }, - .{ - .source = .elasticity, - .destination = .swingTime, - .matrix = .{ - 0.0, 0.5, 2.0, 2.5, 0x0, - 0.5, 1.5, 0.5, 0x0, 0x0, - 2.0, 0.5, 0.0, 0x0, 0x0, - 2.5, 0x0, 0x0, 0.0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0.0, - }, - .factor = -1.0, - .method = .average, + .factor = 1.0, + .method = .sum, }, }, }