"Generates electricity" label

Place to get help with not working mods / modding interface.
Byzzee
Burner Inserter
Burner Inserter
Posts: 6
Joined: Tue Feb 27, 2024 8:55 am
Contact:

"Generates electricity" label

Post by Byzzee »

Hello mates,

I'm making a mod bringing some ecology stuff in game and I got stuck on wind turbines. In-game entities that produce power have "Generates power" label and production bar in their description (screenshot 1). So I wanna make same thing with my wind turbine, but I didn't find the corresponding attribute for the entity prototype.
Will appreciate any help possible. :D

https://imgur.com/2N7DXR1
https://imgur.com/SkJGCfQ

FuryoftheStars
Smart Inserter
Smart Inserter
Posts: 2768
Joined: Tue Apr 25, 2017 2:01 pm
Contact:

Re: "Generates electricity" label

Post by FuryoftheStars »

This is likely an automatic thing that is tagged on either for the entity type or anything that net generates power (without script).

There does exist a few other wind turbine mods already. You can check them out to see if they solved that issue or not and how.
My Mods: Classic Factorio Basic Oil Processing | Sulfur Production from Oils | Wood to Oil Processing | Infinite Resources - Normal Yield | Tree Saplings (Redux) | Alien Biomes Tweaked | Restrictions on Artificial Tiles | New Gear Girl & HR Graphics

Byzzee
Burner Inserter
Burner Inserter
Posts: 6
Joined: Tue Feb 27, 2024 8:55 am
Contact:

Re: "Generates electricity" label

Post by Byzzee »

Actually I did check some other mods having wind turbines and they didn’t solve this problem either.
It just doesn’t seem right that I can’t put this thing into my entity’s description, so maybe it should be done from control script or something…

User avatar
Stringweasel
Filter Inserter
Filter Inserter
Posts: 405
Joined: Thu Apr 27, 2017 8:22 pm
Contact:

Re: "Generates electricity" label

Post by Stringweasel »

It's possible to add custom tooltips. It won't look exactly like normal generators, but at least the information will be there. I do something similar in my mod Biter Power to display the change of escape

Image

In the prototype you add the field `localised_description`

Code: Select all

  {
    name = "bp-generator",
    type = "burner-generator",
    localised_description = {"",
      {"entity-description.bp-generator"},
      {"bp-text.escape-modifier", 5},
    },
    
    ...
 }
And then have the field in you local/en/locale.cfg file something like this

Code: Select all


[bp-text]
escape-modifier=\n[img=tooltip-category-turret][font=default-bold][color=#FFD249]Chance of Escape[/color][/font]\n[font=default-semibold][color=#ffe6c0]Containment modifier:[/color][/font] __1__
Alt-F4 Author | Factorio Modder
My Mods: Hall of Fame | Better Victory Screen | Fluidic Power | Biter Power | Space Spidertron | Spidertron Dock | Weasel's Demolition Derby
Official Contributor to Space Exploration

Byzzee
Burner Inserter
Burner Inserter
Posts: 6
Joined: Tue Feb 27, 2024 8:55 am
Contact:

Re: "Generates electricity" label

Post by Byzzee »

Stringweasel wrote:
Tue Feb 27, 2024 1:49 pm
It's possible to add custom tooltips. It won't look exactly like normal generators, but at least the information will be there. I do something similar in my mod Biter Power to display the change of escape
Oh, actually it's quite close to what I'm trying to accomplish, thanks!
However, making description that way doesn' look exactly like vanilla ones. Also, your "generator" has "Working" status and energy production bar - I suppose you just copied vanilla generator entity, so it just works for you. Maybe if you know, can I just also copy generator entity instead of

Code: Select all

type = "electric-energy-interface"
and just make "required fuel" = None (pardon, Nil) or something like that?

Post Reply

Return to “Modding help”