[Modpack] "Better HUD" and "hunger" [2.x.1] [hud][hunger]

User avatar
Nathan.S
Member
 
Posts: 679
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21

Re: [Mod] Better HUD (and hunger) [1.4] [hud]

by Nathan.S » Sat Oct 11, 2014 16:48

I'm trying to add support for sapier's Animals Modpack, I've added this code
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
if minetest.get_modpath("animals_modpack") ~= nil then
overwrite("cooking:meat_beef_cooked", 5)
end

but I get no health when I eat cooked beef. Looking at the minetest log I know the cooking:meet_beef_cooked is the correct name of the string for the cooked beef, so I'm not sure what I'm doing wrong. Could it be that I can't do the modpack, but have to do each mod individually instead?
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website.
 

Sol
Member
 
Posts: 73
Joined: Thu Jul 31, 2014 05:21
In-game: sol

Re: [Mod] Better HUD (and hunger) [1.4] [hud]

by Sol » Sat Oct 11, 2014 16:57

Yeah, try minetest.get_modpath("cooking")
I doubt that this method works for modpacks.
There is no such thing as duty. If you know that a thing is right, you want to do it. If you don't want to do it—it isn't right. If it's right and you don't want to do it—you don't know what right is and you're not a man. -- Ayn Rand
 

User avatar
Nathan.S
Member
 
Posts: 679
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21

Re: [Mod] Better HUD (and hunger) [1.4] [hud]

by Nathan.S » Sat Oct 11, 2014 17:04

Sol wrote:Yeah, try minetest.get_modpath("cooking")
I doubt that this method works for modpacks.


Thanks so much, that worked.
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website.
 

User avatar
BlockMen
Member
 
Posts: 768
Joined: Fri Mar 01, 2013 17:24
GitHub: BlockMen

Re: [Mod] Better HUD (and hunger) [1.4] [hud]

by BlockMen » Sun Oct 12, 2014 20:36

Sol wrote:Just for your information, the new system with on_dig callback causes unnaturally fast hunger loss while actively digging nodes with the dig_up function. I fixed this by replacing dig_up with a custom drop_up function, though.

What do you mean with "drop_up" function?

Nathan.S wrote:I'm trying to add support for sapier's Animals Modpack
-snip-


Feel free to make a pull request :)
 

User avatar
Nathan.S
Member
 
Posts: 679
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21

Re: [Mod] Better HUD (and hunger) [1.4] [hud]

by Nathan.S » Sun Oct 12, 2014 21:47

There should be a pull request, unless I've done something wrong. I've very new at GIT, been using it less than a week. If it's not there, this is the code I added.

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
 if minetest.get_modpath("cooking") ~= nil then
- overwrite("cooking:meat_beef_cooked", 5)
+ overwrite("cooking:meat_beef_cooked", 4)
+ overwrite("cooking:fish_bluewhite_cooked", 3)
+ overwrite("cooking:fish_clownfish_cooked", 1)
+ overwrite("cooking:meat_chicken_cooked", 2)
+ overwrite("cooking:meat_cooked", 2)
+ overwrite("cooking:meat_pork_cooked", 3)
+ overwrite("cooking:meat_toxic_cooked", -3)
+ overwrite("cooking:meat_venison_cooked", 3)
+ overwrite("cooking:meat_undead_cooked", 1)
end
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website.
 

Sol
Member
 
Posts: 73
Joined: Thu Jul 31, 2014 05:21
In-game: sol

Re: [Mod] Better HUD (and hunger) [1.4] [hud]

by Sol » Mon Oct 13, 2014 04:23

BlockMen wrote:What do you mean with "drop_up" function?

Well, instead of making unrealistic digging all the way up, it drops every node above as an item.
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
function drop_up( pos, node )
   local np, nn
   for i=1,25 do
      local np = {x = pos.x, y = pos.y + i, z = pos.z}
      local nn = core.get_node(np)
      if nn.name == node.name then
         core.remove_node(np)
         core.add_item( np, node.name )
      else
         return false
      end
   end
