forked from MineClone5/MineClone5
reduce redundant code in potion definitions
This commit is contained in:
parent
7670c9ba5c
commit
926d842cdb
|
@ -598,7 +598,7 @@ function mcl_potions.regeneration_func(player, factor, duration)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function mcl_potions.invisiblility_func(player, duration)
|
function mcl_potions.invisiblility_func(player, null, duration)
|
||||||
|
|
||||||
if not is_invisible[player] then
|
if not is_invisible[player] then
|
||||||
|
|
||||||
|
@ -616,7 +616,7 @@ function mcl_potions.invisiblility_func(player, duration)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function mcl_potions.water_breathing_func(player, duration)
|
function mcl_potions.water_breathing_func(player, null, duration)
|
||||||
|
|
||||||
if not is_water_breathing[player] then
|
if not is_water_breathing[player] then
|
||||||
|
|
||||||
|
@ -634,7 +634,7 @@ function mcl_potions.water_breathing_func(player, duration)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function mcl_potions.fire_resistance_func(player, duration)
|
function mcl_potions.fire_resistance_func(player, null, duration)
|
||||||
|
|
||||||
if not is_fire_proof[player] then
|
if not is_fire_proof[player] then
|
||||||
|
|
||||||
|
@ -651,7 +651,7 @@ function mcl_potions.fire_resistance_func(player, duration)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function mcl_potions.night_vision_func(player, duration)
|
function mcl_potions.night_vision_func(player, null, duration)
|
||||||
|
|
||||||
if not is_cat[player] then
|
if not is_cat[player] then
|
||||||
|
|
||||||
|
|
|
@ -5,9 +5,12 @@ mcl_potions = {}
|
||||||
-- duration effects of glowstone are a time factor of 1/2
|
-- duration effects of glowstone are a time factor of 1/2
|
||||||
-- splash potion duration effects are reduced by a factor of 3/4
|
-- splash potion duration effects are reduced by a factor of 3/4
|
||||||
|
|
||||||
|
mcl_potions.II_FACTOR = 2
|
||||||
|
mcl_potions.PLUS_FACTOR = 8/3
|
||||||
|
|
||||||
mcl_potions.DURATION = 180
|
mcl_potions.DURATION = 180
|
||||||
mcl_potions.DURATION_PLUS = mcl_potions.DURATION * (8/3)
|
mcl_potions.DURATION_PLUS = mcl_potions.DURATION * mcl_potions.PLUS_FACTOR
|
||||||
mcl_potions.DURATION_2 = mcl_potions.DURATION * (1/2)
|
mcl_potions.DURATION_2 = mcl_potions.DURATION / mcl_potions.II_FACTOR
|
||||||
|
|
||||||
mcl_potions.INV_FACTOR = 0.50
|
mcl_potions.INV_FACTOR = 0.50
|
||||||
mcl_potions.SPLASH_FACTOR = 0.75
|
mcl_potions.SPLASH_FACTOR = 0.75
|
||||||
|
|
|
@ -164,12 +164,12 @@ register_lingering("thick", S("Lingering Thick Potion"), "#0000FF", {
|
||||||
})
|
})
|
||||||
|
|
||||||
register_lingering("healing", S("Lingering Healing Potion"), "#AA0000", {
|
register_lingering("healing", S("Lingering Healing Potion"), "#AA0000", {
|
||||||
potion_fun = function(player) player:set_hp(player:get_hp() + 2) end,
|
potion_fun = function(player) mcl_potions.healing_func(player, 2) end,
|
||||||
tt = S("+2 HP")
|
tt = S("+2 HP")
|
||||||
})
|
})
|
||||||
|
|
||||||
register_lingering("healing_2", S("Lingering Healing Potion II"), "#DD0000", {
|
register_lingering("healing_2", S("Lingering Healing Potion II"), "#DD0000", {
|
||||||
potion_fun = function(player) player:set_hp(player:get_hp() + 4) end,
|
potion_fun = function(player) mcl_potions.healing_func(player, 4) end,
|
||||||
tt = S("+4 HP")
|
tt = S("+4 HP")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -259,12 +259,12 @@ register_lingering("regeneration_plus", S("Lingering Regeneration Potion +"), "#
|
||||||
})
|
})
|
||||||
|
|
||||||
register_lingering("invisibility", S("Lingering Invisibility Potion"), "#B0B0B0", {
|
register_lingering("invisibility", S("Lingering Invisibility Potion"), "#B0B0B0", {
|
||||||
potion_fun = function(player) mcl_potions.invisiblility_func(player, mcl_potions.DURATION*0.25) end,
|
potion_fun = function(player) mcl_potions.invisiblility_func(player, nil, mcl_potions.DURATION*0.25) end,
|
||||||
tt = time_string(mcl_potions.DURATION*0.25)
|
tt = time_string(mcl_potions.DURATION*0.25)
|
||||||
})
|
})
|
||||||
|
|
||||||
register_lingering("invisibility_plus", S("Lingering Invisibility Potion +"), "#A0A0A0", {
|
register_lingering("invisibility_plus", S("Lingering Invisibility Potion +"), "#A0A0A0", {
|
||||||
potion_fun = function(player) mcl_potions.invisiblility_func(player, mcl_potions.DURATION_PLUS*0.25) end,
|
potion_fun = function(player) mcl_potions.invisiblility_func(player, nil, mcl_potions.DURATION_PLUS*0.25) end,
|
||||||
tt = time_string(mcl_potions.DURATION_PLUS*0.25)
|
tt = time_string(mcl_potions.DURATION_PLUS*0.25)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -281,12 +281,12 @@ register_lingering("invisibility_plus", S("Lingering Invisibility Potion +"), "#
|
||||||
-- })
|
-- })
|
||||||
|
|
||||||
register_lingering("fire_resistance", S("Lingering Fire Resistance Potion"), "#D0A040", {
|
register_lingering("fire_resistance", S("Lingering Fire Resistance Potion"), "#D0A040", {
|
||||||
potion_fun = function(player) mcl_potions.fire_resistance_func(player, mcl_potions.DURATION*0.25) end,
|
potion_fun = function(player) mcl_potions.fire_resistance_func(player, nil, mcl_potions.DURATION*0.25) end,
|
||||||
tt = time_string(mcl_potions.DURATION*0.25)
|
tt = time_string(mcl_potions.DURATION*0.25)
|
||||||
})
|
})
|
||||||
|
|
||||||
register_lingering("fire_resistance_plus", S("Lingering Fire Resistance Potion +"), "#E0B050", {
|
register_lingering("fire_resistance_plus", S("Lingering Fire Resistance Potion +"), "#E0B050", {
|
||||||
potion_fun = function(player) mcl_potions.fire_resistance_func(player, mcl_potions.DURATION_PLUS*0.25) end,
|
potion_fun = function(player) mcl_potions.fire_resistance_func(player, nil, mcl_potions.DURATION_PLUS*0.25) end,
|
||||||
tt = time_string(mcl_potions.DURATION_PLUS*0.25)
|
tt = time_string(mcl_potions.DURATION_PLUS*0.25)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -309,11 +309,11 @@ register_lingering("fire_resistance_plus", S("Lingering Fire Resistance Potion +
|
||||||
-- })
|
-- })
|
||||||
|
|
||||||
register_lingering("night_vision", S("Lingering Night Vision Potion"), "#1010AA", {
|
register_lingering("night_vision", S("Lingering Night Vision Potion"), "#1010AA", {
|
||||||
potion_fun = function(player) mcl_potions.night_vision_func(player, mcl_potions.DURATION*0.25) end,
|
potion_fun = function(player) mcl_potions.night_vision_func(player, nil, mcl_potions.DURATION*0.25) end,
|
||||||
tt = time_string(mcl_potions.DURATION*0.25)
|
tt = time_string(mcl_potions.DURATION*0.25)
|
||||||
})
|
})
|
||||||
|
|
||||||
register_lingering("night_vision_plus", S("Lingering Night Vision Potion +"), "#2020BA", {
|
register_lingering("night_vision_plus", S("Lingering Night Vision Potion +"), "#2020BA", {
|
||||||
potion_fun = function(player) mcl_potions.night_vision_func(player, mcl_potions.DURATION_PLUS*0.25) end,
|
potion_fun = function(player) mcl_potions.night_vision_func(player, nil, mcl_potions.DURATION_PLUS*0.25) end,
|
||||||
tt = time_string(mcl_potions.DURATION_PLUS*0.25)
|
tt = time_string(mcl_potions.DURATION_PLUS*0.25)
|
||||||
})
|
})
|
||||||
|
|
|
@ -10,22 +10,142 @@ end
|
||||||
|
|
||||||
local how_to_drink = S("Use the “Place” key to drink it.")
|
local how_to_drink = S("Use the “Place” key to drink it.")
|
||||||
|
|
||||||
|
local function time_string(dur)
|
||||||
|
if not dur then return nil end
|
||||||
|
return math.floor(dur/60)..string.format(":%02d",math.floor(dur % 60))
|
||||||
|
end
|
||||||
|
|
||||||
local function register_potion(def)
|
local function register_potion(def)
|
||||||
|
|
||||||
|
local dur = mcl_potions.DURATION
|
||||||
|
|
||||||
|
if def.is_inv then
|
||||||
|
dur = dur * mcl_potions.INV_FACTOR
|
||||||
|
end
|
||||||
|
if def.name == "poison" or def.name == "regeneration" then
|
||||||
|
dur = 45
|
||||||
|
end
|
||||||
|
|
||||||
|
local on_use = function (itemstack, user, pointed_thing)
|
||||||
|
def.on_use(user, def.effect, dur)
|
||||||
|
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
||||||
|
mcl_potions._use_potion(itemstack, user, def.color)
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
|
||||||
|
local _tt
|
||||||
|
if def.effect and def.is_dur then
|
||||||
|
_tt = (def.effect*100).."% | "..time_string(dur)
|
||||||
|
if def.name == "poison" or def.name == "regeneration" then
|
||||||
|
_tt = "1/2 Heart/"..def.effect.."sec | "..time_string(dur)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
_tt = def._tt or time_string(dur) or S("No effect")
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_potions:"..def.name, {
|
minetest.register_craftitem("mcl_potions:"..def.name, {
|
||||||
description = def.description,
|
description = S(def.description),
|
||||||
_tt_help = def._tt,
|
_tt_help = _tt,
|
||||||
_doc_items_longdesc = def._longdesc,
|
_doc_items_longdesc = def._longdesc,
|
||||||
_doc_items_usagehelp = how_to_drink,
|
_doc_items_usagehelp = how_to_drink,
|
||||||
stack_max = 1,
|
stack_max = 1,
|
||||||
inventory_image = def.image,
|
inventory_image = def.image or potion_image(def.color),
|
||||||
wield_image = def.image,
|
wield_image = def.image or potion_image(def.color),
|
||||||
groups = def.groups or {brewitem=1, food=3, can_eat_when_full=1, not_in_creative_inventory=0},
|
groups = def.groups or {brewitem=1, food=3, can_eat_when_full=1, not_in_creative_inventory=0},
|
||||||
on_place = def.on_use,
|
on_place = on_use,
|
||||||
on_secondary_use = def.on_use,
|
on_secondary_use = on_use,
|
||||||
})
|
})
|
||||||
|
|
||||||
if def.is_II then
|
if def.is_II then
|
||||||
|
|
||||||
|
local desc_mod = " II"
|
||||||
|
|
||||||
|
local effect_II
|
||||||
|
if def.name == "healing" or def.name == "harming" then
|
||||||
|
effect_II = def.effect*mcl_potions.II_FACTOR
|
||||||
|
elseif def.name == "poison" or def.name == "regeneration" then
|
||||||
|
effect_II = 1.2
|
||||||
|
else
|
||||||
|
effect_II = def.effect^mcl_potions.II_FACTOR
|
||||||
|
end
|
||||||
|
|
||||||
|
dur_2 = dur / mcl_potions.II_FACTOR
|
||||||
|
if def.name == "poison" then dur_2 = dur_2 - 1 end
|
||||||
|
|
||||||
|
if def.name == "slowness" then
|
||||||
|
dur_2 = 20
|
||||||
|
effect_II = 0.40
|
||||||
|
desc_mod = " IV"
|
||||||
|
end
|
||||||
|
|
||||||
|
local _tt
|
||||||
|
if effect_II and def.is_dur then
|
||||||
|
_tt = (effect_II*100).."% | "..time_string(dur_2)
|
||||||
|
if def.name == "poison" or def.name == "regeneration" then
|
||||||
|
_tt = "1/2 Heart/"..effect_II.."sec | "..time_string(dur_2)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
_tt = def._tt_2 or time_string(dur_2) or S("No effect")
|
||||||
|
end
|
||||||
|
|
||||||
|
local on_use = function (itemstack, user, pointed_thing)
|
||||||
|
def.on_use(user, effect_II, dur_2)
|
||||||
|
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
||||||
|
mcl_potions._use_potion(itemstack, user, def.color)
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_craftitem("mcl_potions:"..def.name.."_2", {
|
||||||
|
description = S(def.description..desc_mod),
|
||||||
|
_tt_help = _tt,
|
||||||
|
_doc_items_longdesc = def._longdesc,
|
||||||
|
_doc_items_usagehelp = how_to_drink,
|
||||||
|
stack_max = 1,
|
||||||
|
inventory_image = def.image or potion_image(def.color),
|
||||||
|
wield_image = def.image or potion_image(def.color),
|
||||||
|
groups = def.groups or {brewitem=1, food=3, can_eat_when_full=1, not_in_creative_inventory=0},
|
||||||
|
on_place = on_use,
|
||||||
|
on_secondary_use = on_use,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
if def.is_plus then
|
||||||
|
|
||||||
|
dur_pl = dur * mcl_potions.PLUS_FACTOR
|
||||||
|
if def.name == "poison" or def.name == "regeneration" then
|
||||||
|
dur_pl = 90
|
||||||
|
end
|
||||||
|
|
||||||
|
local _tt
|
||||||
|
if def.effect and def.is_dur then
|
||||||
|
_tt = (def.effect*100).."% | "..time_string(dur_pl)
|
||||||
|
if def.name == "poison" or def.name == "regeneration" then
|
||||||
|
_tt = "1/2 Heart/"..def.effect.."sec | "..time_string(dur_pl)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
_tt = def._tt_plus or time_string(dur_pl) or S("No effect")
|
||||||
|
end
|
||||||
|
|
||||||
|
local on_use = function (itemstack, user, pointed_thing)
|
||||||
|
def.on_use(user, def.effect, dur_pl)
|
||||||
|
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
||||||
|
mcl_potions._use_potion(itemstack, user, def.color)
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_craftitem("mcl_potions:"..def.name.."_plus", {
|
||||||
|
description = S(def.description.." +"),
|
||||||
|
_tt_help = _tt,
|
||||||
|
_doc_items_longdesc = def._longdesc,
|
||||||
|
_doc_items_usagehelp = how_to_drink,
|
||||||
|
stack_max = 1,
|
||||||
|
inventory_image = def.image or potion_image(def.color),
|
||||||
|
wield_image = def.image or potion_image(def.color),
|
||||||
|
groups = def.groups or {brewitem=1, food=3, can_eat_when_full=1, not_in_creative_inventory=0},
|
||||||
|
on_place = on_use,
|
||||||
|
on_secondary_use = on_use,
|
||||||
|
})
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -34,37 +154,38 @@ end
|
||||||
|
|
||||||
local awkward_def = {
|
local awkward_def = {
|
||||||
name = "awkward",
|
name = "awkward",
|
||||||
description = S("Awkward Potion"),
|
description = "Awkward Potion",
|
||||||
_tt = S("No effect"),
|
_tt = S("No effect"),
|
||||||
_longdesc = S("Has an awkward taste and is used for brewing potions."),
|
_longdesc = S("Has an awkward taste and is used for brewing potions."),
|
||||||
image = potion_image("#0000FF"),
|
color = "#0000FF",
|
||||||
groups = {brewitem=1, food=3, can_eat_when_full=1, not_in_creative_inventory=0},
|
groups = {brewitem=1, food=3, can_eat_when_full=1, not_in_creative_inventory=0},
|
||||||
on_use = minetest.item_eat(0, "mcl_potions:glass_bottle"),
|
on_use = minetest.item_eat(0, "mcl_potions:glass_bottle"),
|
||||||
}
|
}
|
||||||
|
|
||||||
local mundane_def = {
|
local mundane_def = {
|
||||||
name = "mundane",
|
name = "mundane",
|
||||||
description = S("Mundane Potion"),
|
description = "Mundane Potion",
|
||||||
_tt = S("No effect"),
|
_tt = S("No effect"),
|
||||||
longdesc = S("Has a clean taste and is used for brewing potions."),
|
longdesc = S("Has a clean taste and is used for brewing potions."),
|
||||||
image = potion_image("#0000FF"),
|
color = "#0000FF",
|
||||||
on_use = minetest.item_eat(0, "mcl_potions:glass_bottle"),
|
on_use = minetest.item_eat(0, "mcl_potions:glass_bottle"),
|
||||||
}
|
}
|
||||||
|
|
||||||
local thick_def = {
|
local thick_def = {
|
||||||
name = "thick",
|
name = "thick",
|
||||||
description = S("Thick Potion"),
|
description = "Thick Potion",
|
||||||
_tt = S("No effect"),
|
_tt = S("No effect"),
|
||||||
_longdesc = S("Has a bitter taste and is used for brewing potions."),
|
_longdesc = S("Has a bitter taste and is used for brewing potions."),
|
||||||
image = potion_image("#0000FF"),
|
color = "#0000FF",
|
||||||
on_use = minetest.item_eat(0, "mcl_potions:glass_bottle"),
|
on_use = minetest.item_eat(0, "mcl_potions:glass_bottle"),
|
||||||
}
|
}
|
||||||
|
|
||||||
local dragon_breath_def = {
|
local dragon_breath_def = {
|
||||||
name = "dragon_breath",
|
name = "dragon_breath",
|
||||||
description = S("Dragon's Breath"),
|
description = "Dragon's Breath",
|
||||||
_tt = S("No effect"),
|
_tt = S("No effect"),
|
||||||
_longdesc = S("Combine with Splash potions to create a Lingering effect"),
|
_longdesc = S("Combine with Splash potions to create a Lingering effect"),
|
||||||
|
color = nil,
|
||||||
image = "mcl_potions_dragon_breath.png",
|
image = "mcl_potions_dragon_breath.png",
|
||||||
groups = { brewitem = 1, not_in_creative_inventory = 0 },
|
groups = { brewitem = 1, not_in_creative_inventory = 0 },
|
||||||
on_use = nil,
|
on_use = nil,
|
||||||
|
@ -72,329 +193,156 @@ local dragon_breath_def = {
|
||||||
|
|
||||||
local healing_def = {
|
local healing_def = {
|
||||||
name = "healing",
|
name = "healing",
|
||||||
description = S("Healing Potion"),
|
description = "Healing Potion",
|
||||||
_tt = S("+2 Hearts"),
|
_tt = S("+2 Hearts"),
|
||||||
|
_tt_2 = S("+4 Hearts"),
|
||||||
_longdesc = S("Drink to heal yourself"),
|
_longdesc = S("Drink to heal yourself"),
|
||||||
image = potion_image("#CC0000"),
|
color = "#CC0000",
|
||||||
on_use = function (itemstack, user, pointed_thing)
|
effect = 4,
|
||||||
mcl_potions.healing_func(user, 4)
|
dur = nil,
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
on_use = mcl_potions.healing_func,
|
||||||
mcl_potions._use_potion(itemstack, user, "#CC0000")
|
is_II = true,
|
||||||
return itemstack
|
effect_sq = false,
|
||||||
end
|
|
||||||
}
|
}
|
||||||
|
|
||||||
local healing_2_def = table.copy(healing_def)
|
|
||||||
healing_2_def.name = "healing_2"
|
|
||||||
healing_2_def.description = S("Healing Potion II")
|
|
||||||
healing_2_def._tt = S("+4 Hearts")
|
|
||||||
healing_2_def.on_use = function (itemstack, user, pointed_thing)
|
|
||||||
mcl_potions.healing_func(user, 8)
|
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
|
||||||
mcl_potions._use_potion(itemstack, user, "#CC0000")
|
|
||||||
return itemstack
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
local harming_def = {
|
local harming_def = {
|
||||||
name = "harming",
|
name = "harming",
|
||||||
description = S("Harming Potion"),
|
description = "Harming Potion",
|
||||||
_tt = S("-3 Hearts"),
|
_tt = S("-3 Hearts"),
|
||||||
|
_tt_II = S("-6 Hearts"),
|
||||||
_longdesc = S("Drink to heal yourself"),
|
_longdesc = S("Drink to heal yourself"),
|
||||||
image = potion_image("#660099"),
|
color = "#660099",
|
||||||
on_use = function (itemstack, user, pointed_thing)
|
effect = -6,
|
||||||
mcl_potions.healing_func(user, -6)
|
dur = nil,
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
on_use = mcl_potions.healing_func,
|
||||||
mcl_potions._use_potion(itemstack, user, "#660099")
|
is_II = true,
|
||||||
return itemstack
|
}
|
||||||
end
|
|
||||||
|
local night_vision_def = {
|
||||||
|
name = "night_vision",
|
||||||
|
description = "Night Vision Potion",
|
||||||
|
_tt = nil,
|
||||||
|
_longdesc = S("Drink to see in the dark."),
|
||||||
|
color = "#1010AA",
|
||||||
|
effect = nil,
|
||||||
|
is_dur = true,
|
||||||
|
on_use = mcl_potions.night_vision_func,
|
||||||
|
is_plus = true,
|
||||||
|
}
|
||||||
|
|
||||||
|
local swiftness_def = {
|
||||||
|
name = "swiftness",
|
||||||
|
description = "Swiftness Potion",
|
||||||
|
_tt = nil,
|
||||||
|
_longdesc = S("Drink to increase your speed."),
|
||||||
|
color = "#009999",
|
||||||
|
effect = 1.2,
|
||||||
|
is_dur = true,
|
||||||
|
on_use = mcl_potions.swiftness_func,
|
||||||
|
is_II = true,
|
||||||
|
is_plus = true,
|
||||||
|
}
|
||||||
|
|
||||||
|
local slowness_def = {
|
||||||
|
name = "slowness",
|
||||||
|
description = "Slowness Potion",
|
||||||
|
_tt = nil,
|
||||||
|
_longdesc = S("Drink to become sluggish"),
|
||||||
|
color = "#000080",
|
||||||
|
effect = 0.85,
|
||||||
|
is_dur = true,
|
||||||
|
on_use = mcl_potions.swiftness_func,
|
||||||
|
is_II = true,
|
||||||
|
is_plus = true,
|
||||||
|
is_inv = true,
|
||||||
|
}
|
||||||
|
|
||||||
|
local leaping_def = {
|
||||||
|
name = "leaping",
|
||||||
|
description = "Leaping Potion",
|
||||||
|
_tt = nil,
|
||||||
|
_longdesc = S("Drink to leap tall buildings in a single bound!"),
|
||||||
|
color = "#00CC33",
|
||||||
|
effect = 1.5,
|
||||||
|
is_dur = true,
|
||||||
|
on_use = mcl_potions.leaping_func,
|
||||||
|
is_II = true,
|
||||||
|
is_plus = true,
|
||||||
|
}
|
||||||
|
|
||||||
|
local poison_def = {
|
||||||
|
name = "poison",
|
||||||
|
description = "Poison Potion",
|
||||||
|
_tt = nil,
|
||||||
|
_longdesc = S("Poison mobs or players with this dangerous potion."),
|
||||||
|
color = "#447755",
|
||||||
|
effect = 2.5,
|
||||||
|
is_dur = true,
|
||||||
|
on_use = mcl_potions.poison_func,
|
||||||
|
is_II = true,
|
||||||
|
is_plus = true,
|
||||||
|
is_inv = true,
|
||||||
|
}
|
||||||
|
|
||||||
|
local regeneration_def = {
|
||||||
|
name = "regeneration",
|
||||||
|
description = "Regeneration Potion",
|
||||||
|
_tt = nil,
|
||||||
|
_longdesc = S("Regenerate mobs or players with this healing potion over time."),
|
||||||
|
color = "#B52CC2",
|
||||||
|
effect = 2.5,
|
||||||
|
is_dur = true,
|
||||||
|
on_use = mcl_potions.regeneration_func,
|
||||||
|
is_II = true,
|
||||||
|
is_plus = true,
|
||||||
|
}
|
||||||
|
|
||||||
|
local invisibility_def = {
|
||||||
|
name = "invisibility",
|
||||||
|
description = "Invisibility Potion",
|
||||||
|
_tt = nil,
|
||||||
|
_longdesc = S("Drink and become invisibile to mobs and players."),
|
||||||
|
color = "#B0B0B0",
|
||||||
|
is_dur = true,
|
||||||
|
on_use = mcl_potions.invisiblility_func,
|
||||||
|
is_plus = true,
|
||||||
|
}
|
||||||
|
|
||||||
|
local water_breathing_def = {
|
||||||
|
name = "water_breathing",
|
||||||
|
description = "Water Breathing Potion",
|
||||||
|
_tt = nil,
|
||||||
|
_longdesc = S("Drink and breath underwater."),
|
||||||
|
color = "#0000AA",
|
||||||
|
is_dur = true,
|
||||||
|
on_use = mcl_potions.water_breathing_func,
|
||||||
|
is_plus = true,
|
||||||
|
}
|
||||||
|
|
||||||
|
local fire_resistance_def = {
|
||||||
|
name = "fire_resistance",
|
||||||
|
description = "Fire Resistance Potion",
|
||||||
|
_tt = nil,
|
||||||
|
_longdesc = S("Drink and resist fire damage."),
|
||||||
|
color = "#D0A040",
|
||||||
|
is_dur = true,
|
||||||
|
on_use = mcl_potions.fire_resistance_func,
|
||||||
|
is_plus = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
local harming_2_def = table.copy(harming_def)
|
|
||||||
harming_2_def.name = "harming_2"
|
|
||||||
harming_2_def.description = S("Harming Potion II")
|
|
||||||
harming_2_def._tt = S("-6 Hearts")
|
|
||||||
harming_2_def.on_use = function (itemstack, user, pointed_thing)
|
|
||||||
mcl_potions.healing_func(user, -12)
|
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
|
||||||
mcl_potions._use_potion(itemstack, user, "#660099")
|
|
||||||
return itemstack
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
local defs = { awkward_def, mundane_def, thick_def, dragon_breath_def,
|
local defs = { awkward_def, mundane_def, thick_def, dragon_breath_def,
|
||||||
healing_def, healing_2_def, harming_def, harming_2_def}
|
healing_def, harming_def, night_vision_def, swiftness_def,
|
||||||
|
slowness_def, leaping_def, poison_def, regeneration_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)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_potions:night_vision", {
|
|
||||||
description = S("Night Vision Potion"),
|
|
||||||
_tt_help = S("3:00"),
|
|
||||||
_doc_items_longdesc = brewhelp,
|
|
||||||
wield_image = potion_image("#1010AA"),
|
|
||||||
inventory_image = potion_image("#1010AA"),
|
|
||||||
groups = { brewitem=1, food=3, can_eat_when_full=1, not_in_creative_inventory=0 },
|
|
||||||
stack_max = 1,
|
|
||||||
|
|
||||||
on_place = function(itemstack, user, pointed_thing)
|
|
||||||
mcl_potions.night_vision_func(user, mcl_potions.DURATION)
|
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
|
||||||
mcl_potions._use_potion(itemstack, user, "#1010AA")
|
|
||||||
return itemstack
|
|
||||||
end,
|
|
||||||
|
|
||||||
on_secondary_use = function(itemstack, user, pointed_thing)
|
|
||||||
mcl_potions.night_vision_func(user, mcl_potions.DURATION)
|
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
|
||||||
mcl_potions._use_potion(itemstack, user, "#1010AA")
|
|
||||||
return itemstack
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_potions:night_vision_plus", {
|
|
||||||
description = S("Night Vision Potion +"),
|
|
||||||
_tt_help = S("8:00"),
|
|
||||||
_doc_items_longdesc = brewhelp,
|
|
||||||
wield_image = potion_image("#2020BA"),
|
|
||||||
inventory_image = potion_image("#2020BA"),
|
|
||||||
groups = { brewitem=1, food=3, can_eat_when_full=1, not_in_creative_inventory=0 },
|
|
||||||
stack_max = 1,
|
|
||||||
|
|
||||||
on_place = function(itemstack, user, pointed_thing)
|
|
||||||
mcl_potions.night_vision_func(user, mcl_potions.DURATION_PLUS)
|
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
|
||||||
mcl_potions._use_potion(itemstack, user, "#2020BA")
|
|
||||||
return itemstack
|
|
||||||
end,
|
|
||||||
|
|
||||||
on_secondary_use = function(itemstack, user, pointed_thing)
|
|
||||||
mcl_potions.night_vision_func(user, mcl_potions.DURATION_PLUS)
|
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
|
||||||
mcl_potions._use_potion(itemstack, user, "#2020BA")
|
|
||||||
return itemstack
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_potions:swiftness", {
|
|
||||||
description = S("Swiftness Potion"),
|
|
||||||
_tt_help = S("+20% | 3:00"),
|
|
||||||
_doc_items_longdesc = brewhelp,
|
|
||||||
wield_image = potion_image("#009999"),
|
|
||||||
inventory_image = potion_image("#009999"),
|
|
||||||
groups = { brewitem=1, food=3, can_eat_when_full=1, not_in_creative_inventory=0 },
|
|
||||||
stack_max = 1,
|
|
||||||
|
|
||||||
on_place = function(itemstack, user, pointed_thing)
|
|
||||||
mcl_potions.swiftness_func(user, 1.2, mcl_potions.DURATION)
|
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
|
||||||
mcl_potions._use_potion(itemstack, user, "#009999")
|
|
||||||
return itemstack
|
|
||||||
end,
|
|
||||||
|
|
||||||
on_secondary_use = function(itemstack, user, pointed_thing)
|
|
||||||
mcl_potions.swiftness_func(user, 1.2, mcl_potions.DURATION)
|
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
|
||||||
mcl_potions._use_potion(itemstack, user, "#009999")
|
|
||||||
return itemstack
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_potions:swiftness_2", {
|
|
||||||
description = S("Swiftness Potion II"),
|
|
||||||
_tt_help = S("+40% | 1:30"),
|
|
||||||
_doc_items_longdesc = brewhelp,
|
|
||||||
wield_image = potion_image("#00BBBB"),
|
|
||||||
inventory_image = potion_image("#00BBBB"),
|
|
||||||
groups = { brewitem=1, food=3, can_eat_when_full=1, not_in_creative_inventory=0 },
|
|
||||||
stack_max = 1,
|
|
||||||
|
|
||||||
on_place = function(itemstack, user, pointed_thing)
|
|
||||||
mcl_potions.swiftness_func(user, 1.4, mcl_potions.DURATION_2)
|
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
|
||||||
mcl_potions._use_potion(itemstack, user, "#00BBBB")
|
|
||||||
return itemstack
|
|
||||||
end,
|
|
||||||
|
|
||||||
on_secondary_use = function(itemstack, user, pointed_thing)
|
|
||||||
mcl_potions.swiftness_func(user, 1.4, mcl_potions.DURATION_2)
|
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
|
||||||
mcl_potions._use_potion(itemstack, user, "#00BBBB")
|
|
||||||
return itemstack
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_potions:swiftness_plus", {
|
|
||||||
description = S("Swiftness Potion +"),
|
|
||||||
_tt_help = S("+20% | 8:00"),
|
|
||||||
_doc_items_longdesc = brewhelp,
|
|
||||||
wield_image = potion_image("#00AAAA"),
|
|
||||||
inventory_image = potion_image("#00AAAA"),
|
|
||||||
groups = { brewitem=1, food=3, can_eat_when_full=1, not_in_creative_inventory=0 },
|
|
||||||
stack_max = 1,
|
|
||||||
|
|
||||||
on_place = function(itemstack, user, pointed_thing)
|
|
||||||
mcl_potions.swiftness_func(user, 1.2, mcl_potions.DURATION_PLUS)
|
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
|
||||||
mcl_potions._use_potion(itemstack, user, "#00AAAA")
|
|
||||||
return itemstack
|
|
||||||
end,
|
|
||||||
|
|
||||||
on_secondary_use = function(itemstack, user, pointed_thing)
|
|
||||||
mcl_potions.swiftness_func(user, 1.2, mcl_potions.DURATION_PLUS)
|
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
|
||||||
mcl_potions._use_potion(itemstack, user, "#00AAAA")
|
|
||||||
return itemstack
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_potions:slowness", {
|
|
||||||
description = S("Slowness Potion"),
|
|
||||||
_tt_help = S("-15% | 1:30"),
|
|
||||||
_doc_items_longdesc = brewhelp,
|
|
||||||
wield_image = potion_image("#000080"),
|
|
||||||
inventory_image = potion_image("#000080"),
|
|
||||||
groups = { brewitem=1, food=3, can_eat_when_full=1, not_in_creative_inventory=0 },
|
|
||||||
stack_max = 1,
|
|
||||||
|
|
||||||
on_place = function(itemstack, user, pointed_thing)
|
|
||||||
mcl_potions.swiftness_func(user, 0.85, mcl_potions.DURATION*mcl_potions.INV_FACTOR)
|
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
|
||||||
mcl_potions._use_potion(itemstack, user, "#000080")
|
|
||||||
return itemstack
|
|
||||||
end,
|
|
||||||
|
|
||||||
on_secondary_use = function(itemstack, user, pointed_thing)
|
|
||||||
mcl_potions.swiftness_func(user, 0.85, mcl_potions.DURATION*mcl_potions.INV_FACTOR)
|
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
|
||||||
mcl_potions._use_potion(itemstack, user, "#000080")
|
|
||||||
return itemstack
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_potions:slowness_plus", {
|
|
||||||
description = S("Slowness Potion +"),
|
|
||||||
_tt_help = S("-15% | 4:00"),
|
|
||||||
_doc_items_longdesc = brewhelp,
|
|
||||||
wield_image = potion_image("#000066"),
|
|
||||||
inventory_image = potion_image("#000066"),
|
|
||||||
groups = { brewitem=1, food=3, can_eat_when_full=1, not_in_creative_inventory=0 },
|
|
||||||
stack_max = 1,
|
|
||||||
|
|
||||||
on_place = function(itemstack, user, pointed_thing)
|
|
||||||
mcl_potions.swiftness_func(user, 0.85, mcl_potions.DURATION_2*mcl_potions.INV_FACTOR)
|
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
|
||||||
mcl_potions._use_potion(itemstack, user, "#000066")
|
|
||||||
return itemstack
|
|
||||||
end,
|
|
||||||
|
|
||||||
on_secondary_use = function(itemstack, user, pointed_thing)
|
|
||||||
mcl_potions.swiftness_func(user, 0.85, mcl_potions.DURATION_2*mcl_potions.INV_FACTOR)
|
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
|
||||||
mcl_potions._use_potion(itemstack, user, "#000066")
|
|
||||||
return itemstack
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_potions:slowness_2", {
|
|
||||||
description = S("Slowness Potion IV"),
|
|
||||||
_tt_help = S("-60% | 0:20"),
|
|
||||||
_doc_items_longdesc = brewhelp,
|
|
||||||
wield_image = potion_image("#000090"),
|
|
||||||
inventory_image = potion_image("#000090"),
|
|
||||||
groups = { brewitem=1, food=3, can_eat_when_full=1, not_in_creative_inventory=0 },
|
|
||||||
stack_max = 1,
|
|
||||||
|
|
||||||
on_place = function(itemstack, user, pointed_thing)
|
|
||||||
mcl_potions.swiftness_func(user, 0.40, 20)
|
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
|
||||||
mcl_potions._use_potion(itemstack, user, "#000090")
|
|
||||||
return itemstack
|
|
||||||
end,
|
|
||||||
|
|
||||||
on_secondary_use = function(itemstack, user, pointed_thing)
|
|
||||||
mcl_potions.swiftness_func(user, 0.40, 20)
|
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
|
||||||
mcl_potions._use_potion(itemstack, user, "#000090")
|
|
||||||
return itemstack
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_potions:leaping", {
|
|
||||||
description = S("Leaping Potion"),
|
|
||||||
_tt_help = S("+50% | 3:00"),
|
|
||||||
_doc_items_longdesc = brewhelp,
|
|
||||||
wield_image = potion_image("#00CC33"),
|
|
||||||
inventory_image = potion_image("#00CC33"),
|
|
||||||
groups = { brewitem=1, food=3, can_eat_when_full=1, not_in_creative_inventory=0 },
|
|
||||||
stack_max = 1,
|
|
||||||
|
|
||||||
on_place = function(itemstack, user, pointed_thing)
|
|
||||||
mcl_potions.leaping_func(user, 1.5, mcl_potions.DURATION)
|
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
|
||||||
mcl_potions._use_potion(itemstack, user, "#00CC33")
|
|
||||||
return itemstack
|
|
||||||
end,
|
|
||||||
|
|
||||||
on_secondary_use = function(itemstack, user, pointed_thing)
|
|
||||||
mcl_potions.leaping_func(user, 1.5, mcl_potions.DURATION)
|
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
|
||||||
mcl_potions._use_potion(itemstack, user, "#00CC33")
|
|
||||||
return itemstack
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_potions:leaping_2", {
|
|
||||||
description = S("Leaping Potion II"),
|
|
||||||
_tt_help = S("+125% | 1:30"),
|
|
||||||
_doc_items_longdesc = brewhelp,
|
|
||||||
wield_image = potion_image("#00EE33"),
|
|
||||||
inventory_image = potion_image("#00EE33"),
|
|
||||||
groups = { brewitem=1, food=3, can_eat_when_full=1, not_in_creative_inventory=0 },
|
|
||||||
stack_max = 1,
|
|
||||||
|
|
||||||
on_place = function(itemstack, user, pointed_thing)
|
|
||||||
mcl_potions.leaping_func(user, 2.25, mcl_potions.DURATION_2)
|
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
|
||||||
mcl_potions._use_potion(itemstack, user, "#00EE33")
|
|
||||||
return itemstack
|
|
||||||
end,
|
|
||||||
|
|
||||||
on_secondary_use = function(itemstack, user, pointed_thing)
|
|
||||||
mcl_potions.leaping_func(user, 2.25, mcl_potions.DURATION_2)
|
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
|
||||||
mcl_potions._use_potion(itemstack, user, "#00EE33")
|
|
||||||
return itemstack
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_potions:leaping_plus", {
|
|
||||||
description = S("Leaping Potion +"),
|
|
||||||
_tt_help = S("+50% | 8:00"),
|
|
||||||
_doc_items_longdesc = brewhelp,
|
|
||||||
wield_image = potion_image("#00DD33"),
|
|
||||||
inventory_image = potion_image("#00DD33"),
|
|
||||||
groups = { brewitem=1, food=3, can_eat_when_full=1, not_in_creative_inventory=0 },
|
|
||||||
stack_max = 1,
|
|
||||||
|
|
||||||
on_place = function(itemstack, user, pointed_thing)
|
|
||||||
mcl_potions.leaping_func(user, 1.5, mcl_potions.DURATION_PLUS)
|
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
|
||||||
mcl_potions._use_potion(itemstack, user, "#00DD33")
|
|
||||||
return itemstack
|
|
||||||
end,
|
|
||||||
|
|
||||||
on_secondary_use = function(itemstack, user, pointed_thing)
|
|
||||||
mcl_potions.leaping_func(user, 1.5, mcl_potions.DURATION_PLUS)
|
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
|
||||||
mcl_potions._use_potion(itemstack, user, "#00DD33")
|
|
||||||
return itemstack
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
-- minetest.register_craftitem("mcl_potions:weakness", {
|
-- minetest.register_craftitem("mcl_potions:weakness", {
|
||||||
|
@ -516,303 +464,3 @@ minetest.register_craftitem("mcl_potions:leaping_plus", {
|
||||||
-- return itemstack
|
-- return itemstack
|
||||||
-- end
|
-- end
|
||||||
-- })
|
-- })
|
||||||
|
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_potions:poison", {
|
|
||||||
description = S("Poison Potion"),
|
|
||||||
_tt_help = S("-1 HP / 2.5s | 0:45"),
|
|
||||||
_doc_items_longdesc = brewhelp,
|
|
||||||
wield_image = potion_image("#225533"),
|
|
||||||
inventory_image = potion_image("#225533"),
|
|
||||||
groups = { brewitem=1, food=3, can_eat_when_full=1, not_in_creative_inventory=0 },
|
|
||||||
stack_max = 1,
|
|
||||||
|
|
||||||
on_place = function(itemstack, user, pointed_thing)
|
|
||||||
mcl_potions.poison_func(user, 2.5, mcl_potions.DURATION*mcl_potions.INV_FACTOR^2)
|
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
|
||||||
mcl_potions._use_potion(itemstack, user, "#225533")
|
|
||||||
return itemstack
|
|
||||||
end,
|
|
||||||
|
|
||||||
on_secondary_use = function(itemstack, user, pointed_thing)
|
|
||||||
mcl_potions.poison_func(user, 2.5, mcl_potions.DURATION*mcl_potions.INV_FACTOR^2)
|
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
|
||||||
mcl_potions._use_potion(itemstack, user, "#225533")
|
|
||||||
return itemstack
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_potions:poison_2", {
|
|
||||||
description = S("Poison Potion II"),
|
|
||||||
_tt_help = S("-1 HP / 1.2s | 0:21"),
|
|
||||||
_doc_items_longdesc = brewhelp,
|
|
||||||
wield_image = potion_image("#447755"),
|
|
||||||
inventory_image = potion_image("#447755"),
|
|
||||||
groups = { brewitem=1, food=3, can_eat_when_full=1, not_in_creative_inventory=0 },
|
|
||||||
stack_max = 1,
|
|
||||||
|
|
||||||
on_place = function(itemstack, user, pointed_thing)
|
|
||||||
mcl_potions.poison_func(user, 1.2, mcl_potions.DURATION_2*mcl_potions.INV_FACTOR^2)
|
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
|
||||||
mcl_potions._use_potion(itemstack, user, "#447755")
|
|
||||||
return itemstack
|
|
||||||
end,
|
|
||||||
|
|
||||||
on_secondary_use = function(itemstack, user, pointed_thing)
|
|
||||||
mcl_potions.poison_func(user, 1.2, mcl_potions.DURATION_2*mcl_potions.INV_FACTOR^2)
|
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
|
||||||
mcl_potions._use_potion(itemstack, user, "#447755")
|
|
||||||
return itemstack
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_potions:poison_plus", {
|
|
||||||
description = S("Poison Potion +"),
|
|
||||||
_tt_help = S("-1 HP / 2.5s | 1:30"),
|
|
||||||
_doc_items_longdesc = brewhelp,
|
|
||||||
wield_image = potion_image("#336644"),
|
|
||||||
inventory_image = potion_image("#336644"),
|
|
||||||
groups = { brewitem=1, food=3, can_eat_when_full=1, not_in_creative_inventory=0 },
|
|
||||||
stack_max = 1,
|
|
||||||
|
|
||||||
on_place = function(itemstack, user, pointed_thing)
|
|
||||||
mcl_potions.poison_func(user, 2.5, mcl_potions.DURATION*mcl_potions.INV_FACTOR)
|
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
|
||||||
mcl_potions._use_potion(itemstack, user, "#336644")
|
|
||||||
return itemstack
|
|
||||||
end,
|
|
||||||
|
|
||||||
on_secondary_use = function(itemstack, user, pointed_thing)
|
|
||||||
mcl_potions.poison_func(user, 2.5, mcl_potions.DURATION*mcl_potions.INV_FACTOR)
|
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
|
||||||
mcl_potions._use_potion(itemstack, user, "#336644")
|
|
||||||
return itemstack
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_potions:regeneration", {
|
|
||||||
description = S("Regeneration Potion"),
|
|
||||||
_tt_help = S("+1 HP / 2.5s | 0:45"),
|
|
||||||
_doc_items_longdesc = brewhelp,
|
|
||||||
wield_image = potion_image("#A52BB2"),
|
|
||||||
inventory_image = potion_image("#A52BB2"),
|
|
||||||
groups = { brewitem=1, food=3, can_eat_when_full=1, not_in_creative_inventory=0 },
|
|
||||||
stack_max = 1,
|
|
||||||
|
|
||||||
on_place = function(itemstack, user, pointed_thing)
|
|
||||||
mcl_potions.regeneration_func(user, 2.5, mcl_potions.DURATION*mcl_potions.INV_FACTOR^2)
|
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
|
||||||
mcl_potions._use_potion(itemstack, user, "#A52BB2")
|
|
||||||
return itemstack
|
|
||||||
end,
|
|
||||||
|
|
||||||
on_secondary_use = function(itemstack, user, pointed_thing)
|
|
||||||
mcl_potions.regeneration_func(user, 2.5, mcl_potions.DURATION*mcl_potions.INV_FACTOR^2)
|
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
|
||||||
mcl_potions._use_potion(itemstack, user, "#A52BB2")
|
|
||||||
return itemstack
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_potions:regeneration_2", {
|
|
||||||
description = S("Regeneration Potion II"),
|
|
||||||
_tt_help = S("+1 HP / 1.2s | 0:22"),
|
|
||||||
_doc_items_longdesc = brewhelp,
|
|
||||||
wield_image = potion_image("#B52CC2"),
|
|
||||||
inventory_image = potion_image("#B52CC2"),
|
|
||||||
groups = { brewitem=1, food=3, can_eat_when_full=1, not_in_creative_inventory=0 },
|
|
||||||
stack_max = 1,
|
|
||||||
|
|
||||||
on_place = function(itemstack, user, pointed_thing)
|
|
||||||
mcl_potions.regeneration_func(user, 1.2, mcl_potions.DURATION*mcl_potions.INV_FACTOR^3 + 1)
|
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
|
||||||
mcl_potions._use_potion(itemstack, user, "#B52CC2")
|
|
||||||
return itemstack
|
|
||||||
end,
|
|
||||||
|
|
||||||
on_secondary_use = function(itemstack, user, pointed_thing)
|
|
||||||
mcl_potions.regeneration_func(user, 1.2, mcl_potions.DURATION*mcl_potions.INV_FACTOR^3 + 1)
|
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
|
||||||
mcl_potions._use_potion(itemstack, user, "#B52CC2")
|
|
||||||
return itemstack
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_potions:regeneration_plus", {
|
|
||||||
description = S("Regeneration Potion +"),
|
|
||||||
_tt_help = S("+1 HP / 2.5s | 1:30"),
|
|
||||||
_doc_items_longdesc = brewhelp,
|
|
||||||
wield_image = potion_image("#C53DD3"),
|
|
||||||
inventory_image = potion_image("#C53DD3"),
|
|
||||||
groups = { brewitem=1, food=3, can_eat_when_full=1, not_in_creative_inventory=0 },
|
|
||||||
stack_max = 1,
|
|
||||||
|
|
||||||
on_place = function(itemstack, user, pointed_thing)
|
|
||||||
mcl_potions.regeneration_func(user, 2.5, mcl_potions.DURATION*mcl_potions.INV_FACTOR)
|
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
|
||||||
mcl_potions._use_potion(itemstack, user, "#C53DD3")
|
|
||||||
return itemstack
|
|
||||||
end,
|
|
||||||
|
|
||||||
on_secondary_use = function(itemstack, user, pointed_thing)
|
|
||||||
mcl_potions.regeneration_func(user, 2.5, mcl_potions.DURATION*mcl_potions.INV_FACTOR)
|
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
|
||||||
mcl_potions._use_potion(itemstack, user, "#C53DD3")
|
|
||||||
return itemstack
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_potions:invisibility", {
|
|
||||||
description = S("Invisibility Potion"),
|
|
||||||
_tt_help = S("3:00"),
|
|
||||||
_doc_items_longdesc = brewhelp,
|
|
||||||
wield_image = potion_image("#B0B0B0"),
|
|
||||||
inventory_image = potion_image("#B0B0B0"),
|
|
||||||
groups = { brewitem=1, food=3, can_eat_when_full=1, not_in_creative_inventory=0 },
|
|
||||||
stack_max = 1,
|
|
||||||
|
|
||||||
on_place = function(itemstack, user, pointed_thing)
|
|
||||||
mcl_potions.invisiblility_func(user, mcl_potions.DURATION)
|
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
|
||||||
mcl_potions._use_potion(itemstack, user, "#B0B0B0")
|
|
||||||
return itemstack
|
|
||||||
end,
|
|
||||||
|
|
||||||
on_secondary_use = function(itemstack, user, pointed_thing)
|
|
||||||
mcl_potions.invisiblility_func(user, mcl_potions.DURATION)
|
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
|
||||||
mcl_potions._use_potion(itemstack, user, "#B0B0B0")
|
|
||||||
return itemstack
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_potions:invisibility_plus", {
|
|
||||||
description = S("Invisibility Potion +"),
|
|
||||||
_tt_help = S("8:00"),
|
|
||||||
_doc_items_longdesc = brewhelp,
|
|
||||||
wield_image = potion_image("#A0A0A0"),
|
|
||||||
inventory_image = potion_image("#A0A0A0"),
|
|
||||||
groups = { brewitem=1, food=3, can_eat_when_full=1, not_in_creative_inventory=0 },
|
|
||||||
stack_max = 1,
|
|
||||||
|
|
||||||
on_place = function(itemstack, user, pointed_thing)
|
|
||||||
mcl_potions.invisiblility_func(user, mcl_potions.DURATION_PLUS)
|
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
|
||||||
mcl_potions._use_potion(itemstack, user, "#A0A0A0")
|
|
||||||
return itemstack
|
|
||||||
end,
|
|
||||||
|
|
||||||
on_secondary_use = function(itemstack, user, pointed_thing)
|
|
||||||
mcl_potions.invisiblility_func(user, mcl_potions.DURATION_PLUS)
|
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
|
||||||
mcl_potions._use_potion(itemstack, user, "#A0A0A0")
|
|
||||||
return itemstack
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Look into reducing attack on punch
|
|
||||||
minetest.register_on_punchnode(function(pos, node, puncher, pointed_thing)
|
|
||||||
if puncher:get_attribute("weakness") then
|
|
||||||
print("Weakness Active")
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_potions:water_breathing", {
|
|
||||||
description = S("Water Breathing Potion"),
|
|
||||||
_tt_help = S("3:00"),
|
|
||||||
_doc_items_longdesc = brewhelp,
|
|
||||||
wield_image = potion_image("#0000AA"),
|
|
||||||
inventory_image = potion_image("#0000AA"),
|
|
||||||
groups = { brewitem=1, food=3, can_eat_when_full=1, not_in_creative_inventory=0 },
|
|
||||||
stack_max = 1,
|
|
||||||
|
|
||||||
on_place = function(itemstack, user, pointed_thing)
|
|
||||||
mcl_potions.water_breathing_func(user, mcl_potions.DURATION)
|
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
|
||||||
mcl_potions._use_potion(itemstack, user, "#0000AA")
|
|
||||||
return itemstack
|
|
||||||
end,
|
|
||||||
|
|
||||||
on_secondary_use = function(itemstack, user, pointed_thing)
|
|
||||||
mcl_potions.water_breathing_func(user, mcl_potions.DURATION)
|
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
|
||||||
mcl_potions._use_potion(itemstack, user, "#0000AA")
|
|
||||||
return itemstack
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_potions:water_breathing_plus", {
|
|
||||||
description = S("Water Breathing Potion +"),
|
|
||||||
_tt_help = S("8:00"),
|
|
||||||
_doc_items_longdesc = brewhelp,
|
|
||||||
wield_image = potion_image("#0000CC"),
|
|
||||||
inventory_image = potion_image("#0000CC"),
|
|
||||||
groups = { brewitem=1, food=3, can_eat_when_full=1, not_in_creative_inventory=0 },
|
|
||||||
stack_max = 1,
|
|
||||||
|
|
||||||
on_place = function(itemstack, user, pointed_thing)
|
|
||||||
mcl_potions.water_breathing_func(user, mcl_potions.DURATION_PLUS)
|
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
|
||||||
mcl_potions._use_potion(itemstack, user, "#0000CC")
|
|
||||||
return itemstack
|
|
||||||
end,
|
|
||||||
|
|
||||||
on_secondary_use = function(itemstack, user, pointed_thing)
|
|
||||||
mcl_potions.water_breathing_func(user, mcl_potions.DURATION_PLUS)
|
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
|
||||||
mcl_potions._use_potion(itemstack, user, "#0000CC")
|
|
||||||
return itemstack
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_potions:fire_resistance", {
|
|
||||||
description = S("Fire Resistance Potion"),
|
|
||||||
_tt_help = S("3:00"),
|
|
||||||
_doc_items_longdesc = brewhelp,
|
|
||||||
wield_image = potion_image("#D0A040"),
|
|
||||||
inventory_image = potion_image("#D0A040"),
|
|
||||||
groups = { brewitem=1, food=3, can_eat_when_full=1, not_in_creative_inventory=0 },
|
|
||||||
stack_max = 1,
|
|
||||||
|
|
||||||
on_place = function(itemstack, user, pointed_thing)
|
|
||||||
mcl_potions.fire_resistance_func(user, mcl_potions.DURATION)
|
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
|
||||||
mcl_potions._use_potion(itemstack, user, "#D0A040")
|
|
||||||
return itemstack
|
|
||||||
end,
|
|
||||||
|
|
||||||
on_secondary_use = function(itemstack, user, pointed_thing)
|
|
||||||
mcl_potions.fire_resistance_func(user, mcl_potions.DURATION)
|
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
|
||||||
mcl_potions._use_potion(itemstack, user, "#D0A040")
|
|
||||||
return itemstack
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_potions:fire_resistance_plus", {
|
|
||||||
description = S("Fire Resistance Potion +"),
|
|
||||||
_tt_help = S("8:00"),
|
|
||||||
_doc_items_longdesc = brewhelp,
|
|
||||||
wield_image = potion_image("#E0B050"),
|
|
||||||
inventory_image = potion_image("#E0B050"),
|
|
||||||
groups = { brewitem=1, food=3, can_eat_when_full=1, not_in_creative_inventory=0 },
|
|
||||||
stack_max = 1,
|
|
||||||
|
|
||||||
on_place = function(itemstack, user, pointed_thing)
|
|
||||||
mcl_potions.fire_resistance_func(user, mcl_potions.DURATION_PLUS)
|
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
|
||||||
mcl_potions._use_potion(itemstack, user, "#E0B050")
|
|
||||||
return itemstack
|
|
||||||
end,
|
|
||||||
|
|
||||||
on_secondary_use = function(itemstack, user, pointed_thing)
|
|
||||||
mcl_potions.fire_resistance_func(user, mcl_potions.DURATION_PLUS)
|
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
|
||||||
mcl_potions._use_potion(itemstack, user, "#E0B050")
|
|
||||||
return itemstack
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
Loading…
Reference in New Issue