forked from mt-mods/vacuum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathphysics_plants.lua
70 lines (66 loc) · 2.07 KB
/
physics_plants.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
-- plants
minetest.register_node("vacuum:dead_leaves", {
description = "Dead Leaves",
drawtype = "plantlike",
waving = 1,
tiles = {"default_dry_shrub.png^dead_leaves.png"},
inventory_image = "default_dry_shrub.png^dead_leaves.png",
wield_image = "default_dry_shrub.png^dead_leaves.png",
paramtype = "light",
paramtype2 = "meshoptions",
place_param2 = 4,
sunlight_propagates = true,
walkable = false,
buildable_to = true,
groups = {
snappy = 3,
flammable = 3,
attached_node = 1
},
sounds = default.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",
fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, 4 / 16, 6 / 16}
}
})
function vacuum.register_physics_plants(height)
-- plants in vacuum
minetest.register_abm({
label = "space vacuum plants",
nodenames = {"group:sapling", "group:plant", "group:flora", "group:flower", "group:leafdecay",
"ethereal:banana", "ethereal:orange", "ethereal:strawberry"},
neighbors = {"vacuum:vacuum", "asteroid:atmos"},
interval = 2,
chance = 3,
max_y = height.end_height,
min_y = height.start_height,
action = vacuum.throttle(1000, function(pos)
if vacuum.is_pos_in_spawn(pos) then
return
end
minetest.set_node(pos, {
name = "default:dry_shrub"
})
end)
})
-- leaves in vacuum
minetest.register_abm({
label = "space vacuum plants",
nodenames = {"group:leaves"},
neighbors = {"vacuum:vacuum", "asteroid:atmos"},
interval = 2,
chance = 3,
max_y = height.end_height,
min_y = height.start_height,
action = vacuum.throttle(2000, function(pos)
if vacuum.is_pos_in_spawn(pos) then
return
end
if vacuum.near_vacuum(pos, 1, 4) then
minetest.set_node(pos, {
name = "vacuum:dead_leaves"
})
end
end)
})
end