[Solved] MT try to build texture when updating text HUD?

Post Reply
User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

[Solved] MT try to build texture when updating text HUD?

by texmex » Post

So I wrote this WAILA-like mod by means of raycasting and globalstep, much based on another mod but much simplified. It works flawlessly except whenever pointing on a not-before-pointed node the game throws this error:

Code: Select all

ERROR[Main]: generateImage(): Could not load image "default:dirt" while building texture; Creating a dummy image
I've narrowed the error down to it happening when updating the text HUD items, but I can't understand why. The code should be commented well enough for anyone to follow: https://github.com/tacotexmex/pointlib
Last edited by texmex on Mon Nov 26, 2018 07:13, edited 1 time in total.

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: Why does MT try to build texture when updating text HUD?

by texmex » Post

I think I've solved it and discovered an engine bug in the process. Because I didn't check for the existance of HUD element "pointlib.hud.name" before updating it the value was passed to another, seemingly randomly choosen, HUD element outside this mod that just so happened to be an image element. So text was passed on to another element as image which of course didn't exist and thus the error was produced.

While it was simple to do an HUD element existance check before doing HUD updates, the value should of course never just pass on to the next random HUD in the list.

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

Re: [Solved] MT try to build texture when updating text HUD?

by Krock » Post

I've got a different question: Is this mod supposed to work in multiplayer?

I'm asking because HUD IDs are assigned according to what's currently free for the client. Possibly it just happened to be that all client receive the HUD elements in the same order every time they join. For safe HUD management, change `pointlib.hud` into a by-playername-indexed table which then contains each existing HUD ID.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: [Solved] MT try to build texture when updating text HUD?

by texmex » Post

Krock wrote:I've got a different question: Is this mod supposed to work in multiplayer?

I'm asking because HUD IDs are assigned according to what's currently free for the client. Possibly it just happened to be that all client receive the HUD elements in the same order every time they join. For safe HUD management, change `pointlib.hud` into a by-playername-indexed table which then contains each existing HUD ID.
Yes, good spotting, I should definitely do that. So far I’ve only used it by myself but soon enough it won’t be only me. Btw, I’ve seen mods do HUD removal on players leaving as well. Do you know why or if that is important? I feel like I’m overlooking something.

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: [Solved] MT try to build texture when updating text HUD?

by texmex » Post

I went ahead and did by-playername-indexed HUD handling. Even if I only used it in singleplayer, your theory of what could have happened sound likely to what happened.

Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests