adjust setting hover height for a bit after joining a sim

This commit is contained in:
Madpeter 2024-10-01 19:00:08 +01:00
parent 9cd5e0f6f0
commit 2d13cca7b3

View file

@ -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;