1
0
Fork 0

Gold apples give the player effects; Added Enchanted Golden Apples (Swiftnes & Leaping instead of Absorbtion and Resistance)

This commit is contained in:
Lizzy Fleckenstein 2021-01-22 19:08:01 +01:00
parent b6aabfc853
commit a92273b930
2 changed files with 31 additions and 6 deletions

View File

@ -144,17 +144,41 @@ minetest.register_craftitem("mcl_core:apple", {
_mcl_saturation = 2.4,
})
-- TODO: Status effects
local gapple_hunger_restore = minetest.item_eat(4)
local function eat_gapple(itemstack, placer, pointed_thing)
local regen_duration, absorbtion_factor = 5, 1
if itemstack:get_name() == "mcl_core:apple_gold_enchanted" then
regen_duration, absorbtion_factor = 20, 4
mcl_potions.fire_resistance_func(placer, 1, 300)
mcl_potions.leaping_func(placer, 1, 300)
end
mcl_potions.swiftness_func(placer, absorbtion_factor, 120) -- TODO: Absorbtion
mcl_potions.regeneration_func(placer, 2, regen_duration)
return gapple_hunger_restore(itemstack, placer, pointed_thing)
end
minetest.register_craftitem("mcl_core:apple_gold", {
-- TODO: Add special highlight color when this item is special
-- TODO: Add special highlight color
description = S("Golden Apple"),
_doc_items_longdesc = S("Golden apples are precious food items which can be eaten."),
wield_image = "mcl_core_apple_golden.png",
inventory_image = "mcl_core_apple_golden.png",
stack_max = 64,
-- TODO: Reduce to 4 when it's ready
on_place = minetest.item_eat(20),
on_secondary_use = minetest.item_eat(20),
groups = { food = 2, eatable = 20, can_eat_when_full = 1 },
on_place = eat_gapple,
on_secondary_use = eat_gapple,
groups = { food = 2, eatable = 4, can_eat_when_full = 1 },
_mcl_saturation = 9.6,
})
minetest.register_craftitem("mcl_core:apple_gold_enchanted", {
description = S("Enchanted Golden Apple"),
_doc_items_longdesc = S("Golden apples are precious food items which can be eaten."),
wield_image = "mcl_core_apple_golden.png" .. mcl_enchanting.overlay,
inventory_image = "mcl_core_apple_golden.png" .. mcl_enchanting.overlay,
stack_max = 64,
on_place = eat_gapple,
on_secondary_use = eat_gapple,
groups = { food = 2, eatable = 4, can_eat_when_full = 1 },
_mcl_saturation = 9.6,
})

View File

@ -5,3 +5,4 @@ mcl_util
mcl_worlds
doc_items
doc?
mcl_enchanting