Skip to content

Commit 0ca43e4

Browse files
committed
Default: Create 'grass', 'dry_grass' groups, use in dirt conversion ABM
1 parent 33aa5e7 commit 0ca43e4

File tree

2 files changed

+11
-18
lines changed

2 files changed

+11
-18
lines changed

mods/default/functions.lua

+4-12
Original file line numberDiff line numberDiff line change
@@ -362,16 +362,8 @@ minetest.register_abm({
362362
"default:dirt_with_grass",
363363
"default:dirt_with_dry_grass",
364364
"default:dirt_with_snow",
365-
"default:grass_1",
366-
"default:grass_2",
367-
"default:grass_3",
368-
"default:grass_4",
369-
"default:grass_5",
370-
"default:dry_grass_1",
371-
"default:dry_grass_2",
372-
"default:dry_grass_3",
373-
"default:dry_grass_4",
374-
"default:dry_grass_5",
365+
"group:grass",
366+
"group:dry_grass",
375367
"default:snow",
376368
},
377369
interval = 6,
@@ -408,9 +400,9 @@ minetest.register_abm({
408400
if name == "default:snow" then
409401
minetest.set_node(pos, {name = "default:dirt_with_snow"})
410402
-- Most likely case first.
411-
elseif name:sub(1, 13) == "default:grass" then
403+
elseif minetest.get_item_group(name, "grass") ~= 0 then
412404
minetest.set_node(pos, {name = "default:dirt_with_grass"})
413-
elseif name:sub(1, 17) == "default:dry_grass" then
405+
elseif minetest.get_item_group(name, "dry_grass") ~= 0 then
414406
minetest.set_node(pos, {name = "default:dirt_with_dry_grass"})
415407
end
416408
end

mods/default/nodes.lua

+7-6
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,7 @@ minetest.register_node("default:junglegrass", {
947947
sunlight_propagates = true,
948948
walkable = false,
949949
buildable_to = true,
950-
groups = {snappy = 3, flora = 1, attached_node = 1},
950+
groups = {snappy = 3, flora = 1, attached_node = 1, grass = 1},
951951
sounds = default.node_sound_leaves_defaults(),
952952
selection_box = {
953953
type = "fixed",
@@ -968,7 +968,7 @@ minetest.register_node("default:grass_1", {
968968
sunlight_propagates = true,
969969
walkable = false,
970970
buildable_to = true,
971-
groups = {snappy = 3, flora = 1, attached_node = 1},
971+
groups = {snappy = 3, flora = 1, attached_node = 1, grass = 1},
972972
sounds = default.node_sound_leaves_defaults(),
973973
selection_box = {
974974
type = "fixed",
@@ -998,7 +998,7 @@ for i = 2, 5 do
998998
buildable_to = true,
999999
drop = "default:grass_1",
10001000
groups = {snappy = 3, flora = 1, attached_node = 1,
1001-
not_in_creative_inventory = 1},
1001+
not_in_creative_inventory = 1, grass = 1},
10021002
sounds = default.node_sound_leaves_defaults(),
10031003
selection_box = {
10041004
type = "fixed",
@@ -1019,7 +1019,8 @@ minetest.register_node("default:dry_grass_1", {
10191019
sunlight_propagates = true,
10201020
walkable = false,
10211021
buildable_to = true,
1022-
groups = {snappy = 3, flammable = 3, flora = 1, attached_node = 1},
1022+
groups = {snappy = 3, flammable = 3, flora = 1,
1023+
attached_node = 1, dry_grass = 1},
10231024
sounds = default.node_sound_leaves_defaults(),
10241025
selection_box = {
10251026
type = "fixed",
@@ -1047,8 +1048,8 @@ for i = 2, 5 do
10471048
sunlight_propagates = true,
10481049
walkable = false,
10491050
buildable_to = true,
1050-
groups = {snappy = 3, flammable = 3, flora = 1,
1051-
attached_node = 1, not_in_creative_inventory=1},
1051+
groups = {snappy = 3, flammable = 3, flora = 1, attached_node = 1,
1052+
not_in_creative_inventory=1, dry_grass = 1},
10521053
drop = "default:dry_grass_1",
10531054
sounds = default.node_sound_leaves_defaults(),
10541055
selection_box = {

0 commit comments

Comments
 (0)