aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r--OpenSim/Region/Environment/Scenes/EntityBase.cs7
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs13
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs8
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneBase.cs4
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs15
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs48
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs32
7 files changed, 104 insertions, 23 deletions
diff --git a/OpenSim/Region/Environment/Scenes/EntityBase.cs b/OpenSim/Region/Environment/Scenes/EntityBase.cs
index 18799e4..82f829d 100644
--- a/OpenSim/Region/Environment/Scenes/EntityBase.cs
+++ b/OpenSim/Region/Environment/Scenes/EntityBase.cs
@@ -36,7 +36,12 @@ namespace OpenSim.Region.Environment.Scenes
36 { 36 {
37 protected List<EntityBase> m_children; 37 protected List<EntityBase> m_children;
38 38
39 public Scene m_scene; 39 protected Scene m_scene;
40
41 public Scene Scene
42 {
43 get { return m_scene; }
44 }
40 45
41 public LLUUID m_uuid; 46 public LLUUID m_uuid;
42 47
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index 5b46040..f3673fc 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -37,6 +37,19 @@ namespace OpenSim.Region.Environment.Scenes
37{ 37{
38 public partial class Scene 38 public partial class Scene
39 { 39 {
40 /// <summary>
41 /// Start all the scripts in the scene which should be started.
42 /// </summary>
43 public void StartScripts()
44 {
45 MainLog.Instance.Verbose("PRIMINVENTORY", "Starting scripts in scene");
46
47 foreach (SceneObjectGroup group in Entities.Values)
48 {
49 group.StartScripts();
50 }
51 }
52
40 //split these method into this partial as a lot of these (hopefully) are only temporary and won't be needed once Caps is more complete 53 //split these method into this partial as a lot of these (hopefully) are only temporary and won't be needed once Caps is more complete
41 // or at least some of they can be moved somewhere else 54 // or at least some of they can be moved somewhere else
42 55
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 215d30d..4156584 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -890,11 +890,12 @@ namespace OpenSim.Region.Environment.Scenes
890 public virtual void LoadPrimsFromStorage(bool m_permissions) 890 public virtual void LoadPrimsFromStorage(bool m_permissions)
891 { 891 {
892 MainLog.Instance.Verbose("SCENE", "Loading objects from datastore"); 892 MainLog.Instance.Verbose("SCENE", "Loading objects from datastore");
893
893 List<SceneObjectGroup> PrimsFromDB = m_storageManager.DataStore.LoadObjects(m_regInfo.RegionID); 894 List<SceneObjectGroup> PrimsFromDB = m_storageManager.DataStore.LoadObjects(m_regInfo.RegionID);
894 foreach (SceneObjectGroup prim in PrimsFromDB) 895 foreach (SceneObjectGroup group in PrimsFromDB)
895 { 896 {
896 AddEntityFromStorage(prim); 897 AddEntityFromStorage(group);
897 SceneObjectPart rootPart = prim.GetChildPart(prim.UUID); 898 SceneObjectPart rootPart = group.GetChildPart(group.UUID);
898 rootPart.ApplySanePermissions(); 899 rootPart.ApplySanePermissions();
899 900
900 bool UsePhysics = (((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) > 0) && m_physicalPrim); 901 bool UsePhysics = (((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) > 0) && m_physicalPrim);
@@ -909,6 +910,7 @@ namespace OpenSim.Region.Environment.Scenes
909 rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics); 910 rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics);
910 rootPart.DoPhysicsPropertyUpdate(UsePhysics, true); 911 rootPart.DoPhysicsPropertyUpdate(UsePhysics, true);
911 } 912 }
913
912 MainLog.Instance.Verbose("SCENE", "Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)"); 914 MainLog.Instance.Verbose("SCENE", "Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)");
913 } 915 }
914 916
diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs
index bf8bedc..d4a4bb0 100644
--- a/OpenSim/Region/Environment/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs
@@ -54,7 +54,6 @@ namespace OpenSim.Region.Environment.Scenes
54 protected ulong m_regionHandle; 54 protected ulong m_regionHandle;
55 protected string m_regionName; 55 protected string m_regionName;
56 protected RegionInfo m_regInfo; 56 protected RegionInfo m_regInfo;
57 protected RegionStatus m_regStatus;
58 57
59 public TerrainEngine Terrain; 58 public TerrainEngine Terrain;
60 59
@@ -68,6 +67,7 @@ namespace OpenSim.Region.Environment.Scenes
68 protected string m_datastore; 67 protected string m_datastore;
69 68
70 private uint m_nextLocalId = 8880000; 69 private uint m_nextLocalId = 8880000;
70
71 private AssetCache m_assetCache; 71 private AssetCache m_assetCache;
72 72
73 public AssetCache AssetCache 73 public AssetCache AssetCache
@@ -75,6 +75,8 @@ namespace OpenSim.Region.Environment.Scenes
75 get { return m_assetCache; } 75 get { return m_assetCache; }
76 set { m_assetCache = value; } 76 set { m_assetCache = value; }
77 } 77 }
78
79 protected RegionStatus m_regStatus;
78 80
79 public RegionStatus Region_Status 81 public RegionStatus Region_Status
80 { 82 {
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs
index 046e05b..50e3fa7 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs
@@ -37,7 +37,18 @@ using OpenSim.Region.Environment.Interfaces;
37namespace OpenSim.Region.Environment.Scenes 37namespace OpenSim.Region.Environment.Scenes
38{ 38{
39 public partial class SceneObjectGroup : EntityBase 39 public partial class SceneObjectGroup : EntityBase
40 { 40 {
41 /// <summary>
42 /// Start the scripts contained in all the prims in this group.
43 /// </summary>
44 public void StartScripts()
45 {
46 foreach (SceneObjectPart part in m_parts.Values)
47 {
48 part.StartScripts();
49 }
50 }
51
41 /// <summary> 52 /// <summary>
42 /// 53 ///
43 /// </summary> 54 /// </summary>
@@ -131,6 +142,6 @@ namespace OpenSim.Region.Environment.Scenes
131 return part.RemoveInventoryItem(remoteClient, localID, itemID); 142 return part.RemoveInventoryItem(remoteClient, localID, itemID);
132 } 143 }
133 return -1; 144 return -1;
134 } 145 }
135 } 146 }
136} \ No newline at end of file 147} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
index aab2291..5f93986 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
@@ -33,6 +33,7 @@ using System.Xml.Serialization;
33using libsecondlife; 33using libsecondlife;
34 34
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Framework.Console;
36using OpenSim.Region.Environment.Interfaces; 37using OpenSim.Region.Environment.Interfaces;
37using OpenSim.Region.Environment.Scenes.Scripting; 38using OpenSim.Region.Environment.Scenes.Scripting;
38 39
@@ -79,6 +80,53 @@ namespace OpenSim.Region.Environment.Scenes
79 { 80 {
80 get { return m_inventorySerial; } 81 get { return m_inventorySerial; }
81 } 82 }
83
84
85 /// <summary>
86 /// Start all the scripts contained in this prim's inventory
87 /// </summary>
88 public void StartScripts()
89 {
90 foreach (TaskInventoryItem item in m_taskInventory.Values)
91 {
92 if ("lsltext" == item.type)
93 {
94 StartScript(item);
95 }
96 }
97 }
98
99 /// <summary>
100 /// Start a script in this prim
101 /// </summary>
102 /// <param name="item"></param>
103 /// <returns>true if script asset was found, false if it wasn't</returns>
104 public bool StartScript(TaskInventoryItem item)
105 {
106// MainLog.Instance.Verbose(
107// "PRIMINVENTORY",
108// "Starting script {0}, {1} in prim {2}, {3}",
109// item.name, item.item_id, Name, UUID);
110
111 AssetBase rezAsset = m_parentGroup.Scene.AssetCache.GetAsset(item.asset_id, false);
112
113 if (rezAsset != null)
114 {
115 string script = Helpers.FieldToUTF8String(rezAsset.Data);
116 m_parentGroup.Scene.EventManager.TriggerRezScript(LocalID, item.item_id, script);
117
118 return true;
119 }
120 else
121 {
122 MainLog.Instance.Error(
123 "PRIMINVENTORY",
124 "Couldn't start script {0}, {1} since asset ID {2} could not be found",
125 item.name, item.item_id, item.asset_id);
126 }
127
128 return false;
129 }
82 130
83 /// <summary> 131 /// <summary>
84 /// Add an item to this prim's inventory. 132 /// Add an item to this prim's inventory.
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index f82771b..9a7f28e 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -172,10 +172,10 @@ namespace OpenSim.Region.Environment.Scenes
172 { 172 {
173 try 173 try
174 { 174 {
175 //lock (m_parentGroup.m_scene.SyncRoot) 175 //lock (m_parentGroup.Scene.SyncRoot)
176 //{ 176 //{
177 PhysActor.Position = new PhysicsVector(value.X, value.Y, value.Z); 177 PhysActor.Position = new PhysicsVector(value.X, value.Y, value.Z);
178 m_parentGroup.m_scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); 178 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
179 //} 179 //}
180 } 180 }
181 catch (Exception e) 181 catch (Exception e)
@@ -225,10 +225,10 @@ namespace OpenSim.Region.Environment.Scenes
225 { 225 {
226 try 226 try
227 { 227 {
228 //lock (m_scene.SyncRoot) 228 //lock (Scene.SyncRoot)
229 //{ 229 //{
230 PhysActor.Orientation = new Quaternion(value.W, value.X, value.Y, value.Z); 230 PhysActor.Orientation = new Quaternion(value.W, value.X, value.Y, value.Z);
231 m_parentGroup.m_scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); 231 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
232 //} 232 //}
233 } 233 }
234 catch (Exception ex) 234 catch (Exception ex)
@@ -554,7 +554,7 @@ namespace OpenSim.Region.Environment.Scenes
554 554
555 if (usePhysics) 555 if (usePhysics)
556 { 556 {
557 PhysActor = m_parentGroup.m_scene.PhysicsScene.AddPrimShape( 557 PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape(
558 Name, 558 Name,
559 Shape, 559 Shape,
560 new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, 560 new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y,
@@ -1044,7 +1044,7 @@ namespace OpenSim.Region.Environment.Scenes
1044 { 1044 {
1045 i += 46; 1045 i += 46;
1046 //IsLocked = (data[i++] != 0) ? true : false; 1046 //IsLocked = (data[i++] != 0) ? true : false;
1047 usePhysics = ((data[i++] != 0) && m_parentGroup.m_scene.m_physicalPrim) ? true : false; 1047 usePhysics = ((data[i++] != 0) && m_parentGroup.Scene.m_physicalPrim) ? true : false;
1048 //System.Console.WriteLine("U" + packet.ToBytes().Length.ToString()); 1048 //System.Console.WriteLine("U" + packet.ToBytes().Length.ToString());
1049 IsTemporary = (data[i++] != 0) ? true : false; 1049 IsTemporary = (data[i++] != 0) ? true : false;
1050 IsPhantom = (data[i++] != 0) ? true : false; 1050 IsPhantom = (data[i++] != 0) ? true : false;
@@ -1079,8 +1079,8 @@ namespace OpenSim.Region.Environment.Scenes
1079 AddFlag(LLObject.ObjectFlags.Phantom); 1079 AddFlag(LLObject.ObjectFlags.Phantom);
1080 if (PhysActor != null) 1080 if (PhysActor != null)
1081 { 1081 {
1082 m_parentGroup.m_scene.PhysicsScene.RemovePrim(PhysActor); 1082 m_parentGroup.Scene.PhysicsScene.RemovePrim(PhysActor);
1083 /// that's not wholesome. Had to make m_scene public 1083 /// that's not wholesome. Had to make Scene public
1084 PhysActor = null; 1084 PhysActor = null;
1085 } 1085 }
1086 } 1086 }
@@ -1089,7 +1089,7 @@ namespace OpenSim.Region.Environment.Scenes
1089 RemFlag(LLObject.ObjectFlags.Phantom); 1089 RemFlag(LLObject.ObjectFlags.Phantom);
1090 if (PhysActor == null) 1090 if (PhysActor == null)
1091 { 1091 {
1092 PhysActor = m_parentGroup.m_scene.PhysicsScene.AddPrimShape( 1092 PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape(
1093 Name, 1093 Name,
1094 Shape, 1094 Shape,
1095 new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, 1095 new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y,
@@ -1127,7 +1127,7 @@ namespace OpenSim.Region.Environment.Scenes
1127 if (PhysActor.IsPhysical) 1127 if (PhysActor.IsPhysical)
1128 { 1128 {
1129 if (!isNew) 1129 if (!isNew)
1130 ParentGroup.m_scene.RemovePhysicalPrim(1); 1130 ParentGroup.Scene.RemovePhysicalPrim(1);
1131 1131
1132 PhysActor.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate; 1132 PhysActor.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate;
1133 PhysActor.OnOutOfBounds -= PhysicsOutOfBounds; 1133 PhysActor.OnOutOfBounds -= PhysicsOutOfBounds;
@@ -1135,14 +1135,14 @@ namespace OpenSim.Region.Environment.Scenes
1135 1135
1136 PhysActor.IsPhysical = UsePhysics; 1136 PhysActor.IsPhysical = UsePhysics;
1137 // If we're not what we're supposed to be in the physics scene, recreate ourselves. 1137 // If we're not what we're supposed to be in the physics scene, recreate ourselves.
1138 //m_parentGroup.m_scene.PhysicsScene.RemovePrim(PhysActor); 1138 //m_parentGroup.Scene.PhysicsScene.RemovePrim(PhysActor);
1139 /// that's not wholesome. Had to make m_scene public 1139 /// that's not wholesome. Had to make Scene public
1140 //PhysActor = null; 1140 //PhysActor = null;
1141 1141
1142 1142
1143 if ((ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0) 1143 if ((ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0)
1144 { 1144 {
1145 //PhysActor = m_parentGroup.m_scene.PhysicsScene.AddPrimShape( 1145 //PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape(
1146 //Name, 1146 //Name,
1147 //Shape, 1147 //Shape,
1148 //new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, 1148 //new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y,
@@ -1152,14 +1152,14 @@ namespace OpenSim.Region.Environment.Scenes
1152 //RotationOffset.Y, RotationOffset.Z), UsePhysics); 1152 //RotationOffset.Y, RotationOffset.Z), UsePhysics);
1153 if (UsePhysics) 1153 if (UsePhysics)
1154 { 1154 {
1155 ParentGroup.m_scene.AddPhysicalPrim(1); 1155 ParentGroup.Scene.AddPhysicalPrim(1);
1156 1156
1157 PhysActor.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate; 1157 PhysActor.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate;
1158 PhysActor.OnOutOfBounds += PhysicsOutOfBounds; 1158 PhysActor.OnOutOfBounds += PhysicsOutOfBounds;
1159 } 1159 }
1160 } 1160 }
1161 } 1161 }
1162 m_parentGroup.m_scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); 1162 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
1163 } 1163 }
1164 } 1164 }
1165 1165
@@ -1517,7 +1517,7 @@ namespace OpenSim.Region.Environment.Scenes
1517 MainLog.Instance.Verbose("PHYSICS", "Physical Object went out of bounds."); 1517 MainLog.Instance.Verbose("PHYSICS", "Physical Object went out of bounds.");
1518 RemFlag(LLObject.ObjectFlags.Physics); 1518 RemFlag(LLObject.ObjectFlags.Physics);
1519 DoPhysicsPropertyUpdate(false, true); 1519 DoPhysicsPropertyUpdate(false, true);
1520 m_parentGroup.m_scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); 1520 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
1521 } 1521 }
1522 1522
1523 public virtual void OnGrab(LLVector3 offsetPos, IClientAPI remoteClient) 1523 public virtual void OnGrab(LLVector3 offsetPos, IClientAPI remoteClient)