given sprite rectangle outside actual sprite size??

Place to get help with not working mods / modding interface.
Post Reply
qqwertt
Burner Inserter
Burner Inserter
Posts: 13
Joined: Fri May 08, 2020 6:26 pm
Contact:

given sprite rectangle outside actual sprite size??

Post by qqwertt »

So I'm making a glorified loader with a large size, the sprite size is exactly 300x100.
Image
This is rotator.png (placeholder)
Image
This is my code for the entity

Code: Select all

{
      name="cargo-rotator",
      type="loader-1x1",
      filter_count=1,
      structure={
        direction_in={filename="__QwrtMod__/graphics/entity/rotator.png",size={300,100}},
        direction_out={filename="__QwrtMod__/graphics/entity/rotator.png",size={300,100}},
      },
      belt_animation_set={
        animation_set={direction_count=20,frame_count=1,filename="__QwrtMod__/graphics/entity/rotator.png",size={300,100}},
      },
      speed=8,
      icon="__QwrtMod__/graphics/placeholder.png",
      icon_size=64,
      collision_box={{-2.4,-0.4},{2.4,0.4}},
      selection_box={{-2.4,-0.4},{2.4,0.4}},
      placeable_by={item="cargo-rotator",count=1},
      flags={"placeable-neutral","player-creation"},
      minable={hardness=0.2,mining_time=0.5,result="cargo-rotator"},
    }

Hiladdar
Fast Inserter
Fast Inserter
Posts: 214
Joined: Mon May 14, 2018 6:47 pm
Contact:

Re: given sprite rectangle outside actual sprite size??

Post by Hiladdar »

In this case the clue is in the error message, ... top-0x100, right_bottom=300x200, ... followed by ... right_bottom=300x100 ...

The mismatch between what the system expects and what is provided.

When working in belts, I would recommend that you also take a look at the functions which are called by the entity definition of the belt. The command:

Code: Select all

belt_animation_set={
        animation_set={direction_count=20,frame_count=1,filename="__QwrtMod__/graphics/entity/rotator.png",size={300,100}},
      },
is a function call to common function used to define animation for belts. It could be that something is being passed from your entity definition to this function that the internal code does not like.

Hiladdar

User avatar
kirazy
Filter Inserter
Filter Inserter
Posts: 416
Joined: Tue Mar 06, 2018 12:18 am
Contact:

Re: given sprite rectangle outside actual sprite size??

Post by kirazy »

Your issue is with belt animation set. You're using an image with one direction but specify 20. So it's looking for an image 2000 pixels tall. You should use the belt sprite sheet here anyways, not your loader prototype.

qqwertt
Burner Inserter
Burner Inserter
Posts: 13
Joined: Fri May 08, 2020 6:26 pm
Contact:

Re: given sprite rectangle outside actual sprite size??

Post by qqwertt »

that worked, thanks!!

User avatar
kirazy
Filter Inserter
Filter Inserter
Posts: 416
Joined: Tue Mar 06, 2018 12:18 am
Contact:

Re: given sprite rectangle outside actual sprite size??

Post by kirazy »

Also if you're making a larger loader, why use the loader-1x1 prototype and not the loader prototype?

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: given sprite rectangle outside actual sprite size??

Post by darkfrei »

You can use the same picture for all of expected sprites, just use the stripes:
(example from Burner Offshore Pump)

Special multiplication function:

Code: Select all

function make_stripes (count, filename)
	local stripe = {filename=filename, width_in_frames = 1, height_in_frames = 1}
	local stripes = {}
    for i = 1, count do
      stripes[i] = stripe
    end
  return stripes
end
Code from animation:

Code: Select all

local layer =
{
  stripes = make_stripes (8*4, dir .. "offshore-pump_north.png"),
  priority = "high",
  frame_count = 32,
  animation_speed = 0.25,
  width = 48,
  height = 84
}
The code makes same picture for every sprite.

Post Reply

Return to “Modding help”