correct ResetAnimations, allow stand to call reset animations, fix start service, add a delay on startup
This commit is contained in:
Madpeter 2024-08-15 16:53:11 +01:00
parent 70d12c08d9
commit e43dbcabc8
19 changed files with 72 additions and 23 deletions

View file

@ -1,5 +1,7 @@
using OpenMetaverse;
using SecondBotEvents.Services;
using System.Collections.Generic;
using System.Linq;
namespace SecondBotEvents.Commands
{
@ -44,11 +46,15 @@ namespace SecondBotEvents.Commands
}
[About("Resets the animation stack for the bot")]
[ReturnHints("Accepted")]
[ReturnHints("Accepted - X stopped animations")]
public object ResetAnimations()
{
// @todo Reset animations function from old version
return Failure("@todo");
List<UUID> animations = GetClient().Self.SignaledAnimations.Copy().Keys.ToList();
foreach (UUID anim in animations)
{
GetClient().Self.AnimationStop(anim, true);
}
return BasicReply("Accepted - "+animations.Count.ToString()+" stopped animations");
}
}

View file

@ -13,6 +13,7 @@ namespace SecondBotEvents.Commands
{
}
[About("an improved version of near me with extra details<br/>NearMeDetails is a object formated as follows<br/><ul><li>id</li><li>name</li><li>x</li><li>y</li><li>z</li><li>range</li></ul>")]
[ReturnHints("array NearMeDetails")]
[ReturnHintsFailure("Error not in a sim")]

View file

@ -109,6 +109,7 @@ namespace SecondBotEvents.Commands
{
master.HomeboundService.MarkStandup();
GetClient().Self.Stand();
master.CommandsService.CommandInterfaceCaller("ResetAnimations", false, false, "Stand command");
return BasicReply("ok");
}

View file

@ -100,6 +100,8 @@ namespace SecondBotEvents
{
fromFolder = args[0];
}
LogFormater.Info("Giving SL a chance - waiting 4 secs");
Thread.Sleep(4000);
StartServices();
}

View file

