forked from luanti-org/minetest_game
		
	Default, flowers: Improve plant selection boxes
Selection box width is limited to 14 / 16 node to visually distinguish box from any neighbouring cubic nodes.
This commit is contained in:
		@@ -523,7 +523,7 @@ minetest.register_node("default:sapling", {
 | 
			
		||||
	on_timer = default.grow_sapling,
 | 
			
		||||
	selection_box = {
 | 
			
		||||
		type = "fixed",
 | 
			
		||||
		fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
 | 
			
		||||
		fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16}
 | 
			
		||||
	},
 | 
			
		||||
	groups = {snappy = 2, dig_immediate = 3, flammable = 2,
 | 
			
		||||
		attached_node = 1, sapling = 1},
 | 
			
		||||
@@ -588,7 +588,7 @@ minetest.register_node("default:apple", {
 | 
			
		||||
	is_ground_content = false,
 | 
			
		||||
	selection_box = {
 | 
			
		||||
		type = "fixed",
 | 
			
		||||
		fixed = {-0.2, -0.5, -0.2, 0.2, 0, 0.2}
 | 
			
		||||
		fixed = {-3 / 16, -7 / 16, -3 / 16, 3 / 16, 4 / 16, 3 / 16}
 | 
			
		||||
	},
 | 
			
		||||
	groups = {fleshy = 3, dig_immediate = 3, flammable = 2,
 | 
			
		||||
		leafdecay = 3, leafdecay_drop = 1},
 | 
			
		||||
@@ -659,7 +659,7 @@ minetest.register_node("default:junglesapling", {
 | 
			
		||||
	on_timer = default.grow_sapling,
 | 
			
		||||
	selection_box = {
 | 
			
		||||
		type = "fixed",
 | 
			
		||||
		fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
 | 
			
		||||
		fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16}
 | 
			
		||||
	},
 | 
			
		||||
	groups = {snappy = 2, dig_immediate = 3, flammable = 2,
 | 
			
		||||
		attached_node = 1, sapling = 1},
 | 
			
		||||
@@ -739,7 +739,7 @@ minetest.register_node("default:pine_sapling", {
 | 
			
		||||
	on_timer = default.grow_sapling,
 | 
			
		||||
	selection_box = {
 | 
			
		||||
		type = "fixed",
 | 
			
		||||
		fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
 | 
			
		||||
		fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16}
 | 
			
		||||
	},
 | 
			
		||||
	groups = {snappy = 2, dig_immediate = 3, flammable = 3,
 | 
			
		||||
		attached_node = 1, sapling = 1},
 | 
			
		||||
@@ -819,7 +819,7 @@ minetest.register_node("default:acacia_sapling", {
 | 
			
		||||
	on_timer = default.grow_sapling,
 | 
			
		||||
	selection_box = {
 | 
			
		||||
		type = "fixed",
 | 
			
		||||
		fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
 | 
			
		||||
		fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16}
 | 
			
		||||
	},
 | 
			
		||||
	groups = {snappy = 2, dig_immediate = 3, flammable = 2,
 | 
			
		||||
		attached_node = 1, sapling = 1},
 | 
			
		||||
@@ -898,7 +898,7 @@ minetest.register_node("default:aspen_sapling", {
 | 
			
		||||
	on_timer = default.grow_sapling,
 | 
			
		||||
	selection_box = {
 | 
			
		||||
		type = "fixed",
 | 
			
		||||
		fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
 | 
			
		||||
		fixed = {-3 / 16, -0.5, -3 / 16, 3 / 16, 0.5, 3 / 16}
 | 
			
		||||
	},
 | 
			
		||||
	groups = {snappy = 2, dig_immediate = 3, flammable = 3,
 | 
			
		||||
		attached_node = 1, sapling = 1},
 | 
			
		||||
@@ -1061,7 +1061,7 @@ minetest.register_node("default:papyrus", {
 | 
			
		||||
	walkable = false,
 | 
			
		||||
	selection_box = {
 | 
			
		||||
		type = "fixed",
 | 
			
		||||
		fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3}
 | 
			
		||||
		fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, 0.5, 6 / 16},
 | 
			
		||||
	},
 | 
			
		||||
	groups = {snappy = 3, flammable = 2},
 | 
			
		||||
	sounds = default.node_sound_leaves_defaults(),
 | 
			
		||||
@@ -1087,7 +1087,7 @@ minetest.register_node("default:dry_shrub", {
 | 
			
		||||
	sounds = default.node_sound_leaves_defaults(),
 | 
			
		||||
	selection_box = {
 | 
			
		||||
		type = "fixed",
 | 
			
		||||
		fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
 | 
			
		||||
		fixed = {-5 / 16, -0.5, -5 / 16, 5 / 16, 4 / 16, 5 / 16},
 | 
			
		||||
	},
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
@@ -1107,7 +1107,7 @@ minetest.register_node("default:junglegrass", {
 | 
			
		||||
	sounds = default.node_sound_leaves_defaults(),
 | 
			
		||||
	selection_box = {
 | 
			
		||||
		type = "fixed",
 | 
			
		||||
		fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
 | 
			
		||||
		fixed = {-7 / 16, -0.5, -7 / 16, 7 / 16, 1.19, 7 / 16},
 | 
			
		||||
	},
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
@@ -1128,7 +1128,7 @@ minetest.register_node("default:grass_1", {
 | 
			
		||||
	sounds = default.node_sound_leaves_defaults(),
 | 
			
		||||
	selection_box = {
 | 
			
		||||
		type = "fixed",
 | 
			
		||||
		fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
 | 
			
		||||
		fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, -5 / 16, 6 / 16},
 | 
			
		||||
	},
 | 
			
		||||
 | 
			
		||||
	on_place = function(itemstack, placer, pointed_thing)
 | 
			
		||||
@@ -1158,7 +1158,7 @@ for i = 2, 5 do
 | 
			
		||||
		sounds = default.node_sound_leaves_defaults(),
 | 
			
		||||
		selection_box = {
 | 
			
		||||
			type = "fixed",
 | 
			
		||||
			fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
 | 
			
		||||
			fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, -3 / 16, 6 / 16},
 | 
			
		||||
		},
 | 
			
		||||
	})
 | 
			
		||||
end
 | 
			
		||||
@@ -1180,7 +1180,7 @@ minetest.register_node("default:dry_grass_1", {
 | 
			
		||||
	sounds = default.node_sound_leaves_defaults(),
 | 
			
		||||
	selection_box = {
 | 
			
		||||
		type = "fixed",
 | 
			
		||||
		fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
 | 
			
		||||
		fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, -3 / 16, 6 / 16},
 | 
			
		||||
	},
 | 
			
		||||
 | 
			
		||||
	on_place = function(itemstack, placer, pointed_thing)
 | 
			
		||||
@@ -1210,7 +1210,7 @@ for i = 2, 5 do
 | 
			
		||||
		sounds = default.node_sound_leaves_defaults(),
 | 
			
		||||
		selection_box = {
 | 
			
		||||
			type = "fixed",
 | 
			
		||||
			fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
 | 
			
		||||
			fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, -1 / 16, 6 / 16},
 | 
			
		||||
		},
 | 
			
		||||
	})
 | 
			
		||||
end
 | 
			
		||||
@@ -1227,6 +1227,10 @@ minetest.register_node("default:bush_stem", {
 | 
			
		||||
	sunlight_propagates = true,
 | 
			
		||||
	groups = {choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
 | 
			
		||||
	sounds = default.node_sound_wood_defaults(),
 | 
			
		||||
	selection_box = {
 | 
			
		||||
		type = "fixed",
 | 
			
		||||
		fixed = {-7 / 16, -0.5, -7 / 16, 7 / 16, 0.54, 7 / 16},
 | 
			
		||||
	},
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
minetest.register_node("default:bush_leaves", {
 | 
			
		||||
@@ -1250,6 +1254,10 @@ minetest.register_node("default:acacia_bush_stem", {
 | 
			
		||||
	sunlight_propagates = true,
 | 
			
		||||
	groups = {choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
 | 
			
		||||
	sounds = default.node_sound_wood_defaults(),
 | 
			
		||||
	selection_box = {
 | 
			
		||||
		type = "fixed",
 | 
			
		||||
		fixed = {-7 / 16, -0.5, -7 / 16, 7 / 16, 0.54, 7 / 16},
 | 
			
		||||
	},
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
minetest.register_node("default:acacia_bush_leaves", {
 | 
			
		||||
 
 | 
			
		||||
@@ -57,12 +57,42 @@ local function add_simple_flower(name, desc, box, f_groups)
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
flowers.datas = {
 | 
			
		||||
	{"rose", "Rose", {-0.15, -0.5, -0.15, 0.15, 0.3, 0.15}, {color_red = 1, flammable = 1}},
 | 
			
		||||
	{"tulip", "Orange Tulip", {-0.15, -0.5, -0.15, 0.15, 0.2, 0.15}, {color_orange = 1, flammable = 1}},
 | 
			
		||||
	{"dandelion_yellow", "Yellow Dandelion", {-0.15, -0.5, -0.15, 0.15, 0.2, 0.15}, {color_yellow = 1, flammable = 1}},
 | 
			
		||||
	{"geranium", "Blue Geranium", {-0.15, -0.5, -0.15, 0.15, 0.2, 0.15}, {color_blue = 1, flammable = 1}},
 | 
			
		||||
	{"viola", "Viola", {-0.5, -0.5, -0.5, 0.5, -0.2, 0.5}, {color_violet = 1, flammable = 1}},
 | 
			
		||||
	{"dandelion_white", "White dandelion", {-0.5, -0.5, -0.5, 0.5, -0.2, 0.5}, {color_white = 1, flammable = 1}}
 | 
			
		||||
	{
 | 
			
		||||
		"rose",
 | 
			
		||||
		"Rose",
 | 
			
		||||
		{-2 / 16, -0.5, -2 / 16, 2 / 16, 5 / 16, 2 / 16},
 | 
			
		||||
		{color_red = 1, flammable = 1}
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		"tulip",
 | 
			
		||||
		"Orange Tulip",
 | 
			
		||||
		{-2 / 16, -0.5, -2 / 16, 2 / 16, 3 / 16, 2 / 16},
 | 
			
		||||
		{color_orange = 1, flammable = 1}
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		"dandelion_yellow",
 | 
			
		||||
		"Yellow Dandelion",
 | 
			
		||||
		{-2 / 16, -0.5, -2 / 16, 2 / 16, 4 / 16, 2 / 16},
 | 
			
		||||
		{color_yellow = 1, flammable = 1}
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		"geranium",
 | 
			
		||||
		"Blue Geranium",
 | 
			
		||||
		{-2 / 16, -0.5, -2 / 16, 2 / 16, 2 / 16, 2 / 16},
 | 
			
		||||
		{color_blue = 1, flammable = 1}
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		"viola",
 | 
			
		||||
		"Viola",
 | 
			
		||||
		{-5 / 16, -0.5, -5 / 16, 5 / 16, -1 / 16, 5 / 16},
 | 
			
		||||
		{color_violet = 1, flammable = 1}
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		"dandelion_white",
 | 
			
		||||
		"White dandelion",
 | 
			
		||||
		{-5 / 16, -0.5, -5 / 16, 5 / 16, -2 / 16, 5 / 16},
 | 
			
		||||
		{color_white = 1, flammable = 1}
 | 
			
		||||
	},
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
for _,item in pairs(flowers.datas) do
 | 
			
		||||
@@ -141,7 +171,7 @@ minetest.register_node("flowers:mushroom_red", {
 | 
			
		||||
	on_use = minetest.item_eat(-5),
 | 
			
		||||
	selection_box = {
 | 
			
		||||
		type = "fixed",
 | 
			
		||||
		fixed = {-0.3, -0.5, -0.3, 0.3, 0, 0.3}
 | 
			
		||||
		fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, -1 / 16, 4 / 16},
 | 
			
		||||
	}
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
@@ -160,7 +190,7 @@ minetest.register_node("flowers:mushroom_brown", {
 | 
			
		||||
	on_use = minetest.item_eat(1),
 | 
			
		||||
	selection_box = {
 | 
			
		||||
		type = "fixed",
 | 
			
		||||
		fixed = {-0.3, -0.5, -0.3, 0.3, 0, 0.3}
 | 
			
		||||
		fixed = {-3 / 16, -0.5, -3 / 16, 3 / 16, -2 / 16, 3 / 16},
 | 
			
		||||
	}
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
@@ -234,11 +264,11 @@ minetest.register_node("flowers:waterlily", {
 | 
			
		||||
	node_placement_prediction = "",
 | 
			
		||||
	node_box = {
 | 
			
		||||
		type = "fixed",
 | 
			
		||||
		fixed = {-0.5, -0.5, -0.5, 0.5, -0.46875, 0.5}
 | 
			
		||||
		fixed = {-0.5, -0.5, -0.5, 0.5, -15 / 32, 0.5}
 | 
			
		||||
	},
 | 
			
		||||
	selection_box = {
 | 
			
		||||
		type = "fixed",
 | 
			
		||||
		fixed = {-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5}
 | 
			
		||||
		fixed = {-7 / 16, -0.5, -7 / 16, 7 / 16, -15 / 32, 7 / 16}
 | 
			
		||||
	},
 | 
			
		||||
 | 
			
		||||
	on_place = function(itemstack, placer, pointed_thing)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user