Factorissimo2


Factorissimo adds factory buildings to Factorio. Place them down, walk in, build your factories inside!

Content
3 years ago
0.14 - 1.1
222K

b Help with building resizing

4 years ago
(updated 4 years ago)

So I am working on getting into modding and wanted to start with what I thought would be something simple, cut the size of all factories in this mod in half. I resized the .png images, and edited the collision/selection boxes to match the new limits and it is indeed the correct size. However I have an issue with the outside overlay (markers for belting items in). I can not figure out how to make them match up to line up with the outside of the half-sized building, so they are way out where the building would be at it's original size (see image below):
https://imgur.com/a/0kjIN0C

I've tried editing values in the layout.lua file, but nothing I change seems to make a difference. I was wondering where I make the changes to the outside factory belt overlay tiles so it matches the new sizes (also, I would love to center the item overlay, but also am unsure what to edit to center those over the building)?

Thanks!

4 years ago
(updated 4 years ago)

To move the overlay icons, you need to edit the "overlays" section. The "overlay_x" and "overlay_y" refer to something different, namely the two-sprite hack I used to make layering work decently.

To edit the connection positions, you need to edit the "connections" section.

4 years ago
(updated 4 years ago)

To move the overlay icons, you need to edit the "overlays" section. The "overlay_x" and "overlay_y" refer to something different, namely the two-sprite hack I used to make layering work decently.

Thanks. I worked on a few changes under connections, like dividing the outside-factiry bounding boxes in half but I'll keep at it, thanks for narrowing that down for me! I think I spent most of my time editing layout.lua and got nowhere...

To edit the connection positions, you need to edit the "connections" section.

I saw on line 122 and something similar on 166:

position = {cpos.outside_x + factory.outside_x, cpos.outside_y + factory.outside_y},

If I divide this by 2 shouldnt it reposition the outside entity connections to line up with the half sized building?

4 years ago

No, don't edit any part of control.lua or things will break. The parts you need to change are all in layout.lua and in the prototypes and graphics folders.

4 years ago

No, don't edit any part of control.lua or things will break. The parts you need to change are all in layout.lua and in the prototypes and graphics folders.

Oh, I got you, I thought you meant the connections.lua file. I think there's something I'm missing in the layout.lua that's messing me up but I can't seem to put my finger on it. I've tried changing a lot of values but never see a new result. I am wondering though, I'm not replacing the factory building that this is testing on (which, as shown in the pic, has belts down at the existing connection points), would I need to remove and replace the factory to re-spawn the connection points? I may have already found what I needed if this is the case and just assumed it didn't take because I took a glance and exited when I saw the connections in their original positions.
0

4 years ago
(updated 4 years ago)

DELETED, SEE BELOW

4 years ago
(updated 4 years ago)

So I've tried dividing every connection or value I could find and removing/re-adding the existing factory I had wasn't updating. So as a quick-ditch effort I crafted a new factory and BAM, the outside connections lined up with the newly sized factories. The issue I have now is the inside of the factory being completely out of whack (likely from my last hail mary which divided way too many values in half when in reality I believe it was a small handful that were needed [will update this post with the exact values just in case someone else wants to know]). Makes sense that the existing entities would retain previous values if you need to move a factory.

So everything that needed changing was in the layout.lua (by everything, this does not include the original resize of the factory entities, which need are in prototypes/factory.lua and graphics/factory > resize images and match them with the factory.lua file. The layout.lua changes that were needed to be made were:

outside_size, outside_door_y, and the first two values of the connections arrays all adjust the outdoor layout

I'm still unsure of the overlay section. I've gotten the belts lined up semi-close but realized a few issues from reducing collision and selection boxes to half their original sizes shaved off .2 of their original values, and for some reason shifted to the left about 0.75, so an offset had to be introduced to the collision/selection boxes which I'm still working on centering, after which the belts need to be shifted to match. Thanks for your help in this, only has taken about 10 hours or so (a lot more work than I originally thought but didn't think about functionality on my first biggish modification to an existing mod :P )

4 years ago

Oh, you tested your values on a prebuilt factory? That won't work. Every factory building stores its own layout values independently of layout.lua so potential layout updates don't break existing factories.

4 years ago

Oh, you tested your values on a prebuilt factory? That won't work. Every factory building stores its own layout values independently of layout.lua so potential layout updates don't break existing factories.

Yeah, I even saw the scripting for that and even thought about that while I was thinking about it at work, but when I got home I completely forgot and luckily I found out early enough. The issue that took the longest was texture shifting, I never divided the texture shift in two, so instead of editing that I was editing selection and collision boxes, adding offsets and the like until I figured out what I needed to do. Thanks for your help Magma, you saved me hours of messing around. Unfortunately I've only edited the layout settings for the 1st size factory, so I still have a lot of editing to do for the next two but at least now I know what to do and I do have one factory up and ready for processing!

New response