Page 1 of 6
[MOD 1.1] Squeak Through 1.8.2
Posted: Sun Sep 20, 2015 9:05 pm
by Supercheese
Squeak Through
Though this is quite an old mod by now (as evidenced by the images here), I am grateful for continued strong community support. Thanks everyone!
You can walk right on through your rows of furnaces and assemblers, but...
Info:
- This small mod slightly reduces the collision boxes for many structures, allowing you to "squeak through" them while walking around your base.
Say goodbye to the frustration of having your path blocked by your steam engines or solar panels when walking around your base!
- Name: Squeak Through
- Latest Release: v1.8.2, February 21, 2021
- Factorio Version: 1.1
- License: GNU GPL
- Authors: Nommy, Lupin, Foxite, Supercheese, & the community
- Github: https://github.com/Suprcheese/Squeak-Through
Long Description:
This mod slightly reduces the collision boxes of the following entity types (as found in type = "..." in the prototype definition), including both vanilla and modded structures, so that you can walk between them when two are adjacent:
- "solar-panel"
- "accumulator"
- "generator"
- "pipe"
- "pipe-to-ground"
- "heat-pipe"
- "reactor"
- "programmable-speaker"
- "container"
- "logistic-container"
- "assembling-machine"
- "arithmetic-combinator"
- "decider-combinator"
- "constant-combinator"
- "boiler"
- "electric-pole"
- "mining-drill"
- "pump"
- "radar"
- "storage-tank"
- "tree"
- "turret"
- "beacon"
- "furnace"
- "lab"
Note to modders:
New in version 1.4.0 is that Squeak Through will now look for the entity prototype value "squeak_behaviour", which if set to false will mean the entity is excluded from having its bounding box adjusted. Simply adding
in the relevant entity prototype should suffice.
While this alone will not immediately address mod compatibility issues, it does provide an easier step than before.
For future compatibility issues, feature requests, bug reports, etc. I would direct all interested parties primarily to GitHub:
https://github.com/Suprcheese/Squeak-Through
Re: [MOD 0.12.X] Squeak Through
Posted: Sun Sep 20, 2015 10:15 pm
by Klonan
Lol i love those images!
Great work
Re: [MOD 0.12.X] Squeak Through
Posted: Tue Sep 22, 2015 12:36 pm
by thatsIch
There was a 0.11 mod which was called Jetpack. I wonder if it is based on the same principle.
Nice images though!
Re: [MOD 0.12.X] Squeak Through
Posted: Fri Oct 23, 2015 12:27 pm
by Nommy
This mod is great!
I looked into it a bit and found out how to make it work dynamically so that the sizes of things added by mods is adjusted too. I'll attach the code (data-final-fixes.lua) and if you want you could replace your data.lua with that file and use it instead. I'd rather that than release it as a separate mod because it does the same thing and I probably won't update it for long anyway, and this is your idea, but if you don't want to use it I will so that other people can squeak through mod stuff too.Those pics made me LOL too BTW.
Anyway this is how it works:
Naming the file data-final-fixes.lua causes the code to run after all data.lua (and data-updates.lua) files from other mods have been processed, so their prototypes will exists when this code executes.
There's a table at the top which defines the prototype types you want to check and the minimum gap required to walk between them.
Code: Select all
local prototype_type_gap_requirements = {
["solar-panel"] = 0.25,
["accumulator"] = 0.25,
["generator"] = 0.25,
["pipe"] = 0.42,
....
It checks all prototypes of these types (so all solar-panels and all pipess etc.) and adjusts the dimensions of the collision box by just enough to make the gap at the edge as large as the size you specify in the list. It doesn't matter how big the thing is because it calculates how big the gap at the edge is and changes the dimensions based on that, only if needed (done in adjust_coordinate_to_form_gap()).
I added a few more, like trees and turrets etc. from the
list on the wiki too.
That's the idea anyway, I've only tested it a little, but it seems to be working as intended. You can walk between bobs steam engines and stuff from other mods too.
Edit: Here's the whole data-final-fixes.lua file for anyone interested, there's not much to it.
Code: Select all
-- Note: Any mods which define the collision box size of prototypes in data-final-fixes.lua will not be affected by this code if that mod loads after this one.
-- Prototypes normally defined in data.lua, or data-updates.lua will be loaded before this executes and properly updated.
-- Table of prototype types to check and the minimum gap required to allow walking in between them.
local prototype_type_gap_requirements = {
["solar-panel"] = 0.25,
["accumulator"] = 0.25,
["generator"] = 0.25,
["pipe"] = 0.42,
["pipe-to-ground"] = 0.42,
["container"] = 0.25,
["smart-container"] = 0.25,
["logistic-container"] = 0.25,
["assembling-machine"] = 0.25,
["arithmetic-combinator"] = 0.25,
["decider-combinator"] = 0.25,
["constant-combinator"] = 0.25,
["boiler"] = 0.42,
["electric-pole"] = 0.25,
["mining-drill"] = 0.25,
["pump"] = 0.42,
["radar"] = 0.25,
["storage-tank"] = 0.25,
["tree"] = 0.25,
["turret"] = 0.25,
["beacon"] = 0.25,
["furnace"] = 0.25,
["lab"] = 0.25,
}
-- All defined prototypes of the types listed above will be checked in adjust_collision_boxes() and have their collision boxes reduced to form the specified gap where needed.
-- Returns a coordinate reduced where required to form the specified gap between it and the tile boundary.
local function adjust_coordinate_to_form_gap(coordinate, required_gap)
-- Treat all coordinates as positive to simplify calculations.
local is_negative_coordinate = (coordinate < 0)
if is_negative_coordinate then
coordinate = coordinate * -1
end
local tile_width = 0.5
-- Calculate the existing gap (how much space there is to the next tile edge or 0 when the coordinate lies on a tile edge).
local distance_past_last_tile_edge = coordinate % tile_width -- This is how far the collision box extends over any tile edge, and should be 0 for a perfect fit.
local existing_gap = 0
if distance_past_last_tile_edge > 0 then
existing_gap = (tile_width - distance_past_last_tile_edge)
end
-- Reduce the coordinate to make the gap large enough if it is not already.
if existing_gap < required_gap then
coordinate = coordinate + existing_gap - required_gap
end
-- Make the coordinate negative again if it was originally negative.
if is_negative_coordinate then
coordinate = coordinate * -1
end
return coordinate
end
-- Checks all existing prototypes listed in prototype_type_gap_requirements and reduces their collision box to make a gap large enough to walk though if it is not already.
local function adjust_collision_boxes()
for prototype_type, required_gap in pairs(prototype_type_gap_requirements) do
for key, prototype in pairs(data.raw[prototype_type]) do
-- If the prototype has a collision box then resize it.
if prototype["collision_box"] then
for y=1,2 do
for x=1,2 do
prototype.collision_box[x][y] = adjust_coordinate_to_form_gap(prototype.collision_box[x][y], required_gap)
end
end
end
end
end
end
-- Make the adjustments.
adjust_collision_boxes()
Re: [MOD 0.12.X] Squeak Through
Posted: Tue Oct 27, 2015 6:59 pm
by Supercheese
Wow, awesome! I'm glad you liked the initial idea, and your implementation is certainly much more flexible. I'll package an update as soon as I can.
Re: [MOD 0.12.X] Squeak Through
Posted: Thu Oct 29, 2015 11:09 pm
by Nommy
Awesome! I'd forgotten about this until just now.
I was thinking before if there could be any issues with weirdly sized collision boxes and there could be one if a normally a negative coordinate was 0 for some reason. I'll post an update in the next day or so to handle this correctly, and to make sure it doesn't change boxes that are set = {{0, 0}, {0, 0}} designating no collisions as well.
Re: [MOD 0.12.X] Squeak Through
Posted: Sun Dec 27, 2015 7:32 am
by A_Factorio457
I replaced the old data.lua with this one. I have an issue with BioFarm where it's poles (which have a 0 size) can't be loaded correctly. So I made it dependent on squeak through so it loads after squeak through. Now BioFarm loads but everything in it is gone. Please Help
Re: [MOD 0.12.X] Squeak Through
Posted: Thu Mar 03, 2016 4:44 pm
by binbinhfr
great mod, thanks.
however, it can mess up other mods.
For example, the Rail Tanker mod, very useful to transport oil via rail, but that use the "small pump" to load/unload oil.
If you change the hitbox of small pump, the Rail Tanker does not connect anymore.
So I put the "small pump" line in comment to avoid this. Because afterall, you do not bump so often into a small pump
Re: [MOD 0.12.X] Squeak Through
Posted: Thu Mar 03, 2016 9:18 pm
by Supercheese
binbinhfr wrote:great mod, thanks.
however, it can mess up other mods.
For example, the Rail Tanker mod, very useful to transport oil via rail, but that use the "small pump" to load/unload oil.
If you change the hitbox of small pump, the Rail Tanker does not connect anymore.
So I put the "small pump" line in comment to avoid this. Because afterall, you do not bump so often into a small pump
The rail tanker mod does not add any extra "pump" type entities -- the mod just asks you to use vanilla small pumps to connect to the tanker. I do not see how altering the collision box of the vanilla pump would cause problems here...
Re: [MOD 0.12.X] Squeak Through
Posted: Thu Mar 03, 2016 11:06 pm
by binbinhfr
Supercheese wrote:binbinhfr wrote:great mod, thanks.
however, it can mess up other mods.
For example, the Rail Tanker mod, very useful to transport oil via rail, but that use the "small pump" to load/unload oil.
If you change the hitbox of small pump, the Rail Tanker does not connect anymore.
So I put the "small pump" line in comment to avoid this. Because afterall, you do not bump so often into a small pump
The rail tanker mod does not add any extra "pump" type entities -- the mod just asks you to use vanilla small pumps to connect to the tanker. I do not see how altering the collision box of the vanilla pump would cause problems here...
I cannot tell you why it works, but commenting the "small pump" line in Squeak Mod, so reversing to original value, make the train to pump connection work again... It's a simple test to make.
Re: [MOD 0.12.X] Squeak Through
Posted: Tue Mar 22, 2016 4:10 am
by Zackreaver
I believe it's because the collision box is used for locating the location of the pump, and modifying it actually makes it believe they aren't close enough.
I commented out small pump and it also fixes the problem, I would suggest just commenting out small pump since we never really have problems with pumps blocking paths.
Re: [MOD 0.12.X] Squeak Through
Posted: Tue Mar 22, 2016 4:12 am
by Supercheese
Yeah I guess that does make sense. I've removed the Small Pump from the affected entities in version 1.0.1.
Re: [MOD 0.12.X] Squeak Through 1.0.1
Posted: Sat Apr 09, 2016 6:27 pm
by Lupin
I had problems with the dynamic code above with mods that add entities with a 0,0-collision box (like "Bio Farm" or "Powered Entities"). I got an error along the line "colliosion box must contain point {0,0}"
I added the following lines checking, if the coordinate would be less than 0 and set it to 0 in that case. It seems to have solved the problem.
Code: Select all
-- Reduce the coordinate to make the gap large enough if it is not already.
if existing_gap < required_gap then
coordinate = coordinate + existing_gap - required_gap
if coordinate < 0 then
coordinate = 0
end
end
Re: [MOD 0.12.X] Squeak Through 1.0.1
Posted: Sun Apr 10, 2016 2:03 am
by Supercheese
Lupin wrote:I had problems with the dynamic code above with mods that add entities with a 0,0-collision box (like "Bio Farm" or "Powered Entities"). I got an error along the line "colliosion box must contain point {0,0}"
I added the following lines checking, if the coordinate would be less than 0 and set it to 0 in that case. It seems to have solved the problem.
Very nice. I've updated the mod to version 1.1.0, which (at long last!) includes the proper code to search all loaded entities and make sure you can Squeak Through when they are placed side by side.
This also means that there is really nothing left of the original mod code that I wrote! It seems I've switched from author to maintainer for this one.
Full changes:
Removed original (extremely simple) code and incorporated the more advanced code by Nommy:
viewtopic.php?p=114341#p114341
Also incorporated Lupin's solution to some incompatibility issues with other mods:
viewtopic.php?p=146721#p146721
This means that all structures of the following prototypes are affected by the mod now, including both vanilla and modded structures:
- "solar-panel"
- "accumulator"
- "generator"
- "pipe"
- "pipe-to-ground"
- "container"
- "smart-container"
- "logistic-container"
- "assembling-machine"
- "arithmetic-combinator"
- "decider-combinator"
- "constant-combinator"
- "boiler"
- "electric-pole"
- "mining-drill"
- "radar"
- "storage-tank"
- "tree"
- "turret"
- "beacon"
- "furnace"
- "lab"
Re: [MOD 0.12.X] Squeak Through 1.1.0
Posted: Wed Apr 13, 2016 8:39 pm
by Sander_Bouwhuis
Oooooooooooooooooooooooohhhhhhhhhhhhhhhh, thank you , thank you, thank you!!!!!
Bumping into things, especially in oil production facilities is a HUGE and UNNECESSARY annoyance.
Re: [MOD 0.12.X] Squeak Through 1.1.0
Posted: Wed Apr 13, 2016 9:06 pm
by Supercheese
Sander_Bouwhuis wrote:Oooooooooooooooooooooooohhhhhhhhhhhhhhhh, thank you , thank you, thank you!!!!!
Bumping into things, especially in oil production facilities is a HUGE and UNNECESSARY annoyance.
Indeed it is, those were my thoughts exactly.
Re: [MOD 0.12.X] Squeak Through 1.1.0
Posted: Sun Apr 17, 2016 2:01 pm
by steinio
Hello,
i get this error if i start with uranium power and squeak through.
Greetings steinio
Re: [MOD 0.12.X] Squeak Through 1.1.0
Posted: Mon Apr 18, 2016 6:41 am
by Winseven4lyf
steinio wrote:Hello,
i get this error if i start with uranium power and squeak through.
Greetings steinio
@steinio, I believe this is because the "lube-port" was resized, and the pipe connection point is probably too far away now, and probably invalid. I have no idea how to fix your problem though
Re: [MOD 0.12.X] Squeak Through 1.1.0
Posted: Mon Apr 18, 2016 12:36 pm
by Nommy
Winseven4lyf wrote:steinio wrote:Hello,
i get this error if i start with uranium power and squeak through.
Greetings steinio
@steinio, I believe this is because the "lube-port" was resized, and the pipe connection point is probably too far away now, and probably invalid. I have no idea how to fix your problem though
@Winseven4lyf, yeah, I think you're right.
@steinio,
you can fix this by commenting out the storage-tank line in data-final-fixes.lua to disable resizing of that the same way pump is disabled.
- Unzip Squeak Through_1.1.0.zip into the folder which it's in then delete the zip file (it works just the same when extracted).
- Open the data-final-fixes.lua file in the extracted mod folder in notepad or any text editor.
- Put -- in front of ["storage-tank"] on line 23 and save. It should work now when you restart factorio.
So it should look like this:
Code: Select all
-- ["pump"] = 0.42, -- Removed for compatibility with Rail Tanker mod
["radar"] = 0.25,
-- ["storage-tank"] = 0.25,
["tree"] = 0.25,
Lupin wrote:I had problems with the dynamic code above with mods that add entities with a 0,0-collision box (like "Bio Farm" or "Powered Entities"). I got an error along the line "colliosion box must contain point {0,0}"
I added the following lines checking, if the coordinate would be less than 0 and set it to 0 in that case. It seems to have solved the problem.
Code: Select all
-- Reduce the coordinate to make the gap large enough if it is not already.
if existing_gap < required_gap then
coordinate = coordinate + existing_gap - required_gap
if coordinate < 0 then
coordinate = 0
end
end
@Lupin, that looks good to me too. I foresaw this problem but had stopped playing and never got around to doing a fix, so sorry about that and thanks for sorting it out.
Adding mod compatibility config
I was just setting up some code to allow specifying which stuff should not be resized when certain mods are loaded in a config like this:
Code: Select all
exclusions = {
{ -- UraniumPower mod
apply_when_object_exists = {
type = "storage-tank",
name = "lube-port"
},
prototype_type_exclusions = { -- exclude by type
"storage-tank",
"pump"
}
},
{ -- Another mod
apply_when_object_exists = {
type = "accumulator",
name = "amazing-accumulator"
},
prototype_exclusions = { -- exclude specific prototypes
"amazing-accumulator",
"super-amazing-accumulator"
}
},
{ -- Permanent exclusions (no apply_when_object_exists)
prototype_exclusions = {
"thing-to-never-resize",
"another-thing-to-never-resize"
}
},
}
The
apply_when_object_exists part is to tell it an object the mod adds, like a prototype, recipe or tech or something which it can search for to determine if the mod is loaded.
Then you can list prototype types or specific prototypes which should not be resized when that mod is running. I was also thinking to make it so you could define a list of specific prototypes to never resize by adding an entry without the
apply_when_object_exists part.
I'm probably not going to be around for long again, but maybe that might make maintaining it easier, IDK.
@Supercheese, would this be useful do you think?
Do you or anyone else have any other ideas, suggestions or stuff you want added?
Now's the time because I'll likely fiddle around for a few days then not end up checking this forum again in ages ;D
Re: [MOD 0.12.X] Squeak Through 1.1.0
Posted: Mon Apr 18, 2016 6:19 pm
by Sander_Bouwhuis
Question : If I want the collision boxess to be as small as possible, what would I set the parameters to?
I constantly get stuck on mining drills which is annoying. The parameter is 0.25 now. Should I set it to 0?
Or 1? Or something else?