improvements to tracking and onevents

This commit is contained in:
Madpeterz 2021-05-23 22:37:40 +01:00
parent 879139d5cf
commit 1b072db244
3 changed files with 44 additions and 47 deletions

View file

@ -52,7 +52,7 @@ namespace BetterSecondBot
{ {
return false; return false;
} }
return true; return getBot()._AllowActions;
} }
public string getFolderUsed() public string getFolderUsed()

View file

@ -98,23 +98,7 @@ namespace BetterSecondbot.Tracking
protected bool hasBot() protected bool hasBot()
{ {
if (controler == null) return controler.BotReady();
{
return false;
}
if (controler.getBot() == null)
{
return false;
}
if (controler.getBot().GetClient == null)
{
return false;
}
if (controler.getBot().GetClient.Network == null)
{
return false;
}
return controler.getBot().GetClient.Network.Connected;
} }
protected void StatusPing(object o, StatusMessageEvent e) protected void StatusPing(object o, StatusMessageEvent e)
@ -192,6 +176,8 @@ namespace BetterSecondbot.Tracking
} }
protected void TrackerEventAdd(object av) protected void TrackerEventAdd(object av)
{
if (controler.BotReady() == true)
{ {
if (UUID.TryParse(av.ToString(), out UUID avuuid) == false) if (UUID.TryParse(av.ToString(), out UUID avuuid) == false)
{ {
@ -210,12 +196,8 @@ namespace BetterSecondbot.Tracking
{ {
return; return;
} }
addToSeen(avuuid);
output(avuuid, "entry###" + name);
string parcelname = ""; string parcelname = "";
string simname = "";
Vector3 pos = controler.getBot().GetClient.Network.CurrentSim.AvatarPositions[avuuid]; Vector3 pos = controler.getBot().GetClient.Network.CurrentSim.AvatarPositions[avuuid];
simname = controler.getBot().GetClient.Network.CurrentSim.Name;
int localp = controler.getBot().GetClient.Parcels.GetParcelLocalID(controler.getBot().GetClient.Network.CurrentSim, pos); int localp = controler.getBot().GetClient.Parcels.GetParcelLocalID(controler.getBot().GetClient.Network.CurrentSim, pos);
parcelname = "?"; parcelname = "?";
if (controler.getBot().GetClient.Network.CurrentSim.Parcels.ContainsKey(localp) == true) if (controler.getBot().GetClient.Network.CurrentSim.Parcels.ContainsKey(localp) == true)
@ -223,8 +205,19 @@ namespace BetterSecondbot.Tracking
Parcel P = controler.getBot().GetClient.Network.CurrentSim.Parcels[localp]; Parcel P = controler.getBot().GetClient.Network.CurrentSim.Parcels[localp];
parcelname = P.Name; parcelname = P.Name;
} }
if (parcelname == "?")
{
return;
}
addToSeen(avuuid);
output(avuuid, "entry###" + name);
string simname = "";
simname = controler.getBot().GetClient.Network.CurrentSim.Name;
controler.getBot().TriggerTrackingEvent(avuuid, name, parcelname, simname, false); controler.getBot().TriggerTrackingEvent(avuuid, name, parcelname, simname, false);
} }
}
protected void addToSeen(UUID av) protected void addToSeen(UUID av)
{ {

View file

@ -404,6 +404,9 @@ namespace BetterSecondBot.bottypes
} }
public bool _AllowActions { get { return AllowActions; } }
protected bool AllowActions = false;
public override void AfterBotLoginHandler() public override void AfterBotLoginHandler()
{ {
if (reconnect == false) if (reconnect == false)
@ -418,6 +421,7 @@ namespace BetterSecondBot.bottypes
Client.Network.SimChanged += ChangeSim; Client.Network.SimChanged += ChangeSim;
delay_group_fetch = helpers.UnixTimeNow() + 10; delay_group_fetch = helpers.UnixTimeNow() + 10;
} }
AllowActions = true;
base.AfterBotLoginHandler(); base.AfterBotLoginHandler();
} }