@ -40,7 +40,7 @@ namespace SecondBotEvents.Services
return basicCfg.IsLoaded();
}
public override void Start()
public override void Start(bool updateEnabled = false, bool setEnabledTo = false)
{
running = true;
LogFormater.Info("Client service [Starting]");

View file

@ -95,7 +95,7 @@ namespace SecondBotEvents.Services
}
}
}
public override void Start()
public override void Start(bool updateEnabled = false, bool setEnabledTo = false)
{
running = true;
master.BotClientNoticeEvent += BotClientRestart;

View file

@ -39,7 +39,7 @@ namespace SecondBotEvents.Services
return "Active";
}
public override void Start()
public override void Start(bool updateEnabled = false, bool setEnabledTo = false)
{
Stop();
running = true;

View file

@ -106,7 +106,7 @@ namespace SecondBotEvents.Services
botConnected = true;
}
public override void Start()
public override void Start(bool updateEnabled = false, bool setEnabledTo = false)
{
running = true;
master.BotClientNoticeEvent += BotClientRestart;

View file

@ -1093,8 +1093,12 @@ namespace SecondBotEvents.Services
}
}
public override void Start()
public override void Start(bool updateEnabled = false, bool setEnabledTo = false)
{
if (updateEnabled)
{
myConfig.setEnabled(setEnabledTo);
}
Stop();
running = true;
master.BotClientNoticeEvent += BotClientRestart;

View file

@ -245,8 +245,12 @@ namespace SecondBotEvents.Services
GetClient().Self.ScriptDialog += DialogWindowEvent;
}
public override void Start()
public override void Start(bool updateEnabled = false, bool setEnabledTo = false)
{
if (updateEnabled)
{
myConfig.setEnabled(setEnabledTo);
}
Stop();
running = true;
master.BotClientNoticeEvent += BotClientRestart;

View file

@ -524,8 +524,12 @@ namespace SecondBotEvents.Services
return true;
}
public override void Start()
public override void Start(bool updateEnabled = false, bool setEnabledTo = false)
{
if (updateEnabled)
{
myConfig.setEnabled(setEnabledTo);
}
running = true;
if (myConfig.GetEnabled() == false)
{

View file

@ -419,8 +419,12 @@ namespace SecondBotEvents.Services
public override void Start()
public override void Start(bool updateEnabled = false, bool setEnabledTo = false)
{
if (updateEnabled)
{
myConfig.setEnabled(setEnabledTo);
}
if (myConfig.GetEnabled() == false)
{
LogFormater.Info("Events service [Disabled]");

View file

@ -319,9 +319,13 @@ namespace SecondBotEvents.Services
LogFormater.Info("Homebound Service [Active]");
}
public override void Start()
public override void Start(bool updateEnabled = false, bool setEnabledTo = false)
{
if(myConfig.GetEnabled() == false)
if (updateEnabled)
{
myConfig.setEnabled(setEnabledTo);
}
if (myConfig.GetEnabled() == false)
{
return;
}

View file

@ -84,8 +84,12 @@ namespace SecondBotEvents.Services
CreateWebServer();
}
public override void Start()
public override void Start(bool updateEnabled = false, bool setEnabledTo = false)
{
if (updateEnabled)
{
myConfig.setEnabled(setEnabledTo);
}
if (myConfig.GetEnabled() == false)
{
LogFormater.Info("HTTP service [Disabled]");

View file

@ -245,8 +245,12 @@ namespace SecondBotEvents.Services
LogFormater.Info("Interaction Service [Active]");
}
public override void Start()
public override void Start(bool updateEnabled = false, bool setEnabledTo = false)
{
if (updateEnabled)
{
myConfig.setEnabled(setEnabledTo);
}
if (myConfig.GetEnabled() == false)
{
LogFormater.Info("Interaction Service [- Not requested -]");

View file

@ -128,8 +128,12 @@ namespace SecondBotEvents.Services
}
public override void Start()
public override void Start(bool updateEnabled = false, bool setEnabledTo = false)
{
if(updateEnabled)
{
myConfig.setEnabled(setEnabledTo);
}
if (myConfig.GetEnabled() == false)
{
LogFormater.Info("Events service [Disabled]");

View file

@ -245,8 +245,12 @@ namespace SecondBotEvents.Services
}
public override void Start()
public override void Start(bool updateEnabled = false, bool setEnabledTo = false)
{
if (updateEnabled)
{
myConfig.setEnabled(setEnabledTo);
}
Stop();
running = true;
master.BotClientNoticeEvent += BotClientRestart;

View file

@ -18,8 +18,7 @@ namespace SecondBotEvents.Services
public void enableAndStart()
{
myConfig.setEnabled(true);
Restart();
Restart(true, true);
}
public void changeConfig(string configKey, string configValue)
@ -46,7 +45,7 @@ namespace SecondBotEvents.Services
return "";
}
public virtual void Start()
public virtual void Start(bool updateEnabled = false, bool setEnabledTo = false)
{
running = true;
}
@ -54,13 +53,13 @@ namespace SecondBotEvents.Services
{
running = false;
}
public void Restart()
public void Restart(bool updateEnabled=false, bool setEnabledTo=false)
{
if (running == true)
{
Stop();
}
Start();
Start(updateEnabled, setEnabledTo);
}
}
}

View file

@ -786,8 +786,12 @@ namespace SecondBotEvents.Services
AttachEvents();
}
public override void Start()
public override void Start(bool updateEnabled = false, bool setEnabledTo = false)
{
if (updateEnabled)
{
myConfig.setEnabled(setEnabledTo);
}
if (myConfig.GetEnabled() == false)
{
LogFormater.Info("OnEvent Service [- Not requested -]");