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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
|
pep = {}
function pep.register_potion(potiondef)
local on_use
if(potiondef.effect_type ~= nil) then
on_use = function(itemstack, user, pointed_thing)
playereffects.apply_effect_type(potiondef.effect_type, potiondef.duration, user)
itemstack:take_item()
return itemstack
end
else
on_use = function(itemstack, user, pointed_thing)
itemstack:take_item()
return itemstack
end
end
minetest.register_craftitem("pep:"..potiondef.basename, {
description = "Glass Bottle ("..potiondef.contentstring..")",
inventory_image = "pep_"..potiondef.basename..".png",
wield_image = "pep_"..potiondef.basename..".png",
on_use = on_use,
})
end
playereffects.register_effect_type("pepspeedplus", "High speed", nil, {"speed"},
function(player)
player:set_physics_override({speed=2})
end,
function(effect, player)
player:set_physics_override({speed=1})
end
)
playereffects.register_effect_type("pepspeedminus", "Low speed", nil, {"speed"},
function(player)
player:set_physics_override({speed=0.5})
end,
function(effect, player)
player:set_physics_override({speed=1})
end
)
playereffects.register_effect_type("pepspeedreset", "Speed neutralizer", nil, {"speed"},
function() end, function() end)
playereffects.register_effect_type("pepjumpplus", "High jump", nil, {"jump"},
function(player)
player:set_physics_override({jump=2})
end,
function(effect, player)
player:set_physics_override({jump=1})
end
)
playereffects.register_effect_type("pepjumpminus", "Low jump", nil, {"jump"},
function(player)
player:set_physics_override({jump=0.5})
end,
function(effect, player)
player:set_physics_override({jump=1})
end
)
playereffects.register_effect_type("pepjumpreset", "Jump height neutralizer", nil, {"jump"},
function() end, function() end)
playereffects.register_effect_type("pepgrav0", "No gravity", nil, {"gravity"},
function(player)
player:set_physics_override({gravity=0})
end,
function(effect, player)
player:set_physics_override({gravity=1})
end
)
playereffects.register_effect_type("pepgravreset", "Gravity neutralizer", nil, {"gravity"},
function() end, function() end)
playereffects.register_effect_type("pepregen", "Regeneration", nil, {"health"},
function(player)
player:set_hp(player:get_hp()+1)
end,
nil, nil, nil, 2
)
playereffects.register_effect_type("pepregen2", "Strong regeneration", nil, {"health"},
function(player)
player:set_hp(player:get_hp()+2)
end,
nil, nil, nil, 1
)
playereffects.register_effect_type("pepbreath", "Perfect breath", nil, {"breath"},
function(player)
player:set_breath(player:get_breath()+2)
end,
nil, nil, nil, 1
)
pep.register_potion({
basename = "speedplus",
contentstring = "Running Potion",
effect_type = "pepspeedplus",
duration = 30
})
pep.register_potion({
basename = "speedminus",
contentstring = "Slug Potion",
effect_type = "pepspeedminus",
duration = 30
})
pep.register_potion({
basename = "speedreset",
contentstring = "Speed Neutralizer",
effect_type = "pepspeedreset",
duration = 0
})
pep.register_potion({
basename = "breath",
contentstring = "Air Potion",
effect_type = "pepbreath",
duration = 30,
})
pep.register_potion({
basename = "regen",
contentstring = "Weak Healing Potion",
effect_type = "pepregen",
duration = 10,
})
pep.register_potion({
basename = "regen2",
contentstring = "Strong Healing Potion",
effect_type = "pepregen2",
duration = 10,
})
pep.register_potion({
basename = "grav0",
contentstring = "Non-Gravity Potion",
effect_type = "pepgrav0",
duration = 20,
})
pep.register_potion({
basename = "gravreset",
contentstring = "Gravity Neutralizer",
effect_type = "pepgravreset",
duration = 0,
})
pep.register_potion({
basename = "jumpplus",
contentstring = "High Jumping Potion",
effect_type = "pepjumpplus",
duration = 30,
})
pep.register_potion({
basename = "jumpminus",
contentstring = "Low Jumping Potion",
effect_type = "pepjumpminus",
duration = 30,
})
pep.register_potion({
basename = "jumpreset",
contentstring = "Jump Neutralizer",
effect_type = "pepjumpreset",
duration = 0,
})
--[=[ register crafts ]=]
--[[ normal potions ]]
if(minetest.get_modpath("vessels")~=nil) then
if(minetest.get_modpath("default")~=nil) then
minetest.register_craft({
type = "shapeless",
output = "pep:breath",
recipe = { "default:papyrus", "default:papyrus", "default:papyrus", "default:papyrus",
"default:papyrus", "default:papyrus", "default:papyrus", "default:papyrus", "vessels:glass_bottle" }
})
minetest.register_craft({
type = "shapeless",
output = "pep:speedminus",
recipe = { "default:dry_shrub", "vessels:glass_bottle" }
})
if(minetest.get_modpath("flowers") ~= nil) then
minetest.register_craft({
type = "shapeless",
output = "pep:jumpplus",
recipe = { "flowers:flower_geranium", "default:grass_1", "vessels:glass_bottle" }
})
end
minetest.register_craft({
type = "shapeless",
output = "pep:jumpminus",
recipe = { "default:leaves", "default:jungleleaves", "vessels:glass_bottle" }
})
minetest.register_craft({
type = "shapeless",
output = "pep:regen",
recipe = { "default:cactus", "default:junglegrass", "vessels:glass_bottle" }
})
minetest.register_craft({
type = "shapeless",
output = "pep:grav0",
recipe = { "default:mese_crystal", "vessels:glass_bottle" }
})
end
if(minetest.get_modpath("flowers") ~= nil) then
minetest.register_craft({
type = "shapeless",
output = "pep:speedplus",
recipe = { "flowers:rose", "flowers:dandelion_yellow", "vessels:glass_bottle" }
})
end
end
if(minetest.get_modpath("default") ~= nil) then
minetest.register_craft({
type = "shapeless",
output = "pep:regen2",
recipe = { "default:gold_lump", "pep:regen" }
})
end
--[[ independent crafts ]]
minetest.register_craft({
type = "shapeless",
output = "pep:speedreset",
recipe = { "pep:speedplus", "pep:speedminus" }
})
minetest.register_craft({
type = "shapeless",
output = "pep:jumpreset",
recipe = { "pep:jumpplus", "pep:jumpminus" }
})
minetest.register_craft({
type = "shapeless",
output = "pep:gravreset" ,
recipe = { "pep:grav0", "group:stone" }
})
|