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

User avatar
BlockMen
Developer
Posts: 768
Joined: Fri Mar 01, 2013 17:24
GitHub: BlockMen
Location: Germany

by BlockMen » Post

Update Version 2.0.1

- Fixed disappearing hotbar (reported by poet-nohit)
- Fixed unused global var
- Added one more check to catch probably incorrect players

poet.nohit
Member
Posts: 55
Joined: Fri Mar 06, 2015 00:50
GitHub: poet-nohit

Re: [Modpack] Better HUD (and hunger) [2.0.1] [hud][hunger]

by poet.nohit » Post

One more bug fix. Funny, but it was actually working better when it assumed show_hunger was a global.

https://github.com/poet-nohit/minetest- ... 0bad173762

User avatar
Minetestforfun
Member
Posts: 940
Joined: Tue Aug 05, 2014 14:09
GitHub: MinetestForFun
IRC: MinetestForFun
In-game: MinetestForFun
Location: On earth
Contact:

Re: [Modpack] Better HUD (and hunger) [2.0.1] [hud][hunger]

by Minetestforfun » Post

Hi BlockMen,

We worked on the upgrade of hud mod 1.4 to 2.0, and we found this : https://github.com/minetest/minetest/issues/2615
Maybe it will interest you

User avatar
BlockMen
Developer
Posts: 768
Joined: Fri Mar 01, 2013 17:24
GitHub: BlockMen
Location: Germany

Re: [Modpack] Better HUD (and hunger) [2.1] [hud][hunger]

by BlockMen » Post

Update Version 2.1

New: ItemWheel
Image

Inspired by Voxelands new hotbar, I added the ItemWheel as experimental hotbar replacement.
It might cause lags on servers or at least slow them down the more users online, so I can only recommend using it on singleplayer. But if someone would test it on a server and post the results would be nice aswell :)

To use the ItemWheel add "hud_item_wheel = true" to minetest.conf.

Known issues:
Currently there is no stack counting or wearout level displayed (fxed in 2.1.1)

Changelog:
- Added "ItemWheel" (experimental)
- Fixed disapperaring hunger bar (reported by poet-nohit)

---

@Minetestforfun
Well, i guess if there is no easy/fast fix for that i should switch back to override the items on_use, since this bug breaks (sometimes) the whole system :\
Last edited by BlockMen on Mon Apr 13, 2015 10:28, edited 1 time in total.

prestidigitator
Member
Posts: 647
Joined: Thu Feb 21, 2013 23:54

Re: [Modpack] Better HUD (and hunger) [2.1] [hud][hunger]

by prestidigitator » Post

BlockMen wrote:Well, i guess if there is no easy/fast fix for that i should switch back to override the items on_use, since this bug breaks (sometimes) the whole system :\
Trying to change this could also create a sort of war of escalation over which event handlers take precedence, can override each other, etc. However, with that caveat, here's an implementation of the Decorator pattern (mostly):

Code: Select all

--- Do whatever it is I want to do when eating food, after calling all other
 -- on_item_eat() handlers.
 --
 -- @param otherReturn
 --    The value returned by the other (normal) on_item_eat() handlers.  Can be
 --    taken into account and/or changed in my function.
 --
local function myEater(hp_change, replace_with_item, itemstack, user, pointed_thing, otherReturn)
   -- Whatever
end;

local oldEaters = minetest.registered_on_item_eats;

local function runOldEaters(...)
   for _, e in ipairs(oldEaters) do
      local val = e(...);
      if val then
         return val;
     end;
   end;
   return nil;
end;

local function alwaysEat(...)
   return myEater(..., runOldEaters(...));
end;

minetest.registered_on_item_eats = { alwaysEat };
Note that minetest.register_on_item_eat() always adds to the original table, as the table is accessed through a closure rather than using the minetest.registered_item_eats variable (see builtin/game/register.lua). That makes it unnecessary to replace the minetest.register_on_item_eat() function itself. However, you could always replace the function anyway, to safeguard against future changes to the implementation:

Code: Select all

minetest.register_on_item_eat = function(handler) table.insert(oldEaters, handler); end;
This might be worth a try if you'd otherwise fall back on using on_use() callbacks on everything and having to whitelist foods. Keep in mind that it's POSSIBLE it might not work if the event handling system (like the registration code) grabs a reference to the minetest.registered_item_eats table before mods get initialized instead of fetching the variable each time.

