Tooling viewer: bucket categorization + Refit button#2840
Conversation
The Toolings tab now collapses tank tooling types into category buttons keyed by construction (Conventional / Isogrid / Balloon / Fuselage / Service Module / Shielded / Cryogenic / Other) and pressure class (HP variants get their own button where they exist). Buttons are sorted alphabetically by title. Each leaf row tags which underlying material(s) supplied it -- Tank-* keys get the construction prefix trimmed (and the -HP suffix dropped since the bucket title already says it), SM-* keys pass through unchanged, and other dashed keys (Avionics-N3) drop the prefix to just the suffix. Type-tab scroll widened to fit the longer badges. Lets the player search for an existing tooled diameter for a tank type without picking material first. ProceduralAvionicsWindow shows the avionics tooling abbreviation (e.g. "N3") next to the config name so it cross-references the grouped Avionics-N entries in the tooling viewer.
Each tooled (diameter, length) row gets a Refit button that writes the dims to whatever part has its PAW open, and switches the part's RF tank type if the row's bucket only carries materials the part isn't on. Disabled when the PAW target's tank type belongs to a different bucket than the one currently shown. When the player opens a PAW on a tank, the viewer jumps into that tank's bucket -- including from inside another bucket page, not just from the main bucket list. A manual bucket pick suppresses the auto-switch until the PAW target changes.
65da377 to
9d6cce6
Compare
|
What is that mysterious SteelAl in your images? |
siimav
left a comment
There was a problem hiding this comment.
General notes:
- Use proper /// method comments
- Do not use var unless the type is apparent from the right side of the assignment.
- Do not mix fields between methods
IDK what to think of the "Refit" feature. Sounds like there's so many corner cases that can force the part into an invalid state. For instance it doesn't appear to handle avionics parameters at all so the outcome will be a weird mix. Same for PP shapes. PickRfType will silently swallow a correct type not being found and will happily use the first one available.
| bool hp = toolingType.EndsWith("-HP"); | ||
| if (toolingType.StartsWith("Tank-Iso-")) return hp ? TankIsogridHP : TankIsogrid; | ||
| if (toolingType.StartsWith("Tank-Balloon-") || toolingType == "Balloon") | ||
| return hp ? TankBalloonHP : TankBalloon; | ||
| if (toolingType == "Fuselage") return hp ? TankFuselageHP : TankFuselage; | ||
| if (toolingType.StartsWith("Tank-Sep-")) return hp ? TankConventionalHP : TankConventional; | ||
| return TankOther; // legacy RF types we don't know how to place: Default, ElectricPropulsion, etc. |
There was a problem hiding this comment.
IDK why your clanker thought this is good formatting.
There was a problem hiding this comment.
I agree it could be improved, but I'm not sure which part you're objecting to. That (only) half of the return statements are manually indented? That all but one are single line ifs? Looking at it again, I will make predicates for each tank type (IsBalloonTank, IsShieldedTank, IsCryoTank) so each line can be a single line. At that point it could change to a switch statement or expression.
There was a problem hiding this comment.
Not clue what it's even aligned on. Just half of the code dangling pretty much nowhere.
| { TankConventional, "Conventional Tanks" }, | ||
| { TankConventionalHP, "HP Conventional Tanks" }, | ||
| { TankIsogrid, "Isogrid Tanks" }, | ||
| { TankIsogridHP, "HP Isogrid Tanks" }, | ||
| { TankBalloon, "Balloon Tanks" }, | ||
| { TankBalloonHP, "HP Balloon Tanks" }, | ||
| { TankFuselage, "Fuselage" }, | ||
| { TankFuselageHP, "HP Fuselage" }, | ||
| { TankServiceModule, "Service Modules" }, | ||
| { TankShieldedKey, "Shielded Tanks" }, | ||
| { TankCryogenic, "Cryogenic Tanks" }, | ||
| { TankOther, "Other Tanks" }, |
There was a problem hiding this comment.
HP and non-HP bucket pairs sort non-adjacently GetGroupedToolingTypes() sorts by GetGroupTitle(). "Conventional Tanks" and "HP Conventional Tanks" sort with several other buckets between them (alphabetically H follows C, I, etc.). Users looking for HP variants would expect them next to their base family. Consider naming them "Conventional Tanks (HP)" so they sort adjacent to the base.
There was a problem hiding this comment.
That's intentional. I think users first decide "Do I need HP or non-HP?" and then they want to see if they have any tanks already tooled for the dimensions they need. They're likely to be flexible about whether it's balloon/conventional/isogrid and even more flexible about the material of the tank.
If tank type (balloon/conventional/isogrid) was a slider instead of part of the type, I'd probably just have two buckets: HP and non-HP (perhaps as a user option for users who aren't so flexible about the tank type, e.g. to keep that isogrid integration bonus). The Refit button would then change tank type as well as material. That would be a considerably more convenient than the current situation where you have to take the rocket apart and put it back together to change the tank type. Outside this PR's scope, of course.
There was a problem hiding this comment.
Oh, but it is weird that the HP types sort together but the non-HP types do not. Add explicit "Non-HP" prefix so they sort together? That would look clunky but it would maintain my intention and alphabetical listing.
There was a problem hiding this comment.
How about Tank (HP Conventional) Tank (HP Fuselage) Tank (HP Isogrid) Tank (HP Shielded) Tank (Non-HP Balloon) Tank (Non-HP Conventional) Tank (Non-HP Fuselage) Tank (Non-HP Isogrid) Tank (Non-HP Shielded)
Better than a clunky Non-HP prefix at the beginning, with the added advantage that all the Tanks sort together.
I'm not sure what you mean about avionics parameters. The Refit button is only for fuel tanks right now. It would be nice to apply it to avionics parts too but like you say, the controllable mass and EC parameters would have to be handled additionally. Those don't apply for fuel tanks though, right? Different PP shapes do present a bit of an issue when they have more than the basic "diameter/length" or "diameter/vscale" sliders. But since RP-1 tooling doesn't distinguish between them (AFAIK?), it seems reasonable to just have Refit handle those diameter and length parameters and leave the other parameters alone. Certainly this handles the bulk of cases with cylindrical/cone/cyl-deriv/cone-deriv. I do need to test that it's working as I expect with other shapes though, I think I only tested switching between cylinders of each tank type and material (tank types being different parts, as mentioned above). |
Shall I change it to "Balloon", "Refined", and "Modern"? Or "Al", "AlCu", "AlLi"? |
- Tank bucket titles -> Tank (HP/Non-HP X) so families sort adjacently - Cache grouped tooling list by ToolingDatabase.Generation - GetGroupedToolingTypes returns List; camelCase locals; predicate helpers - Move grouping consts out from between methods; /// comments; drop var - ToolingPartResizer: explicit private modifiers; log swallowed exceptions - PickRfType refuses when no available material matches instead of forcing first source; Refit button disables that row with an explanatory tooltip
Definitely found some issues here with different shapes and symmetry, will address them soon. Thanks for the review. |
- PickRfType: read typesAvailable as List<TankDefinition> and gate on the type's upgrade being unlocked; the old string cast was always null, so every cross-material refit was disabled. - ApplyProcShape: write the diameter field the active shape actually uses (outerDiameter for hollow, top/bottom for cone) and skip trusses, so hollow tanks land tooled instead of silently missing. - Drive dimension changes through the procedural module's own field-changed handler (the PAW slider path) so attach nodes and attached parts reposition, and let it walk the symmetry group itself instead of re-applying per part. - Apply the type switch across symmetry counterparts; post one message; show no success message when the shape can't be refit. - ROTank: in lengthWidth mode drive currentLength (currentVScale is inert). - Refresh the part's PAW after refit so the slider display matches.
|
OK I've tested pretty thoroughly with the main tank types (modular, another modular, procedural), and with changing shapes with procedural tanks. Refit works well with all of them. It's easier to test with changing shapes with the PR I just put in to preserve diameter/length when changing procedural shape. That way you can see that Refit even applies to cones (treated as cylinders), hollow/filleted variants, and polygon, Refit on truss is currently disabled although I could revisit that and just have it handle top/bottom diameter and length the same way it does for other shapes with both top and bottom diameter. |
Well we have to follow what is shown on the tank part itself or it's gonna get hella confusing. |

Summary
Two-commit change to the Toolings tab in the editor:
ProceduralAvionicsWindownow also shows the avionics tooling abbreviation ("N3") next to the config name so it cross-references the groupedAvionics-Nentries.Before:

After:

Test plan