* Added a List<string> extensionList param to ExtensionLoader.LoadAllExtensions() to only load whitelisted extensions (used in conjunction with .ini file support)
* Modified ExtensionLoader .ini support to allow values with no keys by default * Added Simian .ini file config support * Merged Simian's CoarseLocationUpdates extension into AvatarManager git-svn-id: http://libopenmetaverse.googlecode.com/svn/libopenmetaverse/trunk@2328 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
@@ -72,7 +72,7 @@ namespace Simian.Extensions
|
||||
return accounts.TryGetValue(fullName, out agent);
|
||||
}
|
||||
|
||||
#region Persistance
|
||||
#region Persistence
|
||||
|
||||
public OSD Serialize()
|
||||
{
|
||||
@@ -109,6 +109,6 @@ namespace Simian.Extensions
|
||||
Helpers.LogLevel.Info);
|
||||
}
|
||||
|
||||
#endregion Persistance
|
||||
#endregion Persistence
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ namespace Simian.Extensions
|
||||
Simian server;
|
||||
int currentWearablesSerialNum = -1;
|
||||
int currentAnimSequenceNum = 0;
|
||||
Timer CoarseLocationTimer;
|
||||
|
||||
public AvatarManager()
|
||||
{
|
||||
@@ -31,10 +32,19 @@ namespace Simian.Extensions
|
||||
server.UDP.RegisterPacketCallback(PacketType.SoundTrigger, new PacketCallback(SoundTriggerHandler));
|
||||
server.UDP.RegisterPacketCallback(PacketType.ViewerEffect, new PacketCallback(ViewerEffectHandler));
|
||||
server.UDP.RegisterPacketCallback(PacketType.UUIDNameRequest, new PacketCallback(UUIDNameRequestHandler));
|
||||
|
||||
if (CoarseLocationTimer != null) CoarseLocationTimer.Dispose();
|
||||
CoarseLocationTimer = new Timer(CoarseLocationTimer_Elapsed);
|
||||
CoarseLocationTimer.Change(1000, 1000);
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
if (CoarseLocationTimer != null)
|
||||
{
|
||||
CoarseLocationTimer.Dispose();
|
||||
CoarseLocationTimer = null;
|
||||
}
|
||||
}
|
||||
|
||||
public bool SetDefaultAnimation(Agent agent, UUID animID)
|
||||
@@ -367,5 +377,48 @@ namespace Simian.Extensions
|
||||
|
||||
server.UDP.SendPacket(agent.AgentID, reply, PacketCategory.Transaction);
|
||||
}
|
||||
|
||||
void CoarseLocationTimer_Elapsed(object sender)
|
||||
{
|
||||
lock (server.Agents)
|
||||
{
|
||||
foreach (Agent recipient in server.Agents.Values)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
CoarseLocationUpdatePacket update = new CoarseLocationUpdatePacket();
|
||||
update.Index.Prey = -1;
|
||||
update.Index.You = 0;
|
||||
|
||||
update.AgentData = new CoarseLocationUpdatePacket.AgentDataBlock[server.Agents.Count];
|
||||
update.Location = new CoarseLocationUpdatePacket.LocationBlock[server.Agents.Count];
|
||||
|
||||
// Fill in this avatar
|
||||
update.AgentData[0] = new CoarseLocationUpdatePacket.AgentDataBlock();
|
||||
update.AgentData[0].AgentID = recipient.AgentID;
|
||||
update.Location[0] = new CoarseLocationUpdatePacket.LocationBlock();
|
||||
update.Location[0].X = (byte)((int)recipient.Avatar.Position.X);
|
||||
update.Location[0].Y = (byte)((int)recipient.Avatar.Position.Y);
|
||||
update.Location[0].Z = (byte)((int)recipient.Avatar.Position.Z / 4);
|
||||
++i;
|
||||
|
||||
foreach (Agent agent in server.Agents.Values)
|
||||
{
|
||||
if (agent != recipient)
|
||||
{
|
||||
update.AgentData[i] = new CoarseLocationUpdatePacket.AgentDataBlock();
|
||||
update.AgentData[i].AgentID = agent.AgentID;
|
||||
update.Location[i] = new CoarseLocationUpdatePacket.LocationBlock();
|
||||
update.Location[i].X = (byte)((int)agent.Avatar.Position.X);
|
||||
update.Location[i].Y = (byte)((int)agent.Avatar.Position.Y);
|
||||
update.Location[i].Z = (byte)((int)agent.Avatar.Position.Z / 4);
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
server.UDP.SendPacket(recipient.AgentID, update, PacketCategory.State);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.Packets;
|
||||
using ExtensionLoader;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
namespace Simian.Extensions
|
||||
{
|
||||
public class CoarseLocationUpdates : IExtension<Simian>
|
||||
{
|
||||
Simian server;
|
||||
Timer CoarseLocationTimer;
|
||||
|
||||
public CoarseLocationUpdates()
|
||||
{
|
||||
}
|
||||
|
||||
public void Start(Simian server)
|
||||
{
|
||||
this.server = server;
|
||||
|
||||
if (CoarseLocationTimer != null) CoarseLocationTimer = null;
|
||||
CoarseLocationTimer = new Timer(new TimerCallback(CoarseLocationTimer_Elapsed));
|
||||
CoarseLocationTimer.Change(1000, 1000);
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
CoarseLocationTimer = null;
|
||||
}
|
||||
|
||||
void CoarseLocationTimer_Elapsed(object sender)
|
||||
{
|
||||
lock (server.Agents)
|
||||
{
|
||||
foreach (Agent recipient in server.Agents.Values)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
CoarseLocationUpdatePacket update = new CoarseLocationUpdatePacket();
|
||||
update.Index.Prey = -1;
|
||||
update.Index.You = 0;
|
||||
|
||||
update.AgentData = new CoarseLocationUpdatePacket.AgentDataBlock[server.Agents.Count];
|
||||
update.Location = new CoarseLocationUpdatePacket.LocationBlock[server.Agents.Count];
|
||||
|
||||
// Fill in this avatar
|
||||
update.AgentData[0] = new CoarseLocationUpdatePacket.AgentDataBlock();
|
||||
update.AgentData[0].AgentID = recipient.AgentID;
|
||||
update.Location[0] = new CoarseLocationUpdatePacket.LocationBlock();
|
||||
update.Location[0].X = (byte)((int)recipient.Avatar.Position.X);
|
||||
update.Location[0].Y = (byte)((int)recipient.Avatar.Position.Y);
|
||||
update.Location[0].Z = (byte)((int)recipient.Avatar.Position.Z / 4);
|
||||
++i;
|
||||
|
||||
foreach (Agent agent in server.Agents.Values)
|
||||
{
|
||||
if (agent != recipient)
|
||||
{
|
||||
update.AgentData[i] = new CoarseLocationUpdatePacket.AgentDataBlock();
|
||||
update.AgentData[i].AgentID = agent.AgentID;
|
||||
update.Location[i] = new CoarseLocationUpdatePacket.LocationBlock();
|
||||
update.Location[i].X = (byte)((int)agent.Avatar.Position.X);
|
||||
update.Location[i].Y = (byte)((int)agent.Avatar.Position.Y);
|
||||
update.Location[i].Z = (byte)((int)agent.Avatar.Position.Z / 4);
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
server.UDP.SendPacket(recipient.AgentID, update, PacketCategory.State);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -56,7 +56,11 @@ namespace Simian.Extensions
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
updateTimer.Dispose();
|
||||
if (updateTimer != null)
|
||||
{
|
||||
updateTimer.Dispose();
|
||||
updateTimer = null;
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateTimer_Elapsed(object sender)
|
||||
|
||||
@@ -19,6 +19,7 @@ namespace Simian.Extensions
|
||||
{
|
||||
this.server = server;
|
||||
|
||||
// FIXME: Use the list in Simian.ini
|
||||
// Search for a the best available OpenMetaverse.Rendering plugin
|
||||
List<string> renderers = RenderingLoader.ListRenderers(AppDomain.CurrentDomain.BaseDirectory);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user