Sander_Bouwhuis wrote: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?
If you're using the latest version (1.1.0) then setting it to 100 should cause you to be able to walk right through them.
This tells it you want a 200 tile gap of space around the edge (tiles are 0.5 wide in the code) and since it can't make a gap that big it will remove the collision box instead (making it (0,0), (0,0) ).
When using a value of 0.25 it will look at each edge and if the collision box is not at least 0.25 (half a tile) away from the outer tile boundary which the object occupies it will shrink the collision box to make a 0.25 gap there then repeat the process for the other edges. A value of 0 would make it not change the collision box at all and a value of 1 would shrink it to create a 2 tile gap around the edge I believe.
Re: [MOD 0.12.X] Squeak Through 1.1.0
Posted: Tue Apr 19, 2016 6:14 am
by Sander_Bouwhuis
100?
A mining drill is 3x3. So, if I set it to 0.5 (i.e., 1 tile) it would remove 1 tile on the edge. Therefore only the center tile will have a collision box.
Is this true, or am I misunderstanding?
Re: [MOD 0.12.X] Squeak Through 1.1.0
Posted: Tue Apr 19, 2016 8:12 am
by Nommy
Yep, that's right.
I thought you wanted to get rid of the collisions for drills altogether and an easy way to do that would be set it to something ridiculously big.
Re: [MOD 0.12.X] Squeak Through 1.1.0
Posted: Tue Apr 19, 2016 7:07 pm
by Supercheese
Nommy wrote:@Supercheese, would this be useful do you think?
It certainly could be, as I know I always find the need to Squeak Through my fields of Storage Tanks, and it would be too bad if we would have to remove the collision box manipulation for all of them just to support one modded edge case.
Re: [MOD 0.12.X] Squeak Through 1.1.0
Posted: Wed Apr 20, 2016 7:43 am
by Sander_Bouwhuis
Nommy wrote:Yep, that's right.
I thought you wanted to get rid of the collisions for drills altogether and an easy way to do that would be set it to something ridiculously big.
Ok, thanks for the info. Doesn't getting rid of all collisions create problems?
Re: [MOD 0.12.X] Squeak Through 1.1.0
Posted: Wed Apr 20, 2016 11:02 am
by Nommy
No problem mate.
Sander_Bouwhuis wrote:Doesn't getting rid of all collisions create problems?
I dunno, maybe not. When I that tried it with trees I found it didn't get rid of the collision box entirely like I expected, it just made it really small and the car still hit them, but they seemed normal otherwise.
I really don't know much about how collision box size effects things. The fluid stuff seems like it can be a bit finicky but I don't understand how that works exactly or what causes the problems the rail tanker and uranium power mod had. They might be related to custom code which is set up to require a collision box of a certain size or something, IDK exactly.
The sizes for existing entities seem to be adjusted each time it loads a game so I'd guess that if you tried it and found something that didn't work right you could just change it back to original for that thing and load up your save to get whatever it was working.
Conditional Exclusions Version (Attached)
This version allows you to exclude stuff from being altered by prototype name or type when a mod is detected.
- Moved config stuff out of data-final-fixes.lua into new config.lua file.
- Added ability to exclude prototypes by name or type conditionally in config.lua for mod compatibility.
- Added exclusions to make Nuclear Power and old versions of Rail Tanker compatible.
- Re-enabled "pump" shrinking (is disabled when Rail Tanker is loaded now).
exclusions =
{
{ -- UraniumPower mod (some test-entities display errors if altered so are excluded below)
apply_when_object_exists = {
type = "storage-tank",
name = "lube-port"
},
excluded_prototype_names = {
"lube-port",
"fluid-box-1",
"fluid-box-2"
}
},
{ -- RailTanker mod needs vanilla sized pumps (RailTanker version 1.1.3 and later includes compatibility for squeak through).
apply_when_object_exists = {
type = "cargo-wagon",
name = "rail-tanker"
},
excluded_prototype_types = {
"pump"
}
}
I've only briefly tested this version but the only thing I changed which might cause new problems was to re-enable shrinking of pumps (which are now disabled only when Rail Tanker mod is loaded). When Uranium Power mod is loaded the 3 problematic prototypes are not shrunk and AFAICT both the old incompatible Rail Tanker mod versions (<1.1.2) and the Uranium Power mod (0.6.3) work fine.
I think someone needs to build a power plant from Uranium Power from scratch to test it properly though (I don't know how). I tried the example save which seemed to work fine but I suspect it's possible for problems occur when fluid things are place and can't connect which may not show up when you load a game because everything is already connected. That said I would not be surprised if there were no problems either.
@Supercheese, I'm going to try and set up an interface next so that mods can add exclusions for stuff themselves so it might be worth waiting for that before doing another release. But now you can Squeak Through your fields of storage tanks AND run Uranium Power if you want! (Whether it actually makes any power might be another story though.)
-- 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 be properly updated.
-- Table of prototype types to check and the minimum gap required to allow walking in between them. Tiles are 0.5 wide. Can be set to a large value (e.g 1000) create the smallest possible collision box {{0,0},{0,0}}.
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.
--[[ Defines which prototypes squeak though should not alter for mod compatibility.
apply_when_object_exists (optional): Exclusions will only be applied when an object of the specified type and name is found ( in data.raw[type][name] ).
If omitted the exclusions will always be applied.
type Note: The type and name code can be copied directly from the prototype definition in the mod to here.
name
excluded_prototype_names (optional): (array) Individual prototypes which should not be altered e.g "small-pump" or "steam-engine".
excluded_prototype_types (optional): (array) Types of prototypes which should not be altered e.g "pump" or "generator".
All prototypes from all mods of the types specified will be excluded from alteration.
Meaning if you exclude "pump" no pumps will have their collision boxes changed.
--]]
exclusions =
{
{ -- General Exclusions (always applied)
excluded_prototype_names = {
-- List names of individual prototypes to always exclude here (if needed).
}
},
{ -- UraniumPower mod (some test-entities display errors if altered so are excluded below)
apply_when_object_exists = {
type = "storage-tank",
name = "lube-port"
},
excluded_prototype_names = {
"lube-port",
"fluid-box-1",
"fluid-box-2"
}
},
{ -- RailTanker mod needs vanilla sized pumps (RailTanker version 1.1.3 and later includes compatibility for squeak through).
apply_when_object_exists = {
type = "cargo-wagon",
name = "rail-tanker"
},
excluded_prototype_types = {
"pump"
}
}
}
require "config"
-- Prototype names and types to not alter.
local excluded_prototype_names = {}
local excluded_prototype_types = {}
-- Helper functions to check if a prototype name or type is excluded.
local function prototype_name_excluded(name)
return excluded_prototype_names[name]
end
local function prototype_type_excluded(type)
return excluded_prototype_types[type]
end
-- Returns true when an exclusion should be applied or false otherwise.
local function exclusion_applies(exclusion)
-- Exclusions always apply if no apply_when_object_exists is specified.
if not exclusion.apply_when_object_exists then
return true
else
-- Exclusions apply when the apply_when_object_exists object actually exists.
if data.raw[exclusion.apply_when_object_exists.type][exclusion.apply_when_object_exists.name] then
return true
end
end
-- The apply_when_object_exists object didn't exist (the mod which the exclusion was for is not active).
return false
end
-- Update the exclusion arrays by parsing an exclusion (from config.lua).
local function apply_exclusion(exclusion)
if exclusion.excluded_prototype_names then
for _,n in pairs(exclusion.excluded_prototype_names) do
excluded_prototype_names[n] = true
end
end
if exclusion.excluded_prototype_types then
for _,t in pairs(exclusion.excluded_prototype_types) do
excluded_prototype_types[t] = true
end
end
end
-- Parse the exclusions defined in config.lua only applying those which are applicable.
local function apply_exclusions()
for _,e in pairs(exclusions) do
if exclusion_applies(e) then
apply_exclusion(e)
end
end
end
-- 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
if coordinate < 0 then
coordinate = 0
end
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
-- Don't shrink prototypes of this type if they've been excluded.
if not prototype_type_excluded(prototype_type) then
for prototype_name, prototype in pairs(data.raw[prototype_type]) do
-- If the prototype is not excluded and has a collision box then resize it.
if (not prototype_name_excluded(prototype_name)) and 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
end
-- Exclude prototypes from alteration for mods that have compatibility issues with modified collision boxes.
apply_exclusions()
-- Make the adjustments.
adjust_collision_boxes()
Re: [MOD 0.12.X] Squeak Through 1.1.1
Posted: Thu Apr 21, 2016 3:18 am
by Supercheese
Excellent. Updated to version 1.1.1, incorporating these changes.
This is a modified 1.1.0 version which allows other for mods to configure Squeak Through compatibility themselves. I only changed the lua so you can just copy that over to update 1.1.1 I if you like it I think.
This file can be dropped into existing mods and modified to make them compatible:
-- Create squeak_through_exclusions table if it has not already been created by another mod.
if not squeak_through_exclusions then squeak_through_exclusions = {} end
-- Specify which prototypes who's collision box should not be altered.
squeak_through_exclusions["RailTanker"] =
{
-- Types of prototypes to not alter (affects prototypes from all mods).
excluded_prototype_types =
{
"pump"
}
}
That's all there is too it really. It turned out that interfaces don't work while the data files are being processed but there are no mod boundaries for global stuff anyway at that time so it doesn't matter.
It's set up so compatibility for other mods configured in Squeak Through is overridden by the mod which its for when that mod adds compatibility itself, so mods can do whatever is appropriate for that version providing the correct mod name is specified by both.
squeak_through_exclusions["RailTanker"] = squeak_through_exclusions["RailTanker"] or -- Use mod added exclusions instead if they exist.
{
-- Only exclude these prototypes when this mod added object is detected.
apply_when_object_exists =
{
type = "cargo-wagon",
name = "rail-tanker"
},
-- Types of prototypes to not alter (affects prototypes from all mods).
excluded_prototype_types =
{
"pump"
}
}
There's also this little mod I was using to test that this worked:
Maybe one of us can contact the authors and let them know if you decide to go with this version and make it official etc. RailTanker already has some code to retain vanilla pump sizes but it depended on mod load order last time I checked, so this might be preferable as will affect all pumps too (if that matters).
Anyway, hopefully that will make it easier to manage compatibility with other mods.
Nommy, do you have a Github account that I can mark as a project author so you can commit to the repository there? I'd wager that would make things a bit simpler than they are now.
Re: [MOD 0.12.X] Squeak Through 1.1.1
Posted: Wed May 11, 2016 4:56 pm
by silence9123
Will this work with Bob mod ?
Bob mod has 4 levels of pipes.
Re: [MOD 0.12.X] Squeak Through 1.1.1
Posted: Wed May 11, 2016 7:04 pm
by Supercheese
silence9123 wrote:Will this work with Bob mod ?
Bob mod has 4 levels of pipes.
Yes, I use it with Bob's pipes all the time.
Re: [MOD 0.12.X] Squeak Through 1.1.2
Posted: Fri May 20, 2016 3:09 am
by Supercheese
I just posted version 1.1.2, which resolves an issue when also using the Logistics Railway mod.
Re: [MOD 0.12.X] Squeak Through 1.1.2
Posted: Fri Jun 17, 2016 8:18 am
by Benie
Hey. is it possible to add trains to this? As in, they won't kill me "accidentally" anymore? Yet also respond to signals and inserters for refueling?
Just FYI, I'm using Logistics Railway and Smart Trains.
Re: [MOD 0.12.X] Squeak Through 1.1.2
Posted: Wed Jun 29, 2016 4:08 am
by Kaizokoo
Is there an ETA for version .13 compatibility ?
Re: [MOD 0.12.X] Squeak Through 1.1.2
Posted: Wed Jun 29, 2016 6:29 am
by binbinhfr
waiting for supercheese to officialy update the mod, it seems that adding line
---------------------------
Error
---------------------------
Error while running setup for entity prototype "fusion-reactor" (generator): EntityPrototype Fusion Reactor doesn't have an order string and there is no item to place it.
Modifications: FusionReactor › Enhanced_Map_Colors › Squeak Through
---------------------------
OK
---------------------------
Re: [MOD 0.14] Squeak Through 1.1.4
Posted: Sat Aug 27, 2016 10:12 pm
by Supercheese
Updated for Factorio v0.14.
Re: [MOD 0.14] Squeak Through 1.1.4
Posted: Sat Sep 24, 2016 2:29 pm
by Jürgen Erhard
ObThanksPost
Really, I'm right now playing vanilla in Steam to get me some Steam achievements... and Squeak Through is the mod I currently miss the most. Actually, it's the mod I miss, period. Steam achievements are disabled when you play modded, in case someone reading this didn't know yet.
I mean, I could and can live without being able to squeak "through" pipes (that's actually something that *almost* annoys me about this mod and I'd like to see one without pipes being squeakable... OTOH, I'd like 90° underground pipes then too please ). But not being able to walk in between two airy-looking electric mining drills? Not being able to walk between freaking boxes? They really should mod(ify) that in vanilla.