Page 1 of 1

Bugging ore entities.

Posted: Sat Jul 22, 2017 6:11 pm
by Grundox
So I copied the png of the iron ore entity in the base mod and used it for a new ore entity(the normal one not he high res). My graphics aren't high res so it shouldn't try to display the high res sheet (I guess). The problem now is that it looks completely weird and it even changed colors which I don't understand at all. Can anyone help me to fix this please?

Re: Bugging ore entities.

Posted: Sat Jul 22, 2017 7:47 pm
by Arch666Angel
It would be good if you upload the mod or at least provide the code snippet which include the definition for the ore sheet

Re: Bugging ore entities.

Posted: Sun Jul 23, 2017 7:41 am
by Grundox
Of course, I'm sorry, I forgot that.

Code: Select all

data:extend(
{
   {
   type = "autoplace-control",
   name = "agate",
   richness = true,
   order = "b-e"
   },
   {
   type = "noise-layer",
   name = "agate"
   },
   {
   type = "resource",
   name = "agate",
   icon = "__grundoxores__/graphics/icons/ores/agate.png",
   flags = {"placeable-neutral"},
   order="a-b-a",
   map_color = {r=0.26, g=0.30, b=0.39},
   minable =
   {
     hardness = 1,
     mining_particle = "agate-particle",
     mining_time = 1.5,
     result = "agate"
   },
   collision_box = {{ -0.1, -0.1}, {0.1, 0.1}},
   selection_box = {{ -0.5, -0.5}, {0.5, 0.5}},
   autoplace =
   {
      control = "agate",
      sharpness = 1,
      richness_multiplier = 5000,
      richness_multiplier_distance_bonus = 20,
      richness_base = 2000,
      coverage = 0.01,
      peaks = {
         {
            noise_layer = "agate",
            noise_octaves_difference = -1.5,
            noise_persistence = 0.3,
            starting_area_weight_optimal = 0,
            starting_area_weight_range = 0,
            starting_area_weight_max_range = 2,
         },
         {
            noise_layer = "agate",
            noise_octaves_difference = -2,
            noise_persistence = 0.3,
            starting_area_weight_optimal = 1,
            starting_area_weight_range = 0,
            starting_area_weight_max_range = 2,
         },
         {
            influence = 0.15,
            starting_area_weight_optimal = 1,
            starting_area_weight_range = 0,
            starting_area_weight_max_range = 2,
         }
      }
   },
    stage_counts = {1000, 600, 400, 200, 100, 50, 20, 1},
   stages =
   {
     sheet =
     {
      filename = "__grundoxores__/graphics/entity/ores/iron-ore.png",
      priority = "extra-high",
      tint = {r=0.26, g=0.30, b=0.39},
        width = 38,
        height = 38,
        frame_count = 4,
        variation_count = 8
     }
   },
  },

Re: Bugging ore entities.

Posted: Sun Jul 23, 2017 1:35 pm
by Arch666Angel
They changed the variables for the new ore sheets, they are different from the old 0.14 ones

Code: Select all

    stages =
    {
      sheet =
      {
        filename = "__base__/graphics/entity/" .. name .. "/" .. name .. ".png",
        priority = "extra-high",
        width = 64,
        height = 64,
        frame_count = 8,
        variation_count = 8,
      }
    },
for the low res variants (512x512 pixel sheet)
Be aware that they also changed the stage_counts, which determines which line the game chooses for an ore tile depending on how much ore is in that tile.

The color change is due to the

Code: Select all

tint = {}
command which adds a color to the picture (picture has to be a greyscale).

Re: Bugging ore entities.

Posted: Sun Jul 23, 2017 2:11 pm
by Grundox
Thank you for your great help. I'll try to fix this now. Why is there a tint option? You could also just change the color in eg paintnet. Is it so you can use one sheet for different ore entities?

Re: Bugging ore entities.

Posted: Sun Jul 23, 2017 2:19 pm
by Arch666Angel
Grundox wrote:Thank you for your great help. I'll try to fix this now. Why is there a tint option? You could also just change the color in eg paintnet. Is it so you can use one sheet for different ore entities?
That is the general idea, so you can use one sheet and just use the tint command to generate variations, saves a lot on size for gfx and you can somewhat automate the process.

Re: Bugging ore entities.

Posted: Sun Jul 23, 2017 3:33 pm
by Grundox
Okay that's actually really useful. Another question: How can I remove or delete all ore entities from the base mod without changing the code of the base mod?

Re: Bugging ore entities.

Posted: Mon Jul 24, 2017 8:30 am
by bobingabout
Grundox wrote:Thank you for your great help. I'll try to fix this now. Why is there a tint option? You could also just change the color in eg paintnet. Is it so you can use one sheet for different ore entities?
Take my ores mod for example.
I have only 5 ore sheet images (plus high res versions, a special one for gems, etc) based on the 5 ores in game, but by using tint, I actually add as many as 16 ores. Gold and Silver for example both use a greyscale recolour(and change of contrast, brightness etc to work right for a tintable sheet) of copper, tinted to orange and a blue/grey in game. Tin, Lead, Tungsten etc. use a tinted greyscale of iron. etc.

If you want to use it, my library mod, which includes these tint sheets, offers an easy way to add new ores to the game. Of course your mod then requires my library mod be installed to work, but it does make life easier. You can make a fully functional ore in just a few lines of code.
you'd need to look at my ores mod for an example on how to code the ore though.