-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tweaks: Many module positioning fixes and new tweaks #30
Conversation
List of corrections: - Colour Flash and its translated variants were slightly too far to the left on the x-axis - Combination Lock's status light was floating - The Matrix, Memorable Buttons, Vexillology and Strike/Solve were slightly too far up on the y-axis - Vexillology had the module's selectable as Pass Through - The light scale fixer only scaled down the first light it came in contact with and ignored the rest - The Jack-O’-Lantern and The Sphere did not scale their lights properly - Needy Math's question and answer displays were floating - Needy Math, Filibuster, Needy Mrs. Bob, Draw, Rapid Buttons, Simon Squawks, and Triangle Buttons had z-fighting in their timer displays In many cases where I had to move a module around other items that were already correct got moved so they would have to get moved back, this is why you see some mods being added to the fix highlight section when they were fine before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code should really be refactored. In the meantime, some improvements can be made.
Tweaks/TweaksAssembly/BombWrapper.cs
Outdated
string[] lightSuffixes = { "Top", "1", "2", "3", "4" }; | ||
for (int i = 0; i < 5; i++) | ||
component.transform.Find("hinge/wheelHolder/outerWheel/centre/centralOrb/yellowLights/yellowLight" + lightSuffixes[i]).GetComponent<Light>().range *= component.transform.lossyScale.x; | ||
for (int i = 0; i < 5; i++) | ||
component.transform.Find("hinge/wheelHolder/outerWheel/centre/centralOrb/redLights/redLight" + lightSuffixes[i]).GetComponent<Light>().range *= component.transform.lossyScale.x; | ||
for (int i = 0; i < 5; i++) | ||
component.transform.Find("hinge/wheelHolder/outerWheel/centre/centralOrb/greenLights/greenLight" + lightSuffixes[i]).GetComponent<Light>().range *= component.transform.lossyScale.x; | ||
for (int i = 0; i < 5; i++) | ||
component.transform.Find("hinge/wheelHolder/outerWheel/centre/centralOrb/blueLights/blueLight" + lightSuffixes[i]).GetComponent<Light>().range *= component.transform.lossyScale.x; | ||
for (int i = 0; i < 5; i++) | ||
component.transform.Find("hinge/wheelHolder/outerWheel/centre/centralOrb/pinkLights/pinkLight" + lightSuffixes[i]).GetComponent<Light>().range *= component.transform.lossyScale.x; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be simplified to:
string[] lightSuffixes = { "Top", "1", "2", "3", "4" }; | |
for (int i = 0; i < 5; i++) | |
component.transform.Find("hinge/wheelHolder/outerWheel/centre/centralOrb/yellowLights/yellowLight" + lightSuffixes[i]).GetComponent<Light>().range *= component.transform.lossyScale.x; | |
for (int i = 0; i < 5; i++) | |
component.transform.Find("hinge/wheelHolder/outerWheel/centre/centralOrb/redLights/redLight" + lightSuffixes[i]).GetComponent<Light>().range *= component.transform.lossyScale.x; | |
for (int i = 0; i < 5; i++) | |
component.transform.Find("hinge/wheelHolder/outerWheel/centre/centralOrb/greenLights/greenLight" + lightSuffixes[i]).GetComponent<Light>().range *= component.transform.lossyScale.x; | |
for (int i = 0; i < 5; i++) | |
component.transform.Find("hinge/wheelHolder/outerWheel/centre/centralOrb/blueLights/blueLight" + lightSuffixes[i]).GetComponent<Light>().range *= component.transform.lossyScale.x; | |
for (int i = 0; i < 5; i++) | |
component.transform.Find("hinge/wheelHolder/outerWheel/centre/centralOrb/pinkLights/pinkLight" + lightSuffixes[i]).GetComponent<Light>().range *= component.transform.lossyScale.x; | |
foreach (var color in new[] { "yellow", "red", "green", "blue", "pink" }) | |
{ | |
foreach (var suffix in new[] { "Top", "1", "2", "3", "4" }) | |
{ | |
component.transform.Find($"hinge/wheelHolder/outerWheel/centre/centralOrb/{color}Lights/{color}Light{suffix}").GetComponent<Light>().range *= component.transform.lossyScale.x; | |
} | |
} |
Tweaks/TweaksAssembly/BombWrapper.cs
Outdated
case "ColourFlashES": | ||
case "ColourFlashPL": | ||
// This fixes the position of the module itself (but keeps the status light in its original location) | ||
component.transform.Find("ModuleBackground").transform.localPosition = Vector3.zero; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't realize this before but Find()
returns a transform, so that .transform
is redundant.
component.transform.Find("ModuleBackground").transform.localPosition = Vector3.zero; | |
component.transform.Find("ModuleBackground").localPosition = Vector3.zero; |
Tweaks/TweaksAssembly/BombWrapper.cs
Outdated
for (int i = 0; i < component.transform.childCount; i++) | ||
component.transform.GetChild(i).transform.localPosition -= new Vector3(0, 0.0053061005f, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a better way to iterate over children:
for (int i = 0; i < component.transform.childCount; i++) | |
component.transform.GetChild(i).transform.localPosition -= new Vector3(0, 0.0053061005f, 0); | |
foreach (Transform child in component.transform) | |
child.localPosition -= new Vector3(0, 0.0053061005f, 0); |
Thanks for the PR, merging it in! |
List of corrections:
In many cases where I had to move a module around other items that were already correct got moved so they would have to get moved back, this is why you see some mods being added to the fix highlight section when they were fine before.