[SOLVED] Struggling with Tint Masks and Underground Belts

Place to get help with not working mods / modding interface.
Post Reply
User avatar
MasterZenII
Burner Inserter
Burner Inserter
Posts: 16
Joined: Tue Apr 24, 2018 12:32 am
Contact:

[SOLVED] Struggling with Tint Masks and Underground Belts

Post by MasterZenII »

My findings from this adventure:

In standard animation_set = { ... }
you can use layers = { { stuff 1 }, { stuff 2 } } and so on to declare multiple different graphics for a single entity.

An entity that uses a sheet = { ... } such as underground belts
is a different story, but thankfully not difficult to adapt for multiple graphics.
instead of sheet = { ... } just use sheets = { ... }
this should have been apparent to me as it follows the same standard as icon / icons

The next big find was that Factorio by default crops empty space on spritesheets. I was having issues with my belt tint masks being displaced and that threw me off...but my tint mask graphic was just little arrows in a void of alpha emptiness and Factorio was doing it's job. The two solutions to this problem are to
A) Account for this and use shift = { x, y }
or
B) Declare flag = { "no-crop" } to stop Factorio from cropping alpha

In some instances the shift is probably the better thing to use, but since my graphics were already made so that everything would be layered perfectly the no-crop method was my choice.

Hopefully this helps someone else down the road! ...also I know it isn't a quote but it sticks out better this way.

I'm trying to make new graphics for the belts from UltimateBelts. The mod from Pankeko that updated the graphics just didn't do it for me as the color of the base belts themselves was different. Anyways. I've managed to get transport belts and splitters recolored using tint masks, but for the life of me I cannot figure out how to get underground belts to cooperate.

I'm getting this error:

Error loading mods
Failed to load mods: Error while loading entity prototype "original-ultimate-underground-belt" (underground-belt): Value must be a dictionary in property tree at ROOT.underground-belt.original-ultimate-underground-belt.structure.direction_in.sheet

I have a separate lua file setting colors and establishing belt animations. The script for one of the underground belts is here, the rest are identical apart from names and variables that reference tint colors and belt animation sets from the other file.

Code: Select all


