From 6ec9da0fae91145dcf3fcfd3b994bef33e118468 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Tue, 28 Feb 2017 04:53:52 +0100 Subject: [PATCH] Add simple food poisoning to some food items --- mods/ITEMS/mcl_farming/potatoes.lua | 8 +++++--- mods/ITEMS/mcl_fishing/init.lua | 1 + mods/ITEMS/mcl_mobitems/init.lua | 7 +++---- mods/MISC/mcl_wip/init.lua | 2 ++ mods/PLAYER/mcl_hunger/hunger.lua | 13 +++++++++++++ 5 files changed, 24 insertions(+), 7 deletions(-) diff --git a/mods/ITEMS/mcl_farming/potatoes.lua b/mods/ITEMS/mcl_farming/potatoes.lua index 003d6f8806..d8544ba8e8 100644 --- a/mods/ITEMS/mcl_farming/potatoes.lua +++ b/mods/ITEMS/mcl_farming/potatoes.lua @@ -83,9 +83,11 @@ minetest.register_craftitem("mcl_farming:potato_item_poison", { description = "Poisonous Potato", stack_max = 64, inventory_image = "farming_potato_poison.png", - on_place = minetest.item_eat(2), - on_secondary_use = minetest.item_eat(2), - groups = { food = 2, eatable = 2 }, + -- TODO: Cause status effects + -- TODO: Raise to 2 + on_place = minetest.item_eat(0), + on_secondary_use = minetest.item_eat(0), + groups = { food = 2, eatable = 0 }, }) minetest.register_craft({ diff --git a/mods/ITEMS/mcl_fishing/init.lua b/mods/ITEMS/mcl_fishing/init.lua index 9d66ee5e9f..9d475a4210 100644 --- a/mods/ITEMS/mcl_fishing/init.lua +++ b/mods/ITEMS/mcl_fishing/init.lua @@ -187,6 +187,7 @@ minetest.register_craftitem("mcl_fishing:clownfish_raw", { }) -- Pufferfish +-- TODO: Add status effect minetest.register_craftitem("mcl_fishing:pufferfish_raw", { description = "Pufferfish", inventory_image = "mcl_fishing_pufferfish_raw.png", diff --git a/mods/ITEMS/mcl_mobitems/init.lua b/mods/ITEMS/mcl_mobitems/init.lua index 55ddd988dd..27d8490015 100644 --- a/mods/ITEMS/mcl_mobitems/init.lua +++ b/mods/ITEMS/mcl_mobitems/init.lua @@ -4,10 +4,9 @@ minetest.register_craftitem("mcl_mobitems:rotten_flesh", { description = "Rotten Flesh", inventory_image = "mcl_mobitems_rotten_flesh.png", wield_image = "mcl_mobitems_rotten_flesh.png", - -- TODO: Raise to 4 - on_place = minetest.item_eat(1), - on_secondary_use = minetest.item_eat(1), - groups = { food = 2, eatable = 1 }, + on_place = minetest.item_eat(4), + on_secondary_use = minetest.item_eat(4), + groups = { food = 2, eatable = 4 }, stack_max = 64, }) diff --git a/mods/MISC/mcl_wip/init.lua b/mods/MISC/mcl_wip/init.lua index 59e0083ea8..28687ad9fc 100644 --- a/mods/MISC/mcl_wip/init.lua +++ b/mods/MISC/mcl_wip/init.lua @@ -24,12 +24,14 @@ local wip_items = { "mcl_maps:filled_map", "mcl_maps:empty_map", "mcl_mobitems:rotten_flesh", + "mcl_mobitems:spider_eye", "mcl_minecarts:golden_rail", "mcl_sponges:sponge", "mcl_farming:mushroom_red", "mcl_farming:mushroom_brown", "gemalde:node_1", "mcl_observers:observer", + "mcl_farming:potato_item_poison", } for i=1,#wip_items do diff --git a/mods/PLAYER/mcl_hunger/hunger.lua b/mods/PLAYER/mcl_hunger/hunger.lua index 8269af9f77..ce62206fac 100644 --- a/mods/PLAYER/mcl_hunger/hunger.lua +++ b/mods/PLAYER/mcl_hunger/hunger.lua @@ -187,5 +187,18 @@ function mcl_hunger.handle_node_actions(pos, oldnode, player, ext) mcl_hunger.exhaustion[name] = exhaus end +-- Apply simple poison effect as long there are no real status effect +-- TODO: Remove this when status effects are in place +if minetest.get_modpath("mcl_farming") then + mcl_hunger.register_food("mcl_farming:potato_item_poison", 2, "", 3) +end +if minetest.get_modpath("mcl_mobitems") then + mcl_hunger.register_food("mcl_mobitems:rotten_flesh", 4, "", 8) + mcl_hunger.register_food("mcl_mobitems:spider_eye", 2, "", 4) +end +if minetest.get_modpath("mcl_fishing") then + mcl_hunger.register_food("mcl_fishing:pufferfish_raw", 1, "", 60) +end + minetest.register_on_placenode(mcl_hunger.handle_node_actions) minetest.register_on_dignode(mcl_hunger.handle_node_actions)