Merge branch 'master' of ssh://melanie@opensimulator.org/var/git/opensim

arthursv
Melanie 2009-08-21 00:26:49 +01:00
commit ea32600b8b
3 changed files with 83 additions and 33 deletions

View File

@ -2177,7 +2177,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
bulkUpdate.AgentData.AgentID = AgentId; bulkUpdate.AgentData.AgentID = AgentId;
bulkUpdate.AgentData.TransactionID = transactionId; bulkUpdate.AgentData.TransactionID = transactionId;
bulkUpdate.FolderData = folderDataBlocks.ToArray(); bulkUpdate.FolderData = folderDataBlocks.ToArray();
List<BulkUpdateInventoryPacket.ItemDataBlock> foo = new List<BulkUpdateInventoryPacket.ItemDataBlock>();
bulkUpdate.ItemData = foo.ToArray();
//m_log.Debug("SendBulkUpdateInventory :" + bulkUpdate); //m_log.Debug("SendBulkUpdateInventory :" + bulkUpdate);
OutPacket(bulkUpdate, ThrottleOutPacketType.Asset); OutPacket(bulkUpdate, ThrottleOutPacketType.Asset);
} }

View File

@ -25,26 +25,74 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
using System.Collections.Generic;
using OpenMetaverse; using OpenMetaverse;
using Nini.Config; using Nini.Config;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Framework;
namespace OpenSim.Region.OptionalModules.World.NPC namespace OpenSim.Region.OptionalModules.World.NPC
{ {
public class NPCModule : IRegionModule public interface INPCModule
{
UUID CreateNPC(string firstname, string lastname,Vector3 position, Scene scene, UUID cloneAppearanceFrom);
void Autopilot(UUID agentID, Scene scene, Vector3 pos);
void Say(UUID agentID, Scene scene, string text);
void DeleteNPC(UUID agentID, Scene scene);
}
public class NPCModule : IRegionModule, INPCModule
{ {
// private const bool m_enabled = false; // private const bool m_enabled = false;
private Dictionary<UUID,NPCAvatar> m_avatars = new Dictionary<UUID, NPCAvatar>();
public UUID CreateNPC(string firstname, string lastname,Vector3 position, Scene scene, UUID cloneAppearanceFrom)
{
NPCAvatar npcAvatar = new NPCAvatar(firstname, lastname, position, scene);
scene.AddNewClient(npcAvatar);
ScenePresence sp;
if(scene.TryGetAvatar(npcAvatar.AgentId, out sp))
{
AvatarAppearance x = scene.CommsManager.AvatarService.GetUserAppearance(cloneAppearanceFrom);
List<byte> wearbyte = new List<byte>();
for (int i = 0; i < x.VisualParams.Length; i++)
{
wearbyte.Add(x.VisualParams[i]);
}
sp.SetAppearance(x.Texture.GetBytes(), wearbyte);
}
m_avatars.Add(npcAvatar.AgentId, npcAvatar);
return npcAvatar.AgentId;
}
public void Autopilot(UUID agentID, Scene scene, Vector3 pos)
{
ScenePresence sp;
scene.TryGetAvatar(agentID, out sp);
sp.DoAutoPilot(0,pos,m_avatars[agentID]);
}
public void Say(UUID agentID, Scene scene, string text)
{
m_avatars[agentID].Say(text);
}
public void DeleteNPC(UUID agentID, Scene scene)
{
scene.RemoveClient(agentID);
}
public void Initialise(Scene scene, IConfigSource source) public void Initialise(Scene scene, IConfigSource source)
{ {
// if (m_enabled) scene.RegisterModuleInterface<INPCModule>(this);
// {
// NPCAvatar testAvatar = new NPCAvatar("Jack", "NPC", new Vector3(128, 128, 40), scene);
// NPCAvatar testAvatar2 = new NPCAvatar("Jill", "NPC", new Vector3(136, 128, 40), scene);
// scene.AddNewClient(testAvatar);
// scene.AddNewClient(testAvatar2);
// }
} }
public void PostInitialise() public void PostInitialise()

View File

@ -1978,30 +1978,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return new LSL_Rotation(q.X, q.Y, q.Z, q.W); return new LSL_Rotation(q.X, q.Y, q.Z, q.W);
} }
private LSL_Rotation GetPartRot( SceneObjectPart part ) private LSL_Rotation GetPartRot( SceneObjectPart part )
{ {
Quaternion q; Quaternion q;
if (part.LinkNum == 0 || part.LinkNum == 1) // unlinked or root prim if (part.LinkNum == 0 || part.LinkNum == 1) // unlinked or root prim
{ {
if (part.ParentGroup.RootPart.AttachmentPoint != 0) if (part.ParentGroup.RootPart.AttachmentPoint != 0)
{ {
ScenePresence avatar = World.GetScenePresence(part.AttachedAvatar); ScenePresence avatar = World.GetScenePresence(part.AttachedAvatar);
if (avatar != null) if (avatar != null)
if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0) if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0)
q = avatar.CameraRotation; // Mouselook q = avatar.CameraRotation; // Mouselook
else else
q = avatar.Rotation; // Currently infrequently updated so may be inaccurate q = avatar.Rotation; // Currently infrequently updated so may be inaccurate
else else
q = part.ParentGroup.GroupRotation; // Likely never get here but just in case q = part.ParentGroup.GroupRotation; // Likely never get here but just in case
} }
else else
q = part.ParentGroup.GroupRotation; // just the group rotation q = part.ParentGroup.GroupRotation; // just the group rotation
return new LSL_Rotation(q.X, q.Y, q.Z, q.W); return new LSL_Rotation(q.X, q.Y, q.Z, q.W);
} }
q = part.GetWorldRotation(); q = part.GetWorldRotation();
return new LSL_Rotation(q.X, q.Y, q.Z, q.W); return new LSL_Rotation(q.X, q.Y, q.Z, q.W);
} }
public LSL_Rotation llGetLocalRot() public LSL_Rotation llGetLocalRot()
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);