data:extend(
{

{
    type = "item",
    name = "original-ultimate-underground-belt",
    icons = {
      {
        icon = "__zenultimaterecolor__/graphics/icons/underground.png",
        icon_size = 32,
      },
      {
        icon = "__zenultimaterecolor__/graphics/icons/underground-mask.png",
        icon_size = 32,
        tint = t5,
      },
    },
    icon_size = 32,
    subgroup = "belt",
    order = "b[underground-belt]-h[ultimate-underground-belt]",
    place_result = "original-ultimate-underground-belt",
    stack_size = 50
  },
  
  }
  }
  {
    type = "underground-belt",
    name = "original-ultimate-underground-belt",
    icons = {
      {
        icon = "__zenultimaterecolor__/graphics/icons/splitter.png",
        icon_size = 32,
      },
      {
        icon = "__zenultimaterecolor__/graphics/icons/splitter-mask.png",
        icon_size = 32,
        tint = t5,
      },
    },
    icon_size = 32,
    flags = {"placeable-neutral", "player-creation"},
    minable = {hardness = 0.2, mining_time = 0.5, result = "original-ultimate-underground-belt"},
    max_health = 600,
    corpse = "small-remnants",
    max_distance = 50,
    underground_sprite =
    {
      filename = "__core__/graphics/arrows/underground-lines.png",
      priority = "high",
      width = 64,
      height = 64,
      x = 64,
      scale = 0.5
    },
    underground_remove_belts_sprite =
    {
      filename = "__core__/graphics/arrows/underground-lines-remove.png",
      priority = "high",
      width = 64,
      height = 64,
      x = 64,
      scale = 0.5
    },
    resistances =
    {
      {
        type = "fire",
        percent = 60
      },
      {
        type = "impact",
        percent = 30
      }
    },
    collision_box = {{-0.4, -0.4}, {0.4, 0.4}},
    selection_box = {{-0.5, -0.5}, {0.5, 0.5}},
    animation_speed_coefficient = 32,
    belt_animation_set = t5_belt_animation_set,
    fast_replaceable_group = "transport-belt",
    speed = 0.9375,
    structure =
     {
      direction_in =
      {
        sheet =
        {

				{
					filename = "__zenultimaterecolor__/graphics/entities/low/underground.png",
					priority = "extra-high",
					width = 96,
					height = 96,
					y = 96,
					hr_version =
					{
						filename = "__zenultimaterecolor__/graphics/entities/high/underground.png",
						priority = "extra-high",
						width = 192,
						height = 192,
						y = 192,
						scale = 0.5
					}
				},
				{
					filename = "__zenultimaterecolor__/graphics/entities/low/underground-mask.png",
					priority = "extra-high",
					width = 96,
					height = 96,
					y = 96,
					tint = t5,
					hr_version =
					{
						filename = "__zenultimaterecolor__/graphics/entities/high/underground-mask.png",
						priority = "extra-high",
						width = 192,
						height = 192,
						y = 192,
						scale = 0.5,
						tint = t5,
					}
				}
			
        }
      },
      direction_out =
      {
        sheet =
        {

				{
					filename = "__zenultimaterecolor__/graphics/entities/low/underground.png",
					priority = "extra-high",
					width = 96,
					height = 96,
					hr_version =
					{
						filename = "__zenultimaterecolor__/graphics/entities/high/underground.png",
						priority = "extra-high",
						width = 192,
						height = 192,
						scale = 0.5
					}
				},
				{
					filename = "__zenultimaterecolor__/graphics/entities/low/underground-mask.png",
					priority = "extra-high",
					width = 96,
					height = 96,
					tint = t5,
					hr_version =
					{
						filename = "__zenultimaterecolor__/graphics/entities/high/underground-mask.png",
						priority = "extra-high",
						width = 192,
						height = 192,
						scale = 0.5,
						tint = t5,
					}
				}
			
        }
      },
      direction_in_side_loading =
      {
        sheet =
        {
	
				{
					filename = "__zenultimaterecolor__/graphics/entities/low/underground.png",
					priority = "extra-high",
					width = 96,
					height = 96,
					y = 96*3,
					hr_version =
					{
						filename = "__zenultimaterecolor__/graphics/entities/high/underground.png",
						priority = "extra-high",
						width = 192,
						height = 192,
						y = 192*3,
						scale = 0.5
					}
				},
				{
					filename = "__zenultimaterecolor__/graphics/entities/low/underground-mask.png",
					priority = "extra-high",
					width = 96,
					height = 96,
					y = 96*3,
					tint = t5,
					hr_version =
					{
						filename = "__zenultimaterecolor__/graphics/entities/high/underground-mask.png",
						priority = "extra-high",
						width = 192,
						height = 192,
						y = 192*3,
						scale = 0.5,
						tint = t5,
					}
				}
			
        }
      },
      direction_out_side_loading =
      {
        sheet =
        {
			
				{
					filename = "__zenultimaterecolor__/graphics/entities/low/underground.png",
					priority = "extra-high",
					width = 96,
					height = 96,
					y = 96*2,
					hr_version =
					{
						filename = "__zenultimaterecolor__/graphics/entities/high/underground.png",
						priority = "extra-high",
						width = 192,
						height = 192,
						y = 192*2,
						scale = 0.5
					}
				},
				{
					filename = "__zenultimaterecolor__/graphics/entities/low/underground-mask.png",
					priority = "extra-high",
					width = 96,
					height = 96,
					y = 96*2,
					tint = t5,
					hr_version =
					{
						filename = "__zenultimaterecolor__/graphics/entities/high/underground-mask.png",
						priority = "extra-high",
						width = 192,
						height = 192,
						y = 192*2,
						scale = 0.5,
						tint = t5,
					}
				}
			
        }
      },
      back_patch =
      {
        sheet =
        {
		  filename = "__base__/graphics/entity/underground-belt/underground-belt-structure-back-patch.png",
          priority = "extra-high",
          width = 96,
          height = 96,
          hr_version =
          {
            filename = "__base__/graphics/entity/underground-belt/hr-underground-belt-structure-back-patch.png",
            priority = "extra-high",
            width = 192,
            height = 192,
            scale = 0.5
          }
        }
      },
      front_patch =
      {
        sheet =
        {
          filename = "__base__/graphics/entity/underground-belt/underground-belt-structure-front-patch.png",
          priority = "extra-high",
          width = 96,
          height = 96,
          hr_version =
          {
            filename = "__base__/graphics/entity/underground-belt/hr-underground-belt-structure-front-patch.png",
            priority = "extra-high",
            width = 192,
            height = 192,
            scale = 0.5
          }
        }
      }
    },
    
  },
  }
  )

