-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathgrass.lua
70 lines (65 loc) · 1.84 KB
/
grass.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
minetest.register_node("mymonths:fall_grass", {
description = "Dirt with Grass",
tiles = {"default_grass.png^[colorize:brown:50", "default_dirt.png",
{name = "default_dirt.png^(default_grass_side.png^[colorize:brown:50)",
tileable_vertical = false}},
groups = {crumbly = 3, soil = 1, spreading_dirt_type = 1},
drop = 'default:dirt',
sounds = default.node_sound_dirt_defaults({
footstep = {name = "default_grass_footstep", gain = 0.25},
}),
soil = {
base = "default:dirt_with_dry_grass",
dry = "farming:soil",
wet = "farming:soil_wet"
}
})
minetest.register_abm({
nodenames = {'default:dirt_with_grass'},
interval = 60,
chance = 40,
action = function (pos, node, active_object_count, active_object_count_wider)
if mymonths.month_counter == 9
or mymonths.month_counter == 10 then
minetest.set_node(pos, {name = 'mymonths:fall_grass'})
end
end
})
minetest.register_abm({
nodenames = {'mymonths:fall_grass'},
interval = 60,
chance = 40,
action = function (pos, node, active_object_count, active_object_count_wider)
if mymonths.month_counter == 3 then
minetest.set_node(pos, {name = 'default:dirt_with_grass'})
end
end
})
minetest.register_lbm({
name = "mymonths:change_grass",
nodenames = {'default:dirt_with_grass', 'mymonths:fall_grass'},
run_at_every_load = true,
action = function (pos, node)
local n = node.name
local month = tonumber(mymonths.month_counter)
local day = tonumber(mymonths.day_counter)
if month == 11
or month == 12
or month == 1
or month == 2 then
if n == 'default:dirt_with_grass' then
minetest.set_node(pos, {name = 'mymonths:fall_grass'})
end
elseif month == 4
or month == 5
or month == 6
or month == 7
or month == 8
or month == 9
or month == 10 then
if n == 'mymonths:fall_grass' then
minetest.set_node(pos, {name = 'default:dirt_with_grass'})
end
end
end
})