Clean up poisonous foods

This commit is contained in:
Wuzzy 2020-08-13 19:20:52 +02:00
parent 152d69f91f
commit eff6c4c476
4 changed files with 26 additions and 18 deletions

View File

@ -122,7 +122,6 @@ minetest.register_craftitem("mcl_farming:potato_item_poison", {
_doc_items_longdesc = S("This potato doesn't look too healthy. You can eat it to restore hunger points, but there's a 60% chance it will poison you briefly."), _doc_items_longdesc = S("This potato doesn't look too healthy. You can eat it to restore hunger points, but there's a 60% chance it will poison you briefly."),
stack_max = 64, stack_max = 64,
inventory_image = "farming_potato_poison.png", inventory_image = "farming_potato_poison.png",
-- TODO: Cause status effects
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 },
@ -138,4 +137,13 @@ minetest.register_craft({
mcl_farming:add_plant("plant_potato", "mcl_farming:potato", {"mcl_farming:potato_1", "mcl_farming:potato_2", "mcl_farming:potato_3", "mcl_farming:potato_4", "mcl_farming:potato_5", "mcl_farming:potato_6", "mcl_farming:potato_7"}, 19.75, 20) mcl_farming:add_plant("plant_potato", "mcl_farming:potato", {"mcl_farming:potato_1", "mcl_farming:potato_2", "mcl_farming:potato_3", "mcl_farming:potato_4", "mcl_farming:potato_5", "mcl_farming:potato_6", "mcl_farming:potato_7"}, 19.75, 20)
minetest.register_on_item_eat(function (hp_change, replace_with_item, itemstack, user, pointed_thing)
-- 60% chance of poisoning with poisonous potato
if itemstack:get_name() == "mcl_farming:potato_item_poison" then
if math.random(1,10) >= 6 then
mcl_potions.poison_func(user, 1, 5)
end
end
end )

View File

@ -434,7 +434,7 @@ minetest.register_craftitem("mcl_fishing:pufferfish_raw", {
minetest.register_on_item_eat(function (hp_change, replace_with_item, itemstack, user, pointed_thing) minetest.register_on_item_eat(function (hp_change, replace_with_item, itemstack, user, pointed_thing)
if itemstack:get_name() == "mcl_fishing:pufferfish_raw" then if itemstack:get_name() == "mcl_fishing:pufferfish_raw" then
mcl_potions.poison_func(user, 1.25, 7) mcl_potions.poison_func(user, 1/3, 60)
end end
end ) end )

View File

@ -1,5 +1,3 @@
-- TODO: Add special status effects for raw flesh
local S = minetest.get_translator("mcl_mobitems") local S = minetest.get_translator("mcl_mobitems")
minetest.register_craftitem("mcl_mobitems:rotten_flesh", { minetest.register_craftitem("mcl_mobitems:rotten_flesh", {
@ -136,6 +134,7 @@ minetest.register_craftitem("mcl_mobitems:cooked_rabbit", {
stack_max = 64, stack_max = 64,
}) })
-- Reset food poisoning and status effects
local drink_milk = function(itemstack, player, pointed_thing) local drink_milk = function(itemstack, player, pointed_thing)
local bucket = minetest.do_item_eat(0, "mcl_buckets:bucket_empty", itemstack, player, pointed_thing) local bucket = minetest.do_item_eat(0, "mcl_buckets:bucket_empty", itemstack, player, pointed_thing)
-- Check if we were allowed to drink this (eat delay check) -- Check if we were allowed to drink this (eat delay check)
@ -146,7 +145,6 @@ local drink_milk = function(itemstack, player, pointed_thing)
return bucket return bucket
end end
-- TODO: Clear *all* status effects
minetest.register_craftitem("mcl_mobitems:milk_bucket", { minetest.register_craftitem("mcl_mobitems:milk_bucket", {
description = S("Milk"), description = S("Milk"),
_tt_help = minetest.colorize("#00FF00", S("Cures poison and removes all potion effects")), _tt_help = minetest.colorize("#00FF00", S("Cures poison and removes all potion effects")),
@ -154,7 +152,6 @@ minetest.register_craftitem("mcl_mobitems:milk_bucket", {
_doc_items_usagehelp = "Rightclick to drink the milk.", _doc_items_usagehelp = "Rightclick to drink the milk.",
inventory_image = "mcl_mobitems_bucket_milk.png", inventory_image = "mcl_mobitems_bucket_milk.png",
wield_image = "mcl_mobitems_bucket_milk.png", wield_image = "mcl_mobitems_bucket_milk.png",
-- Clear poisoning when used
on_place = drink_milk, on_place = drink_milk,
on_secondary_use = drink_milk, on_secondary_use = drink_milk,
stack_max = 1, stack_max = 1,
@ -223,8 +220,7 @@ minetest.register_craftitem("mcl_mobitems:ghast_tear", {
_doc_items_longdesc = S("Place this item in an item frame as decoration."), _doc_items_longdesc = S("Place this item in an item frame as decoration."),
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 groups = { brewitem = 1 },
groups = { brewitem = 1, not_in_creative_inventory = 0 },
stack_max = 64, stack_max = 64,
}) })
@ -270,8 +266,7 @@ minetest.register_craftitem("mcl_mobitems:rabbit_foot", {
_doc_items_longdesc = S("Must be your lucky day! Place this item in an item frame for decoration."), _doc_items_longdesc = S("Must be your lucky day! Place this item in an item frame for decoration."),
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 groups = { brewitem = 1 },
groups = { brewitem = 1, not_in_creative_inventory = 0 },
stack_max = 64, stack_max = 64,
}) })
@ -440,3 +435,12 @@ 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",}},
}) })
minetest.register_on_item_eat(function (hp_change, replace_with_item, itemstack, user, pointed_thing)
-- poisoning with spider eye
if itemstack:get_name() == "mcl_mobitems:spider_eye" then
mcl_potions.poison_func(user, 1, 4)
end
end )

View File

@ -1,11 +1,7 @@
-- Apply simple poison effect as long there are no real status effect -- Apply food poisoning effect as long there are no real status effect.
-- TODO: Remove this when status effects are in place -- TODO: Remove this when food poisoning a status effect in mcl_potions.
-- TODO: Consider moving these to the respective mods -- Normal poison damage is set to 0 because it's handled elsewhere.
mcl_hunger.register_food("mcl_farming:potato_item_poison", 2, "", 4, 1, 0, 60)
mcl_hunger.register_food("mcl_mobitems:rotten_flesh", 4, "", 30, 0, 100, 80) mcl_hunger.register_food("mcl_mobitems:rotten_flesh", 4, "", 30, 0, 100, 80)
mcl_hunger.register_food("mcl_mobitems:chicken", 2, "", 30, 0, 100, 30) mcl_hunger.register_food("mcl_mobitems:chicken", 2, "", 30, 0, 100, 30)
mcl_hunger.register_food("mcl_mobitems:spider_eye", 2, "", 4, 1, 0) mcl_hunger.register_food("mcl_fishing:pufferfish_raw", 1, "", 15, 0, 300)
-- mcl_hunger.register_food("mcl_fishing:pufferfish_raw", 1, "", 60, 1, 300)