If providing the files themselves would be more helpful I can. And I'm nearly certain I'm just doing something stupid and don't know any better.
Last edited by MasterZenII on Thu Feb 27, 2020 4:54 am, edited 1 time in total.

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

Re: Struggling with Tint Masks and Underground Belts

Post by Deadlock989 »

The "sheet" property is really hard to get right so don't beat yourself up.

I can't really read it properly from the nasty forum code box but at first glance it looks like you've got the nesting wrong - i.e. a level too deep of { and }. That's what that error usually indicates, anyway. It's expecting to find all the properties of a sheet and instead it's finding another table.
Image

User avatar
MasterZenII
Burner Inserter
Burner Inserter
Posts: 16
Joined: Tue Apr 24, 2018 12:32 am
Contact:

Re: Struggling with Tint Masks and Underground Belts

Post by MasterZenII »

Thanks for stopping by to help. The other parts were much easier as I could just use layers = { all my junk } and it was happy. Sheets just didn't seem to want to work with layers though in any combination or order I tried.

I'll provide just this lua file by itself for now, the full mod right now is a bit chunky and I haven't cleaned all the notes to myself and such out of it yet. XD

I can try bringing it up one tier. i.e. eliminating a set of curly brackets, but then I think the comma at the end of declaring the uncolored base entity graphics would close the sheet property ? I might be wrong. The other errors have been much more helpful on trying to track down how to fix it.
-le sigh-
ultimate-underground-belts.lua
(34.05 KiB) Downloaded 68 times

User avatar
MasterZenII
Burner Inserter
Burner Inserter
Posts: 16
Joined: Tue Apr 24, 2018 12:32 am
Contact:

Re: Struggling with Tint Masks and Underground Belts

Post by MasterZenII »

I WAS in fact being a dummy. Apparently sheets is a thing and does exactly what I wanted!

success.jpg
success.jpg (253.05 KiB) Viewed 1336 times
Now back to photoshop to clean up those masks...seeing them all in game made me go yikes. XD

User avatar
MasterZenII
Burner Inserter
Burner Inserter
Posts: 16
Joined: Tue Apr 24, 2018 12:32 am
Contact:

Re: Struggling with Tint Masks and Underground Belts

Post by MasterZenII »

Now I've got a weird new problem I did not anticipate... The tint mask just isn't quite right on the underground belts. Really obvious on the orange and lime green sets in the image I posted. The structure piece is okay, but on the belt piece I've got two offset overlays...

One big step closer though!

Edit: I have figured out that Factorio by default crops transparency. I may have to rework my tint masks to compensate for that? Unsure as of right now.
Currently trying to use flags = {"no-crop"} to stop this behavior in hopes that it fixes some issues.

Edit - Edit: Actual success! Reporting my findings in the OP for future mask tint users.

Post Reply

Return to “Modding help”