Trying to change a mod tech icon to a HD version

Place to get help with not working mods / modding interface.
devilwarriors
Filter Inserter
Filter Inserter
Posts: 311
Joined: Sat Jan 09, 2016 1:11 am
Contact:

Trying to change a mod tech icon to a HD version

Post by devilwarriors »

Hi,

I'm trying to change the icon of the nixie tube mod for a 128px wide version that I made from the building sprite, but it won't display right and I don't see what I'm doing wrong.

inside technology.lua I change the icon path to my file
icon = "__nixie-tubes__/graphics/technology/nixie-tube.png"
Image
nixie-tube.png - 128px x 128px
But when I launch the game it look like that
Image

Why?
Supercheese
Filter Inserter
Filter Inserter
Posts: 841
Joined: Mon Sep 14, 2015 7:40 am
Contact:

Re: Trying to change a mod tech icon to a HD version

Post by Supercheese »

You need to also set the icon_size property to 128 in your technology definition.

For example:

Code: Select all

data:extend({
 {
  type = "technology",
  name = "alert-systems",
  icon = "__Red Alerts__/graphics/AlertSystems.png",
  icon_size = 128,
  prerequisites = {"circuit-network"},
  effects =
  {
   {
    type = "unlock-recipe",
    recipe = "power-sensor"
   },
  },
  unit =
    {
      count = 40,
      ingredients =
      {
        {"science-pack-1", 1},
        {"science-pack-2", 1}
      },
      time = 15
    },
  order = "a-d-e",
 },
})
devilwarriors
Filter Inserter
Filter Inserter
Posts: 311
Joined: Sat Jan 09, 2016 1:11 am
Contact:

Re: Trying to change a mod tech icon to a HD version

Post by devilwarriors »

Nice, thanks for the fast answer!
keyboardhack
Filter Inserter
Filter Inserter
Posts: 478
Joined: Sat Aug 23, 2014 11:43 pm
Contact:

Re: Trying to change a mod tech icon to a HD version

Post by keyboardhack »

You need to add this line aswell

Code: Select all

icon_size = 128(or whatever size your image has)
Default size for icon_size is 64.
You can read more about it here https://forums.factorio.com/forum/viewtop ... =3&t=18182

EDIT: damn too slow :)
Waste of bytes : P
devilwarriors
Filter Inserter
Filter Inserter
Posts: 311
Joined: Sat Jan 09, 2016 1:11 am
Contact:

Re: Trying to change a mod tech icon to a HD version

Post by devilwarriors »

Oh that a pretty recent change, that explain why all mod have horribly pixelated icons right now (I'm new to the game).
keyboardhack
Filter Inserter
Filter Inserter
Posts: 478
Joined: Sat Aug 23, 2014 11:43 pm
Contact:

Re: Trying to change a mod tech icon to a HD version

Post by keyboardhack »

Made two new icons from the one you posted. Feel free to use if you want although they might not fit with the style you are going for.
These two are 256x256 in size.
Image
Image
Waste of bytes : P
devilwarriors
Filter Inserter
Filter Inserter
Posts: 311
Joined: Sat Jan 09, 2016 1:11 am
Contact:

Re: Trying to change a mod tech icon to a HD version

Post by devilwarriors »

Why 256? is the game accepting this size?
keyboardhack
Filter Inserter
Filter Inserter
Posts: 478
Joined: Sat Aug 23, 2014 11:43 pm
Contact:

Re: Trying to change a mod tech icon to a HD version

Post by keyboardhack »

Haven't tried it but i don't see why it shouldn't.
icon_size is an integer so i assume it can have any value.
Waste of bytes : P
devilwarriors
Filter Inserter
Filter Inserter
Posts: 311
Joined: Sat Jan 09, 2016 1:11 am
Contact:

Re: Trying to change a mod tech icon to a HD version

Post by devilwarriors »

I feel like icons is one thing where I would prefer to control the render of the final size, since I know that this box is 128px wide on screen I prefer to make it that size rather than have the game resize it smaller. Photoshop probably have a better re-sizing algorithm than the game anyway if the max zoom quality is any indication.

Maybe it's because I come from web development where you couldn't trust IE6 to resize an image correctly. :P
devilwarriors
Filter Inserter
Filter Inserter
Posts: 311
Joined: Sat Jan 09, 2016 1:11 am
Contact:

Re: Trying to change a mod tech icon to a HD version

Post by devilwarriors »

I tried and yeah 256 work and look fine.
Post Reply

Return to “Modding help”