forked from MineClone5/MineClone5
Generalize grass color check
This commit is contained in:
parent
a9d95dea23
commit
cf1b999ab6
|
@ -13,9 +13,12 @@ local on_place_flower = mcl_util.generate_on_place_plant_function(function(pos,
|
||||||
if not soil_node then return false end
|
if not soil_node then return false end
|
||||||
|
|
||||||
local has_palette = minetest.registered_nodes[itemstack:get_name()].palette ~= nil
|
local has_palette = minetest.registered_nodes[itemstack:get_name()].palette ~= nil
|
||||||
local colorize = 0
|
local colorize
|
||||||
if has_palette and (soil_node.name == "mcl_core:dirt_with_dry_grass" or soil_node.name == "mcl_core:dirt_with_dry_grass_snow") then
|
if has_palette then
|
||||||
colorize = 1
|
colorize = minetest.registered_nodes[soil_node.name]._mcl_grass_palette_index
|
||||||
|
end
|
||||||
|
if not colorize then
|
||||||
|
colorize = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[ Placement requirements:
|
--[[ Placement requirements:
|
||||||
|
@ -235,8 +238,8 @@ local function add_large_plant(name, desc, longdesc, bottom_img, top_img, inv_im
|
||||||
-- * Only if two enough space
|
-- * Only if two enough space
|
||||||
if (floorname == "mcl_core:dirt" or minetest.get_item_group(floorname, "grass_block") == 1 or (not is_flower and (floorname == "mcl_core:coarse_dirt" or floorname == "mcl_core:podzol" or floorname == "mcl_core:podzol_snow"))) and bottom_buildable and top_buildable and light_ok then
|
if (floorname == "mcl_core:dirt" or minetest.get_item_group(floorname, "grass_block") == 1 or (not is_flower and (floorname == "mcl_core:coarse_dirt" or floorname == "mcl_core:podzol" or floorname == "mcl_core:podzol_snow"))) and bottom_buildable and top_buildable and light_ok then
|
||||||
local param2
|
local param2
|
||||||
if grass_color and (floorname == "mcl_core:dirt_with_dry_grass" or floorname == "mcl_core:dirt_with_dry_grass_snow") then
|
if grass_color then
|
||||||
param2 = 1
|
param2 = minetest.registered_nodes[floorname]._mcl_grass_palette_index
|
||||||
end
|
end
|
||||||
-- Success! We can now place the flower
|
-- Success! We can now place the flower
|
||||||
minetest.sound_play(minetest.registered_nodes[itemstring].sounds.place, {pos = bottom, gain=1})
|
minetest.sound_play(minetest.registered_nodes[itemstring].sounds.place, {pos = bottom, gain=1})
|
||||||
|
|
Loading…
Reference in New Issue