[AvatarScaleMod] Test 2: Height Request

Now requests initial height on instance join instead of syncing every 10s.
Reworked inbould & outbound message queue.
Fixed potential race condition where scalefactor could become 0.

A lot of this is still incredibly jank. Just trying to get things working before cleanup.
This commit is contained in:
NotAKidoS 2023-09-20 20:26:38 -05:00
parent d599f57973
commit c7eb5715ba
7 changed files with 440 additions and 146 deletions

View file

@ -16,22 +16,26 @@ public static class ModNetworkDebugger
if (AvatarScaleManager.Instance == null)
return;
float currentHeight = AvatarScaleManager.Instance.GetHeight();
float currentHeight;
const float step = 0.1f;
if (Input.GetKeyDown(KeyCode.Equals) || Input.GetKeyDown(KeyCode.KeypadPlus))
{
currentHeight += step;
AvatarScaleMod.Logger.Msg($"Networking height: {currentHeight}");
currentHeight = AvatarScaleManager.Instance.GetHeight();
AvatarScaleManager.Instance.SetHeight(currentHeight + step);
currentHeight = AvatarScaleManager.Instance.GetHeight();
ModNetwork.SendNetworkHeight(currentHeight);
AvatarScaleManager.Instance.SetHeight(currentHeight);
AvatarScaleMod.Logger.Msg($"Networking height: {currentHeight}");
}
else if (Input.GetKeyDown(KeyCode.Minus) || Input.GetKeyDown(KeyCode.KeypadMinus))
{
currentHeight -= step;
AvatarScaleMod.Logger.Msg($"Networking height: {currentHeight}");
currentHeight = AvatarScaleManager.Instance.GetHeight();
AvatarScaleManager.Instance.SetHeight(currentHeight - step);
currentHeight = AvatarScaleManager.Instance.GetHeight();
ModNetwork.SendNetworkHeight(currentHeight);
AvatarScaleManager.Instance.SetHeight(currentHeight);
AvatarScaleMod.Logger.Msg($"Networking height: {currentHeight}");
}
else if (Input.GetKeyDown(KeyCode.Backspace))
{