No Overhang

by Atria

Crops entity image if it exceeds entity's collision box

Tweaks
9 days ago
1.1 - 2.0
84

g Idea

8 months ago

Im thankful that someone made this, I can toggle the mod on and off if Im gonna go around cleaning up stuff.

I wonder though if its possible that building sprites could be overlayed with an opacity filter on a button in the UI. I dunno if this can be done in runtime but could be really cool

7 months ago

At first I thought about making the overhang part partially transparent but that itself turned out to be far to complex (because for every sprite I would have to create two sprites).

I don't think it is even possible to show/hide overhang during runtime at all, since the change has to be done during startup of the game

7 months ago
(updated 7 months ago)

what you can do is swap out the sprites at runtime if you iterate over all entities of specific entity types.
however that would require a lot of extra sprites and asides of the fact if you can even figure out how to do all of this correctly, you would bloat the game a lot with additional sprites which depending on user choice might not be used at all but still increase the games loading time, the time it takes to install/update the mod and potentially even memory usage during the phases of which the game has them actively loaded to validate them and whatever other steps it goes through.
so it may not be a good idea to make it a choice and instead tell the user to choose to toggle it by enabling and disabling the mod.

7 months ago

Aren't prototypes (along with their pictures/animations) read only during runtime?

7 months ago

i was thinking you could point at runtime do a different sprite but i just checked on the documentation and yes its only possible to edit at data stage.
so it would either need to be a startup setting which would force the game to restart and re define the prototype with the new setting or alternative seperate prototypes but then you run in the same issue as alpha biomes by having to manage arround the entity limit which can depending on mods/modpack result in not being able to apply the effect on all desired entities.

7 months ago

Yeah its a problem with system resources; you could make a seperate png for each entity with larger then tile image and redraw any excess of the sprite with an alpha layer and have the building switch states on a custom event which would be triggered by a UI button. However this would double the inactive machine frames for every building, and doing so during startup would Im sure SUBSTANTIALLY increase load times. It might be worth trying just to look into testing if it might be worth it. Potentially you could create an image cache that is saved between loads that would reduce the long load times but without trying it out its hard to say

7 months ago

This feels like something I just won't be doing at all.

6 months ago

For this mod of mine I changed all visible entity graphics to add another layer, and tint it. If you're still considering the opacity thing you can reuse some of my code if you want. Basically makes sure everything has layers, and then cut every layer in two. Still some math to do, but the annoying part should be a little easier at least.

6 months ago
(updated 6 months ago)

I was doing a TransparentOverhang first, but in theory every sprite would have to be split into up to 5 sprites. That would be ok for buildings with simple sprites, but once you look at all the possibilities how sprites/animations can be configured in Factorio I quickly decided to just not do that.

There is 29 functions which are used for processing of sprites/animations, one for each way of how sprite/animation can be configured. All of this still would have to be there, to get the non-transparent part of the sprite and then there would have to be another 29 functions for transparent parts of every sprite/animation definition type.

No thanks. :D

New response