Hi there,
I was hoping I could find an answer to a burning matter in this forum...I tried different search terms, even over google but nothing helpful came up.
I want to add buildings and/or resize existing ones...like making a 1x1 chest into 2x2 etc (or even making buildings with 3x3 base size and 1x1 "nose" or sth like that)
I really hope someone can help me
kind regards
uhm...how to...add buildings/resize etc?
Re: uhm...how to...add buildings/resize etc?
I think you would be able to change the size by simply changing the collision box and animation of the chest to for example the one of a 2x2 furnace.
For example i once changed the turret base to the sprite of an assembling machine.
For example i once changed the turret base to the sprite of an assembling machine.
Re: uhm...how to...add buildings/resize etc?
yea I just figured collision box and selection box out but it din't make the building itself bigger...mhh
Re: uhm...how to...add buildings/resize etc?
I think I got it figured out...
I tried it with vanilla iron chest...I had to resize the png and change the width and height in the lua but a new problem occured. after I resized the png, the white part of the png got displayed too...I guess doing it in paint has unforeseen consequences
I tried it with vanilla iron chest...I had to resize the png and change the width and height in the lua but a new problem occured. after I resized the png, the white part of the png got displayed too...I guess doing it in paint has unforeseen consequences
Re: uhm...how to...add buildings/resize etc?
Paint can not handle transparency you should take a program like gimp.
Then it might work
Maybe you can tell me exactly what you have done? I am working on my first mod and i got the same Problem here.. but i have taken the base pictures until now...
Actually i am working with blender and try to get some good graphics done..
do you have successfully chanced a picture for animation too?
Then it might work
Maybe you can tell me exactly what you have done? I am working on my first mod and i got the same Problem here.. but i have taken the base pictures until now...
Actually i am working with blender and try to get some good graphics done..
do you have successfully chanced a picture for animation too?
- Arch666Angel
- Smart Inserter
- Posts: 1636
- Joined: Sun Oct 18, 2015 11:52 am
- Contact:
Re: uhm...how to...add buildings/resize etc?
you can just set the "scale=x" value in the animation/picture part, but it wont look pretty for bigger values, you have to adjust the boxes to the new size then
Angels Mods
I. Angel's Mods Subforum
II. Development and Discussion
III. Bugs & FAQ
"should be fixed"
I. Angel's Mods Subforum
II. Development and Discussion
III. Bugs & FAQ
"should be fixed"
Re: uhm...how to...add buildings/resize etc?
well...I tried something easy and opened the "entity.lua" in "\Steam\steamapps\common\Factorio\data\base\prototypes\entity" and isolated the iron chest entry
----------------------------
{
type = "container",
name = "iron-chest",
[shortened here]
collision_box = {{-0.35, -0.35}, {0.35, 0.35}},
selection_box = {{-0.5, -0.5}, {0.5, 0.5}},
[I think 1x1 is about 1 tile of concrete (-0.5 to 0.5 is 1; 0.0 is the center of the entity) and it looks like "collision box" (where you hit the building) is always a bit smaller than selection box (the yellow markers when you hover your mouse over building)]
[shortened here]
picture =
{
filename = "__base__/graphics/entity/iron-chest/iron-chest.png",
priority = "extra-high",
width = 48,
height = 34,
shift = {0.2, 0}
}
},
This is the part I was looking for...simply doubling the height and width will do nothing but produce errors when starting factorio...width and height is the same as the resolution of the iron-chest.png. In order to create bigger entities you have to change the png size and write the resolution in the lua.
Example...
I enlarged the iron chest x5...my png is now 240x170, I adjusted
collision box and selection box to
collision_box = {{-2.35, -2.35}, {2.35, 2.35}},
selection_box = {{-2.5, -2.5}, {2.5, 2.5}},
and height/width to
width = 240,
height = 170,
and this was the result
As you can see, the iron-chest picture and the collision and selection box don't match but this problem should be solveable by either adjusting the png-size or finding the right value of "shift = {0.2, 0}"
*edit: On second thought...the box fits pretty good on the concrete tiles...adjusting the collision and selection box 0.5 to the left should do the trick
Hope that helps...Im still a bloody newb and this was my first attempt
*edit: Havn't tried animations so far...guess it's the same but different
*edit: oh and you need different *.png's and settings when you create buildings which you want to be able to rotate them...
----------------------------
{
type = "container",
name = "iron-chest",
[shortened here]
collision_box = {{-0.35, -0.35}, {0.35, 0.35}},
selection_box = {{-0.5, -0.5}, {0.5, 0.5}},
[I think 1x1 is about 1 tile of concrete (-0.5 to 0.5 is 1; 0.0 is the center of the entity) and it looks like "collision box" (where you hit the building) is always a bit smaller than selection box (the yellow markers when you hover your mouse over building)]
[shortened here]
picture =
{
filename = "__base__/graphics/entity/iron-chest/iron-chest.png",
priority = "extra-high",
width = 48,
height = 34,
shift = {0.2, 0}
}
},
This is the part I was looking for...simply doubling the height and width will do nothing but produce errors when starting factorio...width and height is the same as the resolution of the iron-chest.png. In order to create bigger entities you have to change the png size and write the resolution in the lua.
Example...
I enlarged the iron chest x5...my png is now 240x170, I adjusted
collision box and selection box to
collision_box = {{-2.35, -2.35}, {2.35, 2.35}},
selection_box = {{-2.5, -2.5}, {2.5, 2.5}},
and height/width to
width = 240,
height = 170,
and this was the result
As you can see, the iron-chest picture and the collision and selection box don't match but this problem should be solveable by either adjusting the png-size or finding the right value of "shift = {0.2, 0}"
*edit: On second thought...the box fits pretty good on the concrete tiles...adjusting the collision and selection box 0.5 to the left should do the trick
Hope that helps...Im still a bloody newb and this was my first attempt
*edit: Havn't tried animations so far...guess it's the same but different
*edit: oh and you need different *.png's and settings when you create buildings which you want to be able to rotate them...
- Arch666Angel
- Smart Inserter
- Posts: 1636
- Joined: Sun Oct 18, 2015 11:52 am
- Contact:
Re: uhm...how to...add buildings/resize etc?
So 1 tile or 1 unit for "shift" is 32 pixels, you can see the tiles ingame by pausing the game, or activating the tile overlay in the debug menu.
collision_box= is the physical border of the entity e.g. the wall you are running against. If you want to allow passage between objects these have to be a bit smaller.
selection_box=Is the yellow box you see if you hover over an entity ingame.
picture=/animation= =Seem to do the same/are interchangeable if you are dealing with just one frame.
What you do is first set the collision box and then shift the picture into place as you need it. If you create a sprite/picture and set it up the right way (in 32 pixels increments) it will be easier to adjust it into the desired position.
After you get the hang of it, it is actually pretty easy, more challenging is the addition of small animations, or pipe overlays which are a pain in the ass...
collision_box= is the physical border of the entity e.g. the wall you are running against. If you want to allow passage between objects these have to be a bit smaller.
selection_box=Is the yellow box you see if you hover over an entity ingame.
picture=/animation= =Seem to do the same/are interchangeable if you are dealing with just one frame.
What you do is first set the collision box and then shift the picture into place as you need it. If you create a sprite/picture and set it up the right way (in 32 pixels increments) it will be easier to adjust it into the desired position.
After you get the hang of it, it is actually pretty easy, more challenging is the addition of small animations, or pipe overlays which are a pain in the ass...
Angels Mods
I. Angel's Mods Subforum
II. Development and Discussion
III. Bugs & FAQ
"should be fixed"
I. Angel's Mods Subforum
II. Development and Discussion
III. Bugs & FAQ
"should be fixed"