FabianTerhorst / coreclr-module

Old alt:V CoreClr (.NET Core Common Language Runtime) community made module. New: https://github.com/altmp/coreclr-module
MIT License
72 stars 67 forks source link

Using PlayerFactory clientside crashes client #772

Closed TuK4z closed 1 year ago

TuK4z commented 1 year ago

Using factory in clientside crashes client, no logs displayed. Crash happens when using this part of code:

public override IPlayerFactory GetPlayerFactory()
{
      return new EGPlayerFactory();
}

Additional code:

public class EGPlayerFactory : IPlayerFactory
{
    public IPlayer Create(ICore core, IntPtr playerPointer, uint id)
    {
        return new EGPlayer(core, playerPointer, id);
    }

    public ILocalPlayer GetLocalPlayer(ICore core, IntPtr localPlayerPointer, uint id)
    {
        return new LocalPlayer(core, localPlayerPointer, id);
    }
}
public class EGPlayer : LocalPlayer
{
    public bool LoggedIn { get; set; }

    public EGPlayer(ICore core, IntPtr nativePointer, uint id) : base(core, nativePointer, id)
    {
        LoggedIn = false;
    }
}
Doxoh commented 1 year ago

why u use our localplayer entity for the Playerfactory, this cannot work. Play a playerentity directly for player factory

TuK4z commented 1 year ago

Sorry i think trying different ways left this. But i changed and crash still happen.

public class EGPlayerFactory : IPlayerFactory
{
    public IPlayer Create(ICore core, IntPtr playerPointer, uint id)
    {
        return new EGPlayer(core, playerPointer, id);
    }

    public ILocalPlayer GetLocalPlayer(ICore core, IntPtr localPlayerPointer, uint id)
    {
        return new EGPlayer(core, localPlayerPointer, id);
    }
}
Doxoh commented 1 year ago

yes this is not possible, there need to be 2 different player classes