forked from MineClone5/MineClone5
Change flower placement rules
This commit is contained in:
parent
b7f50d9028
commit
765a2bc51e
|
@ -711,7 +711,6 @@ minetest.register_node("mcl_core:sapling", {
|
||||||
meta:set_int("stage", 0)
|
meta:set_int("stage", 0)
|
||||||
end,
|
end,
|
||||||
node_placement_prediction = "",
|
node_placement_prediction = "",
|
||||||
on_place = mcl_util.on_place_non_mycelium_plant,
|
|
||||||
_mcl_blast_resistance = 0,
|
_mcl_blast_resistance = 0,
|
||||||
_mcl_hardness = 0,
|
_mcl_hardness = 0,
|
||||||
})
|
})
|
||||||
|
@ -797,7 +796,6 @@ minetest.register_node("mcl_core:darksapling", {
|
||||||
meta:set_int("stage", 0)
|
meta:set_int("stage", 0)
|
||||||
end,
|
end,
|
||||||
node_placement_prediction = "",
|
node_placement_prediction = "",
|
||||||
on_place = mcl_util.on_place_non_mycelium_plant,
|
|
||||||
_mcl_blast_resistance = 0,
|
_mcl_blast_resistance = 0,
|
||||||
_mcl_hardness = 0,
|
_mcl_hardness = 0,
|
||||||
})
|
})
|
||||||
|
@ -941,7 +939,6 @@ minetest.register_node("mcl_core:junglesapling", {
|
||||||
meta:set_int("stage", 0)
|
meta:set_int("stage", 0)
|
||||||
end,
|
end,
|
||||||
node_placement_prediction = "",
|
node_placement_prediction = "",
|
||||||
on_place = mcl_util.on_place_non_mycelium_plant,
|
|
||||||
_mcl_blast_resistance = 0,
|
_mcl_blast_resistance = 0,
|
||||||
_mcl_hardness = 0,
|
_mcl_hardness = 0,
|
||||||
})
|
})
|
||||||
|
@ -1018,7 +1015,6 @@ minetest.register_node("mcl_core:acaciasapling", {
|
||||||
meta:set_int("stage", 0)
|
meta:set_int("stage", 0)
|
||||||
end,
|
end,
|
||||||
node_placement_prediction = "",
|
node_placement_prediction = "",
|
||||||
on_place = mcl_util.on_place_non_mycelium_plant,
|
|
||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
groups = {dig_immediate=3, plant=1,sapling=1,non_mycelium_plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,deco_block=1},
|
groups = {dig_immediate=3, plant=1,sapling=1,non_mycelium_plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,deco_block=1},
|
||||||
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||||
|
@ -1106,7 +1102,6 @@ minetest.register_node("mcl_core:sprucesapling", {
|
||||||
meta:set_int("stage", 0)
|
meta:set_int("stage", 0)
|
||||||
end,
|
end,
|
||||||
node_placement_prediction = "",
|
node_placement_prediction = "",
|
||||||
on_place = mcl_util.on_place_non_mycelium_plant,
|
|
||||||
_mcl_blast_resistance = 0,
|
_mcl_blast_resistance = 0,
|
||||||
_mcl_hardness = 0,
|
_mcl_hardness = 0,
|
||||||
})
|
})
|
||||||
|
@ -1186,7 +1181,6 @@ minetest.register_node("mcl_core:birchsapling", {
|
||||||
meta:set_int("stage", 0)
|
meta:set_int("stage", 0)
|
||||||
end,
|
end,
|
||||||
node_placement_prediction = "",
|
node_placement_prediction = "",
|
||||||
on_place = mcl_util.on_place_non_mycelium_plant,
|
|
||||||
_mcl_blast_resistance = 0,
|
_mcl_blast_resistance = 0,
|
||||||
_mcl_hardness = 0,
|
_mcl_hardness = 0,
|
||||||
})
|
})
|
||||||
|
@ -1291,7 +1285,6 @@ minetest.register_node("mcl_core:reeds", {
|
||||||
groups = {dig_immediate=3, craftitem=1, plant=1, non_mycelium_plant=1, dig_by_piston=1},
|
groups = {dig_immediate=3, craftitem=1, plant=1, non_mycelium_plant=1, dig_by_piston=1},
|
||||||
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||||
node_placement_prediction = "",
|
node_placement_prediction = "",
|
||||||
on_place = mcl_util.on_place_non_mycelium_plant,
|
|
||||||
_mcl_blast_resistance = 0,
|
_mcl_blast_resistance = 0,
|
||||||
_mcl_hardness = 0,
|
_mcl_hardness = 0,
|
||||||
})
|
})
|
||||||
|
@ -1848,7 +1841,6 @@ minetest.register_node("mcl_core:deadbush", {
|
||||||
fixed = {-6/16, -8/16, -6/16, 6/16, 8/16, 6/16},
|
fixed = {-6/16, -8/16, -6/16, 6/16, 8/16, 6/16},
|
||||||
},
|
},
|
||||||
node_placement_prediction = "",
|
node_placement_prediction = "",
|
||||||
on_place = mcl_util.on_place_non_mycelium_plant,
|
|
||||||
_mcl_blast_resistance = 0,
|
_mcl_blast_resistance = 0,
|
||||||
_mcl_hardness = 0,
|
_mcl_hardness = 0,
|
||||||
})
|
})
|
||||||
|
|
|
@ -172,7 +172,19 @@ local function add_large_plant(name, desc, longdesc, bottom_img, top_img, inv_im
|
||||||
local bottom_buildable = minetest.registered_nodes[minetest.get_node(bottom).name].buildable_to
|
local bottom_buildable = minetest.registered_nodes[minetest.get_node(bottom).name].buildable_to
|
||||||
local top_buildable = minetest.registered_nodes[minetest.get_node(top).name].buildable_to
|
local top_buildable = minetest.registered_nodes[minetest.get_node(top).name].buildable_to
|
||||||
local floorname = minetest.get_node({x=bottom.x, y=bottom.y-1, z=bottom.z}).name
|
local floorname = minetest.get_node({x=bottom.x, y=bottom.y-1, z=bottom.z}).name
|
||||||
if floorname ~= "mcl_core:mycelium" and minetest.registered_nodes[floorname].walkable and bottom_buildable and top_buildable then
|
|
||||||
|
local light_night = minetest.get_node_light(bottom, 0.0)
|
||||||
|
local light_day = minetest.get_node_light(bottom, 0.5)
|
||||||
|
local light_ok = false
|
||||||
|
if (light_night and light_night >= 8) or (light_day and light_day >= minetest.LIGHT_MAX) then
|
||||||
|
light_ok = true
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Placement rules:
|
||||||
|
-- * Allowed on dirt or grass block
|
||||||
|
-- * Only with light level >= 8
|
||||||
|
-- * Only if two enough space
|
||||||
|
if (floorname == "mcl_core:dirt" or floorname == "mcl_core:dirt_with_grass" or floorname == "mcl_core:dirt_with_grass_snow") and bottom_buildable and top_buildable and light_ok then
|
||||||
-- Success! We can now place the flower
|
-- Success! We can now place the flower
|
||||||
minetest.sound_play(minetest.registered_nodes["mcl_flowers:"..name].sounds.place, {pos = bottom, gain=1})
|
minetest.sound_play(minetest.registered_nodes["mcl_flowers:"..name].sounds.place, {pos = bottom, gain=1})
|
||||||
minetest.set_node(bottom, {name="mcl_flowers:"..name})
|
minetest.set_node(bottom, {name="mcl_flowers:"..name})
|
||||||
|
|
Loading…
Reference in New Issue