Merge branch 'bzoss_brew' of https://git.minetest.land/Wuzzy/MineClone2 into bzoss_brew
|
@ -202,6 +202,7 @@ There are so many people to list (sorry). Check out the respective mod directori
|
||||||
* [aligator](https://github.com/aligator): Improvement of doors
|
* [aligator](https://github.com/aligator): Improvement of doors
|
||||||
* [ryvnf](https://github.com/ryvnf): Explosion mechanics
|
* [ryvnf](https://github.com/ryvnf): Explosion mechanics
|
||||||
* MysticTempest: Bugfixes
|
* MysticTempest: Bugfixes
|
||||||
|
* [bzoss](https://github.com/bzoss): Brewing Stand
|
||||||
* Lots of other people: TO BE WRITTEN (see mod directories for details)
|
* Lots of other people: TO BE WRITTEN (see mod directories for details)
|
||||||
|
|
||||||
#### Mod credits (summary)
|
#### Mod credits (summary)
|
||||||
|
|
|
@ -36,17 +36,8 @@ mobs:register_mob("mobs_mc:ghast", {
|
||||||
walk_velocity = 1.6,
|
walk_velocity = 1.6,
|
||||||
run_velocity = 3.2,
|
run_velocity = 3.2,
|
||||||
drops = {
|
drops = {
|
||||||
{name = mobs_mc.items.gunpowder,
|
{name = mobs_mc.items.gunpowder, chance = 1, min = 0, max = 2,},
|
||||||
chance = 1,
|
{name = mobs_mc.items.ghast_tear, chance = 3,min = 0,max = 1,},
|
||||||
min = 0,
|
|
||||||
max = 2,},
|
|
||||||
-- TODO: drop tear when it's useful
|
|
||||||
-- ghast tear replaced with gunpowder
|
|
||||||
--{name = mobs_mc.items.ghast_tear,
|
|
||||||
{name = mobs_mc.items.gunpowder,
|
|
||||||
chance = 1,
|
|
||||||
min = 0,
|
|
||||||
max = 1,},
|
|
||||||
},
|
},
|
||||||
animation = {
|
animation = {
|
||||||
stand_speed = 50, walk_speed = 50, run_speed = 50,
|
stand_speed = 50, walk_speed = 50, run_speed = 50,
|
||||||
|
|
|
@ -33,6 +33,7 @@ local rabbit = {
|
||||||
drops = {
|
drops = {
|
||||||
{name = mobs_mc.items.rabbit_raw, chance = 1, min = 0, max = 1},
|
{name = mobs_mc.items.rabbit_raw, chance = 1, min = 0, max = 1},
|
||||||
{name = mobs_mc.items.rabbit_hide, chance = 1, min = 0, max = 1},
|
{name = mobs_mc.items.rabbit_hide, chance = 1, min = 0, max = 1},
|
||||||
|
{name = mobs_mc.items.rabbit_foot, chance = 10, min = 0, max = 1},
|
||||||
-- TODO: Drop rabbit's foot when it's useful
|
-- TODO: Drop rabbit's foot when it's useful
|
||||||
--{name = mobs_mc.items.rabbit_foot, chance = 10, min = 1, max = 1},
|
--{name = mobs_mc.items.rabbit_foot, chance = 10, min = 1, max = 1},
|
||||||
},
|
},
|
||||||
|
|
|
@ -10,10 +10,8 @@ local inventory_lists = {}
|
||||||
local show_armor = minetest.get_modpath("mcl_armor") ~= nil
|
local show_armor = minetest.get_modpath("mcl_armor") ~= nil
|
||||||
local mod_player = minetest.get_modpath("mcl_player") ~= nil
|
local mod_player = minetest.get_modpath("mcl_player") ~= nil
|
||||||
|
|
||||||
-- TODO: Brewing is disabled. Add brewing (uncommented code) when it is implemented properly
|
|
||||||
|
|
||||||
-- Create tables
|
-- Create tables
|
||||||
local builtin_filter_ids = {"blocks","deco","redstone","rail","food","tools","combat","mobs",--[["brew",]]"matr","misc","all"}
|
local builtin_filter_ids = {"blocks","deco","redstone","rail","food","tools","combat","mobs","brew","matr","misc","all"}
|
||||||
for _, f in pairs(builtin_filter_ids) do
|
for _, f in pairs(builtin_filter_ids) do
|
||||||
inventory_lists[f] = {}
|
inventory_lists[f] = {}
|
||||||
end
|
end
|
||||||
|
@ -67,11 +65,10 @@ do
|
||||||
table.insert(inventory_lists["mobs"], name)
|
table.insert(inventory_lists["mobs"], name)
|
||||||
nonmisc = true
|
nonmisc = true
|
||||||
end
|
end
|
||||||
-- TODO: add brew
|
if def.groups.brewitem then
|
||||||
--if def.groups.brewitem then
|
table.insert(inventory_lists["brew"], name)
|
||||||
--table.insert(inventory_lists["brew"], name)
|
nonmisc = true
|
||||||
--nonmisc = true
|
end
|
||||||
--end
|
|
||||||
if def.groups.craftitem then
|
if def.groups.craftitem then
|
||||||
table.insert(inventory_lists["matr"], name)
|
table.insert(inventory_lists["matr"], name)
|
||||||
nonmisc = true
|
nonmisc = true
|
||||||
|
@ -160,7 +157,7 @@ trash:set_size("main", 1)
|
||||||
|
|
||||||
local noffset = {} -- numeric tab offset
|
local noffset = {} -- numeric tab offset
|
||||||
local offset = {} -- string offset:
|
local offset = {} -- string offset:
|
||||||
local boffset = {} --
|
local boffset = {} --
|
||||||
local hoch = {}
|
local hoch = {}
|
||||||
local filtername = {}
|
local filtername = {}
|
||||||
local bg = {}
|
local bg = {}
|
||||||
|
@ -182,6 +179,7 @@ next_noffset("blocks")
|
||||||
next_noffset("deco")
|
next_noffset("deco")
|
||||||
next_noffset("redstone")
|
next_noffset("redstone")
|
||||||
next_noffset("rail")
|
next_noffset("rail")
|
||||||
|
next_noffset("brew")
|
||||||
next_noffset("misc")
|
next_noffset("misc")
|
||||||
next_noffset("nix", true)
|
next_noffset("nix", true)
|
||||||
|
|
||||||
|
@ -193,7 +191,6 @@ next_noffset("food")
|
||||||
next_noffset("tools")
|
next_noffset("tools")
|
||||||
next_noffset("combat")
|
next_noffset("combat")
|
||||||
next_noffset("mobs")
|
next_noffset("mobs")
|
||||||
--next_noffset("brew") -- TODO: add brew
|
|
||||||
next_noffset("matr")
|
next_noffset("matr")
|
||||||
next_noffset("inv", true)
|
next_noffset("inv", true)
|
||||||
|
|
||||||
|
@ -206,6 +203,7 @@ hoch["blocks"] = ""
|
||||||
hoch["deco"] = ""
|
hoch["deco"] = ""
|
||||||
hoch["redstone"] = ""
|
hoch["redstone"] = ""
|
||||||
hoch["rail"] = ""
|
hoch["rail"] = ""
|
||||||
|
hoch["brew"] = ""
|
||||||
hoch["misc"] = ""
|
hoch["misc"] = ""
|
||||||
hoch["nix"] = ""
|
hoch["nix"] = ""
|
||||||
hoch["default"] = ""
|
hoch["default"] = ""
|
||||||
|
@ -213,7 +211,6 @@ hoch["food"] = "_down"
|
||||||
hoch["tools"] = "_down"
|
hoch["tools"] = "_down"
|
||||||
hoch["combat"] = "_down"
|
hoch["combat"] = "_down"
|
||||||
hoch["mobs"] = "_down"
|
hoch["mobs"] = "_down"
|
||||||
--hoch["brew"] = "_down" -- TODO: add brew
|
|
||||||
hoch["matr"] = "_down"
|
hoch["matr"] = "_down"
|
||||||
hoch["inv"] = "_down"
|
hoch["inv"] = "_down"
|
||||||
|
|
||||||
|
@ -228,26 +225,26 @@ filtername["food"] = S("Foodstuffs")
|
||||||
filtername["tools"] = S("Tools")
|
filtername["tools"] = S("Tools")
|
||||||
filtername["combat"] = S("Combat")
|
filtername["combat"] = S("Combat")
|
||||||
filtername["mobs"] = S("Mobs")
|
filtername["mobs"] = S("Mobs")
|
||||||
--filtername["brew"] = S("Brewing") -- TODO: add brew
|
filtername["brew"] = S("Brewing")
|
||||||
filtername["matr"] = S("Materials")
|
filtername["matr"] = S("Materials")
|
||||||
filtername["inv"] = S("Survival Inventory")
|
filtername["inv"] = S("Survival Inventory")
|
||||||
|
|
||||||
local dark_bg = "crafting_creative_bg_dark.png"
|
local dark_bg = "crafting_creative_bg_dark.png"
|
||||||
|
|
||||||
local function reset_menu_item_bg()
|
local function reset_menu_item_bg()
|
||||||
bg["blocks"] = dark_bg
|
bg["blocks"] = dark_bg
|
||||||
bg["deco"] = dark_bg
|
bg["deco"] = dark_bg
|
||||||
bg["redstone"] = dark_bg
|
bg["redstone"] = dark_bg
|
||||||
bg["rail"] = dark_bg
|
bg["rail"] = dark_bg
|
||||||
bg["misc"] = dark_bg
|
bg["misc"] = dark_bg
|
||||||
bg["nix"] = dark_bg
|
bg["nix"] = dark_bg
|
||||||
bg["food"] = dark_bg
|
bg["food"] = dark_bg
|
||||||
bg["tools"] = dark_bg
|
bg["tools"] = dark_bg
|
||||||
bg["combat"] = dark_bg
|
bg["combat"] = dark_bg
|
||||||
bg["mobs"] = dark_bg
|
bg["mobs"] = dark_bg
|
||||||
--bg["brew"] = dark_bg -- TODO: add brew
|
bg["brew"] = dark_bg
|
||||||
bg["matr"] = dark_bg
|
bg["matr"] = dark_bg
|
||||||
bg["inv"] = dark_bg
|
bg["inv"] = dark_bg
|
||||||
bg["default"] = dark_bg
|
bg["default"] = dark_bg
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -377,7 +374,7 @@ mcl_inventory.set_creative_formspec = function(player, start_i, pagenum, inv_siz
|
||||||
tools = "mcl_core:axe_iron",
|
tools = "mcl_core:axe_iron",
|
||||||
combat = "mcl_core:sword_gold",
|
combat = "mcl_core:sword_gold",
|
||||||
mobs = "mobs_mc:cow",
|
mobs = "mobs_mc:cow",
|
||||||
brew = "mcl_potions:potion_water",
|
brew = "mcl_potions:dragon_breath",
|
||||||
matr = "mcl_core:stick",
|
matr = "mcl_core:stick",
|
||||||
inv = "mcl_chests:chest",
|
inv = "mcl_chests:chest",
|
||||||
}
|
}
|
||||||
|
@ -388,7 +385,7 @@ mcl_inventory.set_creative_formspec = function(player, start_i, pagenum, inv_siz
|
||||||
else
|
else
|
||||||
bg_img = "crafting_creative_inactive"..hoch[this_tab]..".png"
|
bg_img = "crafting_creative_inactive"..hoch[this_tab]..".png"
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
"style["..this_tab..";border=false;bgimg=;bgimg_pressed=]"..
|
"style["..this_tab..";border=false;bgimg=;bgimg_pressed=]"..
|
||||||
"item_image_button[" .. boffset[this_tab] ..";1,1;"..tab_icon[this_tab]..";"..this_tab..";]"..
|
"item_image_button[" .. boffset[this_tab] ..";1,1;"..tab_icon[this_tab]..";"..this_tab..";]"..
|
||||||
"image[" .. offset[this_tab] .. ";1.5,1.44;" .. bg_img .. "]" ..
|
"image[" .. offset[this_tab] .. ";1.5,1.44;" .. bg_img .. "]" ..
|
||||||
|
@ -428,9 +425,8 @@ mcl_inventory.set_creative_formspec = function(player, start_i, pagenum, inv_siz
|
||||||
"tooltip[combat;"..F(filtername["combat"]).."]"..
|
"tooltip[combat;"..F(filtername["combat"]).."]"..
|
||||||
tab(name, "mobs") ..
|
tab(name, "mobs") ..
|
||||||
"tooltip[mobs;"..F(filtername["mobs"]).."]"..
|
"tooltip[mobs;"..F(filtername["mobs"]).."]"..
|
||||||
-- TODO: Add brew
|
tab(name, "brew") ..
|
||||||
--tab(name, "brew") ..
|
"tooltip[brew;"..F(filtername["brew"]).."]"..
|
||||||
--"tooltip[brew;"..F(filtername["brew"]).."]"..
|
|
||||||
tab(name, "matr") ..
|
tab(name, "matr") ..
|
||||||
"tooltip[matr;"..F(filtername["matr"]).."]"..
|
"tooltip[matr;"..F(filtername["matr"]).."]"..
|
||||||
tab(name, "inv") ..
|
tab(name, "inv") ..
|
||||||
|
@ -504,12 +500,10 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
if players[name].page == "mobs" then return end
|
if players[name].page == "mobs" then return end
|
||||||
set_inv_page("mobs",player)
|
set_inv_page("mobs",player)
|
||||||
page = "mobs"
|
page = "mobs"
|
||||||
--[[ TODO: add brew
|
|
||||||
elseif fields.brew then
|
elseif fields.brew then
|
||||||
if players[name].page == "brew" then return end
|
if players[name].page == "brew" then return end
|
||||||
set_inv_page("brew",player)
|
set_inv_page("brew",player)
|
||||||
page = "brew"
|
page = "brew"
|
||||||
]]
|
|
||||||
elseif fields.matr then
|
elseif fields.matr then
|
||||||
if players[name].page == "matr" then return end
|
if players[name].page == "matr" then return end
|
||||||
set_inv_page("matr",player)
|
set_inv_page("matr",player)
|
||||||
|
|
|
@ -3,3 +3,5 @@ mcl_formspec
|
||||||
mcl_player?
|
mcl_player?
|
||||||
_mcl_autogroup?
|
_mcl_autogroup?
|
||||||
mcl_armor?
|
mcl_armor?
|
||||||
|
mcl_brewing?
|
||||||
|
mcl_potions?
|
||||||
|
|
7
mods/ITEMS/mcl_brewing/depends.txt
Executable file
|
@ -0,0 +1,7 @@
|
||||||
|
mcl_init
|
||||||
|
mcl_formspec
|
||||||
|
mcl_sounds
|
||||||
|
mcl_potions
|
||||||
|
mcl_mobitems
|
||||||
|
mcl_core?
|
||||||
|
screwdriver?
|
1062
mods/ITEMS/mcl_brewing/init.lua
Executable file
3
mods/ITEMS/mcl_brewing/locale/template.txt
Executable file
|
@ -0,0 +1,3 @@
|
||||||
|
# textdomain: mcl_brewing
|
||||||
|
Brewing Stand=
|
||||||
|
The brewing stand allows the creating of potions for the benefit of various effects. Stay tuned for developments, as you can only view the stand and interact with it, but not create potions.
|
1
mods/ITEMS/mcl_brewing/mod.conf
Executable file
|
@ -0,0 +1 @@
|
||||||
|
name = mcl_brewing
|
BIN
mods/ITEMS/mcl_brewing/sounds/mcl_brewing_complete.ogg
Normal file
BIN
mods/ITEMS/mcl_brewing/textures/mcl_brewing_base.png
Normal file
After Width: | Height: | Size: 191 B |
BIN
mods/ITEMS/mcl_brewing/textures/mcl_brewing_bottle_bg.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
mods/ITEMS/mcl_brewing/textures/mcl_brewing_bubble_sprite.png
Normal file
After Width: | Height: | Size: 243 B |
BIN
mods/ITEMS/mcl_brewing/textures/mcl_brewing_bubbles.png
Normal file
After Width: | Height: | Size: 193 B |
BIN
mods/ITEMS/mcl_brewing/textures/mcl_brewing_bubbles_active.png
Normal file
After Width: | Height: | Size: 194 B |
BIN
mods/ITEMS/mcl_brewing/textures/mcl_brewing_burner.png
Normal file
After Width: | Height: | Size: 147 B |
BIN
mods/ITEMS/mcl_brewing/textures/mcl_brewing_burner_active.png
Normal file
After Width: | Height: | Size: 157 B |
BIN
mods/ITEMS/mcl_brewing/textures/mcl_brewing_fuel_bg.png
Executable file
After Width: | Height: | Size: 250 B |
BIN
mods/ITEMS/mcl_brewing/textures/mcl_brewing_inventory.png
Executable file
After Width: | Height: | Size: 1.0 KiB |
BIN
mods/ITEMS/mcl_brewing/textures/mcl_brewing_potion_bg.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
mods/ITEMS/mcl_brewing/textures/mcl_brewing_side.png
Normal file
After Width: | Height: | Size: 392 B |
BIN
mods/ITEMS/mcl_brewing/textures/mcl_brewing_top.png
Normal file
After Width: | Height: | Size: 404 B |
|
@ -121,7 +121,7 @@ minetest.register_craftitem("mcl_core:sugar", {
|
||||||
_doc_items_longdesc = S("Sugar comes from sugar canes and is used to make sweet foods."),
|
_doc_items_longdesc = S("Sugar comes from sugar canes and is used to make sweet foods."),
|
||||||
inventory_image = "mcl_core_sugar.png",
|
inventory_image = "mcl_core_sugar.png",
|
||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
groups = { craftitem = 1 },
|
groups = { craftitem = 1, brewitem=1 },
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_core:bowl",{
|
minetest.register_craftitem("mcl_core:bowl",{
|
||||||
|
|
|
@ -140,7 +140,7 @@ minetest.register_node("mcl_core:lava_flowing", {
|
||||||
liquid_range = 3,
|
liquid_range = 3,
|
||||||
damage_per_second = 4*2,
|
damage_per_second = 4*2,
|
||||||
_mcl_node_death_message = lava_death_messages,
|
_mcl_node_death_message = lava_death_messages,
|
||||||
post_effect_color = {a=255, r=208, g=73, b=10},
|
post_effect_color = {a=245, r=208, g=73, b=10},
|
||||||
groups = { lava=3, liquid=2, destroys_items=1, not_in_creative_inventory=1, dig_by_piston=1},
|
groups = { lava=3, liquid=2, destroys_items=1, not_in_creative_inventory=1, dig_by_piston=1},
|
||||||
_mcl_blast_resistance = 100,
|
_mcl_blast_resistance = 100,
|
||||||
-- Hardness intentionally set to infinite instead of 100 (Minecraft value) to avoid problems in creative mode
|
-- Hardness intentionally set to infinite instead of 100 (Minecraft value) to avoid problems in creative mode
|
||||||
|
@ -195,7 +195,7 @@ S("• When lava is directly above water, the water turns into stone."),
|
||||||
liquid_range = 3,
|
liquid_range = 3,
|
||||||
damage_per_second = 4*2,
|
damage_per_second = 4*2,
|
||||||
_mcl_node_death_message = lava_death_messages,
|
_mcl_node_death_message = lava_death_messages,
|
||||||
post_effect_color = {a=255, r=208, g=73, b=10},
|
post_effect_color = {a=245, r=208, g=73, b=10},
|
||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
groups = { lava=3, liquid=2, destroys_items=1, not_in_creative_inventory=1, dig_by_piston=1},
|
groups = { lava=3, liquid=2, destroys_items=1, not_in_creative_inventory=1, dig_by_piston=1},
|
||||||
_mcl_blast_resistance = 100,
|
_mcl_blast_resistance = 100,
|
||||||
|
|
|
@ -32,7 +32,7 @@ local fish = function(itemstack, player)
|
||||||
local num = 0
|
local num = 0
|
||||||
local ent = nil
|
local ent = nil
|
||||||
local noent = true
|
local noent = true
|
||||||
|
|
||||||
--Check for bobber if so handle.
|
--Check for bobber if so handle.
|
||||||
for n = 1, #objs do
|
for n = 1, #objs do
|
||||||
ent = objs[n]:get_luaentity()
|
ent = objs[n]:get_luaentity()
|
||||||
|
@ -157,7 +157,7 @@ local bobber_on_step = function(self, dtime)
|
||||||
epos.y = math.floor(epos.y)
|
epos.y = math.floor(epos.y)
|
||||||
local node = minetest.get_node(epos)
|
local node = minetest.get_node(epos)
|
||||||
local def = minetest.registered_nodes[node.name]
|
local def = minetest.registered_nodes[node.name]
|
||||||
|
|
||||||
--If we have no player, remove self.
|
--If we have no player, remove self.
|
||||||
if self.player == nil or self.player == "" then
|
if self.player == nil or self.player == "" then
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
|
@ -168,7 +168,7 @@ local bobber_on_step = function(self, dtime)
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
--Check if player is nearby
|
--Check if player is nearby
|
||||||
if self._tick % 5 == 0 and self.player ~= nil and player ~= nil then
|
if self._tick % 5 == 0 and self.player ~= nil and player ~= nil then
|
||||||
--Destroy bobber if item not wielded.
|
--Destroy bobber if item not wielded.
|
||||||
|
@ -177,7 +177,7 @@ local bobber_on_step = function(self, dtime)
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
--Destroy bobber if player is too far away.
|
--Destroy bobber if player is too far away.
|
||||||
local objpos = self.object:get_pos()
|
local objpos = self.object:get_pos()
|
||||||
local playerpos = player:get_pos()
|
local playerpos = player:get_pos()
|
||||||
|
@ -200,7 +200,7 @@ local bobber_on_step = function(self, dtime)
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
-- If in water, then bob.
|
-- If in water, then bob.
|
||||||
if def.liquidtype == "source" and minetest.get_item_group(def.name, "water") ~= 0 then
|
if def.liquidtype == "source" and minetest.get_item_group(def.name, "water") ~= 0 then
|
||||||
|
@ -251,7 +251,7 @@ local bobber_on_step = function(self, dtime)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- TODO: Destroy when hitting a solid node
|
-- TODO: Destroy when hitting a solid node
|
||||||
--if self._lastpos.x~=nil then
|
--if self._lastpos.x~=nil then
|
||||||
|
@ -273,7 +273,7 @@ minetest.register_on_leaveplayer(function(player)
|
||||||
local num = 0
|
local num = 0
|
||||||
local ent = nil
|
local ent = nil
|
||||||
local noent = true
|
local noent = true
|
||||||
|
|
||||||
for n = 1, #objs do
|
for n = 1, #objs do
|
||||||
ent = objs[n]:get_luaentity()
|
ent = objs[n]:get_luaentity()
|
||||||
if ent then
|
if ent then
|
||||||
|
@ -292,7 +292,7 @@ minetest.register_on_dieplayer(function(player)
|
||||||
local num = 0
|
local num = 0
|
||||||
local ent = nil
|
local ent = nil
|
||||||
local noent = true
|
local noent = true
|
||||||
|
|
||||||
for n = 1, #objs do
|
for n = 1, #objs do
|
||||||
ent = objs[n]:get_luaentity()
|
ent = objs[n]:get_luaentity()
|
||||||
if ent then
|
if ent then
|
||||||
|
@ -426,7 +426,6 @@ minetest.register_craftitem("mcl_fishing:pufferfish_raw", {
|
||||||
on_place = minetest.item_eat(1),
|
on_place = minetest.item_eat(1),
|
||||||
on_secondary_use = minetest.item_eat(1),
|
on_secondary_use = minetest.item_eat(1),
|
||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
groups = { food=2, eatable=1 },
|
groups = { food=2, eatable=1, brewitem = 1 },
|
||||||
_mcl_saturation = 0.2,
|
_mcl_saturation = 0.2,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -142,6 +142,7 @@ local drink_milk = function(itemstack, player, pointed_thing)
|
||||||
if mcl_hunger.active and (bucket:get_name() ~= "mcl_mobitems:milk_bucket" or minetest.settings:get_bool("creative_mode") == true) then
|
if mcl_hunger.active and (bucket:get_name() ~= "mcl_mobitems:milk_bucket" or minetest.settings:get_bool("creative_mode") == true) then
|
||||||
mcl_hunger.stop_poison(player)
|
mcl_hunger.stop_poison(player)
|
||||||
end
|
end
|
||||||
|
mcl_potions._reset_player_effects(player)
|
||||||
return bucket
|
return bucket
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -168,7 +169,7 @@ minetest.register_craftitem("mcl_mobitems:spider_eye", {
|
||||||
wield_image = "mcl_mobitems_spider_eye.png",
|
wield_image = "mcl_mobitems_spider_eye.png",
|
||||||
on_place = minetest.item_eat(2),
|
on_place = minetest.item_eat(2),
|
||||||
on_secondary_use = minetest.item_eat(2),
|
on_secondary_use = minetest.item_eat(2),
|
||||||
groups = { food = 2, eatable = 2 },
|
groups = { food = 2, eatable = 2, brewitem = 1 },
|
||||||
_mcl_saturation = 3.2,
|
_mcl_saturation = 3.2,
|
||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
})
|
})
|
||||||
|
@ -223,7 +224,7 @@ minetest.register_craftitem("mcl_mobitems:ghast_tear", {
|
||||||
wield_image = "mcl_mobitems_ghast_tear.png",
|
wield_image = "mcl_mobitems_ghast_tear.png",
|
||||||
inventory_image = "mcl_mobitems_ghast_tear.png",
|
inventory_image = "mcl_mobitems_ghast_tear.png",
|
||||||
-- TODO: Reveal item when it's useful
|
-- TODO: Reveal item when it's useful
|
||||||
groups = { brewitem = 1, not_in_creative_inventory = 1 },
|
groups = { brewitem = 1, not_in_creative_inventory = 0 },
|
||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -270,7 +271,7 @@ minetest.register_craftitem("mcl_mobitems:rabbit_foot", {
|
||||||
wield_image = "mcl_mobitems_rabbit_foot.png",
|
wield_image = "mcl_mobitems_rabbit_foot.png",
|
||||||
inventory_image = "mcl_mobitems_rabbit_foot.png",
|
inventory_image = "mcl_mobitems_rabbit_foot.png",
|
||||||
-- TODO: Reveal item when it's useful
|
-- TODO: Reveal item when it's useful
|
||||||
groups = { brewitem = 1, not_in_creative_inventory = 1 },
|
groups = { brewitem = 1, not_in_creative_inventory = 0 },
|
||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -316,7 +317,7 @@ minetest.register_craftitem("mcl_mobitems:gunpowder", {
|
||||||
_doc_items_longdesc = doc.sub.items.temp.craftitem,
|
_doc_items_longdesc = doc.sub.items.temp.craftitem,
|
||||||
inventory_image = "default_gunpowder.png",
|
inventory_image = "default_gunpowder.png",
|
||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
groups = { craftitem=1 },
|
groups = { craftitem=1, brewitem = 1 },
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_tool("mcl_mobitems:carrot_on_a_stick", {
|
minetest.register_tool("mcl_mobitems:carrot_on_a_stick", {
|
||||||
|
@ -439,4 +440,3 @@ minetest.register_craft({
|
||||||
{"mcl_mobitems:slimeball","mcl_mobitems:slimeball","mcl_mobitems:slimeball",},
|
{"mcl_mobitems:slimeball","mcl_mobitems:slimeball","mcl_mobitems:slimeball",},
|
||||||
{"mcl_mobitems:slimeball","mcl_mobitems:slimeball","mcl_mobitems:slimeball",}},
|
{"mcl_mobitems:slimeball","mcl_mobitems:slimeball","mcl_mobitems:slimeball",}},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -229,7 +229,7 @@ minetest.register_craftitem("mcl_nether:glowstone_dust", {
|
||||||
_doc_items_longdesc = S("Glowstone dust is the dust which comes out of broken glowstones. It is mainly used in crafting."),
|
_doc_items_longdesc = S("Glowstone dust is the dust which comes out of broken glowstones. It is mainly used in crafting."),
|
||||||
inventory_image = "mcl_nether_glowstone_dust.png",
|
inventory_image = "mcl_nether_glowstone_dust.png",
|
||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
groups = { craftitem=1 },
|
groups = { craftitem=1, brewitem=1 },
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_nether:quartz", {
|
minetest.register_craftitem("mcl_nether:quartz", {
|
||||||
|
|
|
@ -85,7 +85,7 @@ minetest.register_node("mcl_nether:nether_wart", {
|
||||||
tiles = {"mcl_nether_nether_wart_stage_2.png"},
|
tiles = {"mcl_nether_nether_wart_stage_2.png"},
|
||||||
wield_image = "mcl_nether_nether_wart_stage_2.png",
|
wield_image = "mcl_nether_nether_wart_stage_2.png",
|
||||||
inventory_image = "mcl_nether_nether_wart_stage_2.png",
|
inventory_image = "mcl_nether_nether_wart_stage_2.png",
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
{-0.5, -0.5, -0.5, 0.5, 0.45, 0.5}
|
{-0.5, -0.5, -0.5, 0.5, 0.45, 0.5}
|
||||||
|
@ -135,7 +135,7 @@ minetest.register_craftitem("mcl_nether:nether_wart_item", {
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
groups = { craftitem = 1 },
|
groups = { craftitem = 1, brewitem=1 },
|
||||||
})
|
})
|
||||||
|
|
||||||
local names = {"mcl_nether:nether_wart_0", "mcl_nether:nether_wart_1", "mcl_nether:nether_wart_2"}
|
local names = {"mcl_nether:nether_wart_0", "mcl_nether:nether_wart_1", "mcl_nether:nether_wart_2"}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
mcl_core
|
mcl_core
|
||||||
mcl_farming
|
mcl_farming
|
||||||
mcl_mobitems
|
mcl_mobitems
|
||||||
|
mcl_fishing
|
||||||
|
playerphysics
|
||||||
|
|
676
mods/ITEMS/mcl_potions/functions.lua
Normal file
|
@ -0,0 +1,676 @@
|
||||||
|
local is_invisible = {}
|
||||||
|
local is_poisoned = {}
|
||||||
|
local is_regenerating = {}
|
||||||
|
local is_strong = {}
|
||||||
|
local is_weak = {}
|
||||||
|
local is_water_breathing = {}
|
||||||
|
local is_leaping = {}
|
||||||
|
local is_swift = {}
|
||||||
|
local is_cat = {}
|
||||||
|
local is_fire_proof = {}
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_globalstep(function(dtime)
|
||||||
|
|
||||||
|
-- Check for invisible players
|
||||||
|
for player, vals in pairs(is_invisible) do
|
||||||
|
|
||||||
|
if is_invisible[player] and player:get_properties() then
|
||||||
|
|
||||||
|
player = player or player:get_luaentity()
|
||||||
|
|
||||||
|
is_invisible[player].timer = is_invisible[player].timer + dtime
|
||||||
|
|
||||||
|
if player:get_pos() then mcl_potions._add_spawner(player, "#B0B0B0") end
|
||||||
|
|
||||||
|
if is_invisible[player].timer >= is_invisible[player].dur then
|
||||||
|
mcl_potions.make_invisible(player, false)
|
||||||
|
is_invisible[player] = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
elseif not player:get_properties() then
|
||||||
|
is_invisible[player] = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Check for poisoned players
|
||||||
|
for player, vals in pairs(is_poisoned) do
|
||||||
|
|
||||||
|
if is_poisoned[player] and player:get_properties() then
|
||||||
|
|
||||||
|
player = player or player:get_luaentity()
|
||||||
|
|
||||||
|
is_poisoned[player].timer = is_poisoned[player].timer + dtime
|
||||||
|
is_poisoned[player].hit_timer = (is_poisoned[player].hit_timer or 0) + dtime
|
||||||
|
|
||||||
|
if player:get_pos() then mcl_potions._add_spawner(player, "#225533") end
|
||||||
|
|
||||||
|
if is_poisoned[player].hit_timer >= is_poisoned[player].step then
|
||||||
|
|
||||||
|
if player._cmi_is_mob then
|
||||||
|
player.health = math.max(player.health - 1, 1)
|
||||||
|
else
|
||||||
|
player:set_hp( math.max(player:get_hp() - 1, 1), { type = "punch", from = "potion" })
|
||||||
|
end
|
||||||
|
|
||||||
|
is_poisoned[player].hit_timer = 0
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
if is_poisoned[player].timer >= is_poisoned[player].dur then
|
||||||
|
is_poisoned[player] = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
elseif not player:get_properties() then
|
||||||
|
is_poisoned[player] = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Check for regnerating players
|
||||||
|
for player, vals in pairs(is_regenerating) do
|
||||||
|
|
||||||
|
if is_regenerating[player] and player:get_properties() then
|
||||||
|
|
||||||
|
player = player or player:get_luaentity()
|
||||||
|
|
||||||
|
is_regenerating[player].timer = is_regenerating[player].timer + dtime
|
||||||
|
is_regenerating[player].heal_timer = (is_regenerating[player].heal_timer or 0) + dtime
|
||||||
|
|
||||||
|
if player:get_pos() then mcl_potions._add_spawner(player, "#A52BB2") end
|
||||||
|
|
||||||
|
if is_regenerating[player].heal_timer >= is_regenerating[player].step then
|
||||||
|
player:set_hp(math.min(player:get_properties().hp_max or 20, player:get_hp() + 1))
|
||||||
|
is_regenerating[player].heal_timer = 0
|
||||||
|
end
|
||||||
|
|
||||||
|
if is_regenerating[player].timer >= is_regenerating[player].dur then
|
||||||
|
is_regenerating[player] = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
elseif not player:get_properties() then
|
||||||
|
is_regenerating[player] = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Check for water breathing players
|
||||||
|
for player, vals in pairs(is_water_breathing) do
|
||||||
|
|
||||||
|
if is_water_breathing[player] and player:get_properties() then
|
||||||
|
|
||||||
|
player = player or player:get_luaentity()
|
||||||
|
|
||||||
|
is_water_breathing[player].timer = is_water_breathing[player].timer + dtime
|
||||||
|
|
||||||
|
if player:get_pos() then mcl_potions._add_spawner(player, "#0000AA") end
|
||||||
|
|
||||||
|
if player:get_breath() then
|
||||||
|
if player:get_breath() < 10 then player:set_breath(10) end
|
||||||
|
end
|
||||||
|
|
||||||
|
if is_water_breathing[player].timer >= is_water_breathing[player].dur then
|
||||||
|
is_water_breathing[player] = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
elseif not player:get_properties() then
|
||||||
|
is_water_breathing[player] = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Check for leaping players
|
||||||
|
for player, vals in pairs(is_leaping) do
|
||||||
|
|
||||||
|
if is_leaping[player] and player:get_properties() then
|
||||||
|
|
||||||
|
player = player or player:get_luaentity()
|
||||||
|
|
||||||
|
is_leaping[player].timer = is_leaping[player].timer + dtime
|
||||||
|
|
||||||
|
if player:get_pos() then mcl_potions._add_spawner(player, "#00CC33") end
|
||||||
|
|
||||||
|
if is_leaping[player].timer >= is_leaping[player].dur then
|
||||||
|
playerphysics.remove_physics_factor(player, "jump", "mcl_potions:leaping")
|
||||||
|
is_leaping[player] = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
elseif not player:get_properties() then
|
||||||
|
is_leaping[player] = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Check for swift players
|
||||||
|
for player, vals in pairs(is_swift) do
|
||||||
|
|
||||||
|
if is_swift[player] and player:get_properties() then
|
||||||
|
|
||||||
|
player = player or player:get_luaentity()
|
||||||
|
|
||||||
|
is_swift[player].timer = is_swift[player].timer + dtime
|
||||||
|
|
||||||
|
if player:get_pos() then mcl_potions._add_spawner(player, "#009999") end
|
||||||
|
|
||||||
|
if is_swift[player].timer >= is_swift[player].dur then
|
||||||
|
playerphysics.remove_physics_factor(player, "speed", "mcl_potions:swiftness")
|
||||||
|
is_swift[player] = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
elseif not player:get_properties() then
|
||||||
|
is_swift[player] = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Check for Night Vision equipped players
|
||||||
|
for player, vals in pairs(is_cat) do
|
||||||
|
|
||||||
|
if is_cat[player] and player:get_properties() then
|
||||||
|
|
||||||
|
player = player or player:get_luaentity()
|
||||||
|
|
||||||
|
is_cat[player].timer = is_cat[player].timer + dtime
|
||||||
|
|
||||||
|
if player:get_pos() then mcl_potions._add_spawner(player, "#1010AA") end
|
||||||
|
player:override_day_night_ratio(0.45)
|
||||||
|
|
||||||
|
if is_cat[player].timer >= is_cat[player].dur then
|
||||||
|
is_cat[player] = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
elseif not player:get_properties() then
|
||||||
|
is_cat[player] = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Check for Fire Proof players
|
||||||
|
for player, vals in pairs(is_fire_proof) do
|
||||||
|
|
||||||
|
if is_fire_proof[player] and player:get_properties() then
|
||||||
|
|
||||||
|
player = player or player:get_luaentity()
|
||||||
|
|
||||||
|
is_fire_proof[player].timer = is_fire_proof[player].timer + dtime
|
||||||
|
|
||||||
|
if player:get_pos() then mcl_potions._add_spawner(player, "#E0B050") end
|
||||||
|
|
||||||
|
if is_fire_proof[player].timer >= is_fire_proof[player].dur then
|
||||||
|
is_fire_proof[player] = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
elseif not player:get_properties() then
|
||||||
|
is_fire_proof[player] = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Check for Weak players
|
||||||
|
for player, vals in pairs(is_weak) do
|
||||||
|
|
||||||
|
if is_weak[player] and player:get_properties() then
|
||||||
|
|
||||||
|
player = player or player:get_luaentity()
|
||||||
|
|
||||||
|
is_weak[player].timer = is_weak[player].timer + dtime
|
||||||
|
|
||||||
|
if player:get_pos() then mcl_potions._add_spawner(player, "#7700BB") end
|
||||||
|
|
||||||
|
if is_weak[player].timer >= is_weak[player].dur then
|
||||||
|
is_weak[player] = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
elseif not player:get_properties() then
|
||||||
|
is_weak[player] = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Check for Strong players
|
||||||
|
for player, vals in pairs(is_strong) do
|
||||||
|
|
||||||
|
if is_strong[player] and player:get_properties() then
|
||||||
|
|
||||||
|
player = player or player:get_luaentity()
|
||||||
|
|
||||||
|
is_strong[player].timer = is_strong[player].timer + dtime
|
||||||
|
|
||||||
|
if player:get_pos() then mcl_potions._add_spawner(player, "#7700BB") end
|
||||||
|
|
||||||
|
if is_strong[player].timer >= is_strong[player].dur then
|
||||||
|
is_strong[player] = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
elseif not player:get_properties() then
|
||||||
|
is_strong[player] = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end)
|
||||||
|
|
||||||
|
|
||||||
|
local is_fire_node = { ["mcl_core:lava_flowing"]=true,
|
||||||
|
["mcl_core:lava_source"]=true,
|
||||||
|
["mcl_fire:eternal_fire"]=true,
|
||||||
|
["mcl_fire:fire"]=true,
|
||||||
|
["mcl_nether:magma"]=true,
|
||||||
|
["mcl_nether:nether_lava_source"]=true,
|
||||||
|
["mcl_nether:nether_lava_flowing"]=true,
|
||||||
|
["mcl_nether:nether_lava_source"]=true}
|
||||||
|
|
||||||
|
-- Prevent damage to player with Fire Resistance enabled
|
||||||
|
minetest.register_on_player_hpchange(function(player, hp_change)
|
||||||
|
|
||||||
|
if is_fire_proof[player] and hp_change < 0 then
|
||||||
|
-- This is a bit forced, but it assumes damage is taken by fire and avoids it
|
||||||
|
-- also assumes any change in hp happens between calls to this function
|
||||||
|
-- it's worth noting that you don't take damage from players in this case...
|
||||||
|
local player_info = mcl_playerinfo[player:get_player_name()]
|
||||||
|
|
||||||
|
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 player:get_breath() == 0 and hp_change == -4 then -- probably drowning
|
||||||
|
-- return hp_change
|
||||||
|
-- else
|
||||||
|
return 0
|
||||||
|
-- end
|
||||||
|
else
|
||||||
|
return hp_change
|
||||||
|
end
|
||||||
|
|
||||||
|
else
|
||||||
|
return hp_change
|
||||||
|
end
|
||||||
|
|
||||||
|
end, true)
|
||||||
|
|
||||||
|
|
||||||
|
-- -- If a player is punched and is a weak player, damage by 2 additional hearts
|
||||||
|
-- minetest.register_on_player_hpchange(function(player, hp_change)
|
||||||
|
--
|
||||||
|
-- if is_weak[player] and hp_change < 0 then
|
||||||
|
--
|
||||||
|
-- -- prevent weakness from healing the victim
|
||||||
|
-- return math.min(hp_change - 4, 0)
|
||||||
|
--
|
||||||
|
-- else
|
||||||
|
-- return hp_change
|
||||||
|
-- end
|
||||||
|
--
|
||||||
|
-- end, true)
|
||||||
|
|
||||||
|
|
||||||
|
function mcl_potions._reset_player_effects(player)
|
||||||
|
|
||||||
|
player = player or player:get_luaentity()
|
||||||
|
|
||||||
|
if is_invisible[player] then
|
||||||
|
mcl_potions.make_invisible(player, false)
|
||||||
|
is_invisible[player] = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
if is_poisoned[player] then
|
||||||
|
is_poisoned[player] = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
if is_regenerating[player] then
|
||||||
|
is_regenerating[player] = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
if is_strong[player] then
|
||||||
|
is_strong[player] = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
if is_weak[player] then
|
||||||
|
is_weak[player] = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
if is_water_breathing[player] then
|
||||||
|
is_water_breathing[player] = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
if is_leaping[player] then
|
||||||
|
is_leaping[player] = nil
|
||||||
|
playerphysics.remove_physics_factor(player, "jump", "mcl_potions:leaping")
|
||||||
|
end
|
||||||
|
|
||||||
|
if is_swift[player] then
|
||||||
|
is_swift[player] = nil
|
||||||
|
playerphysics.remove_physics_factor(player, "speed", "mcl_potions:swiftness")
|
||||||
|
end
|
||||||
|
|
||||||
|
if is_cat[player] then
|
||||||
|
is_cat[player] = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
if is_fire_proof[player] then
|
||||||
|
is_fire_proof[player] = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_on_leaveplayer( function(player) mcl_potions._reset_player_effects(player) end)
|
||||||
|
minetest.register_on_dieplayer( function(player) mcl_potions._reset_player_effects(player) end)
|
||||||
|
|
||||||
|
function mcl_potions.is_obj_hit(self, pos)
|
||||||
|
|
||||||
|
for _,object in pairs(minetest.get_objects_inside_radius(pos, 1.1)) do
|
||||||
|
|
||||||
|
local entity = object:get_luaentity()
|
||||||
|
|
||||||
|
if entity and entity.name ~= self.object:get_luaentity().name then
|
||||||
|
|
||||||
|
if entity._cmi_is_mob then return true end
|
||||||
|
|
||||||
|
elseif object:is_player() then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function mcl_potions.make_invisible(player, toggle)
|
||||||
|
|
||||||
|
if not player then return false end
|
||||||
|
|
||||||
|
if toggle then -- hide player
|
||||||
|
is_invisible[player].old_size = player:get_properties().visual_size
|
||||||
|
player:set_properties({visual_size = {x = 0, y = 0}})
|
||||||
|
player:set_nametag_attributes({color = {a = 0}})
|
||||||
|
else -- show player
|
||||||
|
player:set_properties({visual_size = is_invisible[player].old_size})
|
||||||
|
player:set_nametag_attributes({color = {a = 255}})
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
function mcl_potions.poison(player, toggle)
|
||||||
|
|
||||||
|
if not player then return false end
|
||||||
|
is_poisoned[player:get_player_name()] = toggle
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
function mcl_potions.regenerate(player, toggle)
|
||||||
|
|
||||||
|
if not player then return false end
|
||||||
|
is_regenerating[player:get_player_name()] = toggle
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
function mcl_potions._use_potion(item, obj, color)
|
||||||
|
local d = 0.1
|
||||||
|
local pos = obj:get_pos()
|
||||||
|
minetest.sound_play("mcl_potions_drinking", {pos = pos, max_hear_distance = 6, gain = 1})
|
||||||
|
minetest.add_particlespawner({
|
||||||
|
amount = 25,
|
||||||
|
time = 1,
|
||||||
|
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},
|
||||||
|
minvel = {x=-0.1, y=0, z=-0.1},
|
||||||
|
maxvel = {x=0.1, y=0.1, z=0.1},
|
||||||
|
minacc = {x=-0.1, y=0, z=-0.1},
|
||||||
|
maxacc = {x=0.1, y=.1, z=0.1},
|
||||||
|
minexptime = 1,
|
||||||
|
maxexptime = 5,
|
||||||
|
minsize = 0.5,
|
||||||
|
maxsize = 1,
|
||||||
|
collisiondetection = true,
|
||||||
|
vertical = false,
|
||||||
|
texture = "mcl_potions_sprite.png^[colorize:"..color..":127",
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function mcl_potions._add_spawner(obj, color)
|
||||||
|
local d = 0.2
|
||||||
|
local pos = obj:get_pos()
|
||||||
|
minetest.add_particlespawner({
|
||||||
|
amount = 2,
|
||||||
|
time = 1,
|
||||||
|
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},
|
||||||
|
minvel = {x=-0.1, y=0, z=-0.1},
|
||||||
|
maxvel = {x=0.1, y=0.1, z=0.1},
|
||||||
|
minacc = {x=-0.1, y=0, z=-0.1},
|
||||||
|
maxacc = {x=0.1, y=.1, z=0.1},
|
||||||
|
minexptime = 0.5,
|
||||||
|
maxexptime = 1,
|
||||||
|
minsize = 0.5,
|
||||||
|
maxsize = 1,
|
||||||
|
collisiondetection = false,
|
||||||
|
vertical = false,
|
||||||
|
texture = "mcl_potions_sprite.png^[colorize:"..color..":127",
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local is_zombie = {}
|
||||||
|
|
||||||
|
for i, zombie in ipairs({"husk","zombie","pigman"}) do
|
||||||
|
is_zombie["mobs_mc:"..zombie] = true
|
||||||
|
is_zombie["mobs_mc:baby_"..zombie] = true
|
||||||
|
end
|
||||||
|
|
||||||
|
function mcl_potions.healing_func(player, hp)
|
||||||
|
|
||||||
|
local obj = player:get_luaentity()
|
||||||
|
|
||||||
|
if is_zombie[player:get_entity_name()] then hp = -hp end
|
||||||
|
|
||||||
|
if hp > 0 then
|
||||||
|
|
||||||
|
if obj and obj._cmi_is_mob then
|
||||||
|
obj.health = math.max(obj.health + hp, obj.hp_max)
|
||||||
|
else
|
||||||
|
player:set_hp(math.min(player:get_hp() + hp, player:get_properties().hp_max))
|
||||||
|
end
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
if obj and obj._cmi_is_mob then
|
||||||
|
obj.health = obj.health + hp
|
||||||
|
else
|
||||||
|
player:set_hp(player:get_hp() + hp, { type = "punch", from = "potion" })
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
-- adjust mob health
|
||||||
|
obj = player:get_luaentity()
|
||||||
|
if obj and obj._cmi_is_mob then
|
||||||
|
obj.health = obj.health + hp
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
function mcl_potions.swiftness_func(player, factor, duration)
|
||||||
|
|
||||||
|
if not player:get_meta() then return false end
|
||||||
|
|
||||||
|
if not is_swift[player] then
|
||||||
|
|
||||||
|
is_swift[player] = {dur = duration, timer = 0}
|
||||||
|
playerphysics.add_physics_factor(player, "speed", "mcl_potions:swiftness", factor)
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
local victim = is_swift[player]
|
||||||
|
|
||||||
|
playerphysics.add_physics_factor(player, "speed", "mcl_potions:swiftness", factor)
|
||||||
|
victim.dur = math.max(duration, victim.dur - victim.timer)
|
||||||
|
victim.timer = 0
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
function mcl_potions.leaping_func(player, factor, duration)
|
||||||
|
|
||||||
|
if not player:get_meta() then return false end
|
||||||
|
|
||||||
|
if not is_leaping[player] then
|
||||||
|
|
||||||
|
is_leaping[player] = {dur = duration, timer = 0}
|
||||||
|
playerphysics.add_physics_factor(player, "jump", "mcl_potions:leaping", factor)
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
local victim = is_leaping[player]
|
||||||
|
|
||||||
|
playerphysics.add_physics_factor(player, "jump", "mcl_potions:leaping", factor)
|
||||||
|
victim.dur = math.max(duration, victim.dur - victim.timer)
|
||||||
|
victim.timer = 0
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function mcl_potions.weakness_func(player, factor, duration)
|
||||||
|
|
||||||
|
if not is_weak[player] then
|
||||||
|
|
||||||
|
is_weak[player] = {dur = duration, timer = 0, factor = factor}
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
local victim = is_weak[player]
|
||||||
|
|
||||||
|
victim.factor = factor
|
||||||
|
victim.dur = math.max(duration, victim.dur - victim.timer)
|
||||||
|
victim.timer = 0
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function mcl_potions.strength_func(player, factor, duration)
|
||||||
|
|
||||||
|
if not is_strong[player] then
|
||||||
|
|
||||||
|
is_strong[player] = {dur = duration, timer = 0, factor = factor}
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
local victim = is_strong[player]
|
||||||
|
|
||||||
|
victim.factor = factor
|
||||||
|
victim.dur = math.max(duration, victim.dur - victim.timer)
|
||||||
|
victim.timer = 0
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function mcl_potions.poison_func(player, factor, duration)
|
||||||
|
|
||||||
|
if not is_poisoned[player] then
|
||||||
|
|
||||||
|
is_poisoned[player] = {step = factor, dur = duration, timer = 0}
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
local victim = is_poisoned[player]
|
||||||
|
|
||||||
|
victim.step = math.min(victim.step, factor)
|
||||||
|
victim.dur = math.max(duration, victim.dur - victim.timer)
|
||||||
|
victim.timer = 0
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function mcl_potions.regeneration_func(player, factor, duration)
|
||||||
|
|
||||||
|
if not is_regenerating[player] then
|
||||||
|
|
||||||
|
is_regenerating[player] = {step = factor, dur = duration, timer = 0}
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
local victim = is_regenerating[player]
|
||||||
|
|
||||||
|
victim.step = math.min(victim.step, factor)
|
||||||
|
victim.dur = math.max(duration, victim.dur - victim.timer)
|
||||||
|
victim.timer = 0
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function mcl_potions.invisiblility_func(player, duration)
|
||||||
|
|
||||||
|
if not is_invisible[player] then
|
||||||
|
|
||||||
|
is_invisible[player] = {dur = duration, timer = 0}
|
||||||
|
mcl_potions.make_invisible(player, true)
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
local victim = is_invisible[player]
|
||||||
|
|
||||||
|
victim.dur = math.max(duration, victim.dur - victim.timer)
|
||||||
|
victim.timer = 0
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
function mcl_potions.water_breathing_func(player, duration)
|
||||||
|
|
||||||
|
if not is_water_breathing[player] then
|
||||||
|
|
||||||
|
is_water_breathing[player] = {dur = duration, timer = 0}
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
local victim = is_water_breathing[player]
|
||||||
|
|
||||||
|
victim.dur = math.max(duration, victim.dur - victim.timer)
|
||||||
|
victim.timer = 0
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function mcl_potions.fire_resistance_func(player, duration)
|
||||||
|
|
||||||
|
if not is_fire_proof[player] then
|
||||||
|
|
||||||
|
is_fire_proof[player] = {dur = duration, timer = 0}
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
local victim = is_fire_proof[player]
|
||||||
|
victim.dur = math.max(duration, victim.dur - victim.timer)
|
||||||
|
victim.timer = 0
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function mcl_potions.night_vision_func(player, duration)
|
||||||
|
|
||||||
|
if not is_cat[player] then
|
||||||
|
|
||||||
|
is_cat[player] = {dur = duration, timer = 0}
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
local victim = is_cat[player]
|
||||||
|
|
||||||
|
victim.dur = math.max(duration, victim.dur - victim.timer)
|
||||||
|
victim.timer = 0
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -1,6 +1,25 @@
|
||||||
local S = minetest.get_translator("mcl_potions")
|
local S = minetest.get_translator("mcl_potions")
|
||||||
|
mcl_potions = {}
|
||||||
|
|
||||||
local brewhelp = S("Put this item in an item frame for decoration. It's useless otherwise.")
|
-- duration effects of redstone are a factor of 8/3
|
||||||
|
-- duration effects of glowstone are a time factor of 1/2
|
||||||
|
-- splash potion duration effects are reduced by a factor of 3/4
|
||||||
|
|
||||||
|
mcl_potions.DURATION = 180
|
||||||
|
mcl_potions.DURATION_PLUS = mcl_potions.DURATION * (8/3)
|
||||||
|
mcl_potions.DURATION_2 = mcl_potions.DURATION * (1/2)
|
||||||
|
|
||||||
|
mcl_potions.INV_FACTOR = 0.50
|
||||||
|
mcl_potions.SPLASH_FACTOR = 0.75
|
||||||
|
|
||||||
|
|
||||||
|
local modpath = minetest.get_modpath("mcl_potions")
|
||||||
|
dofile(modpath .. "/functions.lua")
|
||||||
|
dofile(modpath .. "/splash.lua")
|
||||||
|
dofile(modpath .. "/lingering.lua")
|
||||||
|
dofile(modpath .. "/potions.lua")
|
||||||
|
|
||||||
|
local brewhelp = S("Try different combinations to create potions.")
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_potions:fermented_spider_eye", {
|
minetest.register_craftitem("mcl_potions:fermented_spider_eye", {
|
||||||
description = S("Fermented Spider Eye"),
|
description = S("Fermented Spider Eye"),
|
||||||
|
@ -8,7 +27,7 @@ minetest.register_craftitem("mcl_potions:fermented_spider_eye", {
|
||||||
wield_image = "mcl_potions_spider_eye_fermented.png",
|
wield_image = "mcl_potions_spider_eye_fermented.png",
|
||||||
inventory_image = "mcl_potions_spider_eye_fermented.png",
|
inventory_image = "mcl_potions_spider_eye_fermented.png",
|
||||||
-- TODO: Reveal item when it's actually useful
|
-- TODO: Reveal item when it's actually useful
|
||||||
groups = { brewitem = 1, not_in_creative_inventory = 1, not_in_craft_guide = 1 },
|
groups = { brewitem = 1, not_in_creative_inventory = 0, not_in_craft_guide = 0 },
|
||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -23,8 +42,8 @@ minetest.register_craftitem("mcl_potions:glass_bottle", {
|
||||||
_tt_help = S("Liquid container"),
|
_tt_help = S("Liquid container"),
|
||||||
_doc_items_longdesc = S("A glass bottle is used as a container for liquids and can be used to collect water directly."),
|
_doc_items_longdesc = S("A glass bottle is used as a container for liquids and can be used to collect water directly."),
|
||||||
_doc_items_usagehelp = S("To collect water, it on a cauldron with water (which removes a level of water) or any water source (which removes no water)."),
|
_doc_items_usagehelp = S("To collect water, it on a cauldron with water (which removes a level of water) or any water source (which removes no water)."),
|
||||||
inventory_image = "mcl_potions_potion_bottle_empty.png",
|
inventory_image = "mcl_potions_potion_bottle.png",
|
||||||
wield_image = "mcl_potions_potion_bottle_empty.png",
|
wield_image = "mcl_potions_potion_bottle.png",
|
||||||
groups = {brewitem=1},
|
groups = {brewitem=1},
|
||||||
liquids_pointable = true,
|
liquids_pointable = true,
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
@ -33,7 +52,7 @@ minetest.register_craftitem("mcl_potions:glass_bottle", {
|
||||||
local def = minetest.registered_nodes[node.name]
|
local def = minetest.registered_nodes[node.name]
|
||||||
|
|
||||||
-- Call on_rightclick if the pointed node defines it
|
-- Call on_rightclick if the pointed node defines it
|
||||||
if placer and not placer :get_player_control().sneak then
|
if placer and not placer:get_player_control().sneak then
|
||||||
if def and def.on_rightclick then
|
if def and def.on_rightclick then
|
||||||
return def.on_rightclick(pointed_thing.under, node, placer, itemstack) or itemstack
|
return def.on_rightclick(pointed_thing.under, node, placer, itemstack) or itemstack
|
||||||
end
|
end
|
||||||
|
@ -87,9 +106,9 @@ minetest.register_craftitem("mcl_potions:glass_bottle", {
|
||||||
-- place the water potion at a place where's space
|
-- place the water potion at a place where's space
|
||||||
local water_bottle
|
local water_bottle
|
||||||
if river_water then
|
if river_water then
|
||||||
water_bottle = ItemStack("mcl_potions:potion_river_water")
|
water_bottle = ItemStack("mcl_potions:river_water")
|
||||||
else
|
else
|
||||||
water_bottle = ItemStack("mcl_potions:potion_water")
|
water_bottle = ItemStack("mcl_potions:water")
|
||||||
end
|
end
|
||||||
local inv = placer:get_inventory()
|
local inv = placer:get_inventory()
|
||||||
if creative then
|
if creative then
|
||||||
|
@ -130,9 +149,11 @@ local potion_image = function(colorstring, opacity)
|
||||||
if not opacity then
|
if not opacity then
|
||||||
opacity = 127
|
opacity = 127
|
||||||
end
|
end
|
||||||
return "mcl_potions_potion_bottle_drinkable.png^(mcl_potions_potion_overlay.png^[colorize:"..colorstring..":"..tostring(opacity)..")"
|
return "mcl_potions_potion_overlay.png^[colorize:"..colorstring..":"..tostring(opacity).."^mcl_potions_potion_bottle.png"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- Cauldron fill up rules:
|
-- Cauldron fill up rules:
|
||||||
-- Adding any water increases the water level by 1, preserving the current water type
|
-- Adding any water increases the water level by 1, preserving the current water type
|
||||||
local cauldron_levels = {
|
local cauldron_levels = {
|
||||||
|
@ -158,7 +179,7 @@ end
|
||||||
|
|
||||||
-- Itemstring of potions is “mcl_potions:potion_<NBT Potion Tag>”
|
-- Itemstring of potions is “mcl_potions:potion_<NBT Potion Tag>”
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_potions:potion_water", {
|
minetest.register_craftitem("mcl_potions:water", {
|
||||||
description = S("Water Bottle"),
|
description = S("Water Bottle"),
|
||||||
_tt_help = S("No effect"),
|
_tt_help = S("No effect"),
|
||||||
_doc_items_longdesc = S("Water bottles can be used to fill cauldrons. Drinking water has no effect."),
|
_doc_items_longdesc = S("Water bottles can be used to fill cauldrons. Drinking water has no effect."),
|
||||||
|
@ -203,7 +224,7 @@ minetest.register_craftitem("mcl_potions:potion_water", {
|
||||||
on_secondary_use = minetest.item_eat(0, "mcl_potions:glass_bottle"),
|
on_secondary_use = minetest.item_eat(0, "mcl_potions:glass_bottle"),
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_potions:potion_river_water", {
|
minetest.register_craftitem("mcl_potions:river_water", {
|
||||||
description = S("River Water Bottle"),
|
description = S("River Water Bottle"),
|
||||||
_tt_help = S("No effect"),
|
_tt_help = S("No effect"),
|
||||||
_doc_items_longdesc = S("River water bottles can be used to fill cauldrons. Drinking it has no effect."),
|
_doc_items_longdesc = S("River water bottles can be used to fill cauldrons. Drinking it has no effect."),
|
||||||
|
@ -250,55 +271,11 @@ minetest.register_craftitem("mcl_potions:potion_river_water", {
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
local how_to_drink = S("Use the “Place” key to drink it.")
|
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_potions:potion_awkward", {
|
|
||||||
description = S("Awkward Potion"),
|
|
||||||
_tt_help = S("No effect"),
|
|
||||||
_doc_items_longdesc = S("This potion has an awkward taste and is used for brewing more potions. Drinking it has no effect."),
|
|
||||||
_doc_items_usagehelp = how_to_drink,
|
|
||||||
stack_max = 1,
|
|
||||||
inventory_image = potion_image("#0000FF"),
|
|
||||||
wield_image = potion_image("#0000FF"),
|
|
||||||
-- TODO: Reveal item when it's actually useful
|
|
||||||
groups = {brewitem=1, food=3, can_eat_when_full=1, not_in_creative_inventory=1},
|
|
||||||
on_place = minetest.item_eat(0, "mcl_potions:glass_bottle"),
|
|
||||||
on_secondary_use = minetest.item_eat(0, "mcl_potions:glass_bottle"),
|
|
||||||
})
|
|
||||||
minetest.register_craftitem("mcl_potions:potion_mundane", {
|
|
||||||
description = S("Mundane Potion"),
|
|
||||||
_tt_help = S("No effect"),
|
|
||||||
_doc_items_longdesc = S("This potion has a clean taste and is used for brewing more potions. Drinking it has no effect."),
|
|
||||||
_doc_items_usagehelp = how_to_drink,
|
|
||||||
stack_max = 1,
|
|
||||||
inventory_image = potion_image("#0000FF"),
|
|
||||||
wield_image = potion_image("#0000FF"),
|
|
||||||
-- TODO: Reveal item when it's actually useful
|
|
||||||
groups = {brewitem=1, food=3, can_eat_when_full=1, not_in_creative_inventory=1 },
|
|
||||||
on_place = minetest.item_eat(0, "mcl_potions:glass_bottle"),
|
|
||||||
on_secondary_use = minetest.item_eat(0, "mcl_potions:glass_bottle"),
|
|
||||||
})
|
|
||||||
minetest.register_craftitem("mcl_potions:potion_thick", {
|
|
||||||
description = S("Thick Potion"),
|
|
||||||
_tt_help = S("No effect"),
|
|
||||||
_doc_items_longdesc = S("This potion has a bitter taste and is used for brewing more potions. Drinking it has no effect."),
|
|
||||||
_doc_items_usagehelp = how_to_drink,
|
|
||||||
stack_max = 1,
|
|
||||||
inventory_image = potion_image("#0000FF"),
|
|
||||||
wield_image = potion_image("#0000FF"),
|
|
||||||
-- TODO: Reveal item when it's actually useful
|
|
||||||
groups = {brewitem=1, food=3, can_eat_when_full=1, not_in_creative_inventory=1 },
|
|
||||||
on_place = minetest.item_eat(0, "mcl_potions:glass_bottle"),
|
|
||||||
on_secondary_use = minetest.item_eat(0, "mcl_potions:glass_bottle"),
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_potions:speckled_melon", {
|
minetest.register_craftitem("mcl_potions:speckled_melon", {
|
||||||
description = S("Glistering Melon"),
|
description = S("Glistering Melon"),
|
||||||
_doc_items_longdesc = S("This shiny melon is full of tiny gold nuggets and would be nice in an item frame. It isn't edible and not useful for anything else."),
|
_doc_items_longdesc = S("This shiny melon is full of tiny gold nuggets and would be nice in an item frame. It isn't edible and not useful for anything else."),
|
||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
-- TODO: Reveal item when it's actually useful
|
groups = { brewitem = 1, not_in_creative_inventory = 0, not_in_craft_guide = 1 },
|
||||||
groups = { brewitem = 1, not_in_creative_inventory = 1, not_in_craft_guide = 1 },
|
|
||||||
inventory_image = "mcl_potions_melon_speckled.png",
|
inventory_image = "mcl_potions_melon_speckled.png",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -311,12 +288,123 @@ minetest.register_craft({
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_potions:dragon_breath", {
|
|
||||||
description = S("Dragon's Breath"),
|
local water_table = {
|
||||||
_doc_items_longdesc = brewhelp,
|
["mcl_nether:nether_wart_item"] = "mcl_potions:awkward",
|
||||||
wield_image = "mcl_potions_dragon_breath.png",
|
["mcl_potions:fermented_spider_eye"] = "mcl_potions:weakness",
|
||||||
inventory_image = "mcl_potions_dragon_breath.png",
|
["mcl_potions:speckled_melon"] = "mcl_potions:mundane",
|
||||||
-- TODO: Reveal item when it's actually useful
|
["mcl_core:sugar"] = "mcl_potions:mundane",
|
||||||
groups = { brewitem = 1, not_in_creative_inventory = 1 },
|
["mcl_mobitems:magma_cream"] = "mcl_potions:mundane",
|
||||||
stack_max = 64,
|
["mcl_mobitems:blaze_powder"] = "mcl_potions:mundane",
|
||||||
})
|
["mesecons:wire_00000000_off"] = "mcl_potions:mundane",
|
||||||
|
["mcl_mobitems:ghast_tear"] = "mcl_potions:mundane",
|
||||||
|
["mcl_mobitems:spider_eye"] = "mcl_potions:mundane",
|
||||||
|
["mcl_mobitems:rabbit_foot"] = "mcl_potions:mundane"
|
||||||
|
}
|
||||||
|
|
||||||
|
local awkward_table = {
|
||||||
|
["mcl_potions:speckled_melon"] = "mcl_potions:healing",
|
||||||
|
["mcl_farming:carrot_item_gold"] = "mcl_potions:night_vision",
|
||||||
|
["mcl_core:sugar"] = "mcl_potions:swiftness",
|
||||||
|
["mcl_mobitems:magma_cream"] = "mcl_potions:fire_resistance",
|
||||||
|
["mcl_mobitems:blaze_powder"] = "mcl_potions:strength",
|
||||||
|
["mcl_fishing:pufferfish_raw"] = "mcl_potions:water_breathing",
|
||||||
|
["mcl_mobitems:ghast_tear"] = "mcl_potions:regeneration",
|
||||||
|
["mcl_mobitems:spider_eye"] = "mcl_potions:poison",
|
||||||
|
["mcl_mobitems:rabbit_foot"] = "mcl_potions:leaping",
|
||||||
|
}
|
||||||
|
|
||||||
|
local output_table = {
|
||||||
|
["mcl_potions:river_water"] = water_table,
|
||||||
|
["mcl_potions:water"] = water_table,
|
||||||
|
["mcl_potions:awkward"] = awkward_table,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
local enhancement_table = {}
|
||||||
|
local extension_table = {}
|
||||||
|
local potions = {"awkward", "mundane", "thick"}
|
||||||
|
for i, potion in ipairs({"healing","harming","swiftness","slowness","leaping","poison","regeneration","invisibility","fire_resistance","weakness","strength","water_breathing","night_vision"}) do
|
||||||
|
|
||||||
|
table.insert(potions, potion)
|
||||||
|
|
||||||
|
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.."_splash"] = "mcl_potions:"..potion.."_2_splash"
|
||||||
|
table.insert(potions, potion.."_2")
|
||||||
|
end
|
||||||
|
|
||||||
|
if potion ~= "healing" and potion ~= "harming" then
|
||||||
|
extension_table["mcl_potions:"..potion.."_splash"] = "mcl_potions:"..potion.."_plus_splash"
|
||||||
|
extension_table["mcl_potions:"..potion] = "mcl_potions:"..potion.."_plus"
|
||||||
|
table.insert(potions, potion.."_plus")
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local inversion_table = {
|
||||||
|
["mcl_potions:healing"] = "mcl_potions:harming",
|
||||||
|
["mcl_potions:healing_2"] = "mcl_potions:harming_2",
|
||||||
|
["mcl_potions:swiftness"] = "mcl_potions:slowness",
|
||||||
|
["mcl_potions:swiftness_plus"] = "mlc_potions:slowness_plus",
|
||||||
|
["mcl_potions:leaping"] = "mcl_potions:slowness",
|
||||||
|
["mcl_potions:leaping_plus"] = "mcl_potions:slowness_plus",
|
||||||
|
["mcl_potions:night_vision"] = "mcl_potions:invisibility",
|
||||||
|
["mcl_potions:night_vision_plus"] = "mcl_potions:invisibility_plus",
|
||||||
|
["mcl_potions:poison"] = "mcl_potions:harming",
|
||||||
|
["mcl_potions:poison_2"] = "mcl_potions:harming_2",
|
||||||
|
["mcl_potions:healing_splash"] = "mcl_potions:harming_splash",
|
||||||
|
["mcl_potions:healing_2_splash"] = "mcl_potions:harming_2_splash",
|
||||||
|
["mcl_potions:swiftness_splash"] = "mcl_potions:slowness_splash",
|
||||||
|
["mcl_potions:swiftness_plus_splash"] = "mlc_potions:slowness_plus_splash",
|
||||||
|
["mcl_potions:leaping_splash"] = "mcl_potions:slowness_splash",
|
||||||
|
["mcl_potions:leaping_plus_splash"] = "mcl_potions:slowness_plus_splash",
|
||||||
|
["mcl_potions:night_vision_splash"] = "mcl_potions:invisibility_splash",
|
||||||
|
["mcl_potions:night_vision_plus_splash"] = "mcl_potions:invisibility_plus_splash",
|
||||||
|
["mcl_potions:poison_splash"] = "mcl_potions:harming_splash",
|
||||||
|
["mcl_potions:poison_2_splash"] = "mcl_potions:harming_2_splash",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
local splash_table = {}
|
||||||
|
local lingering_table = {}
|
||||||
|
|
||||||
|
for i, potion in ipairs(potions) do
|
||||||
|
splash_table["mcl_potions:"..potion] = "mcl_potions:"..potion.."_splash"
|
||||||
|
lingering_table["mcl_potions:"..potion.."_splash"] = "mcl_potions:"..potion.."_lingering"
|
||||||
|
end
|
||||||
|
|
||||||
|
for i, potion in ipairs({"awkward", "mundane", "thick", "water", "river_water"}) do
|
||||||
|
splash_table["mcl_potions:"..potion] = "mcl_potions:"..potion.."_splash"
|
||||||
|
lingering_table["mcl_potions:"..potion.."_splash"] = "mcl_potions:"..potion.."_lingering"
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local mod_table = {
|
||||||
|
["mesecons:wire_00000000_off"] = extension_table,
|
||||||
|
["mcl_potions:fermented_spider_eye"] = inversion_table,
|
||||||
|
["mcl_nether:glowstone_dust"] = enhancement_table,
|
||||||
|
["mcl_mobitems:gunpowder"] = splash_table,
|
||||||
|
["mcl_potions:dragon_breath"] = lingering_table,
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Compare two ingredients for compatable alchemy
|
||||||
|
function mcl_potions.get_alchemy(ingr, pot)
|
||||||
|
|
||||||
|
if output_table[pot] ~= nil then
|
||||||
|
local brew_table = output_table[pot]
|
||||||
|
if brew_table[ingr] ~= nil then
|
||||||
|
return brew_table[ingr]
|
||||||
|
end
|
||||||
|
|
||||||
|
elseif mod_table[ingr] ~= nil then
|
||||||
|
local brew_table = mod_table[ingr]
|
||||||
|
if brew_table[pot] ~= nil then
|
||||||
|
return brew_table[pot]
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
257
mods/ITEMS/mcl_potions/lingering.lua
Normal file
|
@ -0,0 +1,257 @@
|
||||||
|
local lingering_image = function(colorstring, opacity)
|
||||||
|
if not opacity then
|
||||||
|
opacity = 127
|
||||||
|
end
|
||||||
|
return "mcl_potions_splash_overlay.png^[colorize:"..colorstring..":"..tostring(opacity).."^mcl_potions_splash_bottle.png"
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local lingering_effect_at = {}
|
||||||
|
|
||||||
|
local function add_lingering_effect(pos, color, def)
|
||||||
|
|
||||||
|
lingering_effect_at[pos] = {color = color, timer = 30, def = def}
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local lingering_timer = 0
|
||||||
|
minetest.register_globalstep(function(dtime)
|
||||||
|
|
||||||
|
lingering_timer = lingering_timer + dtime
|
||||||
|
if lingering_timer >= 1 then
|
||||||
|
|
||||||
|
for pos, vals in pairs(lingering_effect_at) do
|
||||||
|
|
||||||
|
vals.timer = vals.timer - lingering_timer
|
||||||
|
local d = 4 * (vals.timer / 30.0)
|
||||||
|
|
||||||
|
minetest.add_particlespawner({
|
||||||
|
amount = 10 * d^2,
|
||||||
|
time = 1,
|
||||||
|
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},
|
||||||
|
minvel = {x=-0.5, y=0, z=-0.5},
|
||||||
|
maxvel = {x=0.5, y=0.5, z=0.5},
|
||||||
|
minacc = {x=-0.2, y=0, z=-0.2},
|
||||||
|
maxacc = {x=0.2, y=.05, z=0.2},
|
||||||
|
minexptime = 1,
|
||||||
|
maxexptime = 2,
|
||||||
|
minsize = 2,
|
||||||
|
maxsize = 4,
|
||||||
|
collisiondetection = true,
|
||||||
|
vertical = false,
|
||||||
|
texture = "mcl_potions_sprite.png^[colorize:"..vals.color..":127",
|
||||||
|
})
|
||||||
|
|
||||||
|
for _, obj in pairs(minetest.get_objects_inside_radius(pos, d)) do
|
||||||
|
|
||||||
|
local entity = obj:get_luaentity()
|
||||||
|
if obj:is_player() or entity._cmi_is_mob then
|
||||||
|
|
||||||
|
vals.def.potion_fun(obj)
|
||||||
|
vals.timer = vals.timer / 2
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if vals.timer <= 0 then lingering_effect_at[pos] = nil end
|
||||||
|
|
||||||
|
end
|
||||||
|
lingering_timer = 0
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
local function register_lingering(name, descr, color, def)
|
||||||
|
|
||||||
|
local id = "mcl_potions:"..name.."_lingering"
|
||||||
|
minetest.register_craftitem(id, {
|
||||||
|
description = descr,
|
||||||
|
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=0, y=-9.8, z=0})
|
||||||
|
if not minetest.settings:get_bool("creative_mode") then
|
||||||
|
item:take_item()
|
||||||
|
end
|
||||||
|
return item
|
||||||
|
end,
|
||||||
|
stack_max = 1,
|
||||||
|
})
|
||||||
|
|
||||||
|
local w = 0.7
|
||||||
|
|
||||||
|
minetest.register_entity(id.."_flying",{
|
||||||
|
textures = {lingering_image(color)},
|
||||||
|
hp_max = 1,
|
||||||
|
visual_size = {x=w/2,y=w/2},
|
||||||
|
collisionbox = {0,0,0,0,0,0},
|
||||||
|
on_step = function(self, dtime)
|
||||||
|
local pos = self.object:getpos()
|
||||||
|
local node = minetest.get_node(pos)
|
||||||
|
local n = node.name
|
||||||
|
local d = 4
|
||||||
|
if n ~= "air" and n ~= "mcl_portals:portal" and n ~= "mcl_portals:portal_end" or mcl_potions.is_obj_hit(self, pos) then
|
||||||
|
minetest.sound_play("mcl_potions_breaking_glass", {pos = pos, max_hear_distance = 16, gain = 1})
|
||||||
|
add_lingering_effect(pos, color, def)
|
||||||
|
minetest.add_particlespawner({
|
||||||
|
amount = 40,
|
||||||
|
time = 1,
|
||||||
|
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},
|
||||||
|
minvel = {x=-0.5, y=0, z=-0.5},
|
||||||
|
maxvel = {x=0.5, y=0.5, z=0.5},
|
||||||
|
minacc = {x=-0.2, y=0, z=-0.2},
|
||||||
|
maxacc = {x=0.2, y=.05, z=0.2},
|
||||||
|
minexptime = 1,
|
||||||
|
maxexptime = 2,
|
||||||
|
minsize = 1,
|
||||||
|
maxsize = 2,
|
||||||
|
collisiondetection = true,
|
||||||
|
vertical = false,
|
||||||
|
texture = "mcl_potions_sprite.png^[colorize:"..color..":127",
|
||||||
|
})
|
||||||
|
self.object:remove()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
register_lingering("water", "Lingering Potion", "#0000FF", {
|
||||||
|
potion_fun = function(player) end,
|
||||||
|
})
|
||||||
|
|
||||||
|
register_lingering("river_water", "Lingering Potion", "#0000FF", {
|
||||||
|
potion_fun = function(player) end,
|
||||||
|
})
|
||||||
|
|
||||||
|
register_lingering("awkward", "Lingering Awkward Potion", "#0000FF", {
|
||||||
|
potion_fun = function(player) end,
|
||||||
|
})
|
||||||
|
|
||||||
|
register_lingering("mundane", "Lingering Mundane Potion", "#0000FF", {
|
||||||
|
potion_fun = function(player) end,
|
||||||
|
})
|
||||||
|
|
||||||
|
register_lingering("thick", "Lingering Thick Potion", "#0000FF", {
|
||||||
|
potion_fun = function(player) end,
|
||||||
|
})
|
||||||
|
|
||||||
|
register_lingering("healing", "Lingering Healing", "#AA0000", {
|
||||||
|
potion_fun = function(player) player:set_hp(player:get_hp() + 4*0.5) end,
|
||||||
|
})
|
||||||
|
|
||||||
|
register_lingering("healing_2", "Lingering Healing II", "#DD0000", {
|
||||||
|
potion_fun = function(player, redx) player:set_hp(player:get_hp() + 8*0.5) end,
|
||||||
|
})
|
||||||
|
|
||||||
|
register_lingering("harming", "Lingering Harming", "#660099", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.healing_func(player, -6*0.5) end,
|
||||||
|
})
|
||||||
|
|
||||||
|
register_lingering("harming_2", "Lingering Harming II", "#330066", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.healing_func(player, -12*0.5) end,
|
||||||
|
})
|
||||||
|
|
||||||
|
register_lingering("leaping", "Lingering Leaping", "#00CC33", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.leaping_func(player, 1.2, mcl_potions.DURATION*0.25) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_lingering("leaping_2", "Lingering Leaping II", "#00EE33", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.leaping_func(player, 1.4, mcl_potions.DURATION_2*0.25) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_lingering("leaping_plus", "Lingering Leaping +", "#00DD33", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.leaping_func(player, 1.2, mcl_potions.DURATION_PLUS*0.25) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_lingering("swiftness", "Lingering Swiftness", "#009999", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.swiftness_func(player, 1.2, mcl_potions.DURATION*0.25) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_lingering("swiftness_2", "Lingering Swiftness II", "#00BBBB", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.swiftness_func(player, 1.4, mcl_potions.DURATION*0.25) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_lingering("swiftness_plus", "Lingering Swiftness +", "#00BBBB", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.swiftness_func(player, 1.2, mcl_potions.DURATION_PLUS*0.25) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_lingering("slowness", "Lingering Slowness", "#000080", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.swiftness_func(player, 0.85, mcl_potions.DURATION*mcl_potions.INV_FACTOR*0.25) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_lingering("slowness_plus", "Lingering Slowness +", "#000066", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.swiftness_func(player, 0.85, mcl_potions.DURATION_PLUS*mcl_potions.INV_FACTOR*0.25) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_lingering("slowness_2", "Lingering Slowness IV", "#000066", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.swiftness_func(player, 0.4, 20*0.25) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_lingering("poison", "Lingering Poison", "#335544", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.poison_func(player, 2.5, 45*0.25) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_lingering("poison_2", "Lingering Poison II", "#446655", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.poison_func(player, 1.2, 21*0.25) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_lingering("poison_plus", "Lingering Poison +", "#557766", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.poison_func(player, 2.5, 90*0.25) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_lingering("regeneration", "Lingering Regeneration", "#A52BB2", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.regeneration_func(player, 2.5, 45*0.25) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_lingering("regeneration_2", "Lingering Regeneration II", "#B52CC2", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.regeneration_func(player, 1.2, 22*0.25) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_lingering("regeneration_plus", "Lingering Regeneration +", "#C53DD3", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.regeneration_func(player, 2.5, 90*0.25) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_lingering("invisibility", "Lingering Invisibility", "#B0B0B0", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.invisiblility_func(player, mcl_potions.DURATION*0.25) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_lingering("invisibility_plus", "Lingering Invisibility +", "#A0A0A0", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.invisiblility_func(player, mcl_potions.DURATION_PLUS*0.25) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_lingering("weakness", "Lingering Weakness", "#6600AA", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.weakness_func(player, -4, mcl_potions.DURATION*mcl_potions.INV_FACTOR*0.25) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_lingering("weakness_plus", "Lingering Weakness +", "#7700BB", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.weakness_func(player, -4, mcl_potions.DURATION_PLUS*mcl_potions.INV_FACTOR*0.25) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_lingering("fire_resistance", "Lingering Fire Resistance", "#D0A040", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.fire_resistance_func(player, mcl_potions.DURATION) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_lingering("fire_resistance_plus", "Lingering Fire Resistance +", "#E0B050", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.fire_resistance_func(player, mcl_potions.DURATION_PLUS) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_lingering("strength", "Lingering Strength", "#D444D4", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.strength_func(player, 3, mcl_potions.DURATION) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_lingering("strength_2", "Lingering Strength II", "#D444F4", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.strength_func(player, 6, smcl_potions.DURATION_2) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_lingering("strength_plus", "Lingering Strength +", "#D444E4", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.strength_func(player, 3, mcl_potions.DURATION_PLUS) end
|
||||||
|
})
|
844
mods/ITEMS/mcl_potions/potions.lua
Normal file
|
@ -0,0 +1,844 @@
|
||||||
|
local S = minetest.get_translator("mcl_potions")
|
||||||
|
local brewhelp = S("Try different combinations to create potions.")
|
||||||
|
|
||||||
|
local potion_image = function(colorstring, opacity)
|
||||||
|
if not opacity then
|
||||||
|
opacity = 127
|
||||||
|
end
|
||||||
|
return "mcl_potions_potion_overlay.png^[colorize:"..colorstring..":"..tostring(opacity).."^mcl_potions_potion_bottle.png"
|
||||||
|
end
|
||||||
|
|
||||||
|
local how_to_drink = S("Use the “Place” key to drink it.")
|
||||||
|
|
||||||
|
minetest.register_craftitem("mcl_potions:awkward", {
|
||||||
|
description = S("Awkward Potion"),
|
||||||
|
_tt_help = S("No effect"),
|
||||||
|
_doc_items_longdesc = S("This potion has an awkward taste and is used for brewing more potions. Drinking it has no effect."),
|
||||||
|
_doc_items_usagehelp = how_to_drink,
|
||||||
|
stack_max = 1,
|
||||||
|
inventory_image = potion_image("#0000FF"),
|
||||||
|
wield_image = potion_image("#0000FF"),
|
||||||
|
groups = {brewitem=1, food=3, can_eat_when_full=1, not_in_creative_inventory=1},
|
||||||
|
on_place = minetest.item_eat(0, "mcl_potions:glass_bottle"),
|
||||||
|
on_secondary_use = minetest.item_eat(0, "mcl_potions:glass_bottle"),
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craftitem("mcl_potions:mundane", {
|
||||||
|
description = S("Mundane Potion"),
|
||||||
|
_tt_help = S("No effect"),
|
||||||
|
_doc_items_longdesc = S("This potion has a clean taste and is used for brewing more potions. Drinking it has no effect."),
|
||||||
|
_doc_items_usagehelp = how_to_drink,
|
||||||
|
stack_max = 1,
|
||||||
|
inventory_image = potion_image("#0000FF"),
|
||||||
|
wield_image = potion_image("#0000FF"),
|
||||||
|
groups = {brewitem=1, food=3, can_eat_when_full=1, not_in_creative_inventory=1 },
|
||||||
|
on_place = minetest.item_eat(0, "mcl_potions:glass_bottle"),
|
||||||
|
on_secondary_use = minetest.item_eat(0, "mcl_potions:glass_bottle"),
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craftitem("mcl_potions:thick", {
|
||||||
|
description = S("Thick Potion"),
|
||||||
|
_tt_help = S("No effect"),
|
||||||
|
_doc_items_longdesc = S("This potion has a bitter taste and is used for brewing more potions. Drinking it has no effect."),
|
||||||
|
_doc_items_usagehelp = how_to_drink,
|
||||||
|
stack_max = 1,
|
||||||
|
inventory_image = potion_image("#0000FF"),
|
||||||
|
wield_image = potion_image("#0000FF"),
|
||||||
|
groups = {brewitem=1, food=3, can_eat_when_full=1, not_in_creative_inventory=0 },
|
||||||
|
on_place = minetest.item_eat(0, "mcl_potions:glass_bottle"),
|
||||||
|
on_secondary_use = minetest.item_eat(0, "mcl_potions:glass_bottle"),
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_craftitem("mcl_potions:dragon_breath", {
|
||||||
|
description = S("Dragon's Breath"),
|
||||||
|
_doc_items_longdesc = brewhelp,
|
||||||
|
wield_image = "mcl_potions_dragon_breath.png",
|
||||||
|
inventory_image = "mcl_potions_dragon_breath.png",
|
||||||
|
groups = { brewitem = 1, not_in_creative_inventory = 0 },
|
||||||
|
stack_max = 1,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_craftitem("mcl_potions:healing", {
|
||||||
|
description = S("Healing Potion"),
|
||||||
|
_tt_help = S("+2 Hearts"),
|
||||||
|
_doc_items_longdesc = brewhelp,
|
||||||
|
wield_image = potion_image("#CC0000"),
|
||||||
|
inventory_image = potion_image("#CC0000"),
|
||||||
|
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.healing_func(user, 4)
|
||||||
|
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
||||||
|
mcl_potions._use_potion(itemstack, user, "#CC0000")
|
||||||
|
return itemstack
|
||||||
|
end,
|
||||||
|
|
||||||
|
on_secondary_use = function(itemstack, user, pointed_thing)
|
||||||
|
mcl_potions.healing_func(user, 4)
|
||||||
|
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
||||||
|
mcl_potions._use_potion(itemstack, user, "#CC0000")
|
||||||
|
return itemstack
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craftitem("mcl_potions:healing_2", {
|
||||||
|
description = S("Healing Potion II"),
|
||||||
|
_tt_help = S("+4 Hearts"),
|
||||||
|
_doc_items_longdesc = brewhelp,
|
||||||
|
wield_image = potion_image("#DD0000"),
|
||||||
|
inventory_image = potion_image("#DD0000"),
|
||||||
|
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.healing_func(user, 8)
|
||||||
|
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
||||||
|
mcl_potions._use_potion(itemstack, user, "#DD0000")
|
||||||
|
return itemstack
|
||||||
|
end,
|
||||||
|
|
||||||
|
on_secondary_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, "#DD0000")
|
||||||
|
return itemstack
|
||||||
|
end,
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craftitem("mcl_potions:harming", {
|
||||||
|
description = S("Harming Potion"),
|
||||||
|
_tt_help = S("-3 Hearts"),
|
||||||
|
_doc_items_longdesc = brewhelp,
|
||||||
|
wield_image = potion_image("#660099"),
|
||||||
|
inventory_image = potion_image("#660099"),
|
||||||
|
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.healing_func(user, -6)
|
||||||
|
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
||||||
|
mcl_potions._use_potion(itemstack, user, "#660099")
|
||||||
|
return itemstack
|
||||||
|
end,
|
||||||
|
|
||||||
|
on_secondary_use = function(itemstack, user, pointed_thing)
|
||||||
|
mcl_potions.healing_func(user, -6)
|
||||||
|
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
||||||
|
mcl_potions._use_potion(itemstack, user, "#660099")
|
||||||
|
return itemstack
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craftitem("mcl_potions:harming_2", {
|
||||||
|
description = S("Harming Potion II"),
|
||||||
|
_tt_help = S("-6 Hearts"),
|
||||||
|
_doc_items_longdesc = brewhelp,
|
||||||
|
wield_image = potion_image("#330066"),
|
||||||
|
inventory_image = potion_image("#330066"),
|
||||||
|
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.healing_func(user, -12)
|
||||||
|
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
||||||
|
mcl_potions._use_potion(itemstack, user, "#330066")
|
||||||
|
return itemstack
|
||||||
|
end,
|
||||||
|
|
||||||
|
on_secondary_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, "#330066")
|
||||||
|
return itemstack
|
||||||
|
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", {
|
||||||
|
description = S("Weakness Potion"),
|
||||||
|
_tt_help = S("-2 hearts per damage | 1:30"),
|
||||||
|
_doc_items_longdesc = brewhelp,
|
||||||
|
wield_image = potion_image("#6600AA"),
|
||||||
|
inventory_image = potion_image("#6600AA"),
|
||||||
|
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.weakness_func(user, -4, 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, "#6600AA")
|
||||||
|
return itemstack
|
||||||
|
end,
|
||||||
|
|
||||||
|
on_secondary_use = function(itemstack, user, pointed_thing)
|
||||||
|
mcl_potions.weakness_func(user, -4, 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, "#6600AA")
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craftitem("mcl_potions:weakness_plus", {
|
||||||
|
description = S("Weakness Potion +"),
|
||||||
|
_tt_help = S("-2 hearts per damage | 4:00"),
|
||||||
|
_doc_items_longdesc = brewhelp,
|
||||||
|
wield_image = potion_image("#7700BB"),
|
||||||
|
inventory_image = potion_image("#7700BB"),
|
||||||
|
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.weakness_func(user, -4, 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, "#7700BB")
|
||||||
|
return itemstack
|
||||||
|
end,
|
||||||
|
|
||||||
|
on_secondary_use = function(itemstack, user, pointed_thing)
|
||||||
|
mcl_potions.weakness_func(user, -4, 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, "#7700BB")
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craftitem("mcl_potions:strength", {
|
||||||
|
description = S("Strength Potion"),
|
||||||
|
_tt_help = S("+1.5 hearts per damage | 3:00"),
|
||||||
|
_doc_items_longdesc = brewhelp,
|
||||||
|
wield_image = potion_image("#D444D4"),
|
||||||
|
inventory_image = potion_image("#D444D4"),
|
||||||
|
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.weakness_func(user, 3, mcl_potions.DURATION)
|
||||||
|
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
||||||
|
mcl_potions._use_potion(itemstack, user, "#D444D4")
|
||||||
|
return itemstack
|
||||||
|
end,
|
||||||
|
|
||||||
|
on_secondary_use = function(itemstack, user, pointed_thing)
|
||||||
|
mcl_potions.weakness_func(user, 3, mcl_potions.DURATION)
|
||||||
|
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
||||||
|
mcl_potions._use_potion(itemstack, user, "#D444D4")
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craftitem("mcl_potions:strength_2", {
|
||||||
|
description = S("Strength Potion II"),
|
||||||
|
_tt_help = S("+3 hearts per damage | 1:30"),
|
||||||
|
_doc_items_longdesc = brewhelp,
|
||||||
|
wield_image = potion_image("#D444E4"),
|
||||||
|
inventory_image = potion_image("#D444E4"),
|
||||||
|
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.weakness_func(user, 6, mcl_potions.DURATION_2)
|
||||||
|
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
||||||
|
mcl_potions._use_potion(itemstack, user, "#D444E4")
|
||||||
|
return itemstack
|
||||||
|
end,
|
||||||
|
|
||||||
|
on_secondary_use = function(itemstack, user, pointed_thing)
|
||||||
|
mcl_potions.weakness_func(user, 6, mcl_potions.DURATION_2)
|
||||||
|
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
||||||
|
mcl_potions._use_potion(itemstack, user, "#D444E4")
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craftitem("mcl_potions:strength_plus", {
|
||||||
|
description = S("Strength Potion +"),
|
||||||
|
_tt_help = S("1.5 hearts per damage | 8:00"),
|
||||||
|
_doc_items_longdesc = brewhelp,
|
||||||
|
wield_image = potion_image("#D444F4"),
|
||||||
|
inventory_image = potion_image("#D444F4"),
|
||||||
|
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.weakness_func(user, 3, mcl_potions.DURATION_PLUS)
|
||||||
|
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
||||||
|
mcl_potions._use_potion(itemstack, user, "#D444F4")
|
||||||
|
return itemstack
|
||||||
|
end,
|
||||||
|
|
||||||
|
on_secondary_use = function(itemstack, user, pointed_thing)
|
||||||
|
mcl_potions.weakness_func(user, 3, mcl_potions.DURATION_PLUS)
|
||||||
|
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
||||||
|
mcl_potions._use_potion(itemstack, user, "#D444F4")
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
})
|
||||||
|
minetest.register_craftitem("mcl_potions:poison", {
|
||||||
|
description = S("Poison Potion"),
|
||||||
|
_tt_help = S("-1/2 Heart / 2.5sec | 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*mcl_potions.INV_FACTOR)
|
||||||
|
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*mcl_potions.INV_FACTOR)
|
||||||
|
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/2 Heart / 1.2sec | 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*mcl_potions.INV_FACTOR)
|
||||||
|
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*mcl_potions.INV_FACTOR)
|
||||||
|
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/2 Heart / 2.5sec | 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/2 Heart / 2.5sec | 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/2 Heart / 1.2sec | 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/2 Heart / 2.5sec | 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
|
||||||
|
})
|
BIN
mods/ITEMS/mcl_potions/sounds/mcl_potions_breaking_glass.ogg
Executable file
BIN
mods/ITEMS/mcl_potions/sounds/mcl_potions_drinking.ogg
Normal file
231
mods/ITEMS/mcl_potions/splash.lua
Normal file
|
@ -0,0 +1,231 @@
|
||||||
|
local splash_image = function(colorstring, opacity)
|
||||||
|
if not opacity then
|
||||||
|
opacity = 127
|
||||||
|
end
|
||||||
|
return "mcl_potions_splash_overlay.png^[colorize:"..colorstring..":"..tostring(opacity).."^mcl_potions_splash_bottle.png"
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local function register_splash(name, descr, color, def)
|
||||||
|
|
||||||
|
local id = "mcl_potions:"..name.."_splash"
|
||||||
|
minetest.register_craftitem(id, {
|
||||||
|
description = descr,
|
||||||
|
inventory_image = splash_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: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")
|
||||||
|
obj:set_velocity({x=dir.x*velocity,y=dir.y*velocity,z=dir.z*velocity})
|
||||||
|
obj:set_acceleration({x=0, y=-9.8, z=0})
|
||||||
|
if not minetest.settings:get_bool("creative_mode") then
|
||||||
|
item:take_item()
|
||||||
|
end
|
||||||
|
return item
|
||||||
|
end,
|
||||||
|
stack_max = 1,
|
||||||
|
})
|
||||||
|
|
||||||
|
local w = 0.7
|
||||||
|
|
||||||
|
minetest.register_entity(id.."_flying",{
|
||||||
|
textures = {splash_image(color)},
|
||||||
|
hp_max = 1,
|
||||||
|
visual_size = {x=w/2,y=w/2},
|
||||||
|
collisionbox = {0,0,0,0,0,0},
|
||||||
|
on_step = function(self, dtime)
|
||||||
|
local pos = self.object:getpos()
|
||||||
|
local node = minetest.get_node(pos)
|
||||||
|
local n = node.name
|
||||||
|
local d = 2
|
||||||
|
local redux_map = {7/8,0.5,0.25}
|
||||||
|
if n ~= "air" and n ~= "mcl_portals:portal" and n ~= "mcl_portals:portal_end" 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.add_particlespawner({
|
||||||
|
amount = 50,
|
||||||
|
time = 2,
|
||||||
|
minpos = {x=pos.x-d, y=pos.y+0.5, z=pos.z-d},
|
||||||
|
maxpos = {x=pos.x+d, y=pos.y+d, z=pos.z+d},
|
||||||
|
minvel = {x=-1, y=0, z=-1},
|
||||||
|
maxvel = {x=1, y=0.5, z=1},
|
||||||
|
minacc = {x=-0.5, y=0, z=-0.5},
|
||||||
|
maxacc = {x=0.5, y=.2, z=0.5},
|
||||||
|
minexptime = 1,
|
||||||
|
maxexptime = 3,
|
||||||
|
minsize = 2,
|
||||||
|
maxsize = 4,
|
||||||
|
collisiondetection = true,
|
||||||
|
vertical = false,
|
||||||
|
texture = "mcl_potions_sprite.png^[colorize:"..color..":127",
|
||||||
|
})
|
||||||
|
self.object:remove()
|
||||||
|
for _,obj in pairs(minetest.get_objects_inside_radius(pos, 4)) do
|
||||||
|
|
||||||
|
local entity = obj:get_luaentity()
|
||||||
|
if obj:is_player() or entity._cmi_is_mob then
|
||||||
|
|
||||||
|
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))
|
||||||
|
if rad > 0 then def.potion_fun(obj, redux_map[rad]) else def.potion_fun(obj, 1) end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
local splash_DUR = mcl_potions.DURATION*mcl_potions.SPLASH_FACTOR
|
||||||
|
local splash_DUR_2 = mcl_potions.DURATION_2*mcl_potions.SPLASH_FACTOR
|
||||||
|
local splash_DUR_pl = mcl_potions.DURATION_PLUS*mcl_potions.SPLASH_FACTOR
|
||||||
|
|
||||||
|
register_splash("water", "Splash Water", "#0000FF", {
|
||||||
|
potion_fun = function(player, redx) end,
|
||||||
|
})
|
||||||
|
|
||||||
|
register_splash("river_water", "Splash River Water", "#0000FF", {
|
||||||
|
potion_fun = function(player, redx) end,
|
||||||
|
})
|
||||||
|
|
||||||
|
register_splash("awkward", "Splash Awkward Potion", "#0000FF", {
|
||||||
|
potion_fun = function(player, redx) end,
|
||||||
|
})
|
||||||
|
|
||||||
|
register_splash("mundane", "Splash Mundane Potion", "#0000FF", {
|
||||||
|
potion_fun = function(player, redx) end,
|
||||||
|
})
|
||||||
|
|
||||||
|
register_splash("thick", "Splash Thick Potion", "#0000FF", {
|
||||||
|
potion_fun = function(player, redx) end,
|
||||||
|
})
|
||||||
|
|
||||||
|
register_splash("healing", "Splash Healing", "#AA0000", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.healing_func(player, 3*redx) end,
|
||||||
|
})
|
||||||
|
|
||||||
|
register_splash("healing_2", "Splash Healing II", "#DD0000", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.healing_func(player, 6*redx) end,
|
||||||
|
})
|
||||||
|
|
||||||
|
register_splash("harming", "Splash Harming", "#660099", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.healing_func(player, -4*redx) end,
|
||||||
|
})
|
||||||
|
|
||||||
|
register_splash("harming_2", "Splash Harming II", "#330066", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.healing_func(player, -6*redx) end,
|
||||||
|
})
|
||||||
|
|
||||||
|
register_splash("leaping", "Splash Leaping", "#00CC33", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.leaping_func(player, 1.2, splash_DUR*redx) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_splash("leaping_2", "Splash Leaping II", "#00EE33", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.leaping_func(player, 1.4, splash_DUR_2*redx) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_splash("leaping_plus", "Splash Leaping +", "#00DD33", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.leaping_func(player, 1.2, splash_DUR_pl*redx) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_splash("swiftness", "Splash Swiftness", "#009999", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.swiftness_func(player, 1.2, splash_DUR*redx) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_splash("swiftness_2", "Splash Swiftness II", "#00BBBB", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.swiftness_func(player, 1.4, splash_DUR_2*redx) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_splash("swiftness_plus", "Splash Swiftness +", "#00BBBB", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.swiftness_func(player, 1.2, splash_DUR_pl*redx) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_splash("slowness", "Splash Slowness", "#000080", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.swiftness_func(player, 0.85, splash_DUR*mcl_potions.INV_FACTOR*redx) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_splash("slowness_2", "Splash Slowness IV", "#000080", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.swiftness_func(player, 0.4, 20*mcl_potions.SPLASH_FACTOR*redx) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_splash("slowness_plus", "Splash Slowness +", "#000066", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.swiftness_func(player, 0.85, splash_DUR_pl*mcl_potions.INV_FACTOR*redx) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_splash("poison", "Splash Poison", "#335544", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.poison_func(player, 2.5, splash_DUR*mcl_potions.INV_FACTOR*redx) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_splash("poison_2", "Splash Poison II", "#446655", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.poison_func(player, 1.2, splash_DUR_2*mcl_potions.INV_FACTOR*redx) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_splash("poison_plus", "Splash Poison +", "#557766", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.poison_func(player, 2.5, splash_DUR_pl*mcl_potions.INV_FACTOR*redx) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_splash("regeneration", "Splash Regeneration", "#A52BB2", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.regeneration_func(player, 2.5, splash_DUR*mcl_potions.INV_FACTOR*redx) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_splash("regeneration_2", "Splash Regeneration II", "#B52CC2", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.regeneration_func(player, 1.2, (splash_DUR_2*mcl_potions.INV_FACTOR + 1)*redx) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_splash("regeneration_plus", "Splash Regeneration +", "#C53DD3", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.regeneration_func(player, 2.5, splash_DUR_pl*mcl_potions.INV_FACTOR*redx) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_splash("invisibility", "Splash Invisibility", "#B0B0B0", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.invisiblility_func(player, splash_DUR*redx) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_splash("invisibility_plus", "Splash Invisibility +", "#A0A0A0", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.invisiblility_func(player, splash_DUR_pl*redx) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_splash("weakness", "Splash Weakness", "#6600AA", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.weakness_func(player, -4, splash_DUR*mcl_potions.INV_FACTOR*redx) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_splash("weakness_plus", "Splash Weakness +", "#7700BB", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.weakness_func(player, -4, splash_DUR_pl*mcl_potions.INV_FACTOR*redx) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_splash("strength", "Splash Strength", "#D444D4", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.strength_func(player, 3, splash_DUR*redx) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_splash("strength_2", "Splash Strength II", "#D444F4", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.strength_func(player, 6, splash_DUR_2*redx) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_splash("strength_plus", "Splash Strength +", "#D444E4", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.strength_func(player, 3, splash_DUR_pl*redx) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_splash("water_breathing", "Splash Water Breathing", "#0000AA", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.water_breathing_func(player, splash_DUR*redx) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_splash("water_breathing_plus", "Splash Water Breathing +", "#0000CC", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.water_breathing_func(player, splash_DUR_pl*redx) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_splash("fire_resistance", "Splash Fire Resistance", "#D0A040", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.fire_resistance_func(player, splash_DUR*redx) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_splash("fire_resistance_plus", "Splash Fire Resistance +", "#E0B050", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.fire_resistance_func(player, splash_DUR_pl*redx) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_splash("night_vision", "Splash Night Vision", "#1010AA", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.night_vision_func(player, splash_DUR*redx) end
|
||||||
|
})
|
||||||
|
|
||||||
|
register_splash("night_vision_plus", "Splash Night Vision +", "#2020BA", {
|
||||||
|
potion_fun = function(player, redx) mcl_potions.night_vision_func(player, splash_DUR_pl*redx) end
|
||||||
|
})
|
Before Width: | Height: | Size: 214 B After Width: | Height: | Size: 214 B |
Before Width: | Height: | Size: 214 B |
BIN
mods/ITEMS/mcl_potions/textures/mcl_potions_splash_bottle.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
mods/ITEMS/mcl_potions/textures/mcl_potions_splash_overlay.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
mods/ITEMS/mcl_potions/textures/mcl_potions_sprite.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
|
@ -2,9 +2,9 @@
|
||||||
Sprint mod for Minetest by GunshipPenguin
|
Sprint mod for Minetest by GunshipPenguin
|
||||||
|
|
||||||
To the extent possible under law, the author(s)
|
To the extent possible under law, the author(s)
|
||||||
have dedicated all copyright and related and neighboring rights
|
have dedicated all copyright and related and neighboring rights
|
||||||
to this software to the public domain worldwide. This software is
|
to this software to the public domain worldwide. This software is
|
||||||
distributed without any warranty.
|
distributed without any warranty.
|
||||||
]]
|
]]
|
||||||
|
|
||||||
--Configuration variables, these are all explained in README.md
|
--Configuration variables, these are all explained in README.md
|
||||||
|
@ -29,10 +29,11 @@ minetest.register_on_joinplayer(function(player)
|
||||||
|
|
||||||
players[playerName] = {
|
players[playerName] = {
|
||||||
sprinting = false,
|
sprinting = false,
|
||||||
timeOut = 0,
|
timeOut = 0,
|
||||||
shouldSprint = false,
|
shouldSprint = false,
|
||||||
lastPos = player:get_pos(),
|
lastPos = player:get_pos(),
|
||||||
sprintDistance = 0,
|
sprintDistance = 0,
|
||||||
|
fov = 1.0
|
||||||
}
|
}
|
||||||
end)
|
end)
|
||||||
minetest.register_on_leaveplayer(function(player)
|
minetest.register_on_leaveplayer(function(player)
|
||||||
|
@ -43,10 +44,14 @@ end)
|
||||||
local function setSprinting(playerName, sprinting) --Sets the state of a player (0=stopped/moving, 1=sprinting)
|
local function setSprinting(playerName, sprinting) --Sets the state of a player (0=stopped/moving, 1=sprinting)
|
||||||
local player = minetest.get_player_by_name(playerName)
|
local player = minetest.get_player_by_name(playerName)
|
||||||
if players[playerName] then
|
if players[playerName] then
|
||||||
players[playerName]["sprinting"] = sprinting
|
players[playerName].sprinting = sprinting
|
||||||
if sprinting == true then
|
if sprinting == true then
|
||||||
|
players[playerName].fov = math.min(players[playerName].fov + 0.05, 1.2)
|
||||||
|
player:set_fov(players[playerName].fov, true, 0.15)
|
||||||
playerphysics.add_physics_factor(player, "speed", "mcl_sprint:sprint", mcl_sprint.SPEED)
|
playerphysics.add_physics_factor(player, "speed", "mcl_sprint:sprint", mcl_sprint.SPEED)
|
||||||
elseif sprinting == false then
|
elseif sprinting == false then
|
||||||
|
players[playerName].fov = math.max(players[playerName].fov - 0.05, 1.0)
|
||||||
|
player:set_fov(players[playerName].fov, true, 0.15)
|
||||||
playerphysics.remove_physics_factor(player, "speed", "mcl_sprint:sprint")
|
playerphysics.remove_physics_factor(player, "speed", "mcl_sprint:sprint")
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
|
@ -68,7 +73,7 @@ minetest.register_globalstep(function(dtime)
|
||||||
else
|
else
|
||||||
players[playerName]["shouldSprint"] = false
|
players[playerName]["shouldSprint"] = false
|
||||||
end
|
end
|
||||||
|
|
||||||
local playerPos = player:get_pos()
|
local playerPos = player:get_pos()
|
||||||
--If the player is sprinting, create particles behind and cause exhaustion
|
--If the player is sprinting, create particles behind and cause exhaustion
|
||||||
if playerInfo["sprinting"] == true and gameTime % 0.1 == 0 then
|
if playerInfo["sprinting"] == true and gameTime % 0.1 == 0 then
|
||||||
|
@ -117,7 +122,7 @@ minetest.register_globalstep(function(dtime)
|
||||||
elseif players[playerName]["shouldSprint"] == false then
|
elseif players[playerName]["shouldSprint"] == false then
|
||||||
setSprinting(playerName, false)
|
setSprinting(playerName, false)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|