forked from NathanSalapat/minetest-thirsty
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Supports hbhunger Supports hunger_ng Code Change to make non-MTG use easier Addition of drinking sound Farming Redo Support Added Mobs_Animal Support Added Ethereal Support Added New Thirst Icon New Canteen Icon New Bowl icon
- Loading branch information
1 parent
debe438
commit 4bae22e
Showing
28 changed files
with
281 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
------------------------------------------------------------ | ||
-- _____ _ _ _ -- | ||
-- |_ _| |_ (_)_ _ __| |_ _ _ -- | ||
-- | | | ' \| | '_(_-< _| || | -- | ||
-- |_| |_||_|_|_| /__/\__|\_, | -- | ||
-- |__/ -- | ||
------------------------------------------------------------ | ||
-- Thirsty mod [interoperability function] -- | ||
------------------------------------------------------------ | ||
-- because I'm lazy and like small code blocks -- | ||
------------------------------------------------------------ | ||
|
||
thirsty.register_hb_hng_drink = function (item_name,satiate_value,heal_value,hyd_value,hyd_max,rtn_item_name) | ||
|
||
local is_hunger_ng = false | ||
local is_hbhunger = false | ||
if minetest.get_modpath("hunger_ng") then is_hunger_ng = true end | ||
if minetest.get_modpath("hbhunger") then is_hbhunger = true end | ||
|
||
if is_hunger_ng then | ||
hunger_ng.add_hunger_data(item_name,{ | ||
satiates = satiate_value, | ||
heals = heal_value, | ||
returns = nil, | ||
timeout = nil | ||
}) | ||
end | ||
|
||
if is_hbhunger then | ||
hbhunger.register_food(item_name, satiate_value) | ||
end | ||
|
||
local def = table.copy(minetest.registered_items[item_name]) | ||
def.on_use = function(itemstack,player,pointed_thing) | ||
|
||
thirsty.drink(player,hyd_value,hyd_max,rtn_item_name) | ||
|
||
if minetest.registered_items[item_name]._hunger_ng then | ||
hunger_ng.alter_hunger(player:get_player_name(), satiate_value, "from:thirsty-"..item_name) | ||
player:set_hp(player:get_hp()+heal_value) | ||
itemstack:take_item() | ||
return itemstack | ||
else | ||
minetest.do_item_eat(satiate_value,nil, itemstack:take_item(), player, pointed_thing) | ||
return itemstack | ||
end | ||
|
||
end | ||
|
||
if def.type == "node" then | ||
minetest.register_node(":"..item_name, def) | ||
else | ||
minetest.register_craftitem(":"..item_name, def) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
------------------------------------------------------------ | ||
-- _____ _ _ _ -- | ||
-- |_ _| |_ (_)_ _ __| |_ _ _ -- | ||
-- | | | ' \| | '_(_-< _| || | -- | ||
-- |_| |_||_|_|_| /__/\__|\_, | -- | ||
-- |__/ -- | ||
------------------------------------------------------------ | ||
-- Thirsty mod [interop_ethereal] -- | ||
------------------------------------------------------------ | ||
-- Settings to support Ethereal -- | ||
------------------------------------------------------------ | ||
|
||
local E = thirsty.ext_nodes_items | ||
---------------------------- | ||
-- Hydrate and Food Items -- | ||
---------------------------- | ||
thirsty.register_hb_hng_drink("ethereal:firethorn_jelly" ,1,0,1,20,E.glass_bottle) | ||
thirsty.register_hb_hng_drink("ethereal:mushroom_soup" ,2.5,0,2,20,ethereal:bowl) | ||
thirsty.register_hb_hng_drink("ethereal:hearty_stew" ,7.0,0,1,20,ethereal:bowl) | ||
thirsty.register_hb_hng_drink("ethereal:golden_apple" ,10,10,10,30,nil) |
Oops, something went wrong.