-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnature.lua
More file actions
83 lines (72 loc) · 2.01 KB
/
nature.lua
File metadata and controls
83 lines (72 loc) · 2.01 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
local S = minetest.get_translator(minetest.get_current_modname())
local function process_leaves(pos)
if not pos then
return 0
end
local node = minetest.get_node(pos)
local dir_x = 0.001
local dir_z = 0.001
local acl_x = 0.2 * (dir_x)
local acl_z = 0.2 * (dir_z)
ctg_airs.spawn_particle(pos, dir_x, dir_z, acl_x, acl_z)
local count = 0
for j = 1, 4 do
local sz = j
local pos1 = vector.subtract(pos, {
x = sz,
y = sz,
z = sz
})
local pos2 = vector.add(pos, {
x = sz,
y = sz,
z = sz
})
local nodes_thin = minetest.find_nodes_in_area(pos1, pos2, {"vacuum:atmos_thin"})
for i, node in ipairs(nodes_thin) do
if node ~= nil then
if (vacuum.has_in_range(node, "air", 2, 2)) then
-- minetest.log("update thin")
minetest.set_node(node, {
name = "air"
})
count = count + 1
end
end
end
if count > 5 and j > 1 then
break
end
end
-- minetest.log("nature making atmos..")
end
-- producing nodes in thing atmos
minetest.register_abm({
label = "space vacuum sublimate",
nodenames = {"group:leaves"},
neighbors = {"vacuum:atmos_thin"},
interval = 1,
chance = 2,
min_y = vacuum.space_height,
action = vacuum.throttle(100, function(pos)
if not vacuum.is_pos_in_space(pos) then
return
end
process_leaves(pos)
end)
})
-- producing nodes in thing atmos
minetest.register_abm({
label = "space vacuum sublimate",
nodenames = {"vacuum:atmos_thin"},
neighbors = {"group:leaves"},
interval = 2,
chance = 2,
min_y = vacuum.space_height,
action = vacuum.throttle(100, function(pos)
if not vacuum.is_pos_in_space(pos) then
return
end
process_leaves(pos)
end)
})