1
0
Fork 0

Correct issue where all items are replaced with drinking potions in creative

This commit is contained in:
Brandon 2020-06-26 16:55:22 -04:00
parent 1d5a04acb3
commit 4a35ad3fd1
3 changed files with 86 additions and 34 deletions

View File

@ -267,7 +267,6 @@ end
function mcl_potions._use_potion(item, obj, color)
local d = 0.1
local pos = obj:get_pos()
item:replace("mcl_potions:glass_bottle")
minetest.sound_play("mcl_potions_drinking", {pos = pos, max_hear_distance = 6, gain = 1})
minetest.add_particlespawner({
amount = 25,

View File

@ -18,7 +18,6 @@ minetest.register_craftitem("mcl_potions:awkward", {
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"),
@ -32,7 +31,6 @@ minetest.register_craftitem("mcl_potions:mundane", {
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"),
@ -46,7 +44,6 @@ minetest.register_craftitem("mcl_potions:thick", {
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=0 },
on_place = minetest.item_eat(0, "mcl_potions:glass_bottle"),
on_secondary_use = minetest.item_eat(0, "mcl_potions:glass_bottle"),
@ -68,17 +65,19 @@ minetest.register_craftitem("mcl_potions:healing", {
_doc_items_longdesc = brewhelp,
wield_image = potion_image("#CC0000"),
inventory_image = potion_image("#CC0000"),
groups = { brewitem = 1, food=3, can_eat_when_full=1 },
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,
@ -89,17 +88,19 @@ minetest.register_craftitem("mcl_potions:healing_2", {
_doc_items_longdesc = brewhelp,
wield_image = potion_image("#DD0000"),
inventory_image = potion_image("#DD0000"),
groups = { brewitem = 1, food=3, can_eat_when_full=1 },
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,
@ -111,17 +112,19 @@ minetest.register_craftitem("mcl_potions:harming", {
_doc_items_longdesc = brewhelp,
wield_image = potion_image("#660099"),
inventory_image = potion_image("#660099"),
groups = { brewitem = 1, food=3, can_eat_when_full=1 },
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,
@ -132,17 +135,19 @@ minetest.register_craftitem("mcl_potions:harming_2", {
_doc_items_longdesc = brewhelp,
wield_image = potion_image("#330066"),
inventory_image = potion_image("#330066"),
groups = { brewitem = 1, food=3, can_eat_when_full=1 },
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,
@ -154,17 +159,19 @@ minetest.register_craftitem("mcl_potions:night_vision", {
_doc_items_longdesc = brewhelp,
wield_image = potion_image("#1010AA"),
inventory_image = potion_image("#1010AA"),
groups = { brewitem = 1, food=0},
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, 180)
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, 180)
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
mcl_potions._use_potion(itemstack, user, "#1010AA")
return itemstack
end,
@ -175,17 +182,19 @@ minetest.register_craftitem("mcl_potions:night_vision_plus", {
_doc_items_longdesc = brewhelp,
wield_image = potion_image("#2020BA"),
inventory_image = potion_image("#2020BA"),
groups = { brewitem = 1, food=0},
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, 480)
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, 480)
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
mcl_potions._use_potion(itemstack, user, "#2020BA")
return itemstack
end,
@ -197,17 +206,19 @@ minetest.register_craftitem("mcl_potions:swiftness", {
_doc_items_longdesc = brewhelp,
wield_image = potion_image("#009999"),
inventory_image = potion_image("#009999"),
groups = { brewitem = 1, food=0},
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, 180)
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, 180)
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
mcl_potions._use_potion(itemstack, user, "#009999")
return itemstack
end,
@ -218,17 +229,19 @@ minetest.register_craftitem("mcl_potions:swiftness_2", {
_doc_items_longdesc = brewhelp,
wield_image = potion_image("#00BBBB"),
inventory_image = potion_image("#00BBBB"),
groups = { brewitem = 1, food=0},
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, 90)
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, 90)
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
mcl_potions._use_potion(itemstack, user, "#00BBBB")
return itemstack
end,
@ -239,17 +252,19 @@ minetest.register_craftitem("mcl_potions:swiftness_plus", {
_doc_items_longdesc = brewhelp,
wield_image = potion_image("#00AAAA"),
inventory_image = potion_image("#00AAAA"),
groups = { brewitem = 1, food=0},
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, 480)
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, 480)
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
mcl_potions._use_potion(itemstack, user, "#00AAAA")
return itemstack
end,
@ -260,17 +275,19 @@ minetest.register_craftitem("mcl_potions:slowness", {
_doc_items_longdesc = brewhelp,
wield_image = potion_image("#000080"),
inventory_image = potion_image("#000080"),
groups = { brewitem = 1, food=0},
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, 90)
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, 90)
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
mcl_potions._use_potion(itemstack, user, "#000080")
return itemstack
end,
@ -281,17 +298,19 @@ minetest.register_craftitem("mcl_potions:slowness_plus", {
_doc_items_longdesc = brewhelp,
wield_image = potion_image("#000066"),
inventory_image = potion_image("#000066"),
groups = { brewitem = 1, food=0},
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, 240)
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, 240)
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
mcl_potions._use_potion(itemstack, user, "#000066")
return itemstack
end,
@ -303,17 +322,19 @@ minetest.register_craftitem("mcl_potions:leaping", {
_doc_items_longdesc = brewhelp,
wield_image = potion_image("#00CC33"),
inventory_image = potion_image("#00CC33"),
groups = { brewitem = 1, food=0},
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.2, 180)
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.2, 180)
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
mcl_potions._use_potion(itemstack, user, "#00CC33")
return itemstack
end,
@ -324,17 +345,19 @@ minetest.register_craftitem("mcl_potions:leaping_2", {
_doc_items_longdesc = brewhelp,
wield_image = potion_image("#00EE33"),
inventory_image = potion_image("#00EE33"),
groups = { brewitem = 1, food=0},
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.4, 90)
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, 1.4, 90)
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
mcl_potions._use_potion(itemstack, user, "#00EE33")
return itemstack
end,
@ -345,17 +368,19 @@ minetest.register_craftitem("mcl_potions:leaping_plus", {
_doc_items_longdesc = brewhelp,
wield_image = potion_image("#00DD33"),
inventory_image = potion_image("#00DD33"),
groups = { brewitem = 1, food=0},
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.2, 480)
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.2, 480)
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
mcl_potions._use_potion(itemstack, user, "#00DD33")
return itemstack
end,
@ -367,17 +392,19 @@ minetest.register_craftitem("mcl_potions:weakness", {
_doc_items_longdesc = brewhelp,
wield_image = potion_image("#6600AA"),
inventory_image = potion_image("#6600AA"),
groups = { brewitem = 1, food=0},
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, 1.2, 90)
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, 1.2, 90)
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
mcl_potions._use_potion(itemstack, user, "#6600AA")
return itemstack
end
@ -388,17 +415,19 @@ minetest.register_craftitem("mcl_potions:weakness_plus", {
_doc_items_longdesc = brewhelp,
wield_image = potion_image("#7700BB"),
inventory_image = potion_image("#7700BB"),
groups = { brewitem = 1, food=0},
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, 1.4, 240)
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, 1.4, 240)
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
mcl_potions._use_potion(itemstack, user, "#7700BB")
return itemstack
end
@ -410,17 +439,19 @@ minetest.register_craftitem("mcl_potions:poison", {
_doc_items_longdesc = brewhelp,
wield_image = potion_image("#225533"),
inventory_image = potion_image("#225533"),
groups = { brewitem = 1, food = 0 },
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, 45)
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, 45)
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
mcl_potions._use_potion(itemstack, user, "#225533")
return itemstack
end
@ -431,17 +462,19 @@ minetest.register_craftitem("mcl_potions:poison_2", {
_doc_items_longdesc = brewhelp,
wield_image = potion_image("#447755"),
inventory_image = potion_image("#447755"),
groups = { brewitem = 1, food = 0 },
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, 21)
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, 21)
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
mcl_potions._use_potion(itemstack, user, "#447755")
return itemstack
end
@ -452,17 +485,19 @@ minetest.register_craftitem("mcl_potions:poison_plus", {
_doc_items_longdesc = brewhelp,
wield_image = potion_image("#336644"),
inventory_image = potion_image("#336644"),
groups = { brewitem = 1, food = 0 },
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, 90)
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, 90)
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
mcl_potions._use_potion(itemstack, user, "#336644")
return itemstack
end
@ -474,17 +509,19 @@ minetest.register_craftitem("mcl_potions:regeneration", {
_doc_items_longdesc = brewhelp,
wield_image = potion_image("#A52BB2"),
inventory_image = potion_image("#A52BB2"),
groups = { brewitem = 1, food = 0 },
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, 45)
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, 45)
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
mcl_potions._use_potion(itemstack, user, "#A52BB2")
return itemstack
end
@ -495,17 +532,19 @@ minetest.register_craftitem("mcl_potions:regeneration_2", {
_doc_items_longdesc = brewhelp,
wield_image = potion_image("#B52CC2"),
inventory_image = potion_image("#B52CC2"),
groups = { brewitem = 1, food = 0 },
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, 22)
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, 22)
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
mcl_potions._use_potion(itemstack, user, "#B52CC2")
return itemstack
end
@ -516,17 +555,19 @@ minetest.register_craftitem("mcl_potions:regeneration_plus", {
_doc_items_longdesc = brewhelp,
wield_image = potion_image("#C53DD3"),
inventory_image = potion_image("#C53DD3"),
groups = { brewitem = 1, food = 0 },
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, 90)
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, 90)
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
mcl_potions._use_potion(itemstack, user, "#C53DD3")
return itemstack
end
@ -538,17 +579,19 @@ minetest.register_craftitem("mcl_potions:invisibility", {
_doc_items_longdesc = brewhelp,
wield_image = potion_image("#B0B0B0"),
inventory_image = potion_image("#B0B0B0"),
groups = { brewitem = 1, food = 0 },
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, 180)
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, 180)
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
mcl_potions._use_potion(itemstack, user, "#B0B0B0")
return itemstack
end
@ -559,17 +602,19 @@ minetest.register_craftitem("mcl_potions:invisibility_plus", {
_doc_items_longdesc = brewhelp,
wield_image = potion_image("#A0A0A0"),
inventory_image = potion_image("#A0A0A0"),
groups = { brewitem = 1, food = 0 },
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, 480)
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, 480)
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
mcl_potions._use_potion(itemstack, user, "#A0A0A0")
return itemstack
end
@ -588,17 +633,19 @@ minetest.register_craftitem("mcl_potions:water_breathing", {
_doc_items_longdesc = brewhelp,
wield_image = potion_image("#0000AA"),
inventory_image = potion_image("#0000AA"),
groups = { brewitem = 1, food = 0 },
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, 180)
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, 180)
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
mcl_potions._use_potion(itemstack, user, "#0000AA")
return itemstack
end
@ -609,17 +656,19 @@ minetest.register_craftitem("mcl_potions:water_breathing_plus", {
_doc_items_longdesc = brewhelp,
wield_image = potion_image("#0000CC"),
inventory_image = potion_image("#0000CC"),
groups = { brewitem = 1, food = 0 },
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, 480)
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, 480)
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
mcl_potions._use_potion(itemstack, user, "#0000CC")
return itemstack
end
@ -631,17 +680,19 @@ minetest.register_craftitem("mcl_potions:fire_resistance", {
_doc_items_longdesc = brewhelp,
wield_image = potion_image("#D0A040"),
inventory_image = potion_image("#D0A040"),
groups = { brewitem = 1, food = 0 },
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, 180)
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, 180)
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
mcl_potions._use_potion(itemstack, user, "#D0A040")
return itemstack
end
@ -652,17 +703,19 @@ minetest.register_craftitem("mcl_potions:fire_resistance_plus", {
_doc_items_longdesc = brewhelp,
wield_image = potion_image("#E0B050"),
inventory_image = potion_image("#E0B050"),
groups = { brewitem = 1, food = 0 },
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, 480)
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, 480)
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
mcl_potions._use_potion(itemstack, user, "#E0B050")
return itemstack
end

View File

@ -46,11 +46,11 @@ local function setSprinting(playerName, sprinting) --Sets the state of a player
if players[playerName] then
players[playerName].sprinting = sprinting
if sprinting == true then
players[playerName].fov = math.min(players[playerName].fov + 0.03, 1.2)
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)
elseif sprinting == false then
players[playerName].fov = math.max(players[playerName].fov - 0.03, 1.0)
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")
end