aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs206
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs52
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs6
-rw-r--r--OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs3
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs4
-rw-r--r--OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs18
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs6
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs6
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs2
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs107
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs18
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs21
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs19
22 files changed, 396 insertions, 102 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
index 95713e9..6786ac5 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
@@ -1,10 +1,39 @@
1using System; 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
2using System.Collections; 29using System.Collections;
3using System.Collections.Generic; 30using System.Collections.Generic;
4using System.IO; 31using System.IO;
5using System.Reflection; 32using System.Reflection;
33using System.Text;
6 34
7using OpenMetaverse; 35using OpenMetaverse;
36using OpenMetaverse.StructuredData;
8using Nini.Config; 37using Nini.Config;
9using log4net; 38using log4net;
10 39
@@ -12,11 +41,14 @@ using OpenSim.Framework;
12using OpenSim.Framework.Capabilities; 41using OpenSim.Framework.Capabilities;
13using OpenSim.Region.Framework; 42using OpenSim.Region.Framework;
14using OpenSim.Region.Framework.Scenes; 43using OpenSim.Region.Framework.Scenes;
44using OpenSim.Region.Framework.Scenes.Serialization;
15using OpenSim.Framework.Servers; 45using OpenSim.Framework.Servers;
16using OpenSim.Framework.Servers.HttpServer; 46using OpenSim.Framework.Servers.HttpServer;
17using OpenSim.Services.Interfaces; 47using OpenSim.Services.Interfaces;
18 48
19using Caps = OpenSim.Framework.Capabilities.Caps; 49using Caps = OpenSim.Framework.Capabilities.Caps;
50using OSDArray = OpenMetaverse.StructuredData.OSDArray;
51using OSDMap = OpenMetaverse.StructuredData.OSDMap;
20 52
21namespace OpenSim.Region.ClientStack.Linden 53namespace OpenSim.Region.ClientStack.Linden
22{ 54{
@@ -79,7 +111,7 @@ namespace OpenSim.Region.ClientStack.Linden
79 111
80 private bool m_persistBakedTextures = false; 112 private bool m_persistBakedTextures = false;
81 private IAssetService m_assetService; 113 private IAssetService m_assetService;
82 private bool m_dumpAssetsToFile; 114 private bool m_dumpAssetsToFile = false;
83 private string m_regionName; 115 private string m_regionName;
84 116
85 public BunchOfCaps(Scene scene, Caps caps) 117 public BunchOfCaps(Scene scene, Caps caps)
@@ -439,7 +471,7 @@ namespace OpenSim.Region.ClientStack.Linden
439 } 471 }
440 472
441 /// <summary> 473 /// <summary>
442 /// 474 /// Convert raw uploaded data into the appropriate asset and item.
443 /// </summary> 475 /// </summary>
444 /// <param name="assetID"></param> 476 /// <param name="assetID"></param>
445 /// <param name="inventoryItem"></param> 477 /// <param name="inventoryItem"></param>
@@ -448,6 +480,10 @@ namespace OpenSim.Region.ClientStack.Linden
448 UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, 480 UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType,
449 string assetType) 481 string assetType)
450 { 482 {
483 m_log.DebugFormat(
484 "Uploaded asset {0} for inventory item {1}, inv type {2}, asset type {3}",
485 assetID, inventoryItem, inventoryType, assetType);
486
451 sbyte assType = 0; 487 sbyte assType = 0;
452 sbyte inType = 0; 488 sbyte inType = 0;
453 489
@@ -474,6 +510,156 @@ namespace OpenSim.Region.ClientStack.Linden
474 break; 510 break;
475 } 511 }
476 } 512 }
513 else if (inventoryType == "object")
514 {
515 inType = (sbyte)InventoryType.Object;
516 assType = (sbyte)AssetType.Object;
517
518 List<Vector3> positions = new List<Vector3>();
519 List<Quaternion> rotations = new List<Quaternion>();
520 OSDMap request = (OSDMap)OSDParser.DeserializeLLSDXml(data);
521 OSDArray instance_list = (OSDArray)request["instance_list"];
522 OSDArray mesh_list = (OSDArray)request["mesh_list"];
523 OSDArray texture_list = (OSDArray)request["texture_list"];
524 SceneObjectGroup grp = null;
525
526 List<UUID> textures = new List<UUID>();
527 for (int i = 0; i < texture_list.Count; i++)
528 {
529 AssetBase textureAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Texture, "");
530 textureAsset.Data = texture_list[i].AsBinary();
531 m_assetService.Store(textureAsset);
532 textures.Add(textureAsset.FullID);
533 }
534
535 for (int i = 0; i < mesh_list.Count; i++)
536 {
537 PrimitiveBaseShape pbs = PrimitiveBaseShape.CreateBox();
538
539 Primitive.TextureEntry textureEntry
540 = new Primitive.TextureEntry(Primitive.TextureEntry.WHITE_TEXTURE);
541 OSDMap inner_instance_list = (OSDMap)instance_list[i];
542
543 OSDArray face_list = (OSDArray)inner_instance_list["face_list"];
544 for (uint face = 0; face < face_list.Count; face++)
545 {
546 OSDMap faceMap = (OSDMap)face_list[(int)face];
547 Primitive.TextureEntryFace f = pbs.Textures.CreateFace(face);
548 if(faceMap.ContainsKey("fullbright"))
549 f.Fullbright = faceMap["fullbright"].AsBoolean();
550 if (faceMap.ContainsKey ("diffuse_color"))
551 f.RGBA = faceMap["diffuse_color"].AsColor4();
552
553 int textureNum = faceMap["image"].AsInteger();
554 float imagerot = faceMap["imagerot"].AsInteger();
555 float offsets = (float)faceMap["offsets"].AsReal();
556 float offsett = (float)faceMap["offsett"].AsReal();
557 float scales = (float)faceMap["scales"].AsReal();
558 float scalet = (float)faceMap["scalet"].AsReal();
559
560 if(imagerot != 0)
561 f.Rotation = imagerot;
562
563 if(offsets != 0)
564 f.OffsetU = offsets;
565
566 if (offsett != 0)
567 f.OffsetV = offsett;
568
569 if (scales != 0)
570 f.RepeatU = scales;
571
572 if (scalet != 0)
573 f.RepeatV = scalet;
574
575 if (textures.Count > textureNum)
576 f.TextureID = textures[textureNum];
577 else
578 f.TextureID = Primitive.TextureEntry.WHITE_TEXTURE;
579
580 textureEntry.FaceTextures[face] = f;
581 }
582
583 pbs.TextureEntry = textureEntry.GetBytes();
584
585 AssetBase meshAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Mesh, "");
586 meshAsset.Data = mesh_list[i].AsBinary();
587 m_assetService.Store(meshAsset);
588
589 pbs.SculptEntry = true;
590 pbs.SculptTexture = meshAsset.FullID;
591 pbs.SculptType = (byte)SculptType.Mesh;
592 pbs.SculptData = meshAsset.Data;
593
594 Vector3 position = inner_instance_list["position"].AsVector3();
595 Vector3 scale = inner_instance_list["scale"].AsVector3();
596 Quaternion rotation = inner_instance_list["rotation"].AsQuaternion();
597
598// int physicsShapeType = inner_instance_list["physics_shape_type"].AsInteger();
599// int material = inner_instance_list["material"].AsInteger();
600// int mesh = inner_instance_list["mesh"].AsInteger();
601
602 OSDMap permissions = (OSDMap)inner_instance_list["permissions"];
603 int base_mask = permissions["base_mask"].AsInteger();
604 int everyone_mask = permissions["everyone_mask"].AsInteger();
605 UUID creator_id = permissions["creator_id"].AsUUID();
606 UUID group_id = permissions["group_id"].AsUUID();
607 int group_mask = permissions["group_mask"].AsInteger();
608// bool is_owner_group = permissions["is_owner_group"].AsBoolean();
609// UUID last_owner_id = permissions["last_owner_id"].AsUUID();
610 int next_owner_mask = permissions["next_owner_mask"].AsInteger();
611 UUID owner_id = permissions["owner_id"].AsUUID();
612 int owner_mask = permissions["owner_mask"].AsInteger();
613
614 SceneObjectPart prim
615 = new SceneObjectPart(owner_id, pbs, position, Quaternion.Identity, Vector3.Zero);
616
617 prim.Scale = scale;
618 prim.OffsetPosition = position;
619 rotations.Add(rotation);
620 positions.Add(position);
621 prim.UUID = UUID.Random();
622 prim.CreatorID = creator_id;
623 prim.OwnerID = owner_id;
624 prim.GroupID = group_id;
625 prim.LastOwnerID = prim.OwnerID;
626 prim.CreationDate = Util.UnixTimeSinceEpoch();
627 prim.Name = assetName;
628 prim.Description = "";
629
630 prim.BaseMask = (uint)base_mask;
631 prim.EveryoneMask = (uint)everyone_mask;
632 prim.GroupMask = (uint)group_mask;
633 prim.NextOwnerMask = (uint)next_owner_mask;
634 prim.OwnerMask = (uint)owner_mask;
635
636 if (grp == null)
637 grp = new SceneObjectGroup(prim);
638 else
639 grp.AddPart(prim);
640 }
641
642 // Fix first link number
643 if (grp.Parts.Length > 1)
644 grp.RootPart.LinkNum++;
645
646 Vector3 rootPos = positions[0];
647 grp.AbsolutePosition = rootPos;
648 for (int i = 0; i < positions.Count; i++)
649 {
650 Vector3 offset = positions[i] - rootPos;
651 grp.Parts[i].OffsetPosition = offset;
652 }
653
654 for (int i = 0; i < rotations.Count; i++)
655 {
656 if (i != 0)
657 grp.Parts[i].RotationOffset = rotations[i];
658 }
659
660 grp.UpdateGroupRotationR(rotations[0]);
661 data = ASCIIEncoding.ASCII.GetBytes(SceneObjectSerializer.ToOriginalXmlFormat(grp));
662 }
477 663
478 AssetBase asset; 664 AssetBase asset;
479 asset = new AssetBase(assetID, assetName, assType, m_HostCapsObj.AgentID.ToString()); 665 asset = new AssetBase(assetID, assetName, assType, m_HostCapsObj.AgentID.ToString());
@@ -506,8 +692,6 @@ namespace OpenSim.Region.ClientStack.Linden
506 } 692 }
507 } 693 }
508 694
509
510
511 /// <summary> 695 /// <summary>
512 /// 696 ///
513 /// </summary> 697 /// </summary>
@@ -632,7 +816,7 @@ namespace OpenSim.Region.ClientStack.Linden
632 } 816 }
633 817
634 /// <summary> 818 /// <summary>
635 /// 819 /// Handle raw asset upload data via the capability.
636 /// </summary> 820 /// </summary>
637 /// <param name="data"></param> 821 /// <param name="data"></param>
638 /// <param name="path"></param> 822 /// <param name="path"></param>
@@ -670,6 +854,7 @@ namespace OpenSim.Region.ClientStack.Linden
670 854
671 return res; 855 return res;
672 } 856 }
857
673 ///Left this in and commented in case there are unforseen issues 858 ///Left this in and commented in case there are unforseen issues
674 //private void SaveAssetToFile(string filename, byte[] data) 859 //private void SaveAssetToFile(string filename, byte[] data)
675 //{ 860 //{
@@ -679,6 +864,7 @@ namespace OpenSim.Region.ClientStack.Linden
679 // bw.Close(); 864 // bw.Close();
680 // fs.Close(); 865 // fs.Close();
681 //} 866 //}
867
682 private static void SaveAssetToFile(string filename, byte[] data) 868 private static void SaveAssetToFile(string filename, byte[] data)
683 { 869 {
684 string assetPath = "UserAssets"; 870 string assetPath = "UserAssets";
@@ -719,7 +905,7 @@ namespace OpenSim.Region.ClientStack.Linden
719 } 905 }
720 906
721 /// <summary> 907 /// <summary>
722 /// 908 /// Handle raw uploaded asset data.
723 /// </summary> 909 /// </summary>
724 /// <param name="data"></param> 910 /// <param name="data"></param>
725 /// <param name="path"></param> 911 /// <param name="path"></param>
@@ -752,6 +938,7 @@ namespace OpenSim.Region.ClientStack.Linden
752 938
753 return res; 939 return res;
754 } 940 }
941
755 ///Left this in and commented in case there are unforseen issues 942 ///Left this in and commented in case there are unforseen issues
756 //private void SaveAssetToFile(string filename, byte[] data) 943 //private void SaveAssetToFile(string filename, byte[] data)
757 //{ 944 //{
@@ -761,6 +948,7 @@ namespace OpenSim.Region.ClientStack.Linden
761 // bw.Close(); 948 // bw.Close();
762 // fs.Close(); 949 // fs.Close();
763 //} 950 //}
951
764 private static void SaveAssetToFile(string filename, byte[] data) 952 private static void SaveAssetToFile(string filename, byte[] data)
765 { 953 {
766 string assetPath = "UserAssets"; 954 string assetPath = "UserAssets";
@@ -839,7 +1027,7 @@ namespace OpenSim.Region.ClientStack.Linden
839 uploadComplete.new_asset = inventoryItemID; 1027 uploadComplete.new_asset = inventoryItemID;
840 uploadComplete.compiled = errors.Count > 0 ? false : true; 1028 uploadComplete.compiled = errors.Count > 0 ? false : true;
841 uploadComplete.state = "complete"; 1029 uploadComplete.state = "complete";
842 uploadComplete.errors = new OSDArray(); 1030 uploadComplete.errors = new OpenSim.Framework.Capabilities.OSDArray();
843 uploadComplete.errors.Array = errors; 1031 uploadComplete.errors.Array = errors;
844 1032
845 res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); 1033 res = LLSDHelpers.SerialiseLLSDReply(uploadComplete);
@@ -905,7 +1093,7 @@ namespace OpenSim.Region.ClientStack.Linden
905 } 1093 }
906 1094
907 /// <summary> 1095 /// <summary>
908 /// 1096 /// Handle raw uploaded baked texture data.
909 /// </summary> 1097 /// </summary>
910 /// <param name="data"></param> 1098 /// <param name="data"></param>
911 /// <param name="path"></param> 1099 /// <param name="path"></param>
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index e92f072..d02a305 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -162,12 +162,12 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
162 // one and we're done otherwise, ask for a rebake 162 // one and we're done otherwise, ask for a rebake
163 if (checkonly) return false; 163 if (checkonly) return false;
164 164
165 m_log.InfoFormat("[AVFACTORY]: missing baked texture {0}, requesting rebake",face.TextureID); 165 m_log.InfoFormat("[AVFACTORY]: missing baked texture {0}, requesting rebake", face.TextureID);
166 client.SendRebakeAvatarTextures(face.TextureID); 166 client.SendRebakeAvatarTextures(face.TextureID);
167 } 167 }
168 } 168 }
169 169
170 m_log.DebugFormat("[AVFACTORY]: completed texture check for {0}", client.AgentId); 170 m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0}", client.AgentId);
171 171
172 // If we only found default textures, then the appearance is not cached 172 // If we only found default textures, then the appearance is not cached
173 return (defonly ? false : true); 173 return (defonly ? false : true);
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 02efcd8..a00e240 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -50,6 +50,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
50 { 50 {
51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
52 52
53 /// <summary>
54 /// The maximum distance, in standard region units (256m) that an agent is allowed to transfer.
55 /// </summary>
56 public int MaxTransferDistance { get; set; }
57
53 protected bool m_Enabled = false; 58 protected bool m_Enabled = false;
54 protected Scene m_aScene; 59 protected Scene m_aScene;
55 protected List<Scene> m_Scenes = new List<Scene>(); 60 protected List<Scene> m_Scenes = new List<Scene>();
@@ -78,13 +83,26 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
78 string name = moduleConfig.GetString("EntityTransferModule", ""); 83 string name = moduleConfig.GetString("EntityTransferModule", "");
79 if (name == Name) 84 if (name == Name)
80 { 85 {
81 m_agentsInTransit = new List<UUID>(); 86 InitialiseCommon(source);
82 m_Enabled = true; 87 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: {0} enabled.", Name);
83 m_log.InfoFormat("[ENTITY TRANSFER MODULE]: {0} enabled.", Name);
84 } 88 }
85 } 89 }
86 } 90 }
87 91
92 /// <summary>
93 /// Initialize config common for this module and any descendents.
94 /// </summary>
95 /// <param name="source"></param>
96 protected virtual void InitialiseCommon(IConfigSource source)
97 {
98 IConfig transferConfig = source.Configs["EntityTransfer"];
99 if (transferConfig != null)
100 MaxTransferDistance = transferConfig.GetInt("max_distance", 4095);
101
102 m_agentsInTransit = new List<UUID>();
103 m_Enabled = true;
104 }
105
88 public virtual void PostInitialise() 106 public virtual void PostInitialise()
89 { 107 {
90 } 108 }
@@ -114,7 +132,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
114 return; 132 return;
115 } 133 }
116 134
117
118 public virtual void RemoveRegion(Scene scene) 135 public virtual void RemoveRegion(Scene scene)
119 { 136 {
120 if (!m_Enabled) 137 if (!m_Enabled)
@@ -129,7 +146,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
129 { 146 {
130 if (!m_Enabled) 147 if (!m_Enabled)
131 return; 148 return;
132
133 } 149 }
134 150
135 #endregion 151 #endregion
@@ -205,8 +221,18 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
205 sp.ControllingClient.SendTeleportFailed("Problem at destination"); 221 sp.ControllingClient.SendTeleportFailed("Problem at destination");
206 return; 222 return;
207 } 223 }
208 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final destination is x={0} y={1} {2}@{3}", 224
209 finalDestination.RegionLocX / Constants.RegionSize, finalDestination.RegionLocY / Constants.RegionSize, finalDestination.RegionID, finalDestination.ServerURI); 225 uint curX = 0, curY = 0;
226 Utils.LongToUInts(sp.Scene.RegionInfo.RegionHandle, out curX, out curY);
227 int curCellX = (int)(curX / Constants.RegionSize);
228 int curCellY = (int)(curY / Constants.RegionSize);
229 int destCellX = (int)(finalDestination.RegionLocX / Constants.RegionSize);
230 int destCellY = (int)(finalDestination.RegionLocY / Constants.RegionSize);
231
232// m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Source co-ords are x={0} y={1}", curRegionX, curRegionY);
233//
234// m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final dest is x={0} y={1} {2}@{3}",
235// destRegionX, destRegionY, finalDestination.RegionID, finalDestination.ServerURI);
210 236
211 // Check that these are not the same coordinates 237 // Check that these are not the same coordinates
212 if (finalDestination.RegionLocX == sp.Scene.RegionInfo.RegionLocX && 238 if (finalDestination.RegionLocX == sp.Scene.RegionInfo.RegionLocX &&
@@ -217,6 +243,18 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
217 return; 243 return;
218 } 244 }
219 245
246 if (Math.Abs(curCellX - destCellX) > MaxTransferDistance || Math.Abs(curCellY - destCellY) > MaxTransferDistance)
247 {
248 sp.ControllingClient.SendTeleportFailed(
249 string.Format(
250 "Can't teleport to {0} ({1},{2}) from {3} ({4},{5}), destination is more than {6} regions way",
251 finalDestination.RegionName, destCellX, destCellY,
252 sp.Scene.RegionInfo.RegionName, curCellX, curCellY,
253 MaxTransferDistance));
254
255 return;
256 }
257
220 // 258 //
221 // This is it 259 // This is it
222 // 260 //
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
index 8858ad5..6daae62 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
@@ -67,10 +67,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
67 string name = moduleConfig.GetString("EntityTransferModule", ""); 67 string name = moduleConfig.GetString("EntityTransferModule", "");
68 if (name == Name) 68 if (name == Name)
69 { 69 {
70 m_agentsInTransit = new List<UUID>(); 70 InitialiseCommon(source);
71 71 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name);
72 m_Enabled = true;
73 m_log.InfoFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name);
74 } 72 }
75 } 73 }
76 } 74 }
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
index cfd8ffb..27eb178 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
@@ -297,9 +297,10 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
297 if (m_UserCache.ContainsKey(id)) 297 if (m_UserCache.ContainsKey(id))
298 return; 298 return;
299 299
300// m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, craetorData {1}", id, creatorData);
301
300 UserData user = new UserData(); 302 UserData user = new UserData();
301 user.Id = id; 303 user.Id = id;
302
303 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, id); 304 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, id);
304 305
305 if (account != null) 306 if (account != null)
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
index 56c59bd..ced2773 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
@@ -91,6 +91,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
91 remoteClient.SendAlertMessage("Use a search string with at least 2 characters"); 91 remoteClient.SendAlertMessage("Use a search string with at least 2 characters");
92 return; 92 return;
93 } 93 }
94
95m_log.DebugFormat("MAP NAME=({0})", mapName);
94 96
95 // try to fetch from GridServer 97 // try to fetch from GridServer
96 List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20); 98 List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20);
@@ -103,7 +105,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
103 if (info != null) 105 if (info != null)
104 regionInfos.Add(info); 106 regionInfos.Add(info);
105 } 107 }
106 else if (regionInfos.Count == 0 && mapName.StartsWith("http://")) 108 else if (regionInfos.Count == 0)
107 remoteClient.SendAlertMessage("Hyperlink could not be established."); 109 remoteClient.SendAlertMessage("Hyperlink could not be established.");
108 110
109 //m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions", mapName, regionInfos.Count); 111 //m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions", mapName, regionInfos.Count);
diff --git a/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs b/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs
index 22795fc..d0e5609 100644
--- a/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs
+++ b/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs
@@ -36,4 +36,4 @@ namespace OpenSim.Region.Framework.Interfaces
36 void QueueAppearanceSend(UUID agentid); 36 void QueueAppearanceSend(UUID agentid);
37 void QueueAppearanceSave(UUID agentid); 37 void QueueAppearanceSave(UUID agentid);
38 } 38 }
39} 39} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index c04bbb4..28c0276 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -1347,7 +1347,7 @@ namespace OpenSim.Region.Framework.Scenes
1347// m_log.DebugFormat("[AGENT INVENTORY]: Sending inventory folder contents ({0} nodes) for \"{1}\" to {2} {3}", 1347// m_log.DebugFormat("[AGENT INVENTORY]: Sending inventory folder contents ({0} nodes) for \"{1}\" to {2} {3}",
1348// contents.Folders.Count + contents.Items.Count, containingFolder.Name, client.FirstName, client.LastName); 1348// contents.Folders.Count + contents.Items.Count, containingFolder.Name, client.FirstName, client.LastName);
1349 1349
1350 if (containingFolder != null && containingFolder != null) 1350 if (containingFolder != null)
1351 { 1351 {
1352 // If the folder requested contains links, then we need to send those folders first, otherwise the links 1352 // If the folder requested contains links, then we need to send those folders first, otherwise the links
1353 // will be broken in the viewer. 1353 // will be broken in the viewer.
@@ -1359,15 +1359,25 @@ namespace OpenSim.Region.Framework.Scenes
1359 InventoryItemBase linkedItem = InventoryService.GetItem(new InventoryItemBase(item.AssetID)); 1359 InventoryItemBase linkedItem = InventoryService.GetItem(new InventoryItemBase(item.AssetID));
1360 1360
1361 // Take care of genuinely broken links where the target doesn't exist 1361 // Take care of genuinely broken links where the target doesn't exist
1362 if (linkedItem != null) 1362 // HACK: Also, don't follow up links that just point to other links. In theory this is legitimate,
1363 linkedItemFolderIdsToSend.Add(linkedItem.Folder); 1363 // but no viewer has been observed to set these up and this is the lazy way of avoiding cycles
1364 // rather than having to keep track of every folder requested in the recursion.
1365 if (linkedItem != null && linkedItem.AssetType != (int)AssetType.Link)
1366 {
1367 // We don't need to send the folder if source and destination of the link are in the same
1368 // folder.
1369 if (linkedItem.Folder != containingFolder.ID)
1370 linkedItemFolderIdsToSend.Add(linkedItem.Folder);
1371 }
1364 } 1372 }
1365 } 1373 }
1366 1374
1367 foreach (UUID linkedItemFolderId in linkedItemFolderIdsToSend) 1375 foreach (UUID linkedItemFolderId in linkedItemFolderIdsToSend)
1368 SendInventoryUpdate(client, new InventoryFolderBase(linkedItemFolderId), false, true); 1376 SendInventoryUpdate(client, new InventoryFolderBase(linkedItemFolderId), false, true);
1369 1377
1370 client.SendInventoryFolderDetails(client.AgentId, folder.ID, contents.Items, contents.Folders, containingFolder.Version, fetchFolders, fetchItems); 1378 client.SendInventoryFolderDetails(
1379 client.AgentId, folder.ID, contents.Items, contents.Folders,
1380 containingFolder.Version, fetchFolders, fetchItems);
1371 } 1381 }
1372 } 1382 }
1373 1383
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 1575e50..253adae 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2706,8 +2706,10 @@ namespace OpenSim.Region.Framework.Scenes
2706 { 2706 {
2707 string homeURL = string.Empty; 2707 string homeURL = string.Empty;
2708 string first = aCircuit.firstname, last = aCircuit.lastname; 2708 string first = aCircuit.firstname, last = aCircuit.lastname;
2709
2709 if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) 2710 if (aCircuit.ServiceURLs.ContainsKey("HomeURI"))
2710 homeURL = aCircuit.ServiceURLs["HomeURI"].ToString(); 2711 homeURL = aCircuit.ServiceURLs["HomeURI"].ToString();
2712
2711 if (aCircuit.lastname.StartsWith("@")) 2713 if (aCircuit.lastname.StartsWith("@"))
2712 { 2714 {
2713 string[] parts = aCircuit.firstname.Split('.'); 2715 string[] parts = aCircuit.firstname.Split('.');
@@ -2717,6 +2719,7 @@ namespace OpenSim.Region.Framework.Scenes
2717 last = parts[1]; 2719 last = parts[1];
2718 } 2720 }
2719 } 2721 }
2722
2720 uMan.AddUser(aCircuit.AgentID, first, last, homeURL); 2723 uMan.AddUser(aCircuit.AgentID, first, last, homeURL);
2721 } 2724 }
2722 } 2725 }
@@ -3530,7 +3533,6 @@ namespace OpenSim.Region.Framework.Scenes
3530 } 3533 }
3531 } 3534 }
3532 3535
3533
3534 // In all cases, add or update the circuit data with the new agent circuit data and teleport flags 3536 // In all cases, add or update the circuit data with the new agent circuit data and teleport flags
3535 agent.teleportFlags = teleportFlags; 3537 agent.teleportFlags = teleportFlags;
3536 m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); 3538 m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent);
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index e3744bd..ff1d520 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -806,7 +806,8 @@ namespace OpenSim.Region.Framework.Scenes
806 actor.Orientation = GetWorldRotation(); 806 actor.Orientation = GetWorldRotation();
807 807
808 // Tell the physics engines that this prim changed. 808 // Tell the physics engines that this prim changed.
809 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); 809 if (m_parentGroup.Scene != null)
810 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
810 } 811 }
811 812
812 if (!m_parentGroup.m_dupeInProgress) 813 if (!m_parentGroup.m_dupeInProgress)
@@ -1117,6 +1118,9 @@ namespace OpenSim.Region.Framework.Scenes
1117 { 1118 {
1118 get 1119 get
1119 { 1120 {
1121 if (IsAttachment)
1122 return GroupPosition;
1123
1120 return GroupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset); 1124 return GroupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset);
1121 } 1125 }
1122 } 1126 }
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index af6f89c..d2f84e3 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2251,10 +2251,9 @@ namespace OpenSim.Region.Framework.Scenes
2251 m_log.Warn("Sit requested on unknown object: " + targetID.ToString()); 2251 m_log.Warn("Sit requested on unknown object: " + targetID.ToString());
2252 } 2252 }
2253 2253
2254
2255
2256 SendSitResponse(remoteClient, targetID, offset, Quaternion.Identity); 2254 SendSitResponse(remoteClient, targetID, offset, Quaternion.Identity);
2257 } 2255 }
2256
2258 /* 2257 /*
2259 public void SitRayCastAvatarPosition(SceneObjectPart part) 2258 public void SitRayCastAvatarPosition(SceneObjectPart part)
2260 { 2259 {
@@ -2797,7 +2796,6 @@ namespace OpenSim.Region.Framework.Scenes
2797 /// <param name="remoteClient"></param> 2796 /// <param name="remoteClient"></param>
2798 public void SendTerseUpdateToClient(IClientAPI remoteClient) 2797 public void SendTerseUpdateToClient(IClientAPI remoteClient)
2799 { 2798 {
2800
2801 // If the client is inactive, it's getting its updates from another 2799 // If the client is inactive, it's getting its updates from another
2802 // server. 2800 // server.
2803 if (remoteClient.IsActive) 2801 if (remoteClient.IsActive)
@@ -2912,7 +2910,7 @@ namespace OpenSim.Region.Framework.Scenes
2912 } 2910 }
2913 2911
2914 // If we aren't using a cached appearance, then clear out the baked textures 2912 // If we aren't using a cached appearance, then clear out the baked textures
2915 if (! cachedappearance) 2913 if (!cachedappearance)
2916 { 2914 {
2917 m_appearance.ResetAppearance(); 2915 m_appearance.ResetAppearance();
2918 if (m_scene.AvatarFactory != null) 2916 if (m_scene.AvatarFactory != null)
diff --git a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs
index 7304145..77e7acf 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs
@@ -113,7 +113,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance
113 { 113 {
114 bool bakedTextureValid = scene.AvatarFactory.ValidateBakedTextureCache(client); 114 bool bakedTextureValid = scene.AvatarFactory.ValidateBakedTextureCache(client);
115 MainConsole.Instance.OutputFormat( 115 MainConsole.Instance.OutputFormat(
116 "{0} baked apperance texture is {1}", client.Name, bakedTextureValid ? "OK" : "corrupt"); 116 "{0} baked appearance texture is {1}", client.Name, bakedTextureValid ? "OK" : "corrupt");
117 } 117 }
118 }); 118 });
119 } 119 }
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
index 4f1097e..4f86e42 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
@@ -417,9 +417,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
417 public string ParcelVoiceInfoRequest(Scene scene, string request, string path, string param, 417 public string ParcelVoiceInfoRequest(Scene scene, string request, string path, string param,
418 UUID agentID, Caps caps) 418 UUID agentID, Caps caps)
419 { 419 {
420// m_log.DebugFormat( 420 m_log.DebugFormat(
421// "[FreeSwitchVoice][PARCELVOICE]: ParcelVoiceInfoRequest() on {0} for {1}", 421 "[FreeSwitchVoice][PARCELVOICE]: ParcelVoiceInfoRequest() on {0} for {1}",
422// scene.RegionInfo.RegionName, agentID); 422 scene.RegionInfo.RegionName, agentID);
423 423
424 ScenePresence avatar = scene.GetScenePresence(agentID); 424 ScenePresence avatar = scene.GetScenePresence(agentID);
425 string avatarName = avatar.Name; 425 string avatarName = avatar.Name;
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs
index 2bf8489..0800e98 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs
@@ -70,7 +70,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
70 // if groups aren't enabled, we're not needed. 70 // if groups aren't enabled, we're not needed.
71 // if we're not specified as the connector to use, then we're not wanted 71 // if we're not specified as the connector to use, then we're not wanted
72 if ((groupsConfig.GetBoolean("Enabled", false) == false) 72 if ((groupsConfig.GetBoolean("Enabled", false) == false)
73 || (groupsConfig.GetString("MessagingModule", "Default") != Name)) 73 || (groupsConfig.GetString("MessagingModule", "GroupsMessagingModule") != Name))
74 { 74 {
75 m_groupMessagingEnabled = false; 75 m_groupMessagingEnabled = false;
76 return; 76 return;
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs
index 02751ea..42008da 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs
@@ -200,7 +200,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
200 // if groups aren't enabled, we're not needed. 200 // if groups aren't enabled, we're not needed.
201 // if we're not specified as the connector to use, then we're not wanted 201 // if we're not specified as the connector to use, then we're not wanted
202 if ((groupsConfig.GetBoolean("Enabled", false) == false) 202 if ((groupsConfig.GetBoolean("Enabled", false) == false)
203 || (groupsConfig.GetString("ServicesConnectorModule", "Default") != Name)) 203 || (groupsConfig.GetString("ServicesConnectorModule", "XmlRpcGroupsServicesConnector") != Name))
204 { 204 {
205 m_connectorEnabled = false; 205 m_connectorEnabled = false;
206 return; 206 return;
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
index 2631ac1..a08bcd0 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
@@ -109,7 +109,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
109 // if groups aren't enabled, we're not needed. 109 // if groups aren't enabled, we're not needed.
110 // if we're not specified as the connector to use, then we're not wanted 110 // if we're not specified as the connector to use, then we're not wanted
111 if ((groupsConfig.GetBoolean("Enabled", false) == false) 111 if ((groupsConfig.GetBoolean("Enabled", false) == false)
112 || (groupsConfig.GetString("ServicesConnectorModule", "Default") != Name)) 112 || (groupsConfig.GetString("ServicesConnectorModule", "XmlRpcGroupsServicesConnector") != Name))
113 { 113 {
114 m_connectorEnabled = false; 114 m_connectorEnabled = false;
115 return; 115 return;
diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
index eed6450..05c729a 100644
--- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
@@ -36,6 +36,7 @@ using log4net;
36using Nini.Config; 36using Nini.Config;
37using OpenMetaverse; 37using OpenMetaverse;
38using OpenMetaverse.StructuredData; 38using OpenMetaverse.StructuredData;
39using OpenSim.Services.Interfaces;
39 40
40using OpenSim.Framework; 41using OpenSim.Framework;
41using OpenSim.Region.Framework.Interfaces; 42using OpenSim.Region.Framework.Interfaces;
@@ -175,6 +176,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
175 176
176 m_scene.EventManager.TriggerOnChatBroadcast(this, c); 177 m_scene.EventManager.TriggerOnChatBroadcast(this, c);
177 m_scene.EventManager.TriggerLoginsEnabled(m_scene.RegionInfo.RegionName); 178 m_scene.EventManager.TriggerLoginsEnabled(m_scene.RegionInfo.RegionName);
179 m_scene.SceneGridService.InformNeighborsThatRegionisUp(m_scene.RequestModuleInterface<INeighbourService>(), m_scene.RegionInfo);
178 } 180 }
179 } 181 }
180 182
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index c471636..48d236f 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -25,10 +25,13 @@
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;
28using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection;
29using System.Threading; 31using System.Threading;
30using OpenMetaverse; 32using log4net;
31using Nini.Config; 33using Nini.Config;
34using OpenMetaverse;
32using OpenSim.Region.Framework.Interfaces; 35using OpenSim.Region.Framework.Interfaces;
33using OpenSim.Region.Framework.Scenes; 36using OpenSim.Region.Framework.Scenes;
34using OpenSim.Region.CoreModules.Avatar.NPC; 37using OpenSim.Region.CoreModules.Avatar.NPC;
@@ -40,6 +43,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC
40{ 43{
41 public class NPCModule : IRegionModule, INPCModule 44 public class NPCModule : IRegionModule, INPCModule
42 { 45 {
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47
43 // private const bool m_enabled = false; 48 // private const bool m_enabled = false;
44 49
45 private Mutex m_createMutex; 50 private Mutex m_createMutex;
@@ -59,6 +64,17 @@ namespace OpenSim.Region.OptionalModules.World.NPC
59 private UUID p_cloneAppearanceFrom; 64 private UUID p_cloneAppearanceFrom;
60 private UUID p_returnUuid; 65 private UUID p_returnUuid;
61 66
67 public void Initialise(Scene scene, IConfigSource source)
68 {
69 m_createMutex = new Mutex(false);
70
71 m_timer = new Timer(500);
72 m_timer.Elapsed += m_timer_Elapsed;
73 m_timer.Start();
74
75 scene.RegisterModuleInterface<INPCModule>(this);
76 }
77
62 private AvatarAppearance GetAppearance(UUID target, Scene scene) 78 private AvatarAppearance GetAppearance(UUID target, Scene scene)
63 { 79 {
64 if (m_appearanceCache.ContainsKey(target)) 80 if (m_appearanceCache.ContainsKey(target))
@@ -76,6 +92,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC
76 92
77 public UUID CreateNPC(string firstname, string lastname,Vector3 position, Scene scene, UUID cloneAppearanceFrom) 93 public UUID CreateNPC(string firstname, string lastname,Vector3 position, Scene scene, UUID cloneAppearanceFrom)
78 { 94 {
95 m_log.DebugFormat(
96 "[NPC MODULE]: Queueing request to create NPC {0} {1} at {2} in {3} cloning appearance of {4}",
97 firstname, lastname, position, scene.RegionInfo.RegionName, cloneAppearanceFrom);
98
79 // Block. 99 // Block.
80 m_createMutex.WaitOne(); 100 m_createMutex.WaitOne();
81 101
@@ -137,46 +157,67 @@ namespace OpenSim.Region.OptionalModules.World.NPC
137 } 157 }
138 } 158 }
139 159
140
141 public void Initialise(Scene scene, IConfigSource source)
142 {
143 m_createMutex = new Mutex(false);
144
145 m_timer = new Timer(500);
146 m_timer.Elapsed += m_timer_Elapsed;
147 m_timer.Start();
148
149 scene.RegisterModuleInterface<INPCModule>(this);
150 }
151
152 void m_timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) 160 void m_timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
153 { 161 {
154 lock (p_lock) 162 try
155 { 163 {
156 if (p_inUse) 164 lock (p_lock)
157 { 165 {
158 p_inUse = false; 166 if (p_inUse)
159
160 NPCAvatar npcAvatar = new NPCAvatar(p_firstname, p_lastname, p_position, p_scene);
161 npcAvatar.CircuitCode = (uint) Util.RandomClass.Next(0, int.MaxValue);
162
163 p_scene.AddNewClient(npcAvatar);
164
165 ScenePresence sp;
166 if (p_scene.TryGetScenePresence(npcAvatar.AgentId, out sp))
167 { 167 {
168 AvatarAppearance x = GetAppearance(p_cloneAppearanceFrom, p_scene); 168 p_inUse = false;
169 169
170 sp.Appearance.SetTextureEntries(x.Texture); 170 NPCAvatar npcAvatar = new NPCAvatar(p_firstname, p_lastname, p_position, p_scene);
171 sp.Appearance.SetVisualParams((byte[])x.VisualParams.Clone()); 171 npcAvatar.CircuitCode = (uint) Util.RandomClass.Next(0, int.MaxValue);
172 sp.SendAppearanceToAllOtherAgents(); 172
173 m_log.DebugFormat(
174 "[NPC MODULE]: Creating NPC {0} {1} {2} at {3} in {4}",
175 p_firstname, p_lastname, npcAvatar.AgentId, p_position, p_scene.RegionInfo.RegionName);
176
177 AgentCircuitData acd = new AgentCircuitData();
178 acd.AgentID = npcAvatar.AgentId;
179 acd.firstname = p_firstname;
180 acd.lastname = p_lastname;
181 acd.ServiceURLs = new Dictionary<string, object>();
182
183 AvatarAppearance originalAppearance = GetAppearance(p_cloneAppearanceFrom, p_scene);
184 AvatarAppearance npcAppearance = new AvatarAppearance(originalAppearance, true);
185 acd.Appearance = npcAppearance;
186
187 p_scene.AuthenticateHandler.AddNewCircuit(npcAvatar.CircuitCode, acd);
188 p_scene.AddNewClient(npcAvatar);
189
190 ScenePresence sp;
191 if (p_scene.TryGetScenePresence(npcAvatar.AgentId, out sp))
192 {
193 m_log.DebugFormat(
194 "[NPC MODULE]: Successfully retrieved scene presence for NPC {0} {1}", sp.Name, sp.UUID);
195
196 // Shouldn't call this - temporary.
197 sp.CompleteMovement(npcAvatar);
198
199 // sp.SendAppearanceToAllOtherAgents();
200 //
201 // // Send animations back to the avatar as well
202 // sp.Animator.SendAnimPack();
203 }
204 else
205 {
206 m_log.WarnFormat("[NPC MODULE]: Could not find scene presence for NPC {0} {1}", sp.Name, sp.UUID);
207 }
208
209 m_avatars.Add(npcAvatar.AgentId, npcAvatar);
210
211 p_returnUuid = npcAvatar.AgentId;
212
213 m_log.DebugFormat("[NPC MODULE]: Created NPC with id {0}", p_returnUuid);
173 } 214 }
174
175 m_avatars.Add(npcAvatar.AgentId, npcAvatar);
176
177 p_returnUuid = npcAvatar.AgentId;
178 } 215 }
179 } 216 }
217 catch (Exception ex)
218 {
219 m_log.ErrorFormat("[NPC MODULE]: NPC creation failed with exception {0} {1}", ex.Message, ex.StackTrace);
220 }
180 } 221 }
181 222
182 public void PostInitialise() 223 public void PostInitialise()
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 39e1a27..2b8155f 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -977,7 +977,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
977 977
978 public string osDrawPolygon(string drawList, LSL_List x, LSL_List y) 978 public string osDrawPolygon(string drawList, LSL_List x, LSL_List y)
979 { 979 {
980 CheckThreatLevel(ThreatLevel.None, "osDrawFilledPolygon"); 980 CheckThreatLevel(ThreatLevel.None, "osDrawPolygon");
981 981
982 m_host.AddScriptLPS(1); 982 m_host.AddScriptLPS(1);
983 983
@@ -1248,7 +1248,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1248 return String.Empty; 1248 return String.Empty;
1249 } 1249 }
1250 1250
1251 public void osSetWindParam(string plugin, string param, float value) 1251 public void osSetWindParam(string plugin, string param, LSL_Float value)
1252 { 1252 {
1253 CheckThreatLevel(ThreatLevel.VeryLow, "osSetWindParam"); 1253 CheckThreatLevel(ThreatLevel.VeryLow, "osSetWindParam");
1254 m_host.AddScriptLPS(1); 1254 m_host.AddScriptLPS(1);
@@ -1258,13 +1258,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1258 { 1258 {
1259 try 1259 try
1260 { 1260 {
1261 module.WindParamSet(plugin, param, value); 1261 module.WindParamSet(plugin, param, (float)value);
1262 } 1262 }
1263 catch (Exception) { } 1263 catch (Exception) { }
1264 } 1264 }
1265 } 1265 }
1266 1266
1267 public float osGetWindParam(string plugin, string param) 1267 public LSL_Float osGetWindParam(string plugin, string param)
1268 { 1268 {
1269 CheckThreatLevel(ThreatLevel.VeryLow, "osGetWindParam"); 1269 CheckThreatLevel(ThreatLevel.VeryLow, "osGetWindParam");
1270 m_host.AddScriptLPS(1); 1270 m_host.AddScriptLPS(1);
@@ -1416,7 +1416,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1416 { 1416 {
1417 // What actually is the difference to the LL function? 1417 // What actually is the difference to the LL function?
1418 // 1418 //
1419 CheckThreatLevel(ThreatLevel.VeryLow, "osSetParcelMediaURL"); 1419 CheckThreatLevel(ThreatLevel.VeryLow, "osSetParcelSIPAddress");
1420 1420
1421 m_host.AddScriptLPS(1); 1421 m_host.AddScriptLPS(1);
1422 1422
@@ -2222,12 +2222,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2222 return (int)pws; 2222 return (int)pws;
2223 } 2223 }
2224 2224
2225 public void osSetSpeed(string UUID, float SpeedModifier) 2225 public void osSetSpeed(string UUID, LSL_Float SpeedModifier)
2226 { 2226 {
2227 CheckThreatLevel(ThreatLevel.Moderate, "osSetSpeed"); 2227 CheckThreatLevel(ThreatLevel.Moderate, "osSetSpeed");
2228 m_host.AddScriptLPS(1); 2228 m_host.AddScriptLPS(1);
2229 ScenePresence avatar = World.GetScenePresence(new UUID(UUID)); 2229 ScenePresence avatar = World.GetScenePresence(new UUID(UUID));
2230 avatar.SpeedModifier = SpeedModifier; 2230 avatar.SpeedModifier = (float)SpeedModifier;
2231 } 2231 }
2232 2232
2233 public void osKickAvatar(string FirstName,string SurName,string alert) 2233 public void osKickAvatar(string FirstName,string SurName,string alert)
@@ -2308,14 +2308,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2308 { 2308 {
2309 CheckThreatLevel(ThreatLevel.High, "osGetPrimitiveParams"); 2309 CheckThreatLevel(ThreatLevel.High, "osGetPrimitiveParams");
2310 m_host.AddScriptLPS(1); 2310 m_host.AddScriptLPS(1);
2311 InitLSL();
2311 2312
2312 return m_LSL_Api.GetLinkPrimitiveParamsEx(prim, rules); 2313 return m_LSL_Api.GetLinkPrimitiveParamsEx(prim, rules);
2313 } 2314 }
2314 2315
2315 public void osSetPrimitiveParams(LSL_Key prim, LSL_List rules) 2316 public void osSetPrimitiveParams(LSL_Key prim, LSL_List rules)
2316 { 2317 {
2317 CheckThreatLevel(ThreatLevel.High, "osGetPrimitiveParams"); 2318 CheckThreatLevel(ThreatLevel.High, "osSetPrimitiveParams");
2318 m_host.AddScriptLPS(1); 2319 m_host.AddScriptLPS(1);
2320 InitLSL();
2319 2321
2320 m_LSL_Api.SetPrimitiveParamsEx(prim, rules); 2322 m_LSL_Api.SetPrimitiveParamsEx(prim, rules);
2321 } 2323 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index c08ad3b..5a809e6 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -129,8 +129,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
129 129
130 // Wind Module Functions 130 // Wind Module Functions
131 string osWindActiveModelPluginName(); 131 string osWindActiveModelPluginName();
132 void osSetWindParam(string plugin, string param, float value); 132 void osSetWindParam(string plugin, string param, LSL_Float value);
133 float osGetWindParam(string plugin, string param); 133 LSL_Float osGetWindParam(string plugin, string param);
134 134
135 // Parcel commands 135 // Parcel commands
136 void osParcelJoin(vector pos1, vector pos2); 136 void osParcelJoin(vector pos1, vector pos2);
@@ -180,7 +180,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
180 180
181 int osGetSimulatorMemory(); 181 int osGetSimulatorMemory();
182 void osKickAvatar(string FirstName,string SurName,string alert); 182 void osKickAvatar(string FirstName,string SurName,string alert);
183 void osSetSpeed(string UUID, float SpeedModifier); 183 void osSetSpeed(string UUID, LSL_Float SpeedModifier);
184 void osCauseHealing(string avatar, double healing); 184 void osCauseHealing(string avatar, double healing);
185 void osCauseDamage(string avatar, double damage); 185 void osCauseDamage(string avatar, double damage);
186 LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules); 186 LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index e3ea556..7c59098 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -106,16 +106,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
106 return m_OSSL_Functions.osWindActiveModelPluginName(); 106 return m_OSSL_Functions.osWindActiveModelPluginName();
107 } 107 }
108 108
109// Not yet plugged in as available OSSL functions, so commented out 109 public void osSetWindParam(string plugin, string param, LSL_Float value)
110// void osSetWindParam(string plugin, string param, float value) 110 {
111// { 111 m_OSSL_Functions.osSetWindParam(plugin, param, value);
112// m_OSSL_Functions.osSetWindParam(plugin, param, value); 112 }
113// } 113
114// 114 public LSL_Float osGetWindParam(string plugin, string param)
115// float osGetWindParam(string plugin, string param) 115 {
116// { 116 return m_OSSL_Functions.osGetWindParam(plugin, param);
117// return m_OSSL_Functions.osGetWindParam(plugin, param); 117 }
118// }
119 118
120 public void osParcelJoin(vector pos1, vector pos2) 119 public void osParcelJoin(vector pos1, vector pos2)
121 { 120 {
@@ -714,7 +713,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
714 m_OSSL_Functions.osKickAvatar(FirstName, SurName, alert); 713 m_OSSL_Functions.osKickAvatar(FirstName, SurName, alert);
715 } 714 }
716 715
717 public void osSetSpeed(string UUID, float SpeedModifier) 716 public void osSetSpeed(string UUID, LSL_Float SpeedModifier)
718 { 717 {
719 m_OSSL_Functions.osSetSpeed(UUID, SpeedModifier); 718 m_OSSL_Functions.osSetSpeed(UUID, SpeedModifier);
720 } 719 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
index 49d6abe..734d4d5 100644
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
@@ -106,6 +106,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
106 // Get some config 106 // Get some config
107 WriteScriptSourceToDebugFile = m_scriptEngine.Config.GetBoolean("WriteScriptSourceToDebugFile", false); 107 WriteScriptSourceToDebugFile = m_scriptEngine.Config.GetBoolean("WriteScriptSourceToDebugFile", false);
108 CompileWithDebugInformation = m_scriptEngine.Config.GetBoolean("CompileWithDebugInformation", true); 108 CompileWithDebugInformation = m_scriptEngine.Config.GetBoolean("CompileWithDebugInformation", true);
109 bool DeleteScriptsOnStartup = m_scriptEngine.Config.GetBoolean("DeleteScriptsOnStartup", true);
109 110
110 // Get file prefix from scriptengine name and make it file system safe: 111 // Get file prefix from scriptengine name and make it file system safe:
111 FilePrefix = "CommonCompiler"; 112 FilePrefix = "CommonCompiler";
@@ -114,11 +115,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
114 FilePrefix = FilePrefix.Replace(c, '_'); 115 FilePrefix = FilePrefix.Replace(c, '_');
115 } 116 }
116 117
117 // First time we start? Delete old files
118 if (in_startup) 118 if (in_startup)
119 { 119 {
120 in_startup = false; 120 in_startup = false;
121 DeleteOldFiles(); 121 CreateScriptsDirectory();
122
123 // First time we start? Delete old files
124 if (DeleteScriptsOnStartup)
125 DeleteOldFiles();
122 } 126 }
123 127
124 // Map name and enum type of our supported languages 128 // Map name and enum type of our supported languages
@@ -187,11 +191,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
187 } 191 }
188 192
189 /// <summary> 193 /// <summary>
190 /// Delete old script files 194 /// Create the directory where compiled scripts are stored.
191 /// </summary> 195 /// </summary>
192 private void DeleteOldFiles() 196 private void CreateScriptsDirectory()
193 { 197 {
194 // CREATE FOLDER IF IT DOESNT EXIST
195 if (!Directory.Exists(ScriptEnginesPath)) 198 if (!Directory.Exists(ScriptEnginesPath))
196 { 199 {
197 try 200 try
@@ -218,7 +221,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
218 m_scriptEngine.World.RegionInfo.RegionID.ToString()) + "\": " + ex.ToString()); 221 m_scriptEngine.World.RegionInfo.RegionID.ToString()) + "\": " + ex.ToString());
219 } 222 }
220 } 223 }
224 }
221 225
226 /// <summary>
227 /// Delete old script files
228 /// </summary>
229 private void DeleteOldFiles()
230 {
222 foreach (string file in Directory.GetFiles(Path.Combine(ScriptEnginesPath, 231 foreach (string file in Directory.GetFiles(Path.Combine(ScriptEnginesPath,
223 m_scriptEngine.World.RegionInfo.RegionID.ToString()), FilePrefix + "_compiled*")) 232 m_scriptEngine.World.RegionInfo.RegionID.ToString()), FilePrefix + "_compiled*"))
224 { 233 {