aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie2009-08-21 00:26:49 +0100
committerMelanie2009-08-21 00:26:49 +0100
commitea32600b8b6e078f272155f239cb1e978dfca230 (patch)
treef92e63134f3a8e8c208519481c2b9208915a5152 /OpenSim
parentFix the user and password defaults int he remote console setup (diff)
parentMerge branch 'master' of ssh://diva@opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-ea32600b8b6e078f272155f239cb1e978dfca230.zip
opensim-SC_OLD-ea32600b8b6e078f272155f239cb1e978dfca230.tar.gz
opensim-SC_OLD-ea32600b8b6e078f272155f239cb1e978dfca230.tar.bz2
opensim-SC_OLD-ea32600b8b6e078f272155f239cb1e978dfca230.tar.xz
Merge branch 'master' of ssh://melanie@opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs4
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs64
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs48
3 files changed, 83 insertions, 33 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 6969a3d..a7a5aa3 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -2177,7 +2177,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2177 bulkUpdate.AgentData.AgentID = AgentId; 2177 bulkUpdate.AgentData.AgentID = AgentId;
2178 bulkUpdate.AgentData.TransactionID = transactionId; 2178 bulkUpdate.AgentData.TransactionID = transactionId;
2179 bulkUpdate.FolderData = folderDataBlocks.ToArray(); 2179 bulkUpdate.FolderData = folderDataBlocks.ToArray();
2180 2180 List<BulkUpdateInventoryPacket.ItemDataBlock> foo = new List<BulkUpdateInventoryPacket.ItemDataBlock>();
2181 bulkUpdate.ItemData = foo.ToArray();
2182
2181 //m_log.Debug("SendBulkUpdateInventory :" + bulkUpdate); 2183 //m_log.Debug("SendBulkUpdateInventory :" + bulkUpdate);
2182 OutPacket(bulkUpdate, ThrottleOutPacketType.Asset); 2184 OutPacket(bulkUpdate, ThrottleOutPacketType.Asset);
2183 } 2185 }
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index 8c9717c..a3cefc9 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -25,26 +25,74 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System.Collections.Generic;
28using OpenMetaverse; 29using OpenMetaverse;
29using Nini.Config; 30using Nini.Config;
30using OpenSim.Region.Framework.Interfaces; 31using OpenSim.Region.Framework.Interfaces;
31using OpenSim.Region.Framework.Scenes; 32using OpenSim.Region.Framework.Scenes;
33using OpenSim.Framework;
32 34
33namespace OpenSim.Region.OptionalModules.World.NPC 35namespace OpenSim.Region.OptionalModules.World.NPC
34{ 36{
35 public class NPCModule : IRegionModule 37 public interface INPCModule
38 {
39 UUID CreateNPC(string firstname, string lastname,Vector3 position, Scene scene, UUID cloneAppearanceFrom);
40 void Autopilot(UUID agentID, Scene scene, Vector3 pos);
41 void Say(UUID agentID, Scene scene, string text);
42 void DeleteNPC(UUID agentID, Scene scene);
43 }
44
45 public class NPCModule : IRegionModule, INPCModule
36 { 46 {
37 // private const bool m_enabled = false; 47 // private const bool m_enabled = false;
38 48
49 private Dictionary<UUID,NPCAvatar> m_avatars = new Dictionary<UUID, NPCAvatar>();
50
51 public UUID CreateNPC(string firstname, string lastname,Vector3 position, Scene scene, UUID cloneAppearanceFrom)
52 {
53 NPCAvatar npcAvatar = new NPCAvatar(firstname, lastname, position, scene);
54 scene.AddNewClient(npcAvatar);
55
56 ScenePresence sp;
57 if(scene.TryGetAvatar(npcAvatar.AgentId, out sp))
58 {
59 AvatarAppearance x = scene.CommsManager.AvatarService.GetUserAppearance(cloneAppearanceFrom);
60
61 List<byte> wearbyte = new List<byte>();
62 for (int i = 0; i < x.VisualParams.Length; i++)
63 {
64 wearbyte.Add(x.VisualParams[i]);
65 }
66
67 sp.SetAppearance(x.Texture.GetBytes(), wearbyte);
68 }
69
70 m_avatars.Add(npcAvatar.AgentId, npcAvatar);
71
72 return npcAvatar.AgentId;
73 }
74
75 public void Autopilot(UUID agentID, Scene scene, Vector3 pos)
76 {
77 ScenePresence sp;
78 scene.TryGetAvatar(agentID, out sp);
79 sp.DoAutoPilot(0,pos,m_avatars[agentID]);
80 }
81
82 public void Say(UUID agentID, Scene scene, string text)
83 {
84 m_avatars[agentID].Say(text);
85 }
86
87 public void DeleteNPC(UUID agentID, Scene scene)
88 {
89 scene.RemoveClient(agentID);
90 }
91
92
39 public void Initialise(Scene scene, IConfigSource source) 93 public void Initialise(Scene scene, IConfigSource source)
40 { 94 {
41 // if (m_enabled) 95 scene.RegisterModuleInterface<INPCModule>(this);
42 // {
43 // NPCAvatar testAvatar = new NPCAvatar("Jack", "NPC", new Vector3(128, 128, 40), scene);
44 // NPCAvatar testAvatar2 = new NPCAvatar("Jill", "NPC", new Vector3(136, 128, 40), scene);
45 // scene.AddNewClient(testAvatar);
46 // scene.AddNewClient(testAvatar2);
47 // }
48 } 96 }
49 97
50 public void PostInitialise() 98 public void PostInitialise()
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 4e665e9..972e71c 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -1978,30 +1978,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1978 return new LSL_Rotation(q.X, q.Y, q.Z, q.W); 1978 return new LSL_Rotation(q.X, q.Y, q.Z, q.W);
1979 } 1979 }
1980 1980
1981 private LSL_Rotation GetPartRot( SceneObjectPart part ) 1981 private LSL_Rotation GetPartRot( SceneObjectPart part )
1982 { 1982 {
1983 Quaternion q; 1983 Quaternion q;
1984 if (part.LinkNum == 0 || part.LinkNum == 1) // unlinked or root prim 1984 if (part.LinkNum == 0 || part.LinkNum == 1) // unlinked or root prim
1985 { 1985 {
1986 if (part.ParentGroup.RootPart.AttachmentPoint != 0) 1986 if (part.ParentGroup.RootPart.AttachmentPoint != 0)
1987 { 1987 {
1988 ScenePresence avatar = World.GetScenePresence(part.AttachedAvatar); 1988 ScenePresence avatar = World.GetScenePresence(part.AttachedAvatar);
1989 if (avatar != null) 1989 if (avatar != null)
1990 if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0) 1990 if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0)
1991 q = avatar.CameraRotation; // Mouselook 1991 q = avatar.CameraRotation; // Mouselook
1992 else 1992 else
1993 q = avatar.Rotation; // Currently infrequently updated so may be inaccurate 1993 q = avatar.Rotation; // Currently infrequently updated so may be inaccurate
1994 else 1994 else
1995 q = part.ParentGroup.GroupRotation; // Likely never get here but just in case 1995 q = part.ParentGroup.GroupRotation; // Likely never get here but just in case
1996 } 1996 }
1997 else 1997 else
1998 q = part.ParentGroup.GroupRotation; // just the group rotation 1998 q = part.ParentGroup.GroupRotation; // just the group rotation
1999 return new LSL_Rotation(q.X, q.Y, q.Z, q.W); 1999 return new LSL_Rotation(q.X, q.Y, q.Z, q.W);
2000 } 2000 }
2001 q = part.GetWorldRotation(); 2001 q = part.GetWorldRotation();
2002 return new LSL_Rotation(q.X, q.Y, q.Z, q.W); 2002 return new LSL_Rotation(q.X, q.Y, q.Z, q.W);
2003 } 2003 }
2004 2004
2005 public LSL_Rotation llGetLocalRot() 2005 public LSL_Rotation llGetLocalRot()
2006 { 2006 {
2007 m_host.AddScriptLPS(1); 2007 m_host.AddScriptLPS(1);