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:
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.
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.
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.
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.
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.