end
There is no such thing as duty. If you know that a thing is right, you want to do it. If you don't want to do it—it isn't right. If it's right and you don't want to do it—you don't know what right is and you're not a man. -- Ayn Rand
 

User avatar
BlockMen
Member
 
Posts: 768
Joined: Fri Mar 01, 2013 17:24
GitHub: BlockMen

Re: [Mod] Better HUD (and hunger) [1.4] [hud]

by BlockMen » Mon Oct 13, 2014 06:46

Nathan.S wrote:There should be a pull request, unless I've done something wrong. I've very new at GIT, been using it less than a week. If it's not there, this is the code I added.

Oh, had not looked at repository. Yes, is merged ;)

Sol wrote:Well, instead of making unrealistic digging all the way up, it drops every node above as an item.
#code

Ehm...and how is dropping each node above as item related to hunger and this mod? I don't get your point. Are you sure you are in the right topic?
 

Sol
Member
 
Posts: 73
Joined: Thu Jul 31, 2014 05:21
In-game: sol

Re: [Mod] Better HUD (and hunger) [1.4] [hud]

by Sol » Mon Oct 13, 2014 07:20

BlockMen wrote:Are you sure you are in the right topic?

Yes, I am. When you dig a node that calls default.dig_up
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
register_on_dignode(hud.handle_node_actions)
called multiple times making player exhaust really fast. And that in my opinion is not supposed to happen.
I'm not saying this mod is to blame, I'm just pointing out a problem. (:
There is no such thing as duty. If you know that a thing is right, you want to do it. If you don't want to do it—it isn't right. If it's right and you don't want to do it—you don't know what right is and you're not a man. -- Ayn Rand
 

MTDad
Member
 
Posts: 53
Joined: Fri Aug 29, 2014 05:38

Re: [Mod] Better HUD (and hunger) [1.4] [hud]

by MTDad » Mon Oct 13, 2014 15:53

Sol wrote:
BlockMen wrote:Are you sure you are in the right topic?

Yes, I am. When you dig a node that calls default.dig_up
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
register_on_dignode(hud.handle_node_actions)
called multiple times making player exhaust really fast. And that in my opinion is not supposed to happen.
I'm not saying this mod is to blame, I'm just pointing out a problem. (:


aahh, I had to study up on dig_up to see your point, but I for one would disagree. Even though dig_up gives you a time spent short-cut on harvesting, you still need to spend the calories to process that many nodes. If I understand it correctly the same hunger will result from taking 4 nodes of papyrus or whatever, from the bottom as from the top.
 

User avatar
LodeRunner
Member
 
Posts: 25
Joined: Mon Nov 17, 2014 03:14

Re: [Mod] Better HUD (and hunger) [1.4] [hud]

by LodeRunner » Mon Nov 17, 2014 04:22

Is there a way to combine this mod with the "playertools" mod, thereby allowing the HUD to display a greater number of hotbar cells? The "playertools" mod can create the additional slots on-screen, but they don't line up with the graphical squares on the HUD and it looks really nasty and is hard to follow.

Any thoughts on this?
LodeRunner
Wait...didn't I just explore this cavern?
 

mgl
Member
 
Posts: 35
Joined: Wed Sep 10, 2014 16:13
GitHub: mgl512

Re: [Mod] Better HUD (and hunger) [1.4] [hud]

by mgl » Tue Dec 02, 2014 17:08

Submitted a pull request on GitHub to add support for Ferns (of plantlife_modpack), Mobs Redo and update Farming Redo.
 

User avatar
Napiophelios
Member
 
Posts: 752
Joined: Mon Jul 07, 2014 01:14
GitHub: Napiophelios
IRC: Nappi
In-game: Nappi

Re: [Mod] Better HUD (and hunger) [1.4] [hud]

by Napiophelios » Thu Dec 04, 2014 03:08

LodeRunner wrote:Is there a way to combine this mod with the "playertools" mod, thereby allowing the HUD to display a greater number of hotbar cells? The "playertools" mod can create the additional slots on-screen, but they don't line up with the graphical squares on the HUD and it looks really nasty and is hard to follow.

Any thoughts on this?


There was another topic somewhere this was discussed ( I cant find it though )

The easiest solution is to edit the Hud_hotbar texture in the mod/textures folder

If you switch the amount of cells/slots alot between different games
you might have to write your own mod.

I have been experimenting with one but I cant get the "cells" to line up and it looks horrible
 

User avatar
LodeRunner
Member
 
Posts: 25
Joined: Mon Nov 17, 2014 03:14

Re: [Mod] Better HUD (and hunger) [1.4] [hud]

by LodeRunner » Thu Dec 04, 2014 05:57

Napiophelios,

Yeah, I've been trying to decide if it's worth it to modify the texture. I could probably program some lua code to check for a minetest.conf reference...I just don't know if I want to spend the time right now. Pretty busy.

If I commit to doing something, I post it up if it's worthy of sharing.
LodeRunner
Wait...didn't I just explore this cavern?
 

User avatar
LodeRunner
Member
 
Posts: 25
Joined: Mon Nov 17, 2014 03:14

Re: [Mod] Better HUD (and hunger) [1.4] [hud]

by LodeRunner » Tue Dec 09, 2014 02:17

Napiophelios (and others),

I tried altering the texture in GIMP and that was a snap. I then tweaked the hud init.lua so that I could have a reference to the .png file at the top of the code (rather than having to search for it). That worked OK also.

However, if you use unified_inventory (or inventory_plus probably, but I didnt' check that), the 9th, 10th, etc. slot doesn't appear in the menus. You only get 8 hotbar slots on your menus, therefore you cannot utilize any additional slots effectively.

This being the case, a current user would either have to:

1) modify the code for whichever inventory manager mod you use (sounds involved), or
2) switch to using the Crafting mod from BlockMen (which has 9 slots, but involves some caveats of its own).

Since I don't have the time right now and I'm already tweaking some other mods, I'll stick with the default 8 hotbar slots unless someone with more time and ambition want to tackle this project. ;-)
LodeRunner
Wait...didn't I just explore this cavern?
 

User avatar
Napiophelios
Member
 
Posts: 752
Joined: Mon Jul 07, 2014 01:14
GitHub: Napiophelios
IRC: Nappi
In-game: Nappi

Re: [Mod] Better HUD (and hunger) [1.4] [hud]

by Napiophelios » Tue Dec 09, 2014 03:11

Anything after 8 is just the next row in your inventory.

Adding hotbar slots isnt supposed to increase your inventory size
(if I understand what you are saying correctly)

it just increases the amount of items you have access to without having to open the inventory.
 

User avatar
LodeRunner
Member
 
Posts: 25
Joined: Mon Nov 17, 2014 03:14

Re: [Mod] Better HUD (and hunger) [1.4] [hud]

by LodeRunner » Tue Dec 09, 2014 04:57

N,

Hmmm...I hadn't noticed this when I did my testing. I may have to backtrack and try a few things.

Thanks for the tip. I'll see what happens.
LodeRunner
Wait...didn't I just explore this cavern?
 

varnayskiy
New member
 
Posts: 5
Joined: Tue Jun 24, 2014 15:13

Re: [Mod] Better HUD (and hunger) [1.4] [hud]

by varnayskiy » Wed Dec 31, 2014 10:50

What's about HUD_HUNGER_EXHAUST_MOVE*2 on jump event?
function hud.handle_node_actions(pos, oldnode, player, ext)

And what ext stands for? Can't understand from where it's value passed to handle_node_actions()?
Thanks in advance.
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: [Mod] Better HUD (and hunger) [1.4] [hud]

by rubenwardy » Wed Dec 31, 2014 11:15

Are you aware of minetest.register_on_item_eat? You can override the default eat action.
 

User avatar
TenPlus1
Member
 
Posts: 1874
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Better HUD (and hunger) [1.4] [hud]

by TenPlus1 » Wed Dec 31, 2014 15:26

ruberwardy: the hunger.lua file has an overwrite function that replaces the default eat/heart feature and adds healing as well as additional features like hunger and poison...
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: [Mod] Better HUD (and hunger) [1.4] [hud]

by rubenwardy » Wed Dec 31, 2014 15:58

I am aware of that TenPlus, but using the register_on_item_eat will stop you having to have a list of foods. There are very little poisons supported, these could be handled in the override way rather than overriding every food.
 

User avatar
TenPlus1
Member
 
Posts: 1874
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Better HUD (and hunger) [1.4] [hud]

by TenPlus1 » Wed Dec 31, 2014 17:28

The register_on_item_eat adds a callback AFTER the item has been eaten so the hunger.lua still needs to override the initial values for each food item supported otherwise you eat say an apple and it will add 2 hearts instead of 2 hunger...
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: [Mod] Better HUD (and hunger) [1.4] [hud]

by rubenwardy » Wed Dec 31, 2014 17:41

TenPlus1 wrote:The register_on_item_eat adds a callback AFTER the item has been eaten so the hunger.lua still needs to override the initial values for each food item supported otherwise you eat say an apple and it will add 2 hearts instead of 2 hunger...


You are mistaken. I wrote that callback. You can return non-nil to cancel the default action.
 

User avatar
TenPlus1
Member
 
Posts: 1874
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Better HUD (and hunger) [1.4] [hud]

by TenPlus1 » Wed Dec 31, 2014 18:28

Apologies, I misread the guide on that particular command, it looked like it was called after the fact...
 

gumangel
Member
 
Posts: 23
Joined: Thu Jan 01, 2015 21:44
In-game: LaA

Re: [Mod] Better HUD (and hunger) [1.4] [hud]

by gumangel » Sat Jan 03, 2015 18:29

can anyone help me?
when i try to start the server it says :"ERROR:ModError:Failed to load and run
..........\mods\hunger\init.lua
Cheack debug.txt for details
i also dont have all the mods listed in depends.
 

User avatar
ExeterDad
Member
 
Posts: 1121
Joined: Sun Jun 01, 2014 20:00
In-game: ExeterDad

Re: [Mod] Better HUD (and hunger) [1.4] [hud]

by ExeterDad » Sat Jan 03, 2015 19:17

Without more output from debug.txt it's hard to see whats going on. If I were to guess, I'd say you answered your own question. A mod needs those deps for a reason. They "depend" on them to work as intended.
٩(̾●̮̮̃̾•̃̾)۶

Kibbie and I have a beautiful public server now! HOMETOWN
 

gumangel
Member
 
Posts: 23
Joined: Thu Jan 01, 2015 21:44
In-game: LaA

Re: [Mod] Better HUD (and hunger) [1.4] [hud]

by gumangel » Sat Jan 03, 2015 19:24

ExeterDad wrote:Without more output from debug.txt it's hard to see whats going on. If I were to guess, I'd say you answered your own question. A mod needs those deps for a reason. They "depend" on them to work as intended.

21:22:48: ERROR[main]: ========== ERROR FROM LUA ===========
21:22:48: ERROR[main]: Failed to load and run script from
21:22:48: ERROR[main]: D:\Minetest\minetest-0.4.10-64bit\bin\..\mods\hunger\init.lua:
21:22:48: ERROR[main]: ...netest\minetest-0.4.10-64bit\bin\..\mods\hunger\init.lua:71: attempt to concatenate a nil value
21:22:48: ERROR[main]: stack traceback:
21:22:48: ERROR[main]: ...netest\minetest-0.4.10-64bit\bin\..\mods\hunger\init.lua:71: in main chunk
21:22:48: ERROR[main]: ======= END OF ERROR FROM LUA ========
21:22:48: ERROR[main]: Server: Failed to load and run D:\Minetest\minetest-0.4.10-64bit\bin\..\mods\hunger\init.lua
21:22:48: ERROR[main]: ModError: ModError: Failed to load and run D:\Minetest\minetest-0.4.10-64bit\bin\..\mods\hunger\init.lua


but i think u are right...i think i need all the depend mods
 

User avatar
Napiophelios
Member
 
Posts: 752
Joined: Mon Jul 07, 2014 01:14
GitHub: Napiophelios
IRC: Nappi
In-game: Nappi

Re: [Mod] Better HUD (and hunger) [1.4] [hud]

by Napiophelios » Sun Jan 04, 2015 01:16

you dont need every mod listed in the depends text

the mods listed with "?" at the end are soft dependancies (supported mods)

default is the only mandatory dependancy.

with all the various error messages you have posted in different topics
I would think you have a something else going on...like the mod folder's name

rename the folder to: hud (not hunger)
 

gumangel
Member
 
Posts: 23
Joined: Thu Jan 01, 2015 21:44
In-game: LaA

Re: [Mod] Better HUD (and hunger) [1.4] [hud]

by gumangel » Sun Jan 04, 2015 10:40

Napiophelios wrote:you dont need every mod listed in the depends text

the mods listed with "?" at the end are soft dependancies (supported mods)

default is the only mandatory dependancy.

with all the various error messages you have posted in different topics
I would think you have a something else going on...like the mod folder's name

rename the folder to: hud (not hunger)

u are helping me on every single topic :) thank you!
 

User avatar
Echoes91
Member
 
Posts: 67
Joined: Thu Feb 19, 2015 13:21
In-game: Echoes

Re: [Mod] Better HUD (and hunger) [1.4] [hud]

by Echoes91 » Mon Feb 23, 2015 18:35

Good job! This works great and it's the closest thing to a unified hunger system for all those mobs related to food, farming and animal stuff. May I ask why support for "Mobs Redo" has not been implemented yet? That's a common, simple but good and funny mob set, it has already proposed hunger values in its tread and i see that there's already a pull request for them.
I'll upload my own configuration which i use because i find it more rational for a laptop widescreen, expecially for us who didn't play MC and have no need to match its layout :)
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
--
-- health bar
--
HUD_HEALTH_POS = {x=0,y=1}         --min 0, max 1
HUD_HEALTH_OFFSET = {x=10,y=-30}      --offset in pixel

--
-- armor bar
--
HUD_ARMOR_POS = {x=0,y=1}
HUD_ARMOR_OFFSET = {x=10, y=-60}

--
-- hunger bar
--
HUD_HUNGER_POS = {x=1,y=1}         --min 0, max 1
HUD_HUNGER_OFFSET = {x=-250,y=-30}   --offset in pixel

--
-- breath bar
--
HUD_AIR_POS = {x=1,y=1}      --min 0, max 1
HUD_AIR_OFFSET = {x=-250,y=-60}   --offset in pixel
Attachments
screenshot_3081800049.png
My hud layout
screenshot_3081800049.png (724.26 KiB) Viewed 4258 times
"It wasn't easy to break so many functions by editing a single line"
 

User avatar
BlockMen
Member
 
Posts: 768
Joined: Fri Mar 01, 2013 17:24
GitHub: BlockMen

by BlockMen » Tue Feb 24, 2015 09:56

Update! Version 1.4.1 released

Changelog:
- Added plantlife_modpack/mushroom potions (by mgl512)
- Updated Mobs Redo and Farming Redo (by mgl512)
- Support for ferns (plantlife_modpack) (by mgl512)
 

PreviousNext

Return to Mod Releases

Who is online

Users browsing this forum: Bing [Bot] and 22 guests

cron