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

Incompatibility with "More_Emotes" and "CrossHair " #4

Closed
AJAL8000 opened this issue Mar 1, 2024 · 9 comments
Closed

Incompatibility with "More_Emotes" and "CrossHair " #4

AJAL8000 opened this issue Mar 1, 2024 · 9 comments
Assignees
Labels
help wanted Extra attention is needed question Further information is requested

Comments

@AJAL8000
Copy link

AJAL8000 commented Mar 1, 2024

Description:
For some very strange reason. These two mods do not work when Open Monitors is active. I have no idea why this happens, because at first glance they have nothing in common.

Edit: Corporate Restructure doesn't have this problem btw. No idea why.

Mods:
->https://thunderstore.io/c/lethal-company/p/CTNOriginals/CrossHair/
->https://thunderstore.io/c/lethal-company/p/Sligili/More_Emotes/

I get these errors in the Log:

`[Error : Unity Log] NullReferenceException: Object reference not set to an instance of an object
Stack trace:
MoreEmotes.Scripts.CustomAnimationObjects.FindLegs () (at :0)
MoreEmotes.Scripts.CustomAnimationObjects.Update () (at :0)

[Error : Unity Log] NullReferenceException: Object reference not set to an instance of an object
Stack trace:
CrossHair.Patches.PlayerControllerBPatch.Update (GameNetcodeStuff.PlayerControllerB& __instance) (at :0)
(wrapper dynamic-method) GameNetcodeStuff.PlayerControllerB.DMD<GameNetcodeStuff.PlayerControllerB::Update>(GameNetcodeStuff.PlayerControllerB)`

It would be great if you could find out what causes this error. To clarify, Open_Monitors works fine, the problem is that for some reason it makes the other 2 mods stop working.

@julian-perge
Copy link
Owner

Thanks for the issue on this! I looked briefly into the Crosshair code and found the method mentioned here: https://github.com/CTN-Originals/LethalCompany-CrossHair/blob/main/CrossHair/Patches/PlayerControllerBPatch.cs#L127

Even looking at the code it's not immediately clear to me as to what line is causing the issue. I know when I was testing OpenMonitors, I had to add the delay after the CreditsMonitor triggered because if it tried to update immediately in the patch, it was causing null references. I imagine something like that is happening here as well with CrossHair.

@julian-perge
Copy link
Owner

For the MoreEmotes one, same findings as CrossHair. Reading the code it just seems like it's an issue with that mod, and not OpenMonitors.

The FindLegs() method is trying to find the legs on the players GameObject:

private void FindLegs()
{
_legs = (_player.transform.Find("ScavengerModel").Find("LEGS").GetComponent<SkinnedMeshRenderer>();
}

@julian-perge julian-perge self-assigned this Mar 14, 2024
@julian-perge julian-perge added help wanted Extra attention is needed question Further information is requested labels Mar 14, 2024
@a1russell
Copy link

I am also experiencing this issue. I'm not seeing how it could be an issue with More Emotes and/or CrossHair, given that they work without OpenMonitors installed, and they also work when Corporate Restructure is installed.

If it helps, the issue is still present even with all of the terminals hidden via config options.

I don't know anything about C# code or modding, but might the issue have to do with how OpenMonitors is patching "PlayerControllerB"?

@CTNOriginals
Copy link

https://github.com/CTN-Originals/LethalCompany-CrossHair/blob/main/CrossHair/Patches/PlayerControllerBPatch.cs#L127
Even looking at the code it's not immediately clear to me as to what line is causing the issue. I know when I was testing OpenMonitors, I had to add the delay after the CreditsMonitor triggered because if it tried to update immediately in the patch, it was causing null references. I imagine something like that is happening here as well with CrossHair.

@julian-perge Could you please elaborate more on this and also point out where your have face this problem and how you have fixed it?

@julian-perge
Copy link
Owner

https://github.com/CTN-Originals/LethalCompany-CrossHair/blob/main/CrossHair/Patches/PlayerControllerBPatch.cs#L127
Even looking at the code it's not immediately clear to me as to what line is causing the issue. I know when I was testing OpenMonitors, I had to add the delay after the CreditsMonitor triggered because if it tried to update immediately in the patch, it was causing null references. I imagine something like that is happening here as well with CrossHair.

@julian-perge Could you please elaborate more on this and also point out where your have face this problem and how you have fixed it?

There's a CoroutineHelper class that you then pass an IEnumerator method to where you can use yield statements:

    [HarmonyPostfix]
    [HarmonyPatch(nameof(GameNetcodeStuff.PlayerControllerB.ConnectClientToPlayerObject))]
    private static void OnPlayerConnect()
    {
        CoroutineHelper.Instance.StartCoroutine(WaitOnPlayerConnectForMonitorsToBeCreated());
    }

    private static IEnumerator WaitOnPlayerConnectForMonitorsToBeCreated()
    {
        ModLogger.LogDebug("WaitOnPlayerConnectForMonitorsToBeCreated");
        yield return new WaitUntil(() => CreditsMonitor.Instance && LifeSupportMonitor.Instance);
        CreditsMonitor.Instance.UpdateMonitor();
        LifeSupportMonitor.Instance.UpdateMonitor();
        PlayersLifeSupportMonitor.Instance.UpdateMonitor();
    }

@julian-perge
Copy link
Owner

Huh, I think I found the problem after digging a little deeper.

https://github.com/julian-perge/LC_OpenMonitors/blob/main/OpenMonitors/Monitors/Setup.cs#L100

Here I'm renaming the GameObject to Deadline from HeaderText (1), but then in CrossHair, it's trying to look for the original object name which is Header (1): https://github.com/CTN-Originals/LethalCompany-CrossHair/blob/main/Crosshair/Patches/HUDManagerPatch.cs#L22

@CTNOriginals
Copy link

Huh, I think I found the problem after digging a little deeper.

https://github.com/julian-perge/LC_OpenMonitors/blob/main/OpenMonitors/Monitors/Setup.cs#L100

Here I'm renaming the GameObject to Deadline from HeaderText (1), but then in CrossHair, it's trying to look for the original object name which is Header (1): https://github.com/CTN-Originals/LethalCompany-CrossHair/blob/main/Crosshair/Patches/HUDManagerPatch.cs#L22

Yes, i have ndeed just found that same issue, the text i use as a reference is one of the monitors that you likely move around in some way which results in the crosshair mod not having the text reference. that is awkward...

@CTNOriginals
Copy link

Thanks for working with me on this bug and hunting down the issue, I will update my mod once I have time.

CTNOriginals added a commit to CTN-Originals/LethalCompany-CrossHair that referenced this issue Mar 27, 2024
On the [Lethal Company Modding](https://discord.gg/lcmod) discord server, a server member ("haxe11") reported an [issue](julian-perge/LC_OpenMonitors#4) on the repo of [OpenMonitors](https://github.com/julian-perge/LC_OpenMonitors) that mentioned an incompatibility with this mod.
@julian-perge
Copy link
Owner

Should be fixed in v1.1.0 update. Sorry for the delay!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants