Skip to content

Conversation

@Banane9
Copy link
Contributor

@Banane9 Banane9 commented Jan 22, 2026

Adds a fix for Yellow-Dog-Man/Resonite-Issues#1457

Requested in #78

@Banane9 Banane9 added the enhancement New feature or request label Jan 22, 2026
@Banane9 Banane9 requested a review from Nytra January 22, 2026 22:43
Copy link
Contributor

@Nytra Nytra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's more of a workaround than a fix

@Banane9
Copy link
Contributor Author

Banane9 commented Jan 22, 2026

What would you consider fixing it? This is (similar to) how it would have to be done in vanilla too, or alternatively, failing silently when the target is bad

@Nytra
Copy link
Contributor

Nytra commented Jan 22, 2026

@Banane9 Banane9 force-pushed the fix/parent-under-self-audio-clip-player branch from e2eefc9 to 0ffa698 Compare January 22, 2026 23:00
@Banane9 Banane9 force-pushed the fix/parent-under-self-audio-clip-player branch from 0ffa698 to a65201e Compare January 22, 2026 23:13
@Banane9
Copy link
Contributor Author

Banane9 commented Jan 22, 2026

Ah, this fix is supposed to be for the crash caused by the ChildParentAudioClipPlayer itself - I can add your patch for the other issue, though.

[HarmonyPatch(typeof(AudioOutput), "UpdateNativeOutput")]
class Patch
{
    static FieldInfo _updateRegisteredField = AccessTools.Field(typeof(AudioOutput), "_updateRegistered");

    static bool Prefix(AudioOutput __instance)
    {
        if (__instance.Slot.Parent.FilterWorldElement() is null)
        {
            _updateRegisteredField.SetValue(__instance, false);
            return false;
        }
        return true;
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants