From 2d13cca7b34ac173cee19f4c3a0b867c7f1e5039 Mon Sep 17 00:00:00 2001 From: Madpeter <57852827+Madpeterz@users.noreply.github.com> Date: Tue, 1 Oct 2024 19:00:08 +0100 Subject: [PATCH] adjust setting hover height for a bit after joining a sim --- SecondBotEvents/Services/BotClientService.cs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/SecondBotEvents/Services/BotClientService.cs b/SecondBotEvents/Services/BotClientService.cs index 1049584..91c41eb 100644 --- a/SecondBotEvents/Services/BotClientService.cs +++ b/SecondBotEvents/Services/BotClientService.cs @@ -78,16 +78,14 @@ namespace SecondBotEvents.Services protected void BotSimConnected(object o, SimConnectedEventArgs e) { - if(AutoRestartLoginTimer.Enabled == true) - { - GetClient().Self.SetHoverHeight(basicCfg.GetDefaultHoverHeight()); - } AutoRestartLoginTimer.Stop(); + goodticks = 0; LogFormater.Info("Client service ~ Connected to sim: "+e.Simulator.Name); } protected void BotSimDisconnected(object o, SimDisconnectedEventArgs e) { + goodticks = 0; LogFormater.Info("Client service ~ Disconnected from sim: " + e.Simulator.Name); } @@ -208,6 +206,7 @@ namespace SecondBotEvents.Services public void Login() { ResetClient(); + goodticks = 0; LoginParams loginParams = new LoginParams( client, basicCfg.GetFirstName(), @@ -224,6 +223,7 @@ namespace SecondBotEvents.Services client.Network.BeginLogin(loginParams); } + protected int goodticks = 0; public override string Status() { if (client == null) @@ -242,6 +242,16 @@ namespace SecondBotEvents.Services { return "No sim"; } + + if(goodticks == 6) + { + double G = basicCfg.GetDefaultHoverHeight(); + GetClient().Self.SetHoverHeight(G); + } + else if(goodticks < 6) + { + goodticks++; + } Vector3 pos = client.Self.SimPosition; string loc = "" + Math.Round(pos.X).ToString() + "," + Math.Round(pos.Y).ToString() + "," + Math.Round(pos.Z).ToString(); return client.Network.CurrentSim.Name + " " + loc;