-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinit.lua
More file actions
149 lines (140 loc) · 4.29 KB
/
init.lua
File metadata and controls
149 lines (140 loc) · 4.29 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
--
-- Blocks :
--
minetest.register_node("potions_and_magic:vitality_plant", {
description = "vitality plant",
drawtype = "plantlike",
waving = 1,
tiles = {"pm_vitality_plant.png"},
inventory_image = "pm_vitality_plant.png",
wield_image = "pm_vitality_plant.png",
groups = {flammable = 1, snappy = 3, flower = 1, flora = 1, attached_node = 1},
sounds = default.node_sound_leaves_defaults(),
sunlight_propagates = true,
paramtype = "light",
walkable = false,
buildable_to = true,
selection_box = {
type = "fixed",
fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 2 / 16, 4 / 16}
},
})
minetest.register_node("potions_and_magic:glow_mushroom", {
description = "glow mushroom",
drawtype = "plantlike",
tiles = {"pm_glow_mushroom.png"},
inventory_image = "pm_glow_mushroom.png",
wield_image = "pm_glow_mushroom.png",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
buildable_to = true,
groups = {snappy = 3, attached_node = 1, flammable = 1},
sounds = default.node_sound_leaves_defaults(),
light_source = 6,
selection_box = {
type = "fixed",
fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, -1 / 16, 4 / 16},
},
})
minetest.register_node("potions_and_magic:gillykelp", {
description = "gillykelp",
drawtype = "plantlike_rooted",
waving = 1,
tiles = {"default_sand.png"}, -- texture de la "racine"
special_tiles = {{name = "pm_gillykelp.png", tileable_vertical = true}},
use_texture_alpha = "clip",
inventory_image = "pm_gillykelp.png",
wield_image = "pm_gillykelp.png",
groups = {flammable = 1, snappy = 3, flora = 1, attached_node = 1},
sounds = default.node_sound_leaves_defaults(),
sunlight_propagates = true,
paramtype = "light",
walkable = false,
buildable_to = true,
light_source = 2,
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
{-4/16, 0.5, -4/16, 4/16, 1.5, 4/16},
},
},
})
minetest.register_node("potions_and_magic:sugar_cane", {
description = "sugar cane",
drawtype = "plantlike",
tiles = {"pm_sugar_cane.png"},
inventory_image = "pm_sugar_cane.png",
wield_image = "pm_sugar_cane.png",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
groups = {snappy = 3, flammable = 1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("potions_and_magic:slime_block", {
description = "slime block",
drawtype = "nodebox",
use_texture_alpha = "blend",
tiles = {"pm_slime_block.png"},
paramtype = "light",
sunlight_propagates = true,
groups = {snappy = 3, bouncy = 80, fall_damage_add_percent = -100},
light_source = 3,
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.3, 0.5},
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.3, -0.3, -0.3, 0.3, 0.1, 0.3},
},
},
})
--
-- Items :
--
minetest.register_craftitem("potions_and_magic:water_glass_bottle", {
description = "bottle of water",
inventory_image = "pm_water_glass_bottle.png",
on_use = minetest.item_eat(0),
})
local golden_apple_count = {} -- Permet l'accumulation de l'effet
minetest.register_craftitem("potions_and_magic:golden_apple",{
description = "Golden Apple",
inventory_image = "pm_golden_apple.png",
on_use = function(itemstack, user, pointed_thing)
user:set_physics_override({gravity = -1})
if golden_apple_count[user] == nil then -- Pour la première utilisation
golden_apple_count[user] = 1
else
golden_apple_count[user] = golden_apple_count[user] + 1
end
minetest.after(1, function()
golden_apple_count[user] = golden_apple_count[user] - 1
if golden_apple_count[user] == 0 then
user:set_physics_override({gravity = 1})
end
end)
end
})
minetest.register_craftitem("potions_and_magic:sugar",{
description = "Sugar",
inventory_image = "pm_sugar.png",
-- on_use = minetest.item_eat(1)
})
minetest.register_craftitem("potions_and_magic:slime",{
description = "Slime",
inventory_image = "pm_slime.png"
})
local pm_path = minetest.get_modpath("potions_and_magic")
-- Crafts :
dofile(pm_path.."/crafts.lua")
-- Generation :
dofile(pm_path.."/gen.lua")
-- Potions :
dofile(pm_path.."/potions.lua")