VRCBilliards / vrcbce

VRCBilliards: Community Edition
MIT License
300 stars 35 forks source link

Pool Table Doesn't Reset if players left. #63

Closed NataIynn closed 3 years ago

NataIynn commented 3 years ago

If players leave during a active game the pool table doesn't reset. I've tried clicking reset/end button but it doesn't work and users aren't in the world. image

Legoman99573 commented 3 years ago

Could add options to allow world masters and/or instance creators to instantly reset the table regardless if they are in a game or not.

FairlySadPanda commented 3 years ago

Have fixed a clanger of a bug here with 1.1.5 which should greatly help with this problem.

NataIynn commented 3 years ago

Tested, seems still to happen. image

image Also pool cues don't reset correctly.

FairlySadPanda commented 3 years ago

Strange. I will take a look later today.

On Tue, 29 Jun 2021, 03:32 Natalynn, @.***> wrote:

Tested, seems still to happen. [image: image] https://user-images.githubusercontent.com/28743579/123728028-3ef69080-d858-11eb-9a3b-b0c1f7287796.png

[image: image] https://user-images.githubusercontent.com/28743579/123728040-44ec7180-d858-11eb-9140-2b1976e86c79.png Also pool cues don't reset correctly.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/FairlySadPanda/vrcbce/issues/63#issuecomment-870182817, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFS25EEM375TBAMZFGDRO3TVEWDFANCNFSM47IWDTUA .

NataIynn commented 3 years ago

Actually It's happening way more frequent now.

FairlySadPanda commented 3 years ago

Have taken a quick look.

I've changed the OnPlayerLeft code in PoolStateManager.cs to this:

        {
            if (!Networking.IsOwner(Networking.LocalPlayer, gameObject) || !Utilities.IsValid(player))
            {
                return;
            }

            int playerID = player.playerId;
            if (playerID == player1ID || playerID == player2ID || playerID == player3ID || playerID == player4ID)
            {
                if (isGameInMenus)
                {
                    RemovePlayerFromGame(playerID);
                }
                else
                {
                    gameWasReset = true;
                    ForceReset();
                }
            }
        }

The code is now in master in the latest commit here.

I'll improve the ForceReset code so it pops up a window asking for confirmation before resetting in 1.2.0.

The cue glitch could be an issue with your local install of VRCBCE running into oddities due to the changes made between 1.1.0 and now. If possible, try wiping the VRCBCE prefab entirely from your install and installing latest.

I've updated the 1.1.5 release package with this hotfix. Hopefully it helps.

NataIynn commented 3 years ago

I'm testing it currently, I'll let you know. I've replaced all VRC Pool Table prefabs, so they're fully updated with 1.1.6.,

NataIynn commented 3 years ago

Went into existing instanced and it was broken. Locked and cant reset. You can check at A Quiet Loft. VRChat_1920x1080_2021-07-02_05-42-45 040 VRChat_1920x1080_2021-07-02_05-42-47 314

FairlySadPanda commented 3 years ago

I've gone in and rewritten the reset code, but have not tested it yet due to work commitments.

https://github.com/FairlySadPanda/vrcbce/releases/tag/1.1.7

As said in the ticket this should make it more stable when resetting when a player leaves the world, and if the pool is in a bad state - someone's left and the table hasn't reset - (and nothing has crashed) anyone can reset the game.

NataIynn commented 3 years ago

tested and works good now. I havent seen a broken pool table yet. Other than floating cues.