Closed Winterhuman closed 2 months ago
What sort of values are you trying to set it to?
{
[2] = "example.png"
}
Wouldn't work because it's a sparse list and this function uses the lua #
operator, which assumes the list is not sparse.
(This might be a bug)
If you're making a mod for sway, this actually sounds like a feature I'd like to be in sway itself - so feel free to send a PR if that's the case. I've been thinking about making the textures easier to swap out by other mods.
This isn't a mod for Sway, but rather an inventory mod I'm making for a game to override the size and look of it. So far, I've tried:
local bgimg = "example.png"
local bgimg = { "example.png" }
local bgimg = { "example.png", "example.png", ... Number of Tiles }
local bgimg = { bgimg = "example.png" }
I've also tried renaming the image to
sway_hb_bg.png
andflow_extras_list_bg.png
, and trying images with or without alpha channels.
...But no matter what, it uses a different image. Strangely, the inventory tiles I get are brighter than the background they're against (and opaque), but, the flow_extras ... .png
& sway_hb_bg.png
images are all dark & translucent, and every screenshot I find of a sway/sfinv mod has dark tiles.
I think this means the inventory tiles are using the default formspec texture built into the engine (this is a guess), although I couldn't find any reference to such a texture.
Here's what the tiles looks like currently:
updated OP with human readable version numbers
Feel free to re-open if that didn't work.
Released flow_extras
as version 1.7.3
@Lazerbeak12345 Updated flow-extras
to 25471 (1.7.3), which I checked by looking at mod.conf
and the new gui.Image
line, but neither "example.png"
nor { "example.png" }
cause any change unfortunately.
Adding minetest.log(string.format("%s", the_image))
just before the return
line containing gui.Image
shows it is being set to example.png
, so it isn't that the texture name isn't being passed (manually writing the texture name into the return
line leads to the same thing).
When I simplify the return
line to return gui.Image{ w = 1, h = 1, texture_name = the_image }
, just in case the conditioning was wrong, it also doesn't change anything.
And, if I add:
gui.Image{
w = 1, h = 1,
texture_name = "example.png"
},
...inbetween flow.extras.List{}
and h > 1 and flow_extras.List{}
in my mod, the image displays the right image. I think this means the problem must be in the flow_extras.Grid{}
stuff.
Update: moving the gui.List(fields)
line before the grid stuff reveals that the images have been getting set, however, they're behind the inventory tiles. So, it's not that the gui.Image
tiles aren't using the image, it's that the inventory tiles themselves have the light-grey opaque backgrounds and are covering the bgimg
images.
In other words, this is a bug in flow
's List
element, which is drawing opaque backgrounds when presumably it shouldn't, so this issue can remain closed (unless I've missed something).
likely fixable with style elements. I'll investigate later
Thanks to lyk3yx the flow_inspector mod should now work with your use case. They have yet to upload it to contentdb, but I thought I'd mention it since it should make debugging this a bit easier.
Did some rudimentary testing with the inspector tool.
It seems that (as it is), flow extras doesn't make the list background thingies invisible when it should.
This may require a fair bit of logic rework, so if it's complicated, you'll see a PR for that one
looking at i3's code (which is under the same license as this repo, so it's legally fine), there's two things they do
get_slots
in their gui.lua
renders boxes behind each slot, just like I do. I'm sure I'm missing something.I considered the second option, but if the first option works for i3, then it can work for flow_extras.List
.
dig through the generated formspec from I3 by hand to look for anything related
Are you looking for listcolors[]? Unfortunately it changes the colours of every list[]
element (regardless of whether the list is before or after listcolors[]
), i3 works around this by making it semi-transparent so it can still add backgrounds without making other list[]s look bad, unified_inventory (and probably other mods) just make it fully transparent and require you to add slot backgrounds to every list element. I've made flow handle gui.Listcolors
correctly in https://github.com/luk3yx/minetest-flow/commit/da87496e26f4d4685fd2164cfdf799358ae90e0c.
That looks like it to me. I just hadn't gotten around to it yet.
Thinking of it, perhaps I should just document that that element is a prerequisite for this bg functionality. I don't want inclusion of flow-extras.List
element to break the rest of the larger form - especially if they are modifying someone else's form.
resolved in 7687adf
I'd recommend using what luk3yx discovered as a workaround.
Minetest version: 5.8.0 Sway release: 25444 (1.0.3) Flow release: 25058 (2024-05-15) Flow extras release: 21728 (1.7.2)
I was playing around with your other project, Sway, but, I've recently run into a problem.
I wanted to replace the
sway.InventoryTiles()
function so I could set the inventory tile image to something else, however,bgimg
doesn't respond to any value I set (other thanbgimg = { [2] = "example.png" }
, which causes an assertion since it's invalid).Here's what I'm doing:
Please, let me know if you need any more information.