User avatar
BlockMen
Developer
Posts: 768
Joined: Fri Mar 01, 2013 17:24
GitHub: BlockMen
Location: Germany

Re: [Modpack] Better HUD (and hunger) [2.1.1] [hud][hunger]

by BlockMen » Post

Update Version 2.1.1

Changelog:
- Added itemcounting/wearout info
- Added support for hud scaling
- Fixed typo causing endless updating
- Fixed image scaling of some textures (like glass)
- Improved ItemWheel image

Screenshot:
Image

----
@prestidigitator
thx, this is indeed worth testing before switching back ;)

User avatar
Krock
Developer
Posts: 4649
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

Re: [Modpack] Better HUD (and hunger) [2.1.1] [hud][hunger]

by Krock » Post

A 'yay!' for that new HUD, thank you!
Sadly, there's no way to see the other items in the hotbar.

EDIT: After setting "hud_item_wheel = true":

Code: Select all

ERROR[main]: ServerError: E:\Programme\minetest\bin\..\builtin\game\item.lua:20: attempt to call method 'gsub' (a nil value)
ERROR[main]: stack traceback:
ERROR[main]:       E:\Programme\minetest\bin\..\builtin\game\item.lua:20: in function 'inventorycube'
ERROR[main]:       E:\Programme\minetest\bin\..\mods\hud/itemwheel.lua:59: in function 'update_wheel'
ERROR[main]:       E:\Programme\minetest\bin\..\mods\hud/itemwheel.lua:189: in function <E:\Programme\minetest\bin\..\mods\hud/itemwheel.lua:184>
ERROR[main]:       E:\Programme\minetest\bin\..\builtin\game\register.lua:341: in function <E:\Programme\minetest\bin\..\builtin\game\register.lua:329>
EDIT2: This was caused by a table value, default:torch.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

User avatar
BlockMen
Developer
Posts: 768
Joined: Fri Mar 01, 2013 17:24
GitHub: BlockMen
Location: Germany

Re: [Modpack] Better HUD (and hunger) [2.1.1] [hud][hunger]

by BlockMen » Post

Krock wrote:A 'yay!' for that new HUD, thank you!
Sadly, there's no way to see the other items in the hotbar.
-snip-
EDIT: It's somewhat intentional for the "wheel" that you do not see every item. Else the "loop"/toogle-through would be kinda boring IMO; it would be just a "round" hotbar.
---

Update Version 2.1.2

Changelog:
- Fixed crash caused by animated nodes (reported by Krock)
- Fixed "freezing" of empty slots (reported by kilbith)

Also, kilbith brought to my attention that meshnodes are not displayed correct. Same goes for nodeboxes, such as stairs and slabs. Currently there is no way to draw those via Lua, so they are displayed as block currently :\

User avatar
Evergreen
Member
Posts: 2135
Joined: Sun Jan 06, 2013 01:22
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen
Location: A forest in the midwest
Contact:

Re: [Modpack] Better HUD (and hunger) [2.1.2] [hud][hunger]

by Evergreen » Post

This is awesome! The only problem I encountered is the fact that it doesn't update when you add an item to the hotbar, but it does update when you change items.
Back from the dead!

User avatar
philipbenr
Member
Posts: 1897
Joined: Fri Jun 14, 2013 01:56
GitHub: philipbenr
IRC: philipbenr
In-game: robinspi
Location: United States

Re: [Modpack] Better HUD (and hunger) [2.1.2] [hud][hunger]

by philipbenr » Post

That one looks awesome and probably would look good on Android version of Minetest for scrolling around...

User avatar
Minetestforfun
Member
Posts: 940
Joined: Tue Aug 05, 2014 14:09
GitHub: MinetestForFun
IRC: MinetestForFun
In-game: MinetestForFun
Location: On earth
Contact:

Re: [Modpack] Better HUD (and hunger) [2.1.2] [hud][hunger]

by Minetestforfun » Post

i has tested the "Update Version 2.1.1" on my serveur "0.4.12-stable"

So i met a big issue, after a time between 30min and 2 hours, the hud met a BIG crashs, the server still online but we have no more hunger bar, and foods don't do sounds anymore...

With "verbose = 2" i see nothing in my logs for explain that issue

(PS : So we have been forced to revert the 1.4 -> 2.1.x update of your mod...)
Last edited by Minetestforfun on Fri Apr 17, 2015 23:44, edited 3 times in total.

supercutsminetest
Member
Posts: 21
Joined: Wed Apr 08, 2015 12:58

Re: [Modpack] Better HUD (and hunger) [2.1.2] [hud][hunger]

by supercutsminetest » Post

Eating cooked slice of blueberry pie sates 1/2 a hunger and brown mushroom essence sates 1 hunger, is there a functional reason for cooking vs eating an apple then?

User avatar
Ben
Member
Posts: 160
Joined: Tue Mar 31, 2015 20:09

Re: [Modpack] Better HUD (and hunger) [2.1.2] [hud][hunger]

by Ben » Post

Hi, I'm writing a mod which adds a new stat bar. I'm having a bit of trouble with the positioning: do I read it right that all bars are absolutely positioned, and that whoever installs all these mods together sorts out the positioning?

If so, what's the preferred way to let the mod user select the position? The hud.conf file contains a set of globals; would I define some new variables for my mod's stat bar in there?

User avatar
TenPlus1
Member
Posts: 3715
Joined: Mon Jul 29, 2013 13:38
In-game: TenPlus1
Contact:

Re: [Modpack] Better HUD (and hunger) [2.1.2] [hud][hunger]

by TenPlus1 » Post

Could you add the following food item under the farming redo section of your hunger mod:

Code: Select all

overwrite("farming:beans", 1)

Carnildo
New member
Posts: 4
Joined: Tue Sep 23, 2014 07:59

Re: [Modpack] Better HUD (and hunger) [2.1.2] [hud][hunger]

by Carnildo » Post

I'm seeing an intermittent crash when using Pipeworks to make an automatic tree-harvester. The harvester consists of a stack of five node-breakers and a deployer that are activated by a Mesecons sensor. I believe the crash is being caused by one of the node-breakers (which one varies from time to time).

Code: Select all

21:26:02: ERROR[main]: ServerError: ~/.minetest/mods/hud_hunger/hud/api.lua:91: attempt to call method 'hud_change' (a nil value)
21:26:02: ERROR[main]: stack traceback:
21:26:02: ERROR[main]: 	~/.minetest/mods/hud_hunger/hud/api.lua:93: in function 'change_item'
21:26:02: ERROR[main]: 	~/.minetest/mods/hud_hunger/hunger/functions.lua:57: in function 'update_hunger'
21:26:02: ERROR[main]: 	~/.minetest/mods/hud_hunger/hunger/functions.lua:95: in function 'callback'
21:26:02: ERROR[main]: 	/usr/share/games/minetest/builtin/game/item.lua:467: in function </usr/share/games/minetest/builtin/game/item.lua:405>
21:26:02: ERROR[main]: 	(tail call): ?
21:26:02: ERROR[main]: 	/home/mark/.minetest/mods/pipeworks/wielder.lua:325: in function 'act'
21:26:02: ERROR[main]: 	~/.minetest/mods/pipeworks/wielder.lua:109: in function 'wielder_on'
21:26:02: ERROR[main]: 	~/.minetest/mods/pipeworks/wielder.lua:145: in function 'action_on'
21:26:02: ERROR[main]: 	~/.minetest/mods/mesecons/mesecons/internal.lua:189: in function '?'
21:26:02: ERROR[main]: 	~/.minetest/mods/mesecons/mesecons/actionqueue.lua:90: in function 'execute'
21:26:02: ERROR[main]: 	~/.minetest/mods/mesecons/mesecons/actionqueue.lua:84: in function '?'
21:26:02: ERROR[main]: 	/usr/share/games/minetest/builtin/game/register.lua:341: in function </usr/share/games/minetest/builtin/game/register.lua:329>
After the crash, the first attempt to enter the game crashes with the following traceback:

Code: Select all

21:47:59: ERROR[main]: ServerError: ~/.minetest/mods/hud_hunger/hunger/functions.lua:68: attempt to index field '?' (a nil value)
21:47:59: ERROR[main]: stack traceback:
21:47:59: ERROR[main]: 	~/.minetest/mods/hud_hunger/hunger/functions.lua:71: in function 'callback'
21:47:59: ERROR[main]: 	/usr/share/games/minetest/builtin/game/item.lua:299: in function </usr/share/games/minetest/builtin/game/item.lua:191>
21:47:59: ERROR[main]: 	(tail call): ?
21:47:59: ERROR[main]: 	(tail call): ?
21:47:59: ERROR[main]: 	~/.minetest/mods/pipeworks/wielder.lua:379: in function 'act'
21:47:59: ERROR[main]: 	~/.minetest/mods/pipeworks/wielder.lua:109: in function 'wielder_on'
21:47:59: ERROR[main]: 	~/.minetest/mods/pipeworks/wielder.lua:145: in function 'action_on'
21:47:59: ERROR[main]: 	~/.minetest/mods/mesecons/mesecons/internal.lua:189: in function '?'
21:47:59: ERROR[main]: 	~/.minetest/mods/mesecons/mesecons/actionqueue.lua:90: in function 'execute'
21:47:59: ERROR[main]: 	~/.minetest/mods/mesecons/mesecons/actionqueue.lua:84: in function '?'
21:47:59: ERROR[main]: 	/usr/share/games/minetest/builtin/game/register.lua:341: in function </usr/share/games/minetest/builtin/game/register.lua:329>

User avatar
crazyR
Member
Posts: 60
Joined: Thu Jun 19, 2014 14:41
Location: uk

Re: [Modpack] Better HUD (and hunger) [2.1.2] [hud][hunger]

by crazyR » Post

Technic drills icon image is oversized when usimg the wheel mode..

screenshot:
Image

User avatar
linushsao
Member
Posts: 418
Joined: Mon Jan 27, 2014 12:56
IRC: linushsao
In-game: linus
Location: Taipei,Taiwan(R.O.C)
Contact:

Re: [Modpack] Better HUD (and hunger) [2.1.2] [hud][hunger]

by linushsao » Post

solved,It caused by other mods.
1.hunger mod enables falied because of moretree mod enabled failed.
2.moretree mod enabled failed because of plants_lib mod not enabled.

so,enabled plants_lib mod could solved this problem.

dannyplaysminetest
Member
Posts: 37
Joined: Sun Jun 28, 2015 19:20
In-game: Danny

Re: [Modpack] Better HUD (and hunger) [2.1.2] [hud][hunger]

by dannyplaysminetest » Post

Thanks for this Mod, it gives a more realistic feel when playing survival mode and the Hud looks nice in combination with the 3D armor mod since it shows that bar as wel ^_^

amadin
Member
Posts: 549
Joined: Tue Jun 16, 2015 16:23

Re: [Modpack] Better HUD (and hunger) [2.1.2] [hud][hunger]

by amadin » Post

08:09:05: WARNING: Undeclared global variable "HUD_ENABLE_HUNGER" accessed at .../games/minetest_game/mods/hud_hunger/hud/builtin.lua:41

What i do wrong?

User avatar
BlockMen
Developer
Posts: 768
Joined: Fri Mar 01, 2013 17:24
GitHub: BlockMen
Location: Germany

Re: [Modpack] Better HUD (and hunger) [2.1.3] [hud][hunger]

by BlockMen » Post

Update Version 2.1.3

HUD:
- Added hud.swap_statbar() and fix wrong behavior of previous workaround
- Fixed missing background of some statbars in multiplayer

hunger:
- Fixed healing after death
- Fixed healing while drowning
- Fixed crashed caused by Pipeworks mod
- Added wrapper for minetest.item_eat(). see Readme.txt for more informations
- Updated HUD-API usage
- Added beans of Farming Redo

Information for Modders:
If this mod is installed registered on_item_eat callbacks are called AFTER this mods actions, means the itemstack is already modified when passed. You can catch the original itemstack as 6th parameter and modifiy this mods actions aswell that way if wanted.


@amadin: nothing to worry about, its just a warning that is caused by legacy code. Just ignore it ;)

User avatar
jp
Banned
Posts: 947
Joined: Wed Dec 18, 2013 09:03
GitHub: kilbith
Location: France

Re: [Modpack] Better HUD (and hunger) [2.1.3] [hud][hunger]

by jp » Post

Really glad to see you again, BlockMen ;)

User avatar
TenPlus1
Member
Posts: 3715
Joined: Mon Jul 29, 2013 13:38
In-game: TenPlus1
Contact:

Re: [Modpack] Better HUD (and hunger) [2.1.3] [hud][hunger]

by TenPlus1 » Post

Removed

necron099
Member
Posts: 63
Joined: Wed Feb 27, 2013 16:10
Location: Florida

Re: [Modpack] Better HUD (and hunger) [2.1.3] [hud][hunger]

by necron099 » Post

BlockMen,

Ran into this error:

Code: Select all


-------------
  Separator  
-------------

14:05:29: WARNING: Undeclared global variable "HUD_ENABLE_HUNGER" accessed at .../bin/../games/basic_mine/mods/hud_hunger/hud/builtin.lua:41
2015-07-22 14:05:29: ACTION[main]:         .__               __                   __   
2015-07-22 14:05:29: ACTION[main]:   _____ |__| ____   _____/  |_  ____   _______/  |_ 
2015-07-22 14:05:29: ACTION[main]:  /     \|  |/    \_/ __ \   __\/ __ \ /  ___/\   __\
2015-07-22 14:05:29: ACTION[main]: |  Y Y  \  |   |  \  ___/|  | \  ___/ \___ \  |  |  
2015-07-22 14:05:29: ACTION[main]: |__|_|  /__|___|  /\___  >__|  \___  >____  > |__|  
2015-07-22 14:05:29: ACTION[main]:       \/        \/     \/          \/     \/        
2015-07-22 14:05:29: ACTION[main]: World at [/home/fred/linuxgames/minetest0412/bin/../worlds/1basic]
2015-07-22 14:05:29: ACTION[main]: Server for gameid="basic_mine" listening on 0.0.0.0:50685.
2015-07-22 14:05:32: ACTION[main]: Irrlicht: PNG warning: Unknown iTXt compression type or method
2015-07-22 14:05:32: ACTION[main]: Irrlicht: PNG warning: Unknown iTXt compression type or method
2015-07-22 14:05:32: ACTION[main]: Irrlicht: PNG warning: Interlace handling should be turned on when using png_read_image
2015-07-22 14:05:33: ACTION[ServerThread]: singleplayer [127.0.0.1] joins game. 
2015-07-22 14:05:33: ACTION[ServerThread]: singleplayer joins game. List of players: singleplayer
2015-07-22 14:05:34: ACTION[main]: Irrlicht: Could not open file of texture: character.png
2015-07-22 14:05:34: ACTION[main]: Irrlicht: Could not open file of texture: character.png
2015-07-22 14:05:37: ACTION[ServerThread]: singleplayer places node default:apple at (-53,2,224)
2015-07-22 14:05:38: ACTION[ServerThread]: singleplayer uses default:apple, pointing at [node under=-53,2,224 above=-53,2,225]
2015-07-22 14:05:38: ERROR[main]: ServerError: ...../games/basic_mine/mods/hud_hunger/hunger/functions.lua:226: attempt to index a nil value
2015-07-22 14:05:38: ERROR[main]: stack traceback:
2015-07-22 14:05:38: ERROR[main]: 	...../games/basic_mine/mods/hud_hunger/hunger/functions.lua:226: in function 'eat'
2015-07-22 14:05:38: ERROR[main]: 	...../games/basic_mine/mods/hud_hunger/hunger/functions.lua:200: in function <...../games/basic_mine/mods/hud_hunger/hunger/functions.lua:198>
2015-07-22 14:05:38: ACTION[ServerThread]: singleplayer leaves game. List of players: 
Damage was not enabled when this happened.

User avatar
Sane
Member
Posts: 103
Joined: Tue Jun 17, 2014 09:31
GitHub: mt-sane
In-game: Sane

Hidden saturation.

by Sane » Post

Hi there,

I don't quite understand why there is hidden saturation. Is there a way tho show all 30 saturation points?
Trying to stay me.

amadin
Member
Posts: 549
Joined: Tue Jun 16, 2015 16:23

Re: [Modpack] Better HUD (and hunger) [2.1.3] [hud][hunger]

by amadin » Post

I try to change backgroung with
player:hud_set_hotbar_image("gui_hotbar.png") and player:hud_set_hotbar_selected_image("gui_hotbar_selected.png") in minetest.register_on_joinplayer(function(player) but it not work, do you can help me?

Locked

Who is online

Users browsing this forum: No registered users and 3 guests