Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions assets/cubyz/biomes/decorative/stone_rock.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,9 @@
.id = "cubyz:tundra/patchy",
.chance = 6,
},
.{
.id = "cubyz:rare/tuften/fields",
.chance = 3,
},
},
}
67 changes: 67 additions & 0 deletions assets/cubyz/biomes/rare/tuften/fields.zig.zon
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
.{
.properties = .{},
.minHeightLimit = 7,
.minHeight = 40,
.maxHeight = 60,
.maxHeightLimit = 50,
.smoothBeaches = true,
.minRadius = 256,
.maxRadius = 320,
.roughness = 1,
.hills = 15,
.chance = 0.02,
.music = "cubyz:sunrise",
.validPlayerSpawn = true,
.ground_structure = .{
"cubyz:grass",
"2 to 3 cubyz:soil",
},
.structures = .{
.{
.id = "cubyz:boulder",
.chance = 0.00016,
.block = "cubyz:slate",
.size = 5,
.size_variance = 1,
},
.{
.id = "cubyz:flower_patch",
.block = "cubyz:daisies",
.chance = 0.01,
.width = 10,
.variation = 6,
.density = 0.3,
.priority = 0.1,
},
.{
.id = "cubyz:flower_patch",
.block = "cubyz:dandelions",
.chance = 0.01,
.width = 6,
.variation = 4,
.density = 0.3,
.priority = 0.1,
},
.{
.id = "cubyz:sbb",
.structure = "cubyz:tree/tuften/tuft_tree",
.placeMode = .degradable,
.chance = 0.05,
},
.{
.id = "cubyz:sbb",
.structure = "cubyz:tree/tuften/young_tuft_tree",
.placeMode = .degradable,
.chance = 0.03,
},
.{
.id = "cubyz:flower_patch",
.block = "cubyz:grass_vegetation",
.chance = 0.1,
.width = 5,
.variation = 8,
.density = 0.5,
.priority = 0.2,
},
},
}
10 changes: 10 additions & 0 deletions assets/cubyz/blocks/candy_cane/block.zig.zon
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.{
.tags = .{.choppable, .wood},
.blockHealth = 8,
.drops = .{
.{.items = .{.auto}},
},
.rotation = "cubyz:stairs",
.model = "cubyz:cube",
.texture = "cubyz:candy_cane/block",
}
31 changes: 31 additions & 0 deletions assets/cubyz/blocks/candy_cane/branch.zig.zon
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
.{
.tags = .{.choppable, .wood},
.blockHealth = 4,
.drops = .{
.{.items = .{.auto}},
},
.absorbedLight = 0x202830,
.rotation = "cubyz:branch",
.model = .{
.radius = 4,
},
.texture0 = "cubyz:candy_cane/branch/dot",
.texture1 = "cubyz:candy_cane/branch/half_line",
.texture2 = "cubyz:candy_cane/branch/line",
.texture3 = "cubyz:candy_cane/branch/bend",
.texture4 = "cubyz:candy_cane/branch/intersection",
.texture5 = "cubyz:candy_cane/branch/cross",
.item = .{
.material = .{
.durability = 260,
.massDamage = 1.5,
.hardnessDamage = 0.5,
.swingSpeed = 4.2,
.textureRoughness = 0.7,
.colors = .{
0xffc4a6a8, 0xffce2632, 0xfffff1ec, 0xfff0424e, 0xffffffff,
},
},
.texture = "candy_cane.png",
},
}
Binary file added assets/cubyz/blocks/textures/candy_cane/block.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/cubyz/blocks/textures/gold_ore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/cubyz/blocks/textures/gold_ore_reflectivity.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/cubyz/items/textures/candy_cane.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/cubyz/items/textures/raw_gold.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/cubyz/items/textures/raw_silver.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions assets/cubyz/recipes/wood_recipes.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@
.inputs = .{"cubyz:log/glimmergill"},
.output = "2 cubyz:glimmergill_branch",
},
.{
.inputs = .{"cubyz:candy_cane/block"},
.output = "2 cubyz:candy_cane/branch",
},

.{
.inputs = .{"cubyz:birch_planks", "cubyz:coal_ore"},
Expand Down
Binary file added assets/cubyz/sbb/tree/tuften/stem/askew/10.blp
Binary file not shown.
Binary file added assets/cubyz/sbb/tree/tuften/stem/askew/7.blp
Binary file not shown.
Binary file added assets/cubyz/sbb/tree/tuften/stem/askew/8.blp
Binary file not shown.
Binary file added assets/cubyz/sbb/tree/tuften/stem/curvy/10.blp
Binary file not shown.
Binary file added assets/cubyz/sbb/tree/tuften/stem/curvy/7.blp
Binary file not shown.
Binary file added assets/cubyz/sbb/tree/tuften/stem/curvy/8.blp
Binary file not shown.
Binary file added assets/cubyz/sbb/tree/tuften/stem/straight/10.blp
Binary file not shown.
Binary file added assets/cubyz/sbb/tree/tuften/stem/straight/5.blp
Binary file not shown.
Binary file added assets/cubyz/sbb/tree/tuften/stem/straight/6.blp
Binary file not shown.
Binary file added assets/cubyz/sbb/tree/tuften/stem/straight/7.blp
Binary file not shown.
Binary file added assets/cubyz/sbb/tree/tuften/stem/straight/8.blp
Binary file not shown.
Binary file added assets/cubyz/sbb/tree/tuften/stem/straight/9.blp
Binary file not shown.
Binary file added assets/cubyz/sbb/tree/tuften/stem/tilt/10.blp
Binary file not shown.
Binary file added assets/cubyz/sbb/tree/tuften/stem/tilt/7.blp
Binary file not shown.
Binary file added assets/cubyz/sbb/tree/tuften/stem/tilt/8.blp
Binary file not shown.
Binary file added assets/cubyz/sbb/tree/tuften/stem/tilt/9.blp
Binary file not shown.
19 changes: 19 additions & 0 deletions assets/cubyz/sbb/tree/tuften/tuft_canopy.zig.zon
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.{
.blueprints = .{
.{.id = "cubyz:tree/tuften/tufts/small/0/violet"},
.{.id = "cubyz:tree/tuften/tufts/small/0/pink"},
.{.id = "cubyz:tree/tuften/tufts/small/0/red"},
.{.id = "cubyz:tree/tuften/tufts/small/0/orange"},
.{.id = "cubyz:tree/tuften/tufts/small/0/yellow"},
.{.id = "cubyz:tree/tuften/tufts/small/1/violet"},
.{.id = "cubyz:tree/tuften/tufts/small/1/pink"},
.{.id = "cubyz:tree/tuften/tufts/small/1/red"},
.{.id = "cubyz:tree/tuften/tufts/small/1/orange"},
.{.id = "cubyz:tree/tuften/tufts/small/1/yellow"},
.{.id = "cubyz:tree/tuften/tufts/big/violet"},
.{.id = "cubyz:tree/tuften/tufts/big/pink"},
.{.id = "cubyz:tree/tuften/tufts/big/red"},
.{.id = "cubyz:tree/tuften/tufts/big/orange"},
.{.id = "cubyz:tree/tuften/tufts/big/yellow"},
},
}
24 changes: 24 additions & 0 deletions assets/cubyz/sbb/tree/tuften/tuft_tree.zig.zon
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.{
.blueprints = .{
.{.id = "cubyz:tree/tuften/stem/straight/5"},
.{.id = "cubyz:tree/tuften/stem/straight/6"},
.{.id = "cubyz:tree/tuften/stem/straight/7"},
.{.id = "cubyz:tree/tuften/stem/straight/8", .chance = 0.5},
.{.id = "cubyz:tree/tuften/stem/straight/9", .chance = 0.5},
.{.id = "cubyz:tree/tuften/stem/straight/10", .chance = 0.5},
.{.id = "cubyz:tree/tuften/stem/tilt/7"},
.{.id = "cubyz:tree/tuften/stem/tilt/8"},
.{.id = "cubyz:tree/tuften/stem/tilt/9"},
.{.id = "cubyz:tree/tuften/stem/tilt/10"},
.{.id = "cubyz:tree/tuften/stem/curvy/7"},
.{.id = "cubyz:tree/tuften/stem/askew/8"},
.{.id = "cubyz:tree/tuften/stem/askew/8"},
.{.id = "cubyz:tree/tuften/stem/askew/10"},
.{.id = "cubyz:tree/tuften/stem/curvy/7"},
.{.id = "cubyz:tree/tuften/stem/curvy/8"},
.{.id = "cubyz:tree/tuften/stem/curvy/10"},
},
.children = .{
.pink = "cubyz:tree/tuften/tuft_canopy",
},
}
Binary file added assets/cubyz/sbb/tree/tuften/tufts/big/orange.blp
Binary file not shown.
Binary file added assets/cubyz/sbb/tree/tuften/tufts/big/pink.blp
Binary file not shown.
Binary file added assets/cubyz/sbb/tree/tuften/tufts/big/red.blp
Binary file not shown.
Binary file added assets/cubyz/sbb/tree/tuften/tufts/big/violet.blp
Binary file not shown.
Binary file added assets/cubyz/sbb/tree/tuften/tufts/big/yellow.blp
Binary file not shown.
Binary file not shown.
Binary file added assets/cubyz/sbb/tree/tuften/tufts/small/0/pink.blp
Binary file not shown.
Binary file added assets/cubyz/sbb/tree/tuften/tufts/small/0/red.blp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added assets/cubyz/sbb/tree/tuften/tufts/small/1/pink.blp
Binary file not shown.
Binary file added assets/cubyz/sbb/tree/tuften/tufts/small/1/red.blp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added assets/cubyz/sbb/tree/tuften/young/stem/curvy/6.blp
Binary file not shown.
Binary file added assets/cubyz/sbb/tree/tuften/young/stem/curvy/7.blp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added assets/cubyz/sbb/tree/tuften/young/stem/tilt/5.blp
Binary file not shown.
Binary file added assets/cubyz/sbb/tree/tuften/young/stem/tilt/6.blp
Binary file not shown.
Binary file added assets/cubyz/sbb/tree/tuften/young/stem/tilt/7.blp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added assets/cubyz/sbb/tree/tuften/young/tufts/big/red.blp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
14 changes: 14 additions & 0 deletions assets/cubyz/sbb/tree/tuften/young_tuft_canopy.zig.zon
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.{
.blueprints = .{
.{.id = "cubyz:tree/tuften/young/tufts/small/violet"},
.{.id = "cubyz:tree/tuften/young/tufts/small/pink"},
.{.id = "cubyz:tree/tuften/young/tufts/small/red"},
.{.id = "cubyz:tree/tuften/young/tufts/small/orange"},
.{.id = "cubyz:tree/tuften/young/tufts/small/yellow"},
.{.id = "cubyz:tree/tuften/young/tufts/big/violet"},
.{.id = "cubyz:tree/tuften/young/tufts/big/pink"},
.{.id = "cubyz:tree/tuften/young/tufts/big/red"},
.{.id = "cubyz:tree/tuften/young/tufts/big/orange"},
.{.id = "cubyz:tree/tuften/young/tufts/big/yellow"},
},
}
15 changes: 15 additions & 0 deletions assets/cubyz/sbb/tree/tuften/young_tuft_tree.zig.zon
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.{
.blueprints = .{
.{.id = "cubyz:tree/tuften/young/stem/straight/4"},
.{.id = "cubyz:tree/tuften/young/stem/straight/5"},
.{.id = "cubyz:tree/tuften/young/stem/straight/6"},
.{.id = "cubyz:tree/tuften/young/stem/straight/7"},
.{.id = "cubyz:tree/tuften/young/stem/tilt/5"},
.{.id = "cubyz:tree/tuften/young/stem/tilt/6"},
.{.id = "cubyz:tree/tuften/young/stem/curvy/6"},
.{.id = "cubyz:tree/tuften/young/stem/curvy/7"},
},
.children = .{
.pink = "cubyz:tree/tuften/young_tuft_canopy",
},
}
63 changes: 33 additions & 30 deletions src/gui/GuiWindow.zig
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const std = @import("std");

const main = @import("main");
const utils = main.utils;
const graphics = main.graphics;
const draw = graphics.draw;
const Texture = graphics.Texture;
Expand Down Expand Up @@ -164,39 +165,41 @@ pub fn getButtonPositions(self: *const GuiWindow) [3]f32 {
const zoomInPos = zoomOutPos - iconWidth*self.scale;
return .{closePos, zoomOutPos, zoomInPos};
}

pub fn mainButtonReleased(self: *GuiWindow, mousePosition: Vec2f) void {
if(grabPosition != null and @reduce(.And, grabPosition.? == mousePosition) and grabbedWindow == self) {
if(self.showTitleBar or gui.reorderWindows) {
const btnPos = self.getButtonPositions();
const closePos = btnPos[0];
const zoomOutPos = btnPos[1];
const zoomInPos = btnPos[2];
if(mousePosition[0] - self.pos[0] > zoomInPos) {
if(mousePosition[0] - self.pos[0] > zoomOutPos) {
if(mousePosition[0] - self.pos[0] > closePos) {
// Close
if(self.closeable) gui.closeWindowFromRef(self);
} else {
// Zoom out
if(self.scale > 1) {
self.scale -= 0.5;
} else {
self.scale -= 0.25;
}
self.scale = @max(self.scale, 0.25);
gui.updateWindowPositions();
gui.save();
}
if(grabPosition != null and grabbedWindow == self and (self.showTitleBar or gui.reorderWindows)) {
const btnPos = self.getButtonPositions();
const closePos = btnPos[0];
const zoomOutPos = btnPos[1];
const zoomInPos = btnPos[2];
const mousePositionRelative = mousePosition - self.pos;
const grabPositionRelative = if(grabPosition) |gp| gp - self.pos else @as(@Vector(2, f32), .{0.0, 0.0});

if(mousePositionRelative[1] >= 0 and mousePositionRelative[1] <= titleBarHeight) {
if(mousePositionRelative[0] > zoomInPos and mousePositionRelative[0] <= zoomOutPos and grabPositionRelative[0] > zoomInPos and grabPositionRelative[0] <= zoomOutPos) {
// Zoom in
if(self.scale >= 1) {
self.scale += 0.5;
} else {
self.scale += 0.25;
}
gui.updateWindowPositions();
gui.save();
}
if(mousePositionRelative[0] > zoomOutPos and mousePositionRelative[0] <= closePos and grabPositionRelative[0] > zoomOutPos and grabPositionRelative[0] <= closePos) {
// Zoom out
if(self.scale > 1) {
self.scale -= 0.5;
} else {
// Zoom in
if(self.scale >= 1) {
self.scale += 0.5;
} else {
self.scale += 0.25;
}
gui.updateWindowPositions();
gui.save();
self.scale -= 0.25;
}
self.scale = @max(self.scale, 0.25);
gui.updateWindowPositions();
gui.save();
}
if(mousePositionRelative[0] > closePos and grabPositionRelative[0] > closePos) {
// Close
if(self.closeable) gui.closeWindowFromRef(self);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/renderer.zig
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ pub const MeshSelection = struct { // MARK: MeshSelection
}

fn canPlaceBlock(pos: Vec3i, block: main.blocks.Block) bool {
if(main.game.collision.collideWithBlock(block, pos[0], pos[1], pos[2], main.game.Player.getPosBlocking() + main.game.Player.outerBoundingBox.center(), main.game.Player.outerBoundingBox.extent() - @as(Vec3d, @splat(0.00005)), .{0, 0, 0}) != null) {
if(main.game.collision.collideWithBlock(block, pos[0], pos[1], pos[2], main.game.Player.getPosBlocking() + main.game.Player.outerBoundingBox.center(), main.game.Player.outerBoundingBox.extent(), .{0, 0, 0}) != null) {
return false;
}
return true; // TODO: Check other entities
Expand Down