Skip to content
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

Fix extension cords falling off when items are turned on #74268

Merged
merged 4 commits into from
Jun 15, 2024

Conversation

Kamayana
Copy link
Contributor

@Kamayana Kamayana commented Jun 2, 2024

Summary

Bugfixes "Fix extension cords falling off when items are turned on"

Purpose of change

Fixes #74246.

Describe the solution

When writing #70475, I incorrectly made item_contents::combine rely on pocket.saved_type() even when it's called during item conversion. I didn't realize that saved_type it only ever useful during deserialization, otherwise it's always LAST. The function already used the convert parameter for alternative code that checked against pocket.get_pocket_data()->type instead, which is accurate past loading, so simply applying that to the problem code fixes it.

The other part of the fixed issue, the cable "duplicating", was because the item wasn't updating its cable length after conversion made the extension cord fall out. The extension cord wasn't duplicating, it was more like there was a phantom extension cord left behind that kept the item connected at its longer length. Calling update_link_traits() during item conversion fixes this.

Describe alternatives you've considered

Testing

Followed the steps in the issue, no longer reproduces. Followed the steps with only the second commit applied, the lamp immediately updates the cable length and breaks the connection, as intended.

Also spawned and connected some extension cords together and to a battery to make sure nothing unintentionally broke.

Additional context

@github-actions github-actions bot added [C++] Changes (can be) made in C++. Previously named `Code` Items: Containers Things that hold other things <Bugfix> This is a fix for a bug (or closes open issue) astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions labels Jun 2, 2024
@dseguin dseguin merged commit b0402d8 into CleverRaven:master Jun 15, 2024
23 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Items: Containers Things that hold other things json-styled JSON lint passed, label assigned by github actions
Projects
None yet
2 participants