diff options
author | Sean Dague | 2007-10-05 15:45:45 +0000 |
---|---|---|
committer | Sean Dague | 2007-10-05 15:45:45 +0000 |
commit | c3d8f1f4253f72484100394940e62f2912cbc4ff (patch) | |
tree | 8a9f237ed3c1140b4059ec121e0d4ede82eae416 /OpenSim/Region/Environment/Scenes | |
parent | * So, ok, maybe renaming serialized fields on a friday wasn't the smartest of... (diff) | |
download | opensim-SC_OLD-c3d8f1f4253f72484100394940e62f2912cbc4ff.zip opensim-SC_OLD-c3d8f1f4253f72484100394940e62f2912cbc4ff.tar.gz opensim-SC_OLD-c3d8f1f4253f72484100394940e62f2912cbc4ff.tar.bz2 opensim-SC_OLD-c3d8f1f4253f72484100394940e62f2912cbc4ff.tar.xz |
getting all our line endings consistant again
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
4 files changed, 710 insertions, 710 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index b7f5bad..24f1a86 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |||
@@ -1,445 +1,445 @@ | |||
1 | using Axiom.Math; | 1 | using Axiom.Math; |
2 | using libsecondlife; | 2 | using libsecondlife; |
3 | using libsecondlife.Packets; | 3 | using libsecondlife.Packets; |
4 | using OpenSim.Framework.Communications.Cache; | 4 | using OpenSim.Framework.Communications.Cache; |
5 | using OpenSim.Framework.Communications.Caches; | 5 | using OpenSim.Framework.Communications.Caches; |
6 | using OpenSim.Framework.Interfaces; | 6 | using OpenSim.Framework.Interfaces; |
7 | using OpenSim.Framework.Types; | 7 | using OpenSim.Framework.Types; |
8 | using OpenSim.Framework.Utilities; | 8 | using OpenSim.Framework.Utilities; |
9 | using OpenSim.Region.Physics.Manager; | 9 | using OpenSim.Region.Physics.Manager; |
10 | 10 | ||
11 | namespace OpenSim.Region.Environment.Scenes | 11 | namespace OpenSim.Region.Environment.Scenes |
12 | { | 12 | { |
13 | public partial class Scene | 13 | public partial class Scene |
14 | { | 14 | { |
15 | //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 | 15 | //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 |
16 | // or at least some of they can be moved somewhere else | 16 | // or at least some of they can be moved somewhere else |
17 | 17 | ||
18 | public void AddInventoryItem(LLUUID avatarId, InventoryItemBase item) | 18 | public void AddInventoryItem(LLUUID avatarId, InventoryItemBase item) |
19 | { | 19 | { |
20 | ScenePresence avatar; | 20 | ScenePresence avatar; |
21 | 21 | ||
22 | if ( TryGetAvatar( avatarId, out avatar )) | 22 | if ( TryGetAvatar( avatarId, out avatar )) |
23 | { | 23 | { |
24 | AddInventoryItem(avatar.ControllingClient, item); | 24 | AddInventoryItem(avatar.ControllingClient, item); |
25 | } | 25 | } |
26 | } | 26 | } |
27 | 27 | ||
28 | public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item) | 28 | public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item) |
29 | { | 29 | { |
30 | CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); | 30 | CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); |
31 | if (userInfo != null) | 31 | if (userInfo != null) |
32 | { | 32 | { |
33 | userInfo.AddItem(remoteClient.AgentId, item); | 33 | userInfo.AddItem(remoteClient.AgentId, item); |
34 | remoteClient.SendInventoryItemUpdate(item); | 34 | remoteClient.SendInventoryItemUpdate(item); |
35 | } | 35 | } |
36 | } | 36 | } |
37 | 37 | ||
38 | public LLUUID CapsUpdateInventoryItemAsset(LLUUID avatarId, LLUUID itemID, byte[] data) | 38 | public LLUUID CapsUpdateInventoryItemAsset(LLUUID avatarId, LLUUID itemID, byte[] data) |
39 | { | 39 | { |
40 | ScenePresence avatar; | 40 | ScenePresence avatar; |
41 | 41 | ||
42 | if (TryGetAvatar(avatarId, out avatar)) | 42 | if (TryGetAvatar(avatarId, out avatar)) |
43 | { | 43 | { |
44 | return CapsUpdateInventoryItemAsset(avatar.ControllingClient, itemID, data); | 44 | return CapsUpdateInventoryItemAsset(avatar.ControllingClient, itemID, data); |
45 | } | 45 | } |
46 | 46 | ||
47 | return LLUUID.Zero; | 47 | return LLUUID.Zero; |
48 | } | 48 | } |
49 | 49 | ||
50 | public LLUUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID itemID, byte[] data) | 50 | public LLUUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID itemID, byte[] data) |
51 | { | 51 | { |
52 | CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); | 52 | CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); |
53 | if (userInfo != null) | 53 | if (userInfo != null) |
54 | { | 54 | { |
55 | if (userInfo.RootFolder != null) | 55 | if (userInfo.RootFolder != null) |
56 | { | 56 | { |
57 | InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); | 57 | InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); |
58 | if (item != null) | 58 | if (item != null) |
59 | { | 59 | { |
60 | AssetBase asset; | 60 | AssetBase asset; |
61 | asset = new AssetBase(); | 61 | asset = new AssetBase(); |
62 | asset.FullID = LLUUID.Random(); | 62 | asset.FullID = LLUUID.Random(); |
63 | asset.Type = (sbyte) item.assetType; | 63 | asset.Type = (sbyte) item.assetType; |
64 | asset.InvType = (sbyte) item.invType; | 64 | asset.InvType = (sbyte) item.invType; |
65 | asset.Name = item.inventoryName; | 65 | asset.Name = item.inventoryName; |
66 | asset.Data = data; | 66 | asset.Data = data; |
67 | commsManager.AssetCache.AddAsset(asset); | 67 | commsManager.AssetCache.AddAsset(asset); |
68 | 68 | ||
69 | item.assetID = asset.FullID; | 69 | item.assetID = asset.FullID; |
70 | userInfo.UpdateItem(remoteClient.AgentId, item); | 70 | userInfo.UpdateItem(remoteClient.AgentId, item); |
71 | 71 | ||
72 | // remoteClient.SendInventoryItemUpdate(item); | 72 | // remoteClient.SendInventoryItemUpdate(item); |
73 | if (item.invType == 7) | 73 | if (item.invType == 7) |
74 | { | 74 | { |
75 | //do we want to know about updated note cards? | 75 | //do we want to know about updated note cards? |
76 | } | 76 | } |
77 | else if (item.invType == 10) | 77 | else if (item.invType == 10) |
78 | { | 78 | { |
79 | // do we want to know about updated scripts | 79 | // do we want to know about updated scripts |
80 | } | 80 | } |
81 | 81 | ||
82 | return (asset.FullID); | 82 | return (asset.FullID); |
83 | } | 83 | } |
84 | } | 84 | } |
85 | } | 85 | } |
86 | return LLUUID.Zero; | 86 | return LLUUID.Zero; |
87 | } | 87 | } |
88 | 88 | ||
89 | public void UDPUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID transactionID, LLUUID assetID, | 89 | public void UDPUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID transactionID, LLUUID assetID, |
90 | LLUUID itemID) | 90 | LLUUID itemID) |
91 | { | 91 | { |
92 | CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); | 92 | CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); |
93 | if (userInfo != null) | 93 | if (userInfo != null) |
94 | { | 94 | { |
95 | if (userInfo.RootFolder != null) | 95 | if (userInfo.RootFolder != null) |
96 | { | 96 | { |
97 | InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); | 97 | InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); |
98 | if (item != null) | 98 | if (item != null) |
99 | { | 99 | { |
100 | AgentAssetTransactions transactions = | 100 | AgentAssetTransactions transactions = |
101 | commsManager.TransactionsManager.GetUserTransActions(remoteClient.AgentId); | 101 | commsManager.TransactionsManager.GetUserTransActions(remoteClient.AgentId); |
102 | if (transactions != null) | 102 | if (transactions != null) |
103 | { | 103 | { |
104 | AssetBase asset = null; | 104 | AssetBase asset = null; |
105 | bool addToCache = false; | 105 | bool addToCache = false; |
106 | 106 | ||
107 | asset = commsManager.AssetCache.GetAsset(assetID); | 107 | asset = commsManager.AssetCache.GetAsset(assetID); |
108 | if (asset == null) | 108 | if (asset == null) |
109 | { | 109 | { |
110 | asset = transactions.GetTransactionAsset(transactionID); | 110 | asset = transactions.GetTransactionAsset(transactionID); |
111 | addToCache = true; | 111 | addToCache = true; |
112 | } | 112 | } |
113 | 113 | ||
114 | if (asset != null) | 114 | if (asset != null) |
115 | { | 115 | { |
116 | if (asset.FullID == assetID) | 116 | if (asset.FullID == assetID) |
117 | { | 117 | { |
118 | asset.Name = item.inventoryName; | 118 | asset.Name = item.inventoryName; |
119 | asset.Description = item.inventoryDescription; | 119 | asset.Description = item.inventoryDescription; |
120 | asset.InvType = (sbyte) item.invType; | 120 | asset.InvType = (sbyte) item.invType; |
121 | asset.Type = (sbyte) item.assetType; | 121 | asset.Type = (sbyte) item.assetType; |
122 | item.assetID = asset.FullID; | 122 | item.assetID = asset.FullID; |
123 | 123 | ||
124 | if (addToCache) | 124 | if (addToCache) |
125 | { | 125 | { |
126 | commsManager.AssetCache.AddAsset(asset); | 126 | commsManager.AssetCache.AddAsset(asset); |
127 | } | 127 | } |
128 | 128 | ||
129 | userInfo.UpdateItem(remoteClient.AgentId, item); | 129 | userInfo.UpdateItem(remoteClient.AgentId, item); |
130 | } | 130 | } |
131 | } | 131 | } |
132 | } | 132 | } |
133 | } | 133 | } |
134 | } | 134 | } |
135 | } | 135 | } |
136 | } | 136 | } |
137 | 137 | ||
138 | /// <summary> | 138 | /// <summary> |
139 | /// temporary method to test out creating new inventory items | 139 | /// temporary method to test out creating new inventory items |
140 | /// </summary> | 140 | /// </summary> |
141 | /// <param name="remoteClient"></param> | 141 | /// <param name="remoteClient"></param> |
142 | /// <param name="transActionID"></param> | 142 | /// <param name="transActionID"></param> |
143 | /// <param name="folderID"></param> | 143 | /// <param name="folderID"></param> |
144 | /// <param name="callbackID"></param> | 144 | /// <param name="callbackID"></param> |
145 | /// <param name="description"></param> | 145 | /// <param name="description"></param> |
146 | /// <param name="name"></param> | 146 | /// <param name="name"></param> |
147 | /// <param name="invType"></param> | 147 | /// <param name="invType"></param> |
148 | /// <param name="type"></param> | 148 | /// <param name="type"></param> |
149 | /// <param name="wearableType"></param> | 149 | /// <param name="wearableType"></param> |
150 | /// <param name="nextOwnerMask"></param> | 150 | /// <param name="nextOwnerMask"></param> |
151 | public void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID, | 151 | public void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID, |
152 | uint callbackID, string description, string name, sbyte invType, sbyte type, | 152 | uint callbackID, string description, string name, sbyte invType, sbyte type, |
153 | byte wearableType, uint nextOwnerMask) | 153 | byte wearableType, uint nextOwnerMask) |
154 | { | 154 | { |
155 | if (transActionID == LLUUID.Zero) | 155 | if (transActionID == LLUUID.Zero) |
156 | { | 156 | { |
157 | CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); | 157 | CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); |
158 | if (userInfo != null) | 158 | if (userInfo != null) |
159 | { | 159 | { |
160 | AssetBase asset = new AssetBase(); | 160 | AssetBase asset = new AssetBase(); |
161 | asset.Name = name; | 161 | asset.Name = name; |
162 | asset.Description = description; | 162 | asset.Description = description; |
163 | asset.InvType = invType; | 163 | asset.InvType = invType; |
164 | asset.Type = type; | 164 | asset.Type = type; |
165 | asset.FullID = LLUUID.Random(); | 165 | asset.FullID = LLUUID.Random(); |
166 | asset.Data = new byte[1]; | 166 | asset.Data = new byte[1]; |
167 | commsManager.AssetCache.AddAsset(asset); | 167 | commsManager.AssetCache.AddAsset(asset); |
168 | 168 | ||
169 | InventoryItemBase item = new InventoryItemBase(); | 169 | InventoryItemBase item = new InventoryItemBase(); |
170 | item.avatarID = remoteClient.AgentId; | 170 | item.avatarID = remoteClient.AgentId; |
171 | item.creatorsID = remoteClient.AgentId; | 171 | item.creatorsID = remoteClient.AgentId; |
172 | item.inventoryID = LLUUID.Random(); | 172 | item.inventoryID = LLUUID.Random(); |
173 | item.assetID = asset.FullID; | 173 | item.assetID = asset.FullID; |
174 | item.inventoryDescription = description; | 174 | item.inventoryDescription = description; |
175 | item.inventoryName = name; | 175 | item.inventoryName = name; |
176 | item.assetType = invType; | 176 | item.assetType = invType; |
177 | item.invType = invType; | 177 | item.invType = invType; |
178 | item.parentFolderID = folderID; | 178 | item.parentFolderID = folderID; |
179 | item.inventoryCurrentPermissions = 2147483647; | 179 | item.inventoryCurrentPermissions = 2147483647; |
180 | item.inventoryNextPermissions = nextOwnerMask; | 180 | item.inventoryNextPermissions = nextOwnerMask; |
181 | 181 | ||
182 | userInfo.AddItem(remoteClient.AgentId, item); | 182 | userInfo.AddItem(remoteClient.AgentId, item); |
183 | remoteClient.SendInventoryItemUpdate(item); | 183 | remoteClient.SendInventoryItemUpdate(item); |
184 | } | 184 | } |
185 | } | 185 | } |
186 | else | 186 | else |
187 | { | 187 | { |
188 | commsManager.TransactionsManager.HandleInventoryFromTransaction(remoteClient, transActionID, folderID, | 188 | commsManager.TransactionsManager.HandleInventoryFromTransaction(remoteClient, transActionID, folderID, |
189 | callbackID, description, name, invType, | 189 | callbackID, description, name, invType, |
190 | type, wearableType, nextOwnerMask); | 190 | type, wearableType, nextOwnerMask); |
191 | //System.Console.WriteLine("request to create inventory item from transaction " + transActionID); | 191 | //System.Console.WriteLine("request to create inventory item from transaction " + transActionID); |
192 | } | 192 | } |
193 | } | 193 | } |
194 | 194 | ||
195 | /// <summary> | 195 | /// <summary> |
196 | /// | 196 | /// |
197 | /// </summary> | 197 | /// </summary> |
198 | /// <param name="remoteClient"></param> | 198 | /// <param name="remoteClient"></param> |
199 | /// <param name="primLocalID"></param> | 199 | /// <param name="primLocalID"></param> |
200 | public void RequestTaskInventory(IClientAPI remoteClient, uint primLocalID) | 200 | public void RequestTaskInventory(IClientAPI remoteClient, uint primLocalID) |
201 | { | 201 | { |
202 | bool hasPrim = false; | 202 | bool hasPrim = false; |
203 | foreach (EntityBase ent in Entities.Values) | 203 | foreach (EntityBase ent in Entities.Values) |
204 | { | 204 | { |
205 | if (ent is SceneObjectGroup) | 205 | if (ent is SceneObjectGroup) |
206 | { | 206 | { |
207 | hasPrim = ((SceneObjectGroup) ent).HasChildPrim(primLocalID); | 207 | hasPrim = ((SceneObjectGroup) ent).HasChildPrim(primLocalID); |
208 | if (hasPrim != false) | 208 | if (hasPrim != false) |
209 | { | 209 | { |
210 | bool fileChange = ((SceneObjectGroup) ent).GetPartInventoryFileName(remoteClient, primLocalID); | 210 | bool fileChange = ((SceneObjectGroup) ent).GetPartInventoryFileName(remoteClient, primLocalID); |
211 | if (fileChange) | 211 | if (fileChange) |
212 | { | 212 | { |
213 | if (XferManager != null) | 213 | if (XferManager != null) |
214 | { | 214 | { |
215 | ((SceneObjectGroup) ent).RequestInventoryFile(primLocalID, XferManager); | 215 | ((SceneObjectGroup) ent).RequestInventoryFile(primLocalID, XferManager); |
216 | } | 216 | } |
217 | } | 217 | } |
218 | break; | 218 | break; |
219 | } | 219 | } |
220 | } | 220 | } |
221 | } | 221 | } |
222 | } | 222 | } |
223 | 223 | ||
224 | public void RemoveTaskInventory(IClientAPI remoteClient, LLUUID itemID, uint localID) | 224 | public void RemoveTaskInventory(IClientAPI remoteClient, LLUUID itemID, uint localID) |
225 | { | 225 | { |
226 | bool hasPrim = false; | 226 | bool hasPrim = false; |
227 | foreach (EntityBase ent in Entities.Values) | 227 | foreach (EntityBase ent in Entities.Values) |
228 | { | 228 | { |
229 | if (ent is SceneObjectGroup) | 229 | if (ent is SceneObjectGroup) |
230 | { | 230 | { |
231 | hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID); | 231 | hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID); |
232 | if (hasPrim != false) | 232 | if (hasPrim != false) |
233 | { | 233 | { |
234 | int type = ((SceneObjectGroup) ent).RemoveInventoryItem(remoteClient, localID, itemID); | 234 | int type = ((SceneObjectGroup) ent).RemoveInventoryItem(remoteClient, localID, itemID); |
235 | ((SceneObjectGroup) ent).GetProperites(remoteClient); | 235 | ((SceneObjectGroup) ent).GetProperites(remoteClient); |
236 | if (type == 10) | 236 | if (type == 10) |
237 | { | 237 | { |
238 | EventManager.TriggerRemoveScript(localID, itemID); | 238 | EventManager.TriggerRemoveScript(localID, itemID); |
239 | } | 239 | } |
240 | } | 240 | } |
241 | } | 241 | } |
242 | } | 242 | } |
243 | } | 243 | } |
244 | 244 | ||
245 | public void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID) | 245 | public void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID) |
246 | { | 246 | { |
247 | CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); | 247 | CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); |
248 | LLUUID copyID = LLUUID.Random(); | 248 | LLUUID copyID = LLUUID.Random(); |
249 | if (userInfo != null) | 249 | if (userInfo != null) |
250 | { | 250 | { |
251 | if (userInfo.RootFolder != null) | 251 | if (userInfo.RootFolder != null) |
252 | { | 252 | { |
253 | InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); | 253 | InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); |
254 | if (item != null) | 254 | if (item != null) |
255 | { | 255 | { |
256 | bool isTexture = false; | 256 | bool isTexture = false; |
257 | bool rezzed = false; | 257 | bool rezzed = false; |
258 | if (item.invType == 0) | 258 | if (item.invType == 0) |
259 | { | 259 | { |
260 | isTexture = true; | 260 | isTexture = true; |
261 | } | 261 | } |
262 | AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, isTexture); | 262 | AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, isTexture); |
263 | if (rezAsset != null) | 263 | if (rezAsset != null) |
264 | { | 264 | { |
265 | string script = Util.FieldToString(rezAsset.Data); | 265 | string script = Util.FieldToString(rezAsset.Data); |
266 | //Console.WriteLine("rez script "+script); | 266 | //Console.WriteLine("rez script "+script); |
267 | EventManager.TriggerRezScript(localID, copyID, script); | 267 | EventManager.TriggerRezScript(localID, copyID, script); |
268 | rezzed = true; | 268 | rezzed = true; |
269 | } | 269 | } |
270 | else | 270 | else |
271 | { | 271 | { |
272 | //lets try once more incase the asset cache is being slow getting the asset from server | 272 | //lets try once more incase the asset cache is being slow getting the asset from server |
273 | rezAsset = commsManager.AssetCache.GetAsset(item.assetID, isTexture); | 273 | rezAsset = commsManager.AssetCache.GetAsset(item.assetID, isTexture); |
274 | if (rezAsset != null) | 274 | if (rezAsset != null) |
275 | { | 275 | { |
276 | string script = Util.FieldToString(rezAsset.Data); | 276 | string script = Util.FieldToString(rezAsset.Data); |
277 | // Console.WriteLine("rez script " + script); | 277 | // Console.WriteLine("rez script " + script); |
278 | EventManager.TriggerRezScript(localID, copyID, script); | 278 | EventManager.TriggerRezScript(localID, copyID, script); |
279 | rezzed = true; | 279 | rezzed = true; |
280 | } | 280 | } |
281 | } | 281 | } |
282 | 282 | ||
283 | if (rezzed) | 283 | if (rezzed) |
284 | { | 284 | { |
285 | bool hasPrim = false; | 285 | bool hasPrim = false; |
286 | foreach (EntityBase ent in Entities.Values) | 286 | foreach (EntityBase ent in Entities.Values) |
287 | { | 287 | { |
288 | if (ent is SceneObjectGroup) | 288 | if (ent is SceneObjectGroup) |
289 | { | 289 | { |
290 | hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID); | 290 | hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID); |
291 | if (hasPrim != false) | 291 | if (hasPrim != false) |
292 | { | 292 | { |
293 | bool added = | 293 | bool added = |
294 | ((SceneObjectGroup) ent).AddInventoryItem(remoteClient, localID, item, | 294 | ((SceneObjectGroup) ent).AddInventoryItem(remoteClient, localID, item, |
295 | copyID); | 295 | copyID); |
296 | ((SceneObjectGroup) ent).GetProperites(remoteClient); | 296 | ((SceneObjectGroup) ent).GetProperites(remoteClient); |
297 | } | 297 | } |
298 | } | 298 | } |
299 | } | 299 | } |
300 | } | 300 | } |
301 | } | 301 | } |
302 | } | 302 | } |
303 | } | 303 | } |
304 | } | 304 | } |
305 | 305 | ||
306 | /// <summary> | 306 | /// <summary> |
307 | /// | 307 | /// |
308 | /// </summary> | 308 | /// </summary> |
309 | /// <param name="packet"></param> | 309 | /// <param name="packet"></param> |
310 | /// <param name="simClient"></param> | 310 | /// <param name="simClient"></param> |
311 | public void DeRezObject(Packet packet, IClientAPI remoteClient) | 311 | public void DeRezObject(Packet packet, IClientAPI remoteClient) |
312 | { | 312 | { |
313 | DeRezObjectPacket DeRezPacket = (DeRezObjectPacket) packet; | 313 | DeRezObjectPacket DeRezPacket = (DeRezObjectPacket) packet; |
314 | 314 | ||
315 | if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero) | 315 | if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero) |
316 | { | 316 | { |
317 | //currently following code not used (or don't know of any case of destination being zero | 317 | //currently following code not used (or don't know of any case of destination being zero |
318 | } | 318 | } |
319 | else | 319 | else |
320 | { | 320 | { |
321 | foreach (DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData) | 321 | foreach (DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData) |
322 | { | 322 | { |
323 | EntityBase selectedEnt = null; | 323 | EntityBase selectedEnt = null; |
324 | //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString()); | 324 | //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString()); |
325 | foreach (EntityBase ent in Entities.Values) | 325 | foreach (EntityBase ent in Entities.Values) |
326 | { | 326 | { |
327 | if (ent.LocalId == Data.ObjectLocalID) | 327 | if (ent.LocalId == Data.ObjectLocalID) |
328 | { | 328 | { |
329 | selectedEnt = ent; | 329 | selectedEnt = ent; |
330 | break; | 330 | break; |
331 | } | 331 | } |
332 | } | 332 | } |
333 | if (selectedEnt != null) | 333 | if (selectedEnt != null) |
334 | { | 334 | { |
335 | if (PermissionsMngr.CanDeRezObject(remoteClient.AgentId, ((SceneObjectGroup) selectedEnt).UUID)) | 335 | if (PermissionsMngr.CanDeRezObject(remoteClient.AgentId, ((SceneObjectGroup) selectedEnt).UUID)) |
336 | { | 336 | { |
337 | string sceneObjectXml = ((SceneObjectGroup) selectedEnt).ToXmlString(); | 337 | string sceneObjectXml = ((SceneObjectGroup) selectedEnt).ToXmlString(); |
338 | CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); | 338 | CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); |
339 | if (userInfo != null) | 339 | if (userInfo != null) |
340 | { | 340 | { |
341 | AssetBase asset = new AssetBase(); | 341 | AssetBase asset = new AssetBase(); |
342 | asset.Name = ((SceneObjectGroup) selectedEnt).GetPartName(selectedEnt.LocalId); | 342 | asset.Name = ((SceneObjectGroup) selectedEnt).GetPartName(selectedEnt.LocalId); |
343 | asset.Description = | 343 | asset.Description = |
344 | ((SceneObjectGroup) selectedEnt).GetPartDescription(selectedEnt.LocalId); | 344 | ((SceneObjectGroup) selectedEnt).GetPartDescription(selectedEnt.LocalId); |
345 | asset.InvType = 6; | 345 | asset.InvType = 6; |
346 | asset.Type = 6; | 346 | asset.Type = 6; |
347 | asset.FullID = LLUUID.Random(); | 347 | asset.FullID = LLUUID.Random(); |
348 | asset.Data = Helpers.StringToField(sceneObjectXml); | 348 | asset.Data = Helpers.StringToField(sceneObjectXml); |
349 | commsManager.AssetCache.AddAsset(asset); | 349 | commsManager.AssetCache.AddAsset(asset); |
350 | 350 | ||
351 | 351 | ||
352 | InventoryItemBase item = new InventoryItemBase(); | 352 | InventoryItemBase item = new InventoryItemBase(); |
353 | item.avatarID = remoteClient.AgentId; | 353 | item.avatarID = remoteClient.AgentId; |
354 | item.creatorsID = remoteClient.AgentId; | 354 | item.creatorsID = remoteClient.AgentId; |
355 | item.inventoryID = LLUUID.Random(); | 355 | item.inventoryID = LLUUID.Random(); |
356 | item.assetID = asset.FullID; | 356 | item.assetID = asset.FullID; |
357 | item.inventoryDescription = asset.Description; | 357 | item.inventoryDescription = asset.Description; |
358 | item.inventoryName = asset.Name; | 358 | item.inventoryName = asset.Name; |
359 | item.assetType = asset.Type; | 359 | item.assetType = asset.Type; |
360 | item.invType = asset.InvType; | 360 | item.invType = asset.InvType; |
361 | item.parentFolderID = DeRezPacket.AgentBlock.DestinationID; | 361 | item.parentFolderID = DeRezPacket.AgentBlock.DestinationID; |
362 | item.inventoryCurrentPermissions = 2147483647; | 362 | item.inventoryCurrentPermissions = 2147483647; |
363 | item.inventoryNextPermissions = 2147483647; | 363 | item.inventoryNextPermissions = 2147483647; |
364 | 364 | ||
365 | userInfo.AddItem(remoteClient.AgentId, item); | 365 | userInfo.AddItem(remoteClient.AgentId, item); |
366 | remoteClient.SendInventoryItemUpdate(item); | 366 | remoteClient.SendInventoryItemUpdate(item); |
367 | } | 367 | } |
368 | 368 | ||
369 | SceneObjectPart rootPart = | 369 | SceneObjectPart rootPart = |
370 | ((SceneObjectGroup) selectedEnt).GetChildPart(((SceneObjectGroup) selectedEnt).UUID); | 370 | ((SceneObjectGroup) selectedEnt).GetChildPart(((SceneObjectGroup) selectedEnt).UUID); |
371 | if (rootPart.PhysActor != null) | 371 | if (rootPart.PhysActor != null) |
372 | { | 372 | { |
373 | phyScene.RemovePrim(rootPart.PhysActor); | 373 | phyScene.RemovePrim(rootPart.PhysActor); |
374 | rootPart.PhysActor = null; | 374 | rootPart.PhysActor = null; |
375 | } | 375 | } |
376 | 376 | ||
377 | storageManager.DataStore.RemoveObject(((SceneObjectGroup) selectedEnt).UUID, | 377 | storageManager.DataStore.RemoveObject(((SceneObjectGroup) selectedEnt).UUID, |
378 | m_regInfo.SimUUID); | 378 | m_regInfo.SimUUID); |
379 | ((SceneObjectGroup) selectedEnt).DeleteGroup(); | 379 | ((SceneObjectGroup) selectedEnt).DeleteGroup(); |
380 | 380 | ||
381 | lock (Entities) | 381 | lock (Entities) |
382 | { | 382 | { |
383 | Entities.Remove(((SceneObjectGroup) selectedEnt).UUID); | 383 | Entities.Remove(((SceneObjectGroup) selectedEnt).UUID); |
384 | } | 384 | } |
385 | ((SceneObjectGroup) selectedEnt).DeleteParts(); | 385 | ((SceneObjectGroup) selectedEnt).DeleteParts(); |
386 | } | 386 | } |
387 | } | 387 | } |
388 | } | 388 | } |
389 | } | 389 | } |
390 | } | 390 | } |
391 | 391 | ||
392 | public void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos) | 392 | public void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos) |
393 | { | 393 | { |
394 | CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); | 394 | CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); |
395 | if (userInfo != null) | 395 | if (userInfo != null) |
396 | { | 396 | { |
397 | if (userInfo.RootFolder != null) | 397 | if (userInfo.RootFolder != null) |
398 | { | 398 | { |
399 | InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); | 399 | InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); |
400 | if (item != null) | 400 | if (item != null) |
401 | { | 401 | { |
402 | AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false); | 402 | AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false); |
403 | if (rezAsset != null) | 403 | if (rezAsset != null) |
404 | { | 404 | { |
405 | AddRezObject(Util.FieldToString(rezAsset.Data), pos); | 405 | AddRezObject(Util.FieldToString(rezAsset.Data), pos); |
406 | userInfo.DeleteItem(remoteClient.AgentId, item); | 406 | userInfo.DeleteItem(remoteClient.AgentId, item); |
407 | remoteClient.SendRemoveInventoryItem(itemID); | 407 | remoteClient.SendRemoveInventoryItem(itemID); |
408 | } | 408 | } |
409 | else | 409 | else |
410 | { | 410 | { |
411 | //lets try once more incase the asset cache is being slow getting the asset from server | 411 | //lets try once more incase the asset cache is being slow getting the asset from server |
412 | rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false); | 412 | rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false); |
413 | if (rezAsset != null) | 413 | if (rezAsset != null) |
414 | { | 414 | { |
415 | AddRezObject(Util.FieldToString(rezAsset.Data), pos); | 415 | AddRezObject(Util.FieldToString(rezAsset.Data), pos); |
416 | userInfo.DeleteItem(remoteClient.AgentId, item); | 416 | userInfo.DeleteItem(remoteClient.AgentId, item); |
417 | remoteClient.SendRemoveInventoryItem(itemID); | 417 | remoteClient.SendRemoveInventoryItem(itemID); |
418 | } | 418 | } |
419 | } | 419 | } |
420 | } | 420 | } |
421 | } | 421 | } |
422 | } | 422 | } |
423 | } | 423 | } |
424 | 424 | ||
425 | private void AddRezObject(string xmlData, LLVector3 pos) | 425 | private void AddRezObject(string xmlData, LLVector3 pos) |
426 | { | 426 | { |
427 | SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, xmlData); | 427 | SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, xmlData); |
428 | AddEntity(group); | 428 | AddEntity(group); |
429 | group.AbsolutePosition = pos; | 429 | group.AbsolutePosition = pos; |
430 | SceneObjectPart rootPart = group.GetChildPart(group.UUID); | 430 | SceneObjectPart rootPart = group.GetChildPart(group.UUID); |
431 | if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0) | 431 | if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0) |
432 | { | 432 | { |
433 | PrimitiveBaseShape pbs = rootPart.Shape; | 433 | PrimitiveBaseShape pbs = rootPart.Shape; |
434 | rootPart.PhysActor = phyScene.AddPrimShape( | 434 | rootPart.PhysActor = phyScene.AddPrimShape( |
435 | rootPart.Name, | 435 | rootPart.Name, |
436 | pbs, | 436 | pbs, |
437 | new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, | 437 | new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, |
438 | rootPart.AbsolutePosition.Z), | 438 | rootPart.AbsolutePosition.Z), |
439 | new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), | 439 | new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), |
440 | new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, | 440 | new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, |
441 | rootPart.RotationOffset.Y, rootPart.RotationOffset.Z)); | 441 | rootPart.RotationOffset.Y, rootPart.RotationOffset.Z)); |
442 | } | 442 | } |
443 | } | 443 | } |
444 | } | 444 | } |
445 | } | 445 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs index 0049282..89f60d1 100644 --- a/OpenSim/Region/Environment/Scenes/SceneManager.cs +++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs | |||
@@ -1,251 +1,251 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using OpenSim.Framework.Console; | 3 | using OpenSim.Framework.Console; |
4 | using OpenSim.Framework.Types; | 4 | using OpenSim.Framework.Types; |
5 | using libsecondlife; | 5 | using libsecondlife; |
6 | 6 | ||
7 | namespace OpenSim.Region.Environment.Scenes | 7 | namespace OpenSim.Region.Environment.Scenes |
8 | { | 8 | { |
9 | public class SceneManager | 9 | public class SceneManager |
10 | { | 10 | { |
11 | private readonly List<Scene> m_localScenes; | 11 | private readonly List<Scene> m_localScenes; |
12 | private Scene m_currentScene = null; | 12 | private Scene m_currentScene = null; |
13 | 13 | ||
14 | public Scene CurrentScene | 14 | public Scene CurrentScene |
15 | { | 15 | { |
16 | get { return m_currentScene; } | 16 | get { return m_currentScene; } |
17 | } | 17 | } |
18 | 18 | ||
19 | public Scene CurrentOrFirstScene | 19 | public Scene CurrentOrFirstScene |
20 | { | 20 | { |
21 | get | 21 | get |
22 | { | 22 | { |
23 | if (m_currentScene == null) | 23 | if (m_currentScene == null) |
24 | { | 24 | { |
25 | return m_localScenes[0]; | 25 | return m_localScenes[0]; |
26 | } | 26 | } |
27 | else | 27 | else |
28 | { | 28 | { |
29 | return m_currentScene; | 29 | return m_currentScene; |
30 | } | 30 | } |
31 | } | 31 | } |
32 | } | 32 | } |
33 | 33 | ||
34 | public SceneManager() | 34 | public SceneManager() |
35 | { | 35 | { |
36 | m_localScenes = new List<Scene>(); | 36 | m_localScenes = new List<Scene>(); |
37 | } | 37 | } |
38 | 38 | ||
39 | public void Close() | 39 | public void Close() |
40 | { | 40 | { |
41 | for (int i = 0; i < m_localScenes.Count; i++) | 41 | for (int i = 0; i < m_localScenes.Count; i++) |
42 | { | 42 | { |
43 | m_localScenes[i].Close(); | 43 | m_localScenes[i].Close(); |
44 | } | 44 | } |
45 | } | 45 | } |
46 | 46 | ||
47 | public void Add(Scene scene) | 47 | public void Add(Scene scene) |
48 | { | 48 | { |
49 | m_localScenes.Add(scene); | 49 | m_localScenes.Add(scene); |
50 | } | 50 | } |
51 | 51 | ||
52 | public void SaveCurrentSceneToXml(string filename) | 52 | public void SaveCurrentSceneToXml(string filename) |
53 | { | 53 | { |
54 | CurrentOrFirstScene.SavePrimsToXml(filename); | 54 | CurrentOrFirstScene.SavePrimsToXml(filename); |
55 | } | 55 | } |
56 | 56 | ||
57 | public void LoadCurrentSceneFromXml(string filename) | 57 | public void LoadCurrentSceneFromXml(string filename) |
58 | { | 58 | { |
59 | CurrentOrFirstScene.LoadPrimsFromXml(filename); | 59 | CurrentOrFirstScene.LoadPrimsFromXml(filename); |
60 | } | 60 | } |
61 | 61 | ||
62 | public bool RunTerrainCmdOnCurrentScene(string[] cmdparams, ref string result) | 62 | public bool RunTerrainCmdOnCurrentScene(string[] cmdparams, ref string result) |
63 | { | 63 | { |
64 | if (m_currentScene == null) | 64 | if (m_currentScene == null) |
65 | { | 65 | { |
66 | bool success = true; | 66 | bool success = true; |
67 | foreach (Scene scene in m_localScenes) | 67 | foreach (Scene scene in m_localScenes) |
68 | { | 68 | { |
69 | if (!scene.Terrain.RunTerrainCmd(cmdparams, ref result, scene.RegionInfo.RegionName)) | 69 | if (!scene.Terrain.RunTerrainCmd(cmdparams, ref result, scene.RegionInfo.RegionName)) |
70 | { | 70 | { |
71 | success = false; | 71 | success = false; |
72 | } | 72 | } |
73 | } | 73 | } |
74 | 74 | ||
75 | return success; | 75 | return success; |
76 | } | 76 | } |
77 | else | 77 | else |
78 | { | 78 | { |
79 | return m_currentScene.Terrain.RunTerrainCmd(cmdparams, ref result, m_currentScene.RegionInfo.RegionName); | 79 | return m_currentScene.Terrain.RunTerrainCmd(cmdparams, ref result, m_currentScene.RegionInfo.RegionName); |
80 | } | 80 | } |
81 | } | 81 | } |
82 | 82 | ||
83 | public void SendCommandToCurrentSceneScripts(string[] cmdparams) | 83 | public void SendCommandToCurrentSceneScripts(string[] cmdparams) |
84 | { | 84 | { |
85 | ForEachCurrentScene(delegate(Scene scene) { scene.SendCommandToPlugins(cmdparams); }); | 85 | ForEachCurrentScene(delegate(Scene scene) { scene.SendCommandToPlugins(cmdparams); }); |
86 | } | 86 | } |
87 | 87 | ||
88 | public void SetBypassPermissionsOnCurrentScene(bool bypassPermissions) | 88 | public void SetBypassPermissionsOnCurrentScene(bool bypassPermissions) |
89 | { | 89 | { |
90 | ForEachCurrentScene(delegate(Scene scene) { scene.PermissionsMngr.BypassPermissions = bypassPermissions; }); | 90 | ForEachCurrentScene(delegate(Scene scene) { scene.PermissionsMngr.BypassPermissions = bypassPermissions; }); |
91 | } | 91 | } |
92 | 92 | ||
93 | private void ForEachCurrentScene(Action<Scene> func) | 93 | private void ForEachCurrentScene(Action<Scene> func) |
94 | { | 94 | { |
95 | if (m_currentScene == null) | 95 | if (m_currentScene == null) |
96 | { | 96 | { |
97 | m_localScenes.ForEach(func); | 97 | m_localScenes.ForEach(func); |
98 | } | 98 | } |
99 | else | 99 | else |
100 | { | 100 | { |
101 | func(m_currentScene); | 101 | func(m_currentScene); |
102 | } | 102 | } |
103 | } | 103 | } |
104 | 104 | ||
105 | public void BackupCurrentScene() | 105 | public void BackupCurrentScene() |
106 | { | 106 | { |
107 | ForEachCurrentScene(delegate(Scene scene) { scene.Backup(); }); | 107 | ForEachCurrentScene(delegate(Scene scene) { scene.Backup(); }); |
108 | } | 108 | } |
109 | 109 | ||
110 | public void HandleAlertCommandOnCurrentScene(string[] cmdparams) | 110 | public void HandleAlertCommandOnCurrentScene(string[] cmdparams) |
111 | { | 111 | { |
112 | ForEachCurrentScene(delegate(Scene scene) { scene.HandleAlertCommand(cmdparams); }); | 112 | ForEachCurrentScene(delegate(Scene scene) { scene.HandleAlertCommand(cmdparams); }); |
113 | } | 113 | } |
114 | 114 | ||
115 | public bool TrySetCurrentScene(string regionName) | 115 | public bool TrySetCurrentScene(string regionName) |
116 | { | 116 | { |
117 | if ((String.Compare(regionName, "root") == 0) || (String.Compare(regionName, "..") == 0)) | 117 | if ((String.Compare(regionName, "root") == 0) || (String.Compare(regionName, "..") == 0)) |
118 | { | 118 | { |
119 | m_currentScene = null; | 119 | m_currentScene = null; |
120 | return true; | 120 | return true; |
121 | } | 121 | } |
122 | else | 122 | else |
123 | { | 123 | { |
124 | Console.WriteLine("Searching for Region: '" + regionName + "'"); | 124 | Console.WriteLine("Searching for Region: '" + regionName + "'"); |
125 | 125 | ||
126 | foreach (Scene scene in m_localScenes) | 126 | foreach (Scene scene in m_localScenes) |
127 | { | 127 | { |
128 | if (String.Compare(scene.RegionInfo.RegionName, regionName, true) == 0) | 128 | if (String.Compare(scene.RegionInfo.RegionName, regionName, true) == 0) |
129 | { | 129 | { |
130 | m_currentScene = scene; | 130 | m_currentScene = scene; |
131 | return true; | 131 | return true; |
132 | } | 132 | } |
133 | } | 133 | } |
134 | 134 | ||
135 | return false; | 135 | return false; |
136 | } | 136 | } |
137 | } | 137 | } |
138 | 138 | ||
139 | public void SetDebugPacketOnCurrentScene(LogBase log, int newDebug) | 139 | public void SetDebugPacketOnCurrentScene(LogBase log, int newDebug) |
140 | { | 140 | { |
141 | ForEachCurrentScene(delegate(Scene scene) | 141 | ForEachCurrentScene(delegate(Scene scene) |
142 | { | 142 | { |
143 | foreach (EntityBase entity in scene.Entities.Values) | 143 | foreach (EntityBase entity in scene.Entities.Values) |
144 | { | 144 | { |
145 | if (entity is ScenePresence) | 145 | if (entity is ScenePresence) |
146 | { | 146 | { |
147 | ScenePresence scenePrescence = entity as ScenePresence; | 147 | ScenePresence scenePrescence = entity as ScenePresence; |
148 | if (!scenePrescence.IsChildAgent) | 148 | if (!scenePrescence.IsChildAgent) |
149 | { | 149 | { |
150 | log.Error(String.Format("Packet debug for {0} {1} set to {2}", | 150 | log.Error(String.Format("Packet debug for {0} {1} set to {2}", |
151 | scenePrescence.Firstname, scenePrescence.Lastname, | 151 | scenePrescence.Firstname, scenePrescence.Lastname, |
152 | newDebug)); | 152 | newDebug)); |
153 | 153 | ||
154 | scenePrescence.ControllingClient.SetDebug(newDebug); | 154 | scenePrescence.ControllingClient.SetDebug(newDebug); |
155 | } | 155 | } |
156 | } | 156 | } |
157 | } | 157 | } |
158 | }); | 158 | }); |
159 | } | 159 | } |
160 | 160 | ||
161 | public List<ScenePresence> GetCurrentSceneAvatars() | 161 | public List<ScenePresence> GetCurrentSceneAvatars() |
162 | { | 162 | { |
163 | List<ScenePresence> avatars = new List<ScenePresence>(); | 163 | List<ScenePresence> avatars = new List<ScenePresence>(); |
164 | 164 | ||
165 | ForEachCurrentScene(delegate(Scene scene) | 165 | ForEachCurrentScene(delegate(Scene scene) |
166 | { | 166 | { |
167 | foreach (EntityBase entity in scene.Entities.Values) | 167 | foreach (EntityBase entity in scene.Entities.Values) |
168 | { | 168 | { |
169 | if (entity is ScenePresence) | 169 | if (entity is ScenePresence) |
170 | { | 170 | { |
171 | ScenePresence scenePrescence = entity as ScenePresence; | 171 | ScenePresence scenePrescence = entity as ScenePresence; |
172 | if (!scenePrescence.IsChildAgent) | 172 | if (!scenePrescence.IsChildAgent) |
173 | { | 173 | { |
174 | avatars.Add(scenePrescence); | 174 | avatars.Add(scenePrescence); |
175 | } | 175 | } |
176 | } | 176 | } |
177 | } | 177 | } |
178 | }); | 178 | }); |
179 | 179 | ||
180 | return avatars; | 180 | return avatars; |
181 | } | 181 | } |
182 | 182 | ||
183 | public RegionInfo GetRegionInfo(ulong regionHandle) | 183 | public RegionInfo GetRegionInfo(ulong regionHandle) |
184 | { | 184 | { |
185 | foreach (Scene scene in m_localScenes) | 185 | foreach (Scene scene in m_localScenes) |
186 | { | 186 | { |
187 | if (scene.RegionInfo.RegionHandle == regionHandle) | 187 | if (scene.RegionInfo.RegionHandle == regionHandle) |
188 | { | 188 | { |
189 | return scene.RegionInfo; | 189 | return scene.RegionInfo; |
190 | } | 190 | } |
191 | } | 191 | } |
192 | 192 | ||
193 | return null; | 193 | return null; |
194 | } | 194 | } |
195 | 195 | ||
196 | public void SetCurrentSceneTimePhase(int timePhase) | 196 | public void SetCurrentSceneTimePhase(int timePhase) |
197 | { | 197 | { |
198 | ForEachCurrentScene(delegate(Scene scene) | 198 | ForEachCurrentScene(delegate(Scene scene) |
199 | { | 199 | { |
200 | scene.SetTimePhase( | 200 | scene.SetTimePhase( |
201 | timePhase) | 201 | timePhase) |
202 | ; | 202 | ; |
203 | }); | 203 | }); |
204 | } | 204 | } |
205 | 205 | ||
206 | 206 | ||
207 | public void ForceCurrentSceneClientUpdate() | 207 | public void ForceCurrentSceneClientUpdate() |
208 | { | 208 | { |
209 | ForEachCurrentScene(delegate(Scene scene) { scene.ForceClientUpdate(); }); | 209 | ForEachCurrentScene(delegate(Scene scene) { scene.ForceClientUpdate(); }); |
210 | } | 210 | } |
211 | 211 | ||
212 | public void HandleEditCommandOnCurrentScene(string[] cmdparams) | 212 | public void HandleEditCommandOnCurrentScene(string[] cmdparams) |
213 | { | 213 | { |
214 | ForEachCurrentScene(delegate(Scene scene) { scene.HandleEditCommand(cmdparams); }); | 214 | ForEachCurrentScene(delegate(Scene scene) { scene.HandleEditCommand(cmdparams); }); |
215 | } | 215 | } |
216 | 216 | ||
217 | public bool TryGetAvatar( LLUUID avatarId, out ScenePresence avatar ) | 217 | public bool TryGetAvatar( LLUUID avatarId, out ScenePresence avatar ) |
218 | { | 218 | { |
219 | foreach (Scene scene in m_localScenes) | 219 | foreach (Scene scene in m_localScenes) |
220 | { | 220 | { |
221 | if( scene.TryGetAvatar( avatarId, out avatar )) | 221 | if( scene.TryGetAvatar( avatarId, out avatar )) |
222 | { | 222 | { |
223 | return true; | 223 | return true; |
224 | } | 224 | } |
225 | } | 225 | } |
226 | 226 | ||
227 | avatar = null; | 227 | avatar = null; |
228 | return false; | 228 | return false; |
229 | } | 229 | } |
230 | 230 | ||
231 | public void CloseScene(Scene scene) | 231 | public void CloseScene(Scene scene) |
232 | { | 232 | { |
233 | m_localScenes.Remove(scene); | 233 | m_localScenes.Remove(scene); |
234 | scene.Close(); | 234 | scene.Close(); |
235 | } | 235 | } |
236 | 236 | ||
237 | public bool TryGetAvatarByName(string avatarName, out ScenePresence avatar) | 237 | public bool TryGetAvatarByName(string avatarName, out ScenePresence avatar) |
238 | { | 238 | { |
239 | foreach (Scene scene in m_localScenes) | 239 | foreach (Scene scene in m_localScenes) |
240 | { | 240 | { |
241 | if (scene.TryGetAvatarByName(avatarName, out avatar)) | 241 | if (scene.TryGetAvatarByName(avatarName, out avatar)) |
242 | { | 242 | { |
243 | return true; | 243 | return true; |
244 | } | 244 | } |
245 | } | 245 | } |
246 | 246 | ||
247 | avatar = null; | 247 | avatar = null; |
248 | return false; | 248 | return false; |
249 | } | 249 | } |
250 | } | 250 | } |
251 | } \ No newline at end of file | 251 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs b/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs index dbd43be..baaeb86 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs +++ b/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs | |||
@@ -1,6 +1,6 @@ | |||
1 | using Axiom.Math; | 1 | using Axiom.Math; |
2 | using libsecondlife; | 2 | using libsecondlife; |
3 | 3 | ||
4 | namespace OpenSim.Region.Environment.Scenes.Scripting | 4 | namespace OpenSim.Region.Environment.Scenes.Scripting |
5 | { | 5 | { |
6 | public interface IScriptHost | 6 | public interface IScriptHost |
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs b/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs index 6876cfb..2337aba 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs +++ b/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs | |||
@@ -1,13 +1,13 @@ | |||
1 | using System; | 1 | using System; |
2 | using Axiom.Math; | 2 | using Axiom.Math; |
3 | using libsecondlife; | 3 | using libsecondlife; |
4 | 4 | ||
5 | namespace OpenSim.Region.Environment.Scenes.Scripting | 5 | namespace OpenSim.Region.Environment.Scenes.Scripting |
6 | { | 6 | { |
7 | public class NullScriptHost : IScriptHost | 7 | public class NullScriptHost : IScriptHost |
8 | { | 8 | { |
9 | private LLVector3 m_pos = new LLVector3(128, 128, 30); | 9 | private LLVector3 m_pos = new LLVector3(128, 128, 30); |
10 | 10 | ||
11 | public string Name | 11 | public string Name |
12 | { | 12 | { |
13 | get { return "Object"; } | 13 | get { return "Object"; } |
@@ -38,13 +38,13 @@ namespace OpenSim.Region.Environment.Scenes.Scripting | |||
38 | } | 38 | } |
39 | 39 | ||
40 | public LLUUID ObjectOwner | 40 | public LLUUID ObjectOwner |
41 | { | 41 | { |
42 | get { return LLUUID.Zero; } | 42 | get { return LLUUID.Zero; } |
43 | } | 43 | } |
44 | 44 | ||
45 | public LLUUID ObjectCreator | 45 | public LLUUID ObjectCreator |
46 | { | 46 | { |
47 | get { return LLUUID.Zero; } | 47 | get { return LLUUID.Zero; } |
48 | } | 48 | } |
49 | 49 | ||
50 | public LLVector3 AbsolutePosition | 50 | public LLVector3 AbsolutePosition |