forked from VoxeLibre/VoxeLibre
Merge branch 'master' of https://git.minetest.land/Wuzzy/MineClone2 into master
This commit is contained in:
commit
d6c7c9dcd0
|
@ -152,22 +152,22 @@ local function brewing_stand_timer(pos, elapsed)
|
||||||
|
|
||||||
d = 0.5
|
d = 0.5
|
||||||
minetest.add_particlespawner({
|
minetest.add_particlespawner({
|
||||||
amount = 4,
|
amount = 4,
|
||||||
time = 1,
|
time = 1,
|
||||||
minpos = {x=pos.x-d, y=pos.y+0.5, z=pos.z-d},
|
minpos = {x=pos.x-d, y=pos.y+0.5, z=pos.z-d},
|
||||||
maxpos = {x=pos.x+d, y=pos.y+2, z=pos.z+d},
|
maxpos = {x=pos.x+d, y=pos.y+2, z=pos.z+d},
|
||||||
minvel = {x=-0.1, y=0, z=-0.1},
|
minvel = {x=-0.1, y=0, z=-0.1},
|
||||||
maxvel = {x=0.1, y=0.5, z=0.1},
|
maxvel = {x=0.1, y=0.5, z=0.1},
|
||||||
minacc = {x=-0.05, y=0, z=-0.05},
|
minacc = {x=-0.05, y=0, z=-0.05},
|
||||||
maxacc = {x=0.05, y=.1, z=0.05},
|
maxacc = {x=0.05, y=.1, z=0.05},
|
||||||
minexptime = 1,
|
minexptime = 1,
|
||||||
maxexptime = 2,
|
maxexptime = 2,
|
||||||
minsize = 0.5,
|
minsize = 0.5,
|
||||||
maxsize = 2,
|
maxsize = 2,
|
||||||
collisiondetection = true,
|
collisiondetection = true,
|
||||||
vertical = false,
|
vertical = false,
|
||||||
texture = "mcl_brewing_bubble_sprite.png",
|
texture = "mcl_brewing_bubble_sprite.png",
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Replace the stand item with the brew result
|
-- Replace the stand item with the brew result
|
||||||
if stand_timer >= BREW_TIME then
|
if stand_timer >= BREW_TIME then
|
||||||
|
@ -231,7 +231,6 @@ local function brewing_stand_timer(pos, elapsed)
|
||||||
meta:set_float("fuel_timer", fuel_timer)
|
meta:set_float("fuel_timer", fuel_timer)
|
||||||
meta:set_float("stand_timer", stand_timer)
|
meta:set_float("stand_timer", stand_timer)
|
||||||
meta:set_float("fuel", fuel)
|
meta:set_float("fuel", fuel)
|
||||||
-- meta:set_list("stand_items", stand_list)
|
|
||||||
meta:set_string("formspec", formspec)
|
meta:set_string("formspec", formspec)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
@ -313,15 +312,15 @@ local doc_string =
|
||||||
S("To use a brewing stand, rightclick it.").."\n"..
|
S("To use a brewing stand, rightclick it.").."\n"..
|
||||||
S("To brew, you need blaze powder as fuel, a brewing material and at least 1 glass bottle filled with a liquid.").."\n"..
|
S("To brew, you need blaze powder as fuel, a brewing material and at least 1 glass bottle filled with a liquid.").."\n"..
|
||||||
S("Place the blaze powder in the left slot, the brewing material in the middle slot and 1-3 bottles in the remaining slots.").."\n"..
|
S("Place the blaze powder in the left slot, the brewing material in the middle slot and 1-3 bottles in the remaining slots.").."\n"..
|
||||||
S("When you have found a good comination, the brewing will commence automatically and steam starts to appear, using up the fuel and brewing material. The potions will soon be ready.").."\n"..
|
S("When you have found a good combination, the brewing will commence automatically and steam starts to appear, using up the fuel and brewing material. The potions will soon be ready.").."\n"..
|
||||||
S("Different combinations of brewing materials and liquids will give different results. Try to experiment!")
|
S("Different combinations of brewing materials and liquids will give different results. Try to experiment!")
|
||||||
|
|
||||||
local tiles = {"mcl_brewing_top.png", --top
|
local tiles = {"mcl_brewing_top.png", --top
|
||||||
"mcl_brewing_base.png", --bottom
|
"mcl_brewing_base.png", --bottom
|
||||||
"mcl_brewing_side.png", --right
|
"mcl_brewing_side.png", --right
|
||||||
"mcl_brewing_side.png", --left
|
"mcl_brewing_side.png", --left
|
||||||
"mcl_brewing_side.png", --back
|
"mcl_brewing_side.png", --back
|
||||||
"mcl_brewing_side.png^[transformFX"} --front
|
"mcl_brewing_side.png^[transformFX"} --front
|
||||||
|
|
||||||
local allow_put = function(pos, listname, index, stack, player)
|
local allow_put = function(pos, listname, index, stack, player)
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
|
@ -856,7 +855,6 @@ minetest.register_node("mcl_brewing:stand_011", {
|
||||||
_mcl_blast_resistance = 1,
|
_mcl_blast_resistance = 1,
|
||||||
_mcl_hardness = 1,
|
_mcl_hardness = 1,
|
||||||
on_destruct = on_destruct,
|
on_destruct = on_destruct,
|
||||||
-- after_dig_node = after_dig,
|
|
||||||
allow_metadata_inventory_take = allow_take,
|
allow_metadata_inventory_take = allow_take,
|
||||||
allow_metadata_inventory_put = allow_put,
|
allow_metadata_inventory_put = allow_put,
|
||||||
on_metadata_inventory_put = on_put,
|
on_metadata_inventory_put = on_put,
|
||||||
|
|
|
@ -4,7 +4,7 @@ Inventory=Inventar
|
||||||
To use a brewing stand, rightclick it.=Um einen Braustand zu benutzen, rechtsklicken Sie ihn.
|
To use a brewing stand, rightclick it.=Um einen Braustand zu benutzen, rechtsklicken Sie ihn.
|
||||||
To brew, you need blaze powder as fuel, a brewing material and at least 1 glass bottle filled with a liquid.=Zum Brauen benötigt man Lohenstaub als Brennstoff, ein Braumaterial und mindestens 1 Glasflasche, die mit einer Flüssigkeit gefüllt ist.
|
To brew, you need blaze powder as fuel, a brewing material and at least 1 glass bottle filled with a liquid.=Zum Brauen benötigt man Lohenstaub als Brennstoff, ein Braumaterial und mindestens 1 Glasflasche, die mit einer Flüssigkeit gefüllt ist.
|
||||||
Place the blaze powder in the left slot, the brewing material in the middle slot and 1-3 bottles in the remaining slots.=Platzieren Sie den Lohenstaub in den linken Plartz, das Braumaterial in den mittleren Platz und 1-3 Glasflaschen in die übrigen Plätze.
|
Place the blaze powder in the left slot, the brewing material in the middle slot and 1-3 bottles in the remaining slots.=Platzieren Sie den Lohenstaub in den linken Plartz, das Braumaterial in den mittleren Platz und 1-3 Glasflaschen in die übrigen Plätze.
|
||||||
When you have found a good comination, the brewing will commence automatically and steam starts to appear, using up the fuel and brewing material. The potions will soon be ready.=Wenn Sie eine gute Kombination gefunden haben, beginnt der Brauvorgang automatisch, und es entsteht Dampf. Der Brennstoff und das Brühmaterial wird aufbraucht. Die Tränke werden bald fertig sein.
|
When you have found a good combination, the brewing will commence automatically and steam starts to appear, using up the fuel and brewing material. The potions will soon be ready.=Wenn Sie eine gute Kombination gefunden haben, beginnt der Brauvorgang automatisch, und es entsteht Dampf. Der Brennstoff und das Brühmaterial wird aufbraucht. Die Tränke werden bald fertig sein.
|
||||||
Different combinations of brewing materials and liquids will give different results. Try to experiment!=Unterschiedliche Kombinationen von Braumaterialien und Flüssigkeiten werden zu unterschiedlichen Ergebnissen führen. Experimentieren Sie!
|
Different combinations of brewing materials and liquids will give different results. Try to experiment!=Unterschiedliche Kombinationen von Braumaterialien und Flüssigkeiten werden zu unterschiedlichen Ergebnissen führen. Experimentieren Sie!
|
||||||
The stand allows you to brew potions!=Der Stand ermöglicht das Brauen von Tränken.
|
The stand allows you to brew potions!=Der Stand ermöglicht das Brauen von Tränken.
|
||||||
Brew Potions=Tränke brauen
|
Brew Potions=Tränke brauen
|
||||||
|
|
|
@ -4,7 +4,7 @@ Inventory=Инвентарь
|
||||||
To use a brewing stand, rightclick it.=Кликните правой, чтобы использовать варочный стенд.
|
To use a brewing stand, rightclick it.=Кликните правой, чтобы использовать варочный стенд.
|
||||||
To brew, you need blaze powder as fuel, a brewing material and at least 1 glass bottle filled with a liquid.=Для приготовления зелья вам понадобится огненный порошок в качестве топлива, исходный материал и как минимум 1 стеклянная бутылка, наполненная жидкостью.
|
To brew, you need blaze powder as fuel, a brewing material and at least 1 glass bottle filled with a liquid.=Для приготовления зелья вам понадобится огненный порошок в качестве топлива, исходный материал и как минимум 1 стеклянная бутылка, наполненная жидкостью.
|
||||||
Place the blaze powder in the left slot, the brewing material in the middle slot and 1-3 bottles in the remaining slots.=Поместите огненный порошок в левый отсек, исходный материал в средний отсек и 1-3 бутылки в оставшиеся отсеки.
|
Place the blaze powder in the left slot, the brewing material in the middle slot and 1-3 bottles in the remaining slots.=Поместите огненный порошок в левый отсек, исходный материал в средний отсек и 1-3 бутылки в оставшиеся отсеки.
|
||||||
When you have found a good comination, the brewing will commence automatically and steam starts to appear, using up the fuel and brewing material. The potions will soon be ready.=Когда вы подберёте хорошее сочетание, приготовление зелья начнётся автоматически — появится пар и начнётся расход топлива и исходного материала. Зелья вскоре будут готовы.
|
When you have found a good combination, the brewing will commence automatically and steam starts to appear, using up the fuel and brewing material. The potions will soon be ready.=Когда вы подберёте хорошее сочетание, приготовление зелья начнётся автоматически — появится пар и начнётся расход топлива и исходного материала. Зелья вскоре будут готовы.
|
||||||
Different combinations of brewing materials and liquids will give different results. Try to experiment!=Разные сочетания варочных материалов и жидкостей будут давать разные результаты. Поэкспериментируйте!
|
Different combinations of brewing materials and liquids will give different results. Try to experiment!=Разные сочетания варочных материалов и жидкостей будут давать разные результаты. Поэкспериментируйте!
|
||||||
The stand allows you to brew potions!=Стенд позволяет вам варить зелья!
|
The stand allows you to brew potions!=Стенд позволяет вам варить зелья!
|
||||||
Brew Potions=Зельеварение
|
Brew Potions=Зельеварение
|
||||||
|
|
|
@ -4,7 +4,7 @@ Inventory=
|
||||||
To use a brewing stand, rightclick it.=
|
To use a brewing stand, rightclick it.=
|
||||||
To brew, you need blaze powder as fuel, a brewing material and at least 1 glass bottle filled with a liquid.=
|
To brew, you need blaze powder as fuel, a brewing material and at least 1 glass bottle filled with a liquid.=
|
||||||
Place the blaze powder in the left slot, the brewing material in the middle slot and 1-3 bottles in the remaining slots.=
|
Place the blaze powder in the left slot, the brewing material in the middle slot and 1-3 bottles in the remaining slots.=
|
||||||
When you have found a good comination, the brewing will commence automatically and steam starts to appear, using up the fuel and brewing material. The potions will soon be ready.=
|
When you have found a good combination, the brewing will commence automatically and steam starts to appear, using up the fuel and brewing material. The potions will soon be ready.=
|
||||||
Different combinations of brewing materials and liquids will give different results. Try to experiment!=
|
Different combinations of brewing materials and liquids will give different results. Try to experiment!=
|
||||||
The stand allows you to brew potions!=
|
The stand allows you to brew potions!=
|
||||||
Brew Potions=
|
Brew Potions=
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
local S = minetest.get_translator("mcl_potions")
|
||||||
|
|
||||||
local is_invisible = {}
|
local is_invisible = {}
|
||||||
local is_poisoned = {}
|
local is_poisoned = {}
|
||||||
local is_regenerating = {}
|
local is_regenerating = {}
|
||||||
|
@ -296,14 +298,15 @@ minetest.register_globalstep(function(dtime)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
local is_fire_node = { ["mcl_core:lava_flowing"]=true,
|
local is_fire_node = { ["mcl_core:lava_flowing"]=true,
|
||||||
["mcl_core:lava_source"]=true,
|
["mcl_core:lava_source"]=true,
|
||||||
["mcl_fire:eternal_fire"]=true,
|
["mcl_fire:eternal_fire"]=true,
|
||||||
["mcl_fire:fire"]=true,
|
["mcl_fire:fire"]=true,
|
||||||
["mcl_nether:magma"]=true,
|
["mcl_nether:magma"]=true,
|
||||||
["mcl_nether:nether_lava_source"]=true,
|
["mcl_nether:nether_lava_source"]=true,
|
||||||
["mcl_nether:nether_lava_flowing"]=true,
|
["mcl_nether:nether_lava_flowing"]=true,
|
||||||
["mcl_nether:nether_lava_source"]=true}
|
["mcl_nether:nether_lava_source"]=true
|
||||||
|
}
|
||||||
|
|
||||||
-- Prevent damage to player with Fire Resistance enabled
|
-- Prevent damage to player with Fire Resistance enabled
|
||||||
minetest.register_on_player_hpchange(function(player, hp_change, reason)
|
minetest.register_on_player_hpchange(function(player, hp_change, reason)
|
||||||
|
@ -314,8 +317,6 @@ minetest.register_on_player_hpchange(function(player, hp_change, reason)
|
||||||
-- it's worth noting that you don't take damage from players in this case...
|
-- it's worth noting that you don't take damage from players in this case...
|
||||||
local player_info = mcl_playerinfo[player:get_player_name()]
|
local player_info = mcl_playerinfo[player:get_player_name()]
|
||||||
|
|
||||||
-- if reason.type == "drown" then return hp_change
|
|
||||||
|
|
||||||
if is_fire_node[player_info.node_head] or is_fire_node[player_info.node_feet] or is_fire_node[player_info.node_stand] then
|
if is_fire_node[player_info.node_head] or is_fire_node[player_info.node_feet] or is_fire_node[player_info.node_stand] then
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
|
@ -347,7 +348,9 @@ end, true)
|
||||||
|
|
||||||
function mcl_potions._reset_player_effects(player)
|
function mcl_potions._reset_player_effects(player)
|
||||||
|
|
||||||
if not player:is_player() then return end
|
if not player:is_player() then
|
||||||
|
return
|
||||||
|
end
|
||||||
meta = player:get_meta()
|
meta = player:get_meta()
|
||||||
|
|
||||||
mcl_potions.make_invisible(player, false)
|
mcl_potions.make_invisible(player, false)
|
||||||
|
@ -375,7 +378,9 @@ end
|
||||||
|
|
||||||
function mcl_potions._save_player_effects(player)
|
function mcl_potions._save_player_effects(player)
|
||||||
|
|
||||||
if not player:is_player() then return end
|
if not player:is_player() then
|
||||||
|
return
|
||||||
|
end
|
||||||
meta = player:get_meta()
|
meta = player:get_meta()
|
||||||
|
|
||||||
meta:set_string("_is_invisible", minetest.serialize(is_invisible[player]))
|
meta:set_string("_is_invisible", minetest.serialize(is_invisible[player]))
|
||||||
|
@ -393,7 +398,9 @@ end
|
||||||
|
|
||||||
function mcl_potions._load_player_effects(player)
|
function mcl_potions._load_player_effects(player)
|
||||||
|
|
||||||
if not player:is_player() then return end
|
if not player:is_player() then
|
||||||
|
return
|
||||||
|
end
|
||||||
meta = player:get_meta()
|
meta = player:get_meta()
|
||||||
|
|
||||||
if minetest.deserialize(meta:get_string("_is_invisible")) then
|
if minetest.deserialize(meta:get_string("_is_invisible")) then
|
||||||
|
@ -487,7 +494,9 @@ function mcl_potions.is_obj_hit(self, pos)
|
||||||
|
|
||||||
if entity and entity.name ~= self.object:get_luaentity().name then
|
if entity and entity.name ~= self.object:get_luaentity().name then
|
||||||
|
|
||||||
if entity._cmi_is_mob then return true end
|
if entity._cmi_is_mob then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
elseif object:is_player() and self._thrower ~= object:get_player_name() then
|
elseif object:is_player() and self._thrower ~= object:get_player_name() then
|
||||||
return true
|
return true
|
||||||
|
@ -500,7 +509,9 @@ end
|
||||||
|
|
||||||
function mcl_potions.make_invisible(player, toggle)
|
function mcl_potions.make_invisible(player, toggle)
|
||||||
|
|
||||||
if not player then return false end
|
if not player then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
local is_player = player:is_player()
|
local is_player = player:is_player()
|
||||||
local entity = player:get_luaentity()
|
local entity = player:get_luaentity()
|
||||||
|
@ -533,22 +544,22 @@ function mcl_potions._use_potion(item, obj, color)
|
||||||
local pos = obj:get_pos()
|
local pos = obj:get_pos()
|
||||||
minetest.sound_play("mcl_potions_drinking", {pos = pos, max_hear_distance = 6, gain = 1})
|
minetest.sound_play("mcl_potions_drinking", {pos = pos, max_hear_distance = 6, gain = 1})
|
||||||
minetest.add_particlespawner({
|
minetest.add_particlespawner({
|
||||||
amount = 25,
|
amount = 25,
|
||||||
time = 1,
|
time = 1,
|
||||||
minpos = {x=pos.x-d, y=pos.y+1, z=pos.z-d},
|
minpos = {x=pos.x-d, y=pos.y+1, z=pos.z-d},
|
||||||
maxpos = {x=pos.x+d, y=pos.y+2, z=pos.z+d},
|
maxpos = {x=pos.x+d, y=pos.y+2, z=pos.z+d},
|
||||||
minvel = {x=-0.1, y=0, z=-0.1},
|
minvel = {x=-0.1, y=0, z=-0.1},
|
||||||
maxvel = {x=0.1, y=0.1, z=0.1},
|
maxvel = {x=0.1, y=0.1, z=0.1},
|
||||||
minacc = {x=-0.1, y=0, z=-0.1},
|
minacc = {x=-0.1, y=0, z=-0.1},
|
||||||
maxacc = {x=0.1, y=.1, z=0.1},
|
maxacc = {x=0.1, y=.1, z=0.1},
|
||||||
minexptime = 1,
|
minexptime = 1,
|
||||||
maxexptime = 5,
|
maxexptime = 5,
|
||||||
minsize = 0.5,
|
minsize = 0.5,
|
||||||
maxsize = 1,
|
maxsize = 1,
|
||||||
collisiondetection = true,
|
collisiondetection = true,
|
||||||
vertical = false,
|
vertical = false,
|
||||||
texture = "mcl_potions_sprite.png^[colorize:"..color..":127",
|
texture = "mcl_potions_sprite.png^[colorize:"..color..":127",
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -556,22 +567,22 @@ function mcl_potions._add_spawner(obj, color)
|
||||||
local d = 0.2
|
local d = 0.2
|
||||||
local pos = obj:get_pos()
|
local pos = obj:get_pos()
|
||||||
minetest.add_particlespawner({
|
minetest.add_particlespawner({
|
||||||
amount = 1,
|
amount = 1,
|
||||||
time = 1,
|
time = 1,
|
||||||
minpos = {x=pos.x-d, y=pos.y+1, z=pos.z-d},
|
minpos = {x=pos.x-d, y=pos.y+1, z=pos.z-d},
|
||||||
maxpos = {x=pos.x+d, y=pos.y+2, z=pos.z+d},
|
maxpos = {x=pos.x+d, y=pos.y+2, z=pos.z+d},
|
||||||
minvel = {x=-0.1, y=0, z=-0.1},
|
minvel = {x=-0.1, y=0, z=-0.1},
|
||||||
maxvel = {x=0.1, y=0.1, z=0.1},
|
maxvel = {x=0.1, y=0.1, z=0.1},
|
||||||
minacc = {x=-0.1, y=0, z=-0.1},
|
minacc = {x=-0.1, y=0, z=-0.1},
|
||||||
maxacc = {x=0.1, y=.1, z=0.1},
|
maxacc = {x=0.1, y=.1, z=0.1},
|
||||||
minexptime = 0.5,
|
minexptime = 0.5,
|
||||||
maxexptime = 1,
|
maxexptime = 1,
|
||||||
minsize = 0.5,
|
minsize = 0.5,
|
||||||
maxsize = 1,
|
maxsize = 1,
|
||||||
collisiondetection = false,
|
collisiondetection = false,
|
||||||
vertical = false,
|
vertical = false,
|
||||||
texture = "mcl_potions_sprite.png^[colorize:"..color..":127",
|
texture = "mcl_potions_sprite.png^[colorize:"..color..":127",
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -633,7 +644,9 @@ end
|
||||||
|
|
||||||
function mcl_potions.swiftness_func(player, factor, duration)
|
function mcl_potions.swiftness_func(player, factor, duration)
|
||||||
|
|
||||||
if not player:get_meta() then return false end
|
if not player:get_meta() then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
if not is_swift[player] then
|
if not is_swift[player] then
|
||||||
|
|
||||||
|
@ -654,7 +667,9 @@ end
|
||||||
|
|
||||||
function mcl_potions.leaping_func(player, factor, duration)
|
function mcl_potions.leaping_func(player, factor, duration)
|
||||||
|
|
||||||
if not player:get_meta() then return false end
|
if not player:get_meta() then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
if not is_leaping[player] then
|
if not is_leaping[player] then
|
||||||
|
|
||||||
|
@ -889,28 +904,37 @@ get_chat_function["leaping"] = mcl_potions.leaping_func
|
||||||
get_chat_function["swiftness"] = mcl_potions.swiftness_func
|
get_chat_function["swiftness"] = mcl_potions.swiftness_func
|
||||||
get_chat_function["heal"] = mcl_potions.healing_func
|
get_chat_function["heal"] = mcl_potions.healing_func
|
||||||
|
|
||||||
minetest.register_chatcommand("potion",{
|
minetest.register_chatcommand("effect",{
|
||||||
params = "<params>",
|
params = S("<effect> <duration> [<factor>]"),
|
||||||
description = "Set player potion effects -- arguments <effect (e.g. poison or night_vision)> <factor (1 = 100%)> <duration (sec)>",
|
description = S("Add a status effect to yourself. Arguments: <effect>: name of potion effect, e.g. poison. <duration>: duration in seconds. <factor>: effect strength multiplier (1 = 100%)"),
|
||||||
privs = {server = true},
|
privs = {server = true},
|
||||||
func = function(name, params)
|
func = function(name, params)
|
||||||
|
|
||||||
P = {}
|
local P = {}
|
||||||
i = 0
|
local i = 0
|
||||||
for str in string.gmatch(params, "([^ ]+)") do
|
for str in string.gmatch(params, "([^ ]+)") do
|
||||||
i = i + 1
|
i = i + 1
|
||||||
P[i] = str
|
P[i] = str
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if not P[1] then
|
||||||
|
return false, S("Missing effect parameter!")
|
||||||
|
elseif not tonumber(P[2]) then
|
||||||
|
return false, S("Missing or invalid duration parameter!")
|
||||||
|
elseif P[3] and not tonumber(P[3]) then
|
||||||
|
return false, S("Invalid factor parameter!")
|
||||||
|
end
|
||||||
|
-- Default factor = 1
|
||||||
if not P[3] then
|
if not P[3] then
|
||||||
P[3] = P[2]
|
P[3] = 1.0
|
||||||
end
|
end
|
||||||
|
|
||||||
if get_chat_function[P[1]] then
|
if get_chat_function[P[1]] then
|
||||||
get_chat_function[P[1]](minetest.get_player_by_name(name), tonumber(P[2]), tonumber(P[3]))
|
get_chat_function[P[1]](minetest.get_player_by_name(name), tonumber(P[3]), tonumber(P[2]))
|
||||||
|
return true
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(name, P[1].." is not an available potion effect. Use /help potion as needed.")
|
return false, S("@1 is not an available potion effect.", P[1])
|
||||||
end
|
end
|
||||||
|
|
||||||
end ,
|
end,
|
||||||
})
|
})
|
||||||
|
|
|
@ -296,14 +296,14 @@ end
|
||||||
|
|
||||||
mcl_potions.register_splash("water", S("Splash Water Bottle"), "#0022FF", {
|
mcl_potions.register_splash("water", S("Splash Water Bottle"), "#0022FF", {
|
||||||
tt=S("Extinguishes fire and hurts some mobs"),
|
tt=S("Extinguishes fire and hurts some mobs"),
|
||||||
longdesc=S("A throwable water bottle that will shatter on impact, where it extinguishes nearby fire and hurts mobs that are vulnerable to water."),
|
longdesc=S("A throwable water bottle that will shatter on impact, where it extinguishes nearby fire and hurts mobs that are vulnerable to water."),
|
||||||
no_effect=true,
|
no_effect=true,
|
||||||
potion_fun=water_splash,
|
potion_fun=water_splash,
|
||||||
effect=1
|
effect=1
|
||||||
})
|
})
|
||||||
mcl_potions.register_lingering("water", S("Lingering Water Bottle"), "#0022FF", {
|
mcl_potions.register_lingering("water", S("Lingering Water Bottle"), "#0022FF", {
|
||||||
tt=S("Extinguishes fire and hurts some mobs"),
|
tt=S("Extinguishes fire and hurts some mobs"),
|
||||||
longdesc=S("A throwable water bottle that will shatter on impact, where it creates a cloud of water vapor that lingers on the ground for a while. This cloud extinguishes fire and hurts mobs that are vulnerable to water."),
|
longdesc=S("A throwable water bottle that will shatter on impact, where it creates a cloud of water vapor that lingers on the ground for a while. This cloud extinguishes fire and hurts mobs that are vulnerable to water."),
|
||||||
no_effect=true,
|
no_effect=true,
|
||||||
potion_fun=water_splash,
|
potion_fun=water_splash,
|
||||||
effect=1
|
effect=1
|
||||||
|
@ -366,23 +366,23 @@ local extension_table = {}
|
||||||
local potions = {}
|
local potions = {}
|
||||||
|
|
||||||
for i, potion in ipairs({"healing","harming","swiftness","slowness",
|
for i, potion in ipairs({"healing","harming","swiftness","slowness",
|
||||||
"leaping","poison","regeneration","invisibility","fire_resistance",
|
"leaping","poison","regeneration","invisibility","fire_resistance",
|
||||||
-- "weakness","strength",
|
-- "weakness","strength",
|
||||||
"water_breathing","night_vision"}) do
|
"water_breathing","night_vision"}) do
|
||||||
|
|
||||||
table.insert(potions, potion)
|
table.insert(potions, potion)
|
||||||
|
|
||||||
if potion ~= "invisibility" and potion ~= "night_vision" and potion ~= "weakness" and potion ~= "water_breathing" and potion ~= "fire_resistance" then
|
if potion ~= "invisibility" and potion ~= "night_vision" and potion ~= "weakness" and potion ~= "water_breathing" and potion ~= "fire_resistance" then
|
||||||
enhancement_table["mcl_potions:"..potion] = "mcl_potions:"..potion.."_2"
|
enhancement_table["mcl_potions:"..potion] = "mcl_potions:"..potion.."_2"
|
||||||
enhancement_table["mcl_potions:"..potion.."_splash"] = "mcl_potions:"..potion.."_2_splash"
|
enhancement_table["mcl_potions:"..potion.."_splash"] = "mcl_potions:"..potion.."_2_splash"
|
||||||
table.insert(potions, potion.."_2")
|
table.insert(potions, potion.."_2")
|
||||||
end
|
end
|
||||||
|
|
||||||
if potion ~= "healing" and potion ~= "harming" then
|
if potion ~= "healing" and potion ~= "harming" then
|
||||||
extension_table["mcl_potions:"..potion.."_splash"] = "mcl_potions:"..potion.."_plus_splash"
|
extension_table["mcl_potions:"..potion.."_splash"] = "mcl_potions:"..potion.."_plus_splash"
|
||||||
extension_table["mcl_potions:"..potion] = "mcl_potions:"..potion.."_plus"
|
extension_table["mcl_potions:"..potion] = "mcl_potions:"..potion.."_plus"
|
||||||
table.insert(potions, potion.."_plus")
|
table.insert(potions, potion.."_plus")
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -419,7 +419,7 @@ local splash_table = {}
|
||||||
local lingering_table = {}
|
local lingering_table = {}
|
||||||
|
|
||||||
for i, potion in ipairs(potions) do
|
for i, potion in ipairs(potions) do
|
||||||
splash_table["mcl_potions:"..potion] = "mcl_potions:"..potion.."_splash"
|
splash_table["mcl_potions:"..potion] = "mcl_potions:"..potion.."_splash"
|
||||||
lingering_table["mcl_potions:"..potion.."_splash"] = "mcl_potions:"..potion.."_lingering"
|
lingering_table["mcl_potions:"..potion.."_splash"] = "mcl_potions:"..potion.."_lingering"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,9 @@ minetest.register_globalstep(function(dtime)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if vals.timer <= 0 then lingering_effect_at[pos] = nil end
|
if vals.timer <= 0 then
|
||||||
|
lingering_effect_at[pos] = nil
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
lingering_timer = 0
|
lingering_timer = 0
|
||||||
|
@ -82,93 +84,93 @@ end)
|
||||||
|
|
||||||
function mcl_potions.register_lingering(name, descr, color, def)
|
function mcl_potions.register_lingering(name, descr, color, def)
|
||||||
|
|
||||||
local id = "mcl_potions:"..name.."_lingering"
|
local id = "mcl_potions:"..name.."_lingering"
|
||||||
local longdesc = def.longdesc
|
local longdesc = def.longdesc
|
||||||
if not def.no_effect then
|
if not def.no_effect then
|
||||||
longdesc = S("A throwable potion that will shatter on impact, where it creates a magic cloud that lingers around for a while. Any player or mob inside the cloud will receive the potion's effect, possibly repeatedly.")
|
longdesc = S("A throwable potion that will shatter on impact, where it creates a magic cloud that lingers around for a while. Any player or mob inside the cloud will receive the potion's effect, possibly repeatedly.")
|
||||||
if def.longdesc then
|
if def.longdesc then
|
||||||
longdesc = longdesc .. "\n" .. def.longdesc
|
longdesc = longdesc .. "\n" .. def.longdesc
|
||||||
end
|
|
||||||
end
|
|
||||||
minetest.register_craftitem(id, {
|
|
||||||
description = descr,
|
|
||||||
_tt_help = def.tt,
|
|
||||||
_doc_items_longdesc = longdesc,
|
|
||||||
_doc_items_usagehelp = S("Use the “Punch” key to throw it."),
|
|
||||||
inventory_image = lingering_image(color),
|
|
||||||
groups = {brewitem=1, not_in_creative_inventory=0},
|
|
||||||
on_use = function(item, placer, pointed_thing)
|
|
||||||
local velocity = 10
|
|
||||||
local dir = placer:get_look_dir();
|
|
||||||
local pos = placer:getpos();
|
|
||||||
local obj = minetest.add_entity({x=pos.x+dir.x,y=pos.y+2+dir.y,z=pos.z+dir.z}, id.."_flying")
|
|
||||||
obj:setvelocity({x=dir.x*velocity,y=dir.y*velocity,z=dir.z*velocity})
|
|
||||||
obj:setacceleration({x=dir.x*-3, y=-9.8, z=dir.z*-3})
|
|
||||||
obj:get_luaentity()._thrower = placer:get_player_name()
|
|
||||||
if not minetest.is_creative_enabled(placer:get_player_name()) then
|
|
||||||
item:take_item()
|
|
||||||
end
|
|
||||||
return item
|
|
||||||
end,
|
|
||||||
stack_max = 1,
|
|
||||||
_on_dispense = function(stack, dispenserpos, droppos, dropnode, dropdir)
|
|
||||||
local s_pos = vector.add(dispenserpos, vector.multiply(dropdir, 0.51))
|
|
||||||
local obj = minetest.add_entity({x=s_pos.x+dropdir.x,y=s_pos.y+dropdir.y,z=s_pos.z+dropdir.z}, id.."_flying")
|
|
||||||
local velocity = 22
|
|
||||||
obj:set_velocity({x=dropdir.x*velocity,y=dropdir.y*velocity,z=dropdir.z*velocity})
|
|
||||||
obj:set_acceleration({x=dropdir.x*-3, y=-9.8, z=dropdir.z*-3})
|
|
||||||
end
|
end
|
||||||
})
|
end
|
||||||
|
minetest.register_craftitem(id, {
|
||||||
|
description = descr,
|
||||||
|
_tt_help = def.tt,
|
||||||
|
_doc_items_longdesc = longdesc,
|
||||||
|
_doc_items_usagehelp = S("Use the “Punch” key to throw it."),
|
||||||
|
inventory_image = lingering_image(color),
|
||||||
|
groups = {brewitem=1, not_in_creative_inventory=0},
|
||||||
|
on_use = function(item, placer, pointed_thing)
|
||||||
|
local velocity = 10
|
||||||
|
local dir = placer:get_look_dir();
|
||||||
|
local pos = placer:getpos();
|
||||||
|
local obj = minetest.add_entity({x=pos.x+dir.x,y=pos.y+2+dir.y,z=pos.z+dir.z}, id.."_flying")
|
||||||
|
obj:setvelocity({x=dir.x*velocity,y=dir.y*velocity,z=dir.z*velocity})
|
||||||
|
obj:setacceleration({x=dir.x*-3, y=-9.8, z=dir.z*-3})
|
||||||
|
obj:get_luaentity()._thrower = placer:get_player_name()
|
||||||
|
if not minetest.is_creative_enabled(placer:get_player_name()) then
|
||||||
|
item:take_item()
|
||||||
|
end
|
||||||
|
return item
|
||||||
|
end,
|
||||||
|
stack_max = 1,
|
||||||
|
_on_dispense = function(stack, dispenserpos, droppos, dropnode, dropdir)
|
||||||
|
local s_pos = vector.add(dispenserpos, vector.multiply(dropdir, 0.51))
|
||||||
|
local obj = minetest.add_entity({x=s_pos.x+dropdir.x,y=s_pos.y+dropdir.y,z=s_pos.z+dropdir.z}, id.."_flying")
|
||||||
|
local velocity = 22
|
||||||
|
obj:set_velocity({x=dropdir.x*velocity,y=dropdir.y*velocity,z=dropdir.z*velocity})
|
||||||
|
obj:set_acceleration({x=dropdir.x*-3, y=-9.8, z=dropdir.z*-3})
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
local w = 0.7
|
local w = 0.7
|
||||||
|
|
||||||
minetest.register_entity(id.."_flying",{
|
minetest.register_entity(id.."_flying",{
|
||||||
textures = {lingering_image(color)},
|
textures = {lingering_image(color)},
|
||||||
hp_max = 1,
|
hp_max = 1,
|
||||||
visual_size = {x=w/2,y=w/2},
|
visual_size = {x=w/2,y=w/2},
|
||||||
collisionbox = {-0.1,-0.1,-0.1,0.1,0.1,0.1},
|
collisionbox = {-0.1,-0.1,-0.1,0.1,0.1,0.1},
|
||||||
pointable = false,
|
pointable = false,
|
||||||
on_step = function(self, dtime)
|
on_step = function(self, dtime)
|
||||||
local pos = self.object:get_pos()
|
local pos = self.object:get_pos()
|
||||||
local node = minetest.get_node(pos)
|
local node = minetest.get_node(pos)
|
||||||
local n = node.name
|
local n = node.name
|
||||||
local g = minetest.get_node_group(n, "liquid")
|
local g = minetest.get_node_group(n, "liquid")
|
||||||
local d = 4
|
local d = 4
|
||||||
if n ~= "air" and n ~= "mcl_portals:portal" and n ~= "mcl_portals:portal_end" and g == 0 or mcl_potions.is_obj_hit(self, pos) then
|
if n ~= "air" and n ~= "mcl_portals:portal" and n ~= "mcl_portals:portal_end" and g == 0 or mcl_potions.is_obj_hit(self, pos) then
|
||||||
minetest.sound_play("mcl_potions_breaking_glass", {pos = pos, max_hear_distance = 16, gain = 1})
|
minetest.sound_play("mcl_potions_breaking_glass", {pos = pos, max_hear_distance = 16, gain = 1})
|
||||||
add_lingering_effect(pos, color, def, name == "water")
|
add_lingering_effect(pos, color, def, name == "water")
|
||||||
local texture, minacc, maxacc
|
local texture, minacc, maxacc
|
||||||
if name == "water" then
|
if name == "water" then
|
||||||
texture = "mcl_potions_droplet.png"
|
texture = "mcl_potions_droplet.png"
|
||||||
minacc = {x=-0.2, y=-0.05, z=-0.2}
|
minacc = {x=-0.2, y=-0.05, z=-0.2}
|
||||||
maxacc = {x=0.2, y=0.05, z=0.2}
|
maxacc = {x=0.2, y=0.05, z=0.2}
|
||||||
else
|
else
|
||||||
texture = "mcl_potions_sprite.png"
|
texture = "mcl_potions_sprite.png"
|
||||||
minacc = {x=-0.2, y=0, z=-0.2}
|
minacc = {x=-0.2, y=0, z=-0.2}
|
||||||
maxacc = {x=0.2, y=.05, z=0.2}
|
maxacc = {x=0.2, y=.05, z=0.2}
|
||||||
end
|
end
|
||||||
minetest.add_particlespawner({
|
minetest.add_particlespawner({
|
||||||
amount = 40,
|
amount = 40,
|
||||||
time = 1,
|
time = 1,
|
||||||
minpos = {x=pos.x-d, y=pos.y+0.5, z=pos.z-d},
|
minpos = {x=pos.x-d, y=pos.y+0.5, z=pos.z-d},
|
||||||
maxpos = {x=pos.x+d, y=pos.y+1, z=pos.z+d},
|
maxpos = {x=pos.x+d, y=pos.y+1, z=pos.z+d},
|
||||||
minvel = {x=-0.5, y=0, z=-0.5},
|
minvel = {x=-0.5, y=0, z=-0.5},
|
||||||
maxvel = {x=0.5, y=0.5, z=0.5},
|
maxvel = {x=0.5, y=0.5, z=0.5},
|
||||||
minacc = minacc,
|
minacc = minacc,
|
||||||
maxacc = maxacc,
|
maxacc = maxacc,
|
||||||
minexptime = 1,
|
minexptime = 1,
|
||||||
maxexptime = 2,
|
maxexptime = 2,
|
||||||
minsize = 1,
|
minsize = 1,
|
||||||
maxsize = 2,
|
maxsize = 2,
|
||||||
collisiondetection = true,
|
collisiondetection = true,
|
||||||
vertical = false,
|
vertical = false,
|
||||||
texture = texture.."^[colorize:"..color..":127",
|
texture = texture.."^[colorize:"..color..":127",
|
||||||
})
|
})
|
||||||
if name == "water" then
|
if name == "water" then
|
||||||
mcl_potions._extinguish_nearby_fire(pos, d)
|
mcl_potions._extinguish_nearby_fire(pos, d)
|
||||||
end
|
end
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
|
@ -100,15 +100,10 @@ Grants limitless breath underwater.=Gibt unbegrenzten Atem im Wasser.
|
||||||
Fire Resistance=Feuerresistenz
|
Fire Resistance=Feuerresistenz
|
||||||
Grants immunity to damage from heat sources like fire.=Gibt Immunität gegenüber Schaden von Hitzequellen wie Feuer.
|
Grants immunity to damage from heat sources like fire.=Gibt Immunität gegenüber Schaden von Hitzequellen wie Feuer.
|
||||||
Weakness=Schwäche
|
Weakness=Schwäche
|
||||||
-4 HP damage | 1:30=-4 HP Schaden | 1:30
|
|
||||||
Weakness +=Schwäche +
|
Weakness +=Schwäche +
|
||||||
-4 HP damage | 4:00=-4 HP Schaden | 4:00
|
|
||||||
Strength=Stärke
|
Strength=Stärke
|
||||||
+3 HP damage | 3:00=+3 HP Schaden | 3:00
|
|
||||||
Strength II=Stärke II
|
Strength II=Stärke II
|
||||||
+6 HP damage | 1:30=+6 HP Schaden | 1:30
|
|
||||||
Strength +=Stärke +
|
Strength +=Stärke +
|
||||||
+3 HP damage | 8:00=+3 HP Schaden | 8:00
|
|
||||||
Try different combinations to create potions.=Probieren Sie Kombinationen aus, um Tränke herzustellen.
|
Try different combinations to create potions.=Probieren Sie Kombinationen aus, um Tränke herzustellen.
|
||||||
No effect=Keine Wirkung
|
No effect=Keine Wirkung
|
||||||
|
|
||||||
|
|
|
@ -99,15 +99,10 @@ Grants limitless breath underwater.=
|
||||||
Fire Resistance=
|
Fire Resistance=
|
||||||
Grants immunity to damage from heat sources like fire.=
|
Grants immunity to damage from heat sources like fire.=
|
||||||
Weakness=
|
Weakness=
|
||||||
-4 HP damage | 1:30=
|
|
||||||
Weakness +=
|
Weakness +=
|
||||||
-4 HP damage | 4:00=
|
|
||||||
Strength=
|
Strength=
|
||||||
+3 HP damage | 3:00=
|
|
||||||
Strength II=
|
Strength II=
|
||||||
+6 HP damage | 1:30=
|
|
||||||
Strength +=
|
Strength +=
|
||||||
+3 HP damage | 8:00=
|
|
||||||
Try different combinations to create potions.=
|
Try different combinations to create potions.=
|
||||||
No effect=
|
No effect=
|
||||||
|
|
||||||
|
|
|
@ -99,15 +99,10 @@ Grants limitless breath underwater.=
|
||||||
Fire Resistance=
|
Fire Resistance=
|
||||||
Grants immunity to damage from heat sources like fire.=
|
Grants immunity to damage from heat sources like fire.=
|
||||||
Weakness=
|
Weakness=
|
||||||
-4 HP damage | 1:30=
|
|
||||||
Weakness +=
|
Weakness +=
|
||||||
-4 HP damage | 4:00=
|
|
||||||
Strength=
|
Strength=
|
||||||
+3 HP damage | 3:00=
|
|
||||||
Strength II=
|
Strength II=
|
||||||
+6 HP damage | 1:30=
|
|
||||||
Strength +=
|
Strength +=
|
||||||
+3 HP damage | 8:00=
|
|
||||||
Try different combinations to create potions.=
|
Try different combinations to create potions.=
|
||||||
No effect=Aucun effet
|
No effect=Aucun effet
|
||||||
|
|
||||||
|
|
|
@ -99,15 +99,10 @@ Grants limitless breath underwater.=Даёт возможность неогра
|
||||||
Fire Resistance=Огнестойкость
|
Fire Resistance=Огнестойкость
|
||||||
Grants immunity to damage from heat sources like fire.=Делает невосприимчивым к урону от источников тепла, например, от огня.
|
Grants immunity to damage from heat sources like fire.=Делает невосприимчивым к урону от источников тепла, например, от огня.
|
||||||
Weakness=Слабость
|
Weakness=Слабость
|
||||||
-4 HP damage | 1:30=Урон -4 HP | 1:30
|
|
||||||
Weakness +=Слабость +
|
Weakness +=Слабость +
|
||||||
-4 HP damage | 4:00=Урон -4 HP | 4:00
|
|
||||||
Strength=Сила
|
Strength=Сила
|
||||||
+3 HP damage | 3:00=Урон +3 HP | 3:00
|
|
||||||
Strength II=Сила II
|
Strength II=Сила II
|
||||||
+6 HP damage | 1:30=Урон +6 HP | 1:30
|
|
||||||
Strength +=Сила +
|
Strength +=Сила +
|
||||||
+3 HP damage | 8:00=Урон +3 HP | 8:00
|
|
||||||
Try different combinations to create potions.=Пробуйте разные сочетания для приготовления зелий.
|
Try different combinations to create potions.=Пробуйте разные сочетания для приготовления зелий.
|
||||||
No effect=Не оказывает эффекта
|
No effect=Не оказывает эффекта
|
||||||
|
|
||||||
|
|
|
@ -99,15 +99,10 @@ Grants limitless breath underwater.=
|
||||||
Fire Resistance=
|
Fire Resistance=
|
||||||
Grants immunity to damage from heat sources like fire.=
|
Grants immunity to damage from heat sources like fire.=
|
||||||
Weakness=
|
Weakness=
|
||||||
-4 HP damage | 1:30=
|
|
||||||
Weakness +=
|
Weakness +=
|
||||||
-4 HP damage | 4:00=
|
|
||||||
Strength=
|
Strength=
|
||||||
+3 HP damage | 3:00=
|
|
||||||
Strength II=
|
Strength II=
|
||||||
+6 HP damage | 1:30=
|
|
||||||
Strength +=
|
Strength +=
|
||||||
+3 HP damage | 8:00=
|
|
||||||
Try different combinations to create potions.=
|
Try different combinations to create potions.=
|
||||||
No effect=
|
No effect=
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,9 @@ local how_to_drink = S("Use the “Place” key to drink it.")
|
||||||
local potion_intro = S("Drinking a potion gives you a particular effect.")
|
local potion_intro = S("Drinking a potion gives you a particular effect.")
|
||||||
|
|
||||||
local function time_string(dur)
|
local function time_string(dur)
|
||||||
if not dur then return nil end
|
if not dur then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
return math.floor(dur/60)..string.format(":%02d",math.floor(dur % 60))
|
return math.floor(dur/60)..string.format(":%02d",math.floor(dur % 60))
|
||||||
end
|
end
|
||||||
local function perc_string(num)
|
local function perc_string(num)
|
||||||
|
@ -127,7 +129,7 @@ local function register_potion(def)
|
||||||
if not def.no_effect then
|
if not def.no_effect then
|
||||||
potion_longdesc = potion_intro .. "\n" .. def._longdesc
|
potion_longdesc = potion_intro .. "\n" .. def._longdesc
|
||||||
end
|
end
|
||||||
local potion_usagehelp
|
local potion_usagehelp
|
||||||
local basic_potion_tt
|
local basic_potion_tt
|
||||||
if def.name ~= "dragon_breath" then
|
if def.name ~= "dragon_breath" then
|
||||||
potion_usagehelp = how_to_drink
|
potion_usagehelp = how_to_drink
|
||||||
|
@ -224,11 +226,11 @@ local function register_potion(def)
|
||||||
end
|
end
|
||||||
|
|
||||||
local on_use = function (itemstack, user, pointed_thing)
|
local on_use = function (itemstack, user, pointed_thing)
|
||||||
def.on_use(user, effect_II, dur_2)
|
def.on_use(user, effect_II, dur_2)
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
||||||
mcl_potions._use_potion(itemstack, user, def.color)
|
mcl_potions._use_potion(itemstack, user, def.color)
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_potions:"..def.name.."_2", {
|
minetest.register_craftitem("mcl_potions:"..def.name.."_2", {
|
||||||
description = S("@1 Potion@2", def.description, desc_mod),
|
description = S("@1 Potion@2", def.description, desc_mod),
|
||||||
|
@ -307,11 +309,11 @@ local function register_potion(def)
|
||||||
end
|
end
|
||||||
|
|
||||||
local on_use = function (itemstack, user, pointed_thing)
|
local on_use = function (itemstack, user, pointed_thing)
|
||||||
def.on_use(user, def.effect, dur_pl)
|
def.on_use(user, def.effect, dur_pl)
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
||||||
mcl_potions._use_potion(itemstack, user, def.color)
|
mcl_potions._use_potion(itemstack, user, def.color)
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_potions:"..def.name.."_plus", {
|
minetest.register_craftitem("mcl_potions:"..def.name.."_plus", {
|
||||||
description = S("@1 + Potion", def.description),
|
description = S("@1 + Potion", def.description),
|
||||||
|
@ -571,9 +573,9 @@ local fire_resistance_def = {
|
||||||
|
|
||||||
|
|
||||||
local defs = { awkward_def, mundane_def, thick_def, dragon_breath_def,
|
local defs = { awkward_def, mundane_def, thick_def, dragon_breath_def,
|
||||||
healing_def, harming_def, night_vision_def, swiftness_def,
|
healing_def, harming_def, night_vision_def, swiftness_def,
|
||||||
slowness_def, leaping_def, poison_def, regeneration_def,
|
slowness_def, leaping_def, poison_def, regeneration_def,
|
||||||
invisibility_def, water_breathing_def, fire_resistance_def}
|
invisibility_def, water_breathing_def, fire_resistance_def}
|
||||||
|
|
||||||
for _, def in ipairs(defs) do
|
for _, def in ipairs(defs) do
|
||||||
register_potion(def)
|
register_potion(def)
|
||||||
|
@ -584,7 +586,7 @@ end
|
||||||
|
|
||||||
-- minetest.register_craftitem("mcl_potions:weakness", {
|
-- minetest.register_craftitem("mcl_potions:weakness", {
|
||||||
-- description = S("Weakness"),
|
-- description = S("Weakness"),
|
||||||
-- _tt_help = S("-4 HP damage | 1:30"),
|
-- _tt_help = TODO,
|
||||||
-- _doc_items_longdesc = brewhelp,
|
-- _doc_items_longdesc = brewhelp,
|
||||||
-- wield_image = potion_image("#6600AA"),
|
-- wield_image = potion_image("#6600AA"),
|
||||||
-- inventory_image = potion_image("#6600AA"),
|
-- inventory_image = potion_image("#6600AA"),
|
||||||
|
@ -608,7 +610,7 @@ end
|
||||||
--
|
--
|
||||||
-- minetest.register_craftitem("mcl_potions:weakness_plus", {
|
-- minetest.register_craftitem("mcl_potions:weakness_plus", {
|
||||||
-- description = S("Weakness +"),
|
-- description = S("Weakness +"),
|
||||||
-- _tt_help = S("-4 HP damage | 4:00"),
|
-- _tt_help = TODO,
|
||||||
-- _doc_items_longdesc = brewhelp,
|
-- _doc_items_longdesc = brewhelp,
|
||||||
-- wield_image = potion_image("#7700BB"),
|
-- wield_image = potion_image("#7700BB"),
|
||||||
-- inventory_image = potion_image("#7700BB"),
|
-- inventory_image = potion_image("#7700BB"),
|
||||||
|
@ -632,7 +634,7 @@ end
|
||||||
--
|
--
|
||||||
-- minetest.register_craftitem("mcl_potions:strength", {
|
-- minetest.register_craftitem("mcl_potions:strength", {
|
||||||
-- description = S("Strength"),
|
-- description = S("Strength"),
|
||||||
-- _tt_help = S("+3 HP damage | 3:00"),
|
-- _tt_help = TODO,
|
||||||
-- _doc_items_longdesc = brewhelp,
|
-- _doc_items_longdesc = brewhelp,
|
||||||
-- wield_image = potion_image("#D444D4"),
|
-- wield_image = potion_image("#D444D4"),
|
||||||
-- inventory_image = potion_image("#D444D4"),
|
-- inventory_image = potion_image("#D444D4"),
|
||||||
|
@ -656,7 +658,7 @@ end
|
||||||
--
|
--
|
||||||
-- minetest.register_craftitem("mcl_potions:strength_2", {
|
-- minetest.register_craftitem("mcl_potions:strength_2", {
|
||||||
-- description = S("Strength II"),
|
-- description = S("Strength II"),
|
||||||
-- _tt_help = S("+6 HP damage | 1:30"),
|
-- _tt_help = TODO,
|
||||||
-- _doc_items_longdesc = brewhelp,
|
-- _doc_items_longdesc = brewhelp,
|
||||||
-- wield_image = potion_image("#D444E4"),
|
-- wield_image = potion_image("#D444E4"),
|
||||||
-- inventory_image = potion_image("#D444E4"),
|
-- inventory_image = potion_image("#D444E4"),
|
||||||
|
@ -680,7 +682,7 @@ end
|
||||||
--
|
--
|
||||||
-- minetest.register_craftitem("mcl_potions:strength_plus", {
|
-- minetest.register_craftitem("mcl_potions:strength_plus", {
|
||||||
-- description = S("Strength +"),
|
-- description = S("Strength +"),
|
||||||
-- _tt_help = S("+3 HP damage | 8:00"),
|
-- _tt_help = TODO,
|
||||||
-- _doc_items_longdesc = brewhelp,
|
-- _doc_items_longdesc = brewhelp,
|
||||||
-- wield_image = potion_image("#D444F4"),
|
-- wield_image = potion_image("#D444F4"),
|
||||||
-- inventory_image = potion_image("#D444F4"),
|
-- inventory_image = potion_image("#D444F4"),
|
||||||
|
|
|
@ -11,34 +11,34 @@ end
|
||||||
|
|
||||||
function mcl_potions.register_splash(name, descr, color, def)
|
function mcl_potions.register_splash(name, descr, color, def)
|
||||||
|
|
||||||
local id = "mcl_potions:"..name.."_splash"
|
local id = "mcl_potions:"..name.."_splash"
|
||||||
local longdesc = def.longdesc
|
local longdesc = def.longdesc
|
||||||
if not def.no_effect then
|
if not def.no_effect then
|
||||||
longdesc = S("A throwable potion that will shatter on impact, where it gives all nearby players and mobs a status effect.")
|
longdesc = S("A throwable potion that will shatter on impact, where it gives all nearby players and mobs a status effect.")
|
||||||
if def.longdesc then
|
if def.longdesc then
|
||||||
longdesc = longdesc .. "\n" .. def.longdesc
|
longdesc = longdesc .. "\n" .. def.longdesc
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
minetest.register_craftitem(id, {
|
minetest.register_craftitem(id, {
|
||||||
description = descr,
|
description = descr,
|
||||||
_tt_help = def.tt,
|
_tt_help = def.tt,
|
||||||
_doc_items_longdesc = longdesc,
|
_doc_items_longdesc = longdesc,
|
||||||
_doc_items_usagehelp = S("Use the “Punch” key to throw it."),
|
_doc_items_usagehelp = S("Use the “Punch” key to throw it."),
|
||||||
inventory_image = splash_image(color),
|
inventory_image = splash_image(color),
|
||||||
groups = {brewitem=1, not_in_creative_inventory=0},
|
groups = {brewitem=1, not_in_creative_inventory=0},
|
||||||
on_use = function(item, placer, pointed_thing)
|
on_use = function(item, placer, pointed_thing)
|
||||||
local velocity = 10
|
local velocity = 10
|
||||||
local dir = placer:get_look_dir();
|
local dir = placer:get_look_dir();
|
||||||
local pos = placer:get_pos();
|
local pos = placer:get_pos();
|
||||||
local obj = minetest.add_entity({x=pos.x+dir.x,y=pos.y+2+dir.y,z=pos.z+dir.z}, id.."_flying")
|
local obj = minetest.add_entity({x=pos.x+dir.x,y=pos.y+2+dir.y,z=pos.z+dir.z}, id.."_flying")
|
||||||
obj:set_velocity({x=dir.x*velocity,y=dir.y*velocity,z=dir.z*velocity})
|
obj:set_velocity({x=dir.x*velocity,y=dir.y*velocity,z=dir.z*velocity})
|
||||||
obj:set_acceleration({x=dir.x*-3, y=-9.8, z=dir.z*-3})
|
obj:set_acceleration({x=dir.x*-3, y=-9.8, z=dir.z*-3})
|
||||||
obj:get_luaentity()._thrower = placer:get_player_name()
|
obj:get_luaentity()._thrower = placer:get_player_name()
|
||||||
if not minetest.is_creative_enabled(placer:get_player_name()) then
|
if not minetest.is_creative_enabled(placer:get_player_name()) then
|
||||||
item:take_item()
|
item:take_item()
|
||||||
end
|
end
|
||||||
return item
|
return item
|
||||||
end,
|
end,
|
||||||
stack_max = 1,
|
stack_max = 1,
|
||||||
_on_dispense = function(stack, dispenserpos, droppos, dropnode, dropdir)
|
_on_dispense = function(stack, dispenserpos, droppos, dropnode, dropdir)
|
||||||
local s_pos = vector.add(dispenserpos, vector.multiply(dropdir, 0.51))
|
local s_pos = vector.add(dispenserpos, vector.multiply(dropdir, 0.51))
|
||||||
|
@ -47,70 +47,73 @@ function mcl_potions.register_splash(name, descr, color, def)
|
||||||
obj:set_velocity({x=dropdir.x*velocity,y=dropdir.y*velocity,z=dropdir.z*velocity})
|
obj:set_velocity({x=dropdir.x*velocity,y=dropdir.y*velocity,z=dropdir.z*velocity})
|
||||||
obj:set_acceleration({x=dropdir.x*-3, y=-9.8, z=dropdir.z*-3})
|
obj:set_acceleration({x=dropdir.x*-3, y=-9.8, z=dropdir.z*-3})
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
local w = 0.7
|
local w = 0.7
|
||||||
|
|
||||||
minetest.register_entity(id.."_flying",{
|
minetest.register_entity(id.."_flying",{
|
||||||
textures = {splash_image(color)},
|
textures = {splash_image(color)},
|
||||||
hp_max = 1,
|
hp_max = 1,
|
||||||
visual_size = {x=w/2,y=w/2},
|
visual_size = {x=w/2,y=w/2},
|
||||||
collisionbox = {-0.1,-0.1,-0.1,0.1,0.1,0.1},
|
collisionbox = {-0.1,-0.1,-0.1,0.1,0.1,0.1},
|
||||||
pointable = false,
|
pointable = false,
|
||||||
on_step = function(self, dtime)
|
on_step = function(self, dtime)
|
||||||
local pos = self.object:get_pos()
|
local pos = self.object:get_pos()
|
||||||
local node = minetest.get_node(pos)
|
local node = minetest.get_node(pos)
|
||||||
local n = node.name
|
local n = node.name
|
||||||
local g = minetest.get_node_group(n, "liquid")
|
local g = minetest.get_node_group(n, "liquid")
|
||||||
local d = 0.1
|
local d = 0.1
|
||||||
local redux_map = {7/8,0.5,0.25}
|
local redux_map = {7/8,0.5,0.25}
|
||||||
if n ~= "air" and n ~= "mcl_portals:portal" and n ~= "mcl_portals:portal_end" and g == 0 or mcl_potions.is_obj_hit(self, pos) then
|
if n ~= "air" and n ~= "mcl_portals:portal" and n ~= "mcl_portals:portal_end" and g == 0 or mcl_potions.is_obj_hit(self, pos) then
|
||||||
minetest.sound_play("mcl_potions_breaking_glass", {pos = pos, max_hear_distance = 16, gain = 1})
|
minetest.sound_play("mcl_potions_breaking_glass", {pos = pos, max_hear_distance = 16, gain = 1})
|
||||||
local texture, acc
|
local texture, acc
|
||||||
if name == "water" then
|
if name == "water" then
|
||||||
texture = "mcl_potions_droplet.png"
|
texture = "mcl_potions_droplet.png"
|
||||||
acc = {x=0, y=-GRAVITY, z=0}
|
acc = {x=0, y=-GRAVITY, z=0}
|
||||||
else
|
else
|
||||||
texture = "mcl_potions_sprite.png"
|
texture = "mcl_potions_sprite.png"
|
||||||
acc = {x=0, y=0, z=0}
|
acc = {x=0, y=0, z=0}
|
||||||
end
|
end
|
||||||
minetest.add_particlespawner({
|
minetest.add_particlespawner({
|
||||||
amount = 50,
|
amount = 50,
|
||||||
time = 0.1,
|
time = 0.1,
|
||||||
minpos = {x=pos.x-d, y=pos.y+0.5, z=pos.z-d},
|
minpos = {x=pos.x-d, y=pos.y+0.5, z=pos.z-d},
|
||||||
maxpos = {x=pos.x+d, y=pos.y+0.5+d, z=pos.z+d},
|
maxpos = {x=pos.x+d, y=pos.y+0.5+d, z=pos.z+d},
|
||||||
minvel = {x=-2, y=0, z=-2},
|
minvel = {x=-2, y=0, z=-2},
|
||||||
maxvel = {x=2, y=2, z=2},
|
maxvel = {x=2, y=2, z=2},
|
||||||
minacc = acc,
|
minacc = acc,
|
||||||
maxacc = acc,
|
maxacc = acc,
|
||||||
minexptime = 0.5,
|
minexptime = 0.5,
|
||||||
maxexptime = 1.25,
|
maxexptime = 1.25,
|
||||||
minsize = 1,
|
minsize = 1,
|
||||||
maxsize = 2,
|
maxsize = 2,
|
||||||
collisiondetection = true,
|
collisiondetection = true,
|
||||||
vertical = false,
|
vertical = false,
|
||||||
texture = texture.."^[colorize:"..color..":127"
|
texture = texture.."^[colorize:"..color..":127"
|
||||||
})
|
})
|
||||||
|
|
||||||
if name == "water" then
|
if name == "water" then
|
||||||
mcl_potions._extinguish_nearby_fire(pos)
|
mcl_potions._extinguish_nearby_fire(pos)
|
||||||
end
|
end
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
for _,obj in pairs(minetest.get_objects_inside_radius(pos, 4)) do
|
for _,obj in pairs(minetest.get_objects_inside_radius(pos, 4)) do
|
||||||
|
|
||||||
local entity = obj:get_luaentity()
|
local entity = obj:get_luaentity()
|
||||||
if obj:is_player() or entity._cmi_is_mob then
|
if obj:is_player() or entity._cmi_is_mob then
|
||||||
|
|
||||||
local pos2 = obj:get_pos()
|
local pos2 = obj:get_pos()
|
||||||
local rad = math.floor(math.sqrt((pos2.x-pos.x)^2 + (pos2.y-pos.y)^2 + (pos2.z-pos.z)^2))
|
local rad = math.floor(math.sqrt((pos2.x-pos.x)^2 + (pos2.y-pos.y)^2 + (pos2.z-pos.z)^2))
|
||||||
if rad > 0 then def.potion_fun(obj, redux_map[rad]) else def.potion_fun(obj, 1) end
|
if rad > 0 then
|
||||||
|
def.potion_fun(obj, redux_map[rad])
|
||||||
end
|
else
|
||||||
|
def.potion_fun(obj, 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end,
|
end
|
||||||
})
|
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
local function time_string(dur)
|
local function time_string(dur)
|
||||||
|
|
|
@ -19,12 +19,11 @@ local function arrow_image(colorstring, opacity)
|
||||||
opacity = 127
|
opacity = 127
|
||||||
end
|
end
|
||||||
return {"mcl_bows_arrow.png^[transformFX^(mcl_bows_arrow_overlay.png^[transformFX^[colorize:"..colorstring..":"..tostring(opacity)..")",
|
return {"mcl_bows_arrow.png^[transformFX^(mcl_bows_arrow_overlay.png^[transformFX^[colorize:"..colorstring..":"..tostring(opacity)..")",
|
||||||
"mcl_bows_arrow.png^[transformFX^(mcl_bows_arrow_overlay.png^[transformFX^[colorize:"..colorstring..":"..tostring(opacity)..")",
|
"mcl_bows_arrow.png^[transformFX^(mcl_bows_arrow_overlay.png^[transformFX^[colorize:"..colorstring..":"..tostring(opacity)..")",
|
||||||
"mcl_bows_arrow_back.png^[colorize:"..colorstring..":"..tostring(opacity),
|
"mcl_bows_arrow_back.png^[colorize:"..colorstring..":"..tostring(opacity),
|
||||||
"mcl_bows_arrow_front.png^[colorize:"..colorstring..":"..tostring(opacity),
|
"mcl_bows_arrow_front.png^[colorize:"..colorstring..":"..tostring(opacity),
|
||||||
"mcl_bows_arrow.png^(mcl_bows_arrow_overlay.png^[colorize:"..colorstring..":"..tostring(opacity)..")",
|
"mcl_bows_arrow.png^(mcl_bows_arrow_overlay.png^[colorize:"..colorstring..":"..tostring(opacity)..")",
|
||||||
"mcl_bows_arrow.png^[transformFX^(mcl_bows_arrow_overlay.png^[transformFX^[colorize:"..colorstring..":"..tostring(opacity)..")"}
|
"mcl_bows_arrow.png^[transformFX^(mcl_bows_arrow_overlay.png^[transformFX^[colorize:"..colorstring..":"..tostring(opacity)..")"}
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local how_to_shoot = minetest.registered_items["mcl_bows:arrow"]._doc_items_usagehelp
|
local how_to_shoot = minetest.registered_items["mcl_bows:arrow"]._doc_items_usagehelp
|
||||||
|
|
Loading…
Reference in New Issue