From f1f2cd4d4e45c62040740f80760cd4ca1d550edf Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Thu, 30 Nov 2017 23:39:34 -0800 Subject: [PATCH] Fix grass spread bug. --- init.lua | 10 +++++----- readme.md | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/init.lua b/init.lua index 45af8bc..4b64fa2 100644 --- a/init.lua +++ b/init.lua @@ -28,7 +28,7 @@ local function cmpy(p2, y) return math.max(1, p2) end end -local function after_place_node(pos, placer, itemstack, pointed_thing) +local function on_construct(pos) -- get chunk from pos local v = vector.apply(pos, function(a) return math.floor((a - 48) / chunksize) end) local o = vector.subtract(pos, vector.apply(v, function(a) return (a * chunksize) + 48 end)) @@ -59,7 +59,7 @@ minetest.override_item("default:dirt_with_grass", { tiles = {"luscious_grass.png", {name = "default_dirt.png", color = "white"}, "luscious_grass.png"}, overlay_tiles = {"", "", {name = "luscious_dirt_overlay.png", color = "white"}}, place_param2 = 136, - after_place_node = after_place_node, + on_construct = on_construct, }) for _, v in pairs({ @@ -80,7 +80,7 @@ for _, v in pairs({ color = "#8afb94ff", tiles = {tile}, place_param2 = 136, - after_place_node = after_place_node, + on_construct = on_construct, }) end @@ -105,7 +105,7 @@ for _, v in pairs({ color = "#7dea1eff", tiles = {tile}, place_param2 = 136, - after_place_node = after_place_node, + on_construct = on_construct, }) end for i = 1, 5 do @@ -182,7 +182,7 @@ local function update_p2(pos, size) local p = vector.new(x, y, z) local node = minetest.get_node(p) if cn[node.name] then - after_place_node(p) + on_construct(p) end end end diff --git a/readme.md b/readme.md index 841ff06..04461f5 100644 --- a/readme.md +++ b/readme.md @@ -24,7 +24,9 @@ nodes in the landscape. - separate palette to color leaves and grass. - should not break with texture packs, but you'll lose texture pack specific leaf and grass textures. +- grass spread places the correct color. - jungle dirt is replaced by dirt with grass. +- jungle grass is also colored. - dirt with dry grass is replaced by dirt with grass. - dirt with snow is replaced by dirt with grass. - dry grass is replaced with grass. @@ -32,7 +34,6 @@ nodes in the landscape. ## bugs - leaf decay is broken due to p2 usage -- grass spread is broken or will place wrongly colored grass nodes - snowy pine trees are no longer generated, only regular pines ## palette