mod-defined utility-sprite not recognized

Place to get help with not working mods / modding interface.
Post Reply
ixu
Fast Inserter
Fast Inserter
Posts: 105
Joined: Sun May 29, 2016 6:18 pm
Contact:

mod-defined utility-sprite not recognized

Post by ixu »

In data.lua:

Code: Select all

data.raw["utility-sprites"].default.factorio = 
{
    filename = "__core__/graphics/factorio-icon.png",
    priority = "medium",
    size = 64,
    scale = 0.5,
    flags = {"icon"}
}

I want to use that sprite in some gui-field as caption:

Code: Select all

myframe.caption = "[img=utility/factorio]"
But it only shows "[ img=utility/factorio ]" (without the spaces) instead of the factorio-icon
Mods: ingteb, ixuClock, ixuAutoSave, NoCheating, hardCrafting (Maintainer) and more
Desperately tried to implement redo :)

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: mod-defined utility-sprite not recognized

Post by Deadlock989 »

You can't add new utility sprites. You can only change existing ones.

But you can just create a new sprite prototype and then use it in rich text.

Code: Select all

    {
        type = "sprite",
        name = "fuel-icon-red",
        filename = "whatever",
        priority = "extra-high",
        width = 64,
        height = 64,
        mipmap_count = 4,
    }

Code: Select all

[img=fuel-icon-red]
Image

ixu
Fast Inserter
Fast Inserter
Posts: 105
Joined: Sun May 29, 2016 6:18 pm
Contact:

Re: mod-defined utility-sprite not recognized

Post by ixu »

Thanks.
But I did not found this fact in the documentation or the wiki. Should be updated there.
Mods: ingteb, ixuClock, ixuAutoSave, NoCheating, hardCrafting (Maintainer) and more
Desperately tried to implement redo :)

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: mod-defined utility-sprite not recognized

Post by Deadlock989 »

ixu wrote:
Mon Nov 30, 2020 12:36 am
Thanks.
But I did not found this fact in the documentation or the wiki. Should be updated there.
Anyone can become a wiki contributor.
Image

ixu
Fast Inserter
Fast Inserter
Posts: 105
Joined: Sun May 29, 2016 6:18 pm
Contact:

Re: mod-defined utility-sprite not recognized

Post by ixu »

Sure, I will do this tomorrow. But the Factorio-docu needs update too:

https://lua-api.factorio.com/latest/Con ... SpritePath
Mods: ingteb, ixuClock, ixuAutoSave, NoCheating, hardCrafting (Maintainer) and more
Desperately tried to implement redo :)

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: mod-defined utility-sprite not recognized

Post by Deadlock989 »

No, it says so. If it makes you feel better, I also missed it the first time I did this kind of thing. But it's right there.

Untitled.jpg
Untitled.jpg (88.54 KiB) Viewed 998 times
Image

Post Reply

Return to “Modding help”