-
Notifications
You must be signed in to change notification settings - Fork 1
/
init.lua
33 lines (31 loc) · 912 Bytes
/
init.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
-- override default apple
minetest.override_item("default:apple", {
after_dig_node = function(pos, oldnode, oldmetadata, digger)
if oldnode.param2 == 0 then
minetest.set_node(pos, {name = "endless_apples:apple_mark"})
minetest.get_node_timer(pos):start(math.random(300, 1500))
end
end,
})
-- air node to mark apple pos
minetest.register_node("endless_apples:apple_mark", {
description = "Air!",
drawtype = "airlike",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
pointable = false,
diggable = false,
buildable_to = true,
drop = "",
groups = {not_in_creative_inventory = 1},
on_timer = function(pos, elapsed)
if not minetest.find_node_near(pos, 1, "default:leaves") then
minetest.remove_node(pos)
elseif minetest.get_node_light(pos) < 13 then
minetest.get_node_timer(pos):start(200)
else
minetest.set_node(pos, {name = "default:apple"})
end
end
})