Page 1 of 1

"Generates electricity" label

Posted: Tue Feb 27, 2024 9:32 am
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

Re: "Generates electricity" label

Posted: Tue Feb 27, 2024 11:34 am
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.

Re: "Generates electricity" label

Posted: Tue Feb 27, 2024 11:58 am
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…

Re: "Generates electricity" label

Posted: Tue Feb 27, 2024 1:49 pm
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__

Re: "Generates electricity" label

Posted: Tue Feb 27, 2024 3:14 pm
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?