forked from Ezhh/endless_apples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
67 lines (64 loc) · 1.92 KB
/
init.lua
File metadata and controls
67 lines (64 loc) · 1.92 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
-- alternative apple
minetest.register_node("endless_apples:apple", {
description = "Apple",
drawtype = "plantlike",
tiles = {"default_apple.png"},
inventory_image = "default_apple.png",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
is_ground_content = false,
selection_box = {
type = "fixed",
fixed = {-3 / 16, -7 / 16, -3 / 16, 3 / 16, 4 / 16, 3 / 16}
},
groups = {fleshy = 3, dig_immediate = 3, flammable = 2,
leafdecay = 3, leafdecay_drop = 1, food_apple = 1},
on_use = minetest.item_eat(2),
sounds = default.node_sound_leaves_defaults(),
})
-- override default apple
minetest.register_node(":default:apple", {
description = "Apple",
drawtype = "plantlike",
tiles = {"default_apple.png"},
inventory_image = "default_apple.png",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
is_ground_content = false,
selection_box = {
type = "fixed",
fixed = {-3 / 16, -7 / 16, -3 / 16, 3 / 16, 4 / 16, 3 / 16}
},
groups = {fleshy = 3, dig_immediate = 3, flammable = 2,
leafdecay = 3, leafdecay_drop = 1, food_apple = 1,
not_in_creative_inventory = 1},
on_use = minetest.item_eat(2),
sounds = default.node_sound_leaves_defaults(),
after_dig_node = function(pos, oldnode, oldmetadata, digger)
minetest.set_node(pos, {name = "endless_apples:apple_mark", param2 = 1})
minetest.get_node_timer(pos):start(math.random(120, 300))
end,
drop = "endless_apples:apple"
})
-- 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 minetest.get_node(pos).param1 < 12 then
minetest.get_node_timer(pos):start(math.random(40, 75))
return
end
minetest.set_node(pos, {name = "default:apple"})
end
})