aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie Thielker2010-07-11 14:26:57 +0200
committerMelanie2010-07-11 14:50:14 +0100
commit26621ca500a43918b589cff13c9c3ab41f16a8a2 (patch)
treecf72a50e306385019c80950140e586c8a80b3b38
parentRemove localID from script controls data. It won't transfer to another (diff)
downloadopensim-SC_OLD-26621ca500a43918b589cff13c9c3ab41f16a8a2.zip
opensim-SC_OLD-26621ca500a43918b589cff13c9c3ab41f16a8a2.tar.gz
opensim-SC_OLD-26621ca500a43918b589cff13c9c3ab41f16a8a2.tar.bz2
opensim-SC_OLD-26621ca500a43918b589cff13c9c3ab41f16a8a2.tar.xz
Add scripted controllers into agent intersim messaging
-rw-r--r--OpenSim/Framework/ChildAgentDataUpdate.cs65
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs33
3 files changed, 102 insertions, 0 deletions
diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs
index a1ac84c..89ee39c 100644
--- a/OpenSim/Framework/ChildAgentDataUpdate.cs
+++ b/OpenSim/Framework/ChildAgentDataUpdate.cs
@@ -265,6 +265,46 @@ namespace OpenSim.Framework
265 } 265 }
266 } 266 }
267 267
268 public class ControllerData
269 {
270 public UUID ItemID;
271 public uint IgnoreControls;
272 public uint EventControls;
273
274 public ControllerData(UUID item, uint ignore, uint ev)
275 {
276 ItemID = item;
277 IgnoreControls = ignore;
278 EventControls = ev;
279 }
280
281 public ControllerData(OSDMap args)
282 {
283 UnpackUpdateMessage(args);
284 }
285
286 public OSDMap PackUpdateMessage()
287 {
288 OSDMap controldata = new OSDMap();
289 controldata["item"] = OSD.FromUUID(ItemID);
290 controldata["ignore"] = OSD.FromInteger(IgnoreControls);
291 controldata["event"] = OSD.FromInteger(EventControls);
292
293 return controldata;
294 }
295
296
297 public void UnpackUpdateMessage(OSDMap args)
298 {
299 if (args["item"] != null)
300 ItemID = args["item"].AsUUID();
301 if (args["ignore"] != null)
302 IgnoreControls = (uint)args["ignore"].AsInteger();
303 if (args["event"] != null)
304 EventControls = (uint)args["event"].AsInteger();
305 }
306 }
307
268 public class AgentData : IAgentData 308 public class AgentData : IAgentData
269 { 309 {
270 private UUID m_id; 310 private UUID m_id;
@@ -313,6 +353,9 @@ namespace OpenSim.Framework
313 public UUID[] Wearables; 353 public UUID[] Wearables;
314 public AttachmentData[] Attachments; 354 public AttachmentData[] Attachments;
315 355
356 // Scripted
357 public ControllerData[] Controllers;
358
316 public string CallbackURI; 359 public string CallbackURI;
317 360
318 public virtual OSDMap Pack() 361 public virtual OSDMap Pack()
@@ -403,6 +446,14 @@ namespace OpenSim.Framework
403 args["attachments"] = attachs; 446 args["attachments"] = attachs;
404 } 447 }
405 448
449 if ((Controllers != null) && (Controllers.Length > 0))
450 {
451 OSDArray controls = new OSDArray(Controllers.Length);
452 foreach (ControllerData ctl in Controllers)
453 controls.Add(ctl.PackUpdateMessage());
454 args["controllers"] = controls;
455 }
456
406 457
407 if ((CallbackURI != null) && (!CallbackURI.Equals(""))) 458 if ((CallbackURI != null) && (!CallbackURI.Equals("")))
408 args["callback_uri"] = OSD.FromString(CallbackURI); 459 args["callback_uri"] = OSD.FromString(CallbackURI);
@@ -559,6 +610,20 @@ namespace OpenSim.Framework
559 } 610 }
560 } 611 }
561 612
613 if ((args["controllers"] != null) && (args["controllers"]).Type == OSDType.Array)
614 {
615 OSDArray controls = (OSDArray)(args["controllers"]);
616 Controllers = new ControllerData[controls.Count];
617 int i = 0;
618 foreach (OSD o in controls)
619 {
620 if (o.Type == OSDType.Map)
621 {
622 Controllers[i++] = new ControllerData((OSDMap)o);
623 }
624 }
625 }
626
562 if (args["callback_uri"] != null) 627 if (args["callback_uri"] != null)
563 CallbackURI = args["callback_uri"].AsString(); 628 CallbackURI = args["callback_uri"].AsString();
564 } 629 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 0698411..13e4b56 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -4140,6 +4140,10 @@ namespace OpenSim.Region.Framework.Scenes
4140 case 16: 4140 case 16:
4141 _nextOwnerMask = ApplyMask(_nextOwnerMask, set, mask) & 4141 _nextOwnerMask = ApplyMask(_nextOwnerMask, set, mask) &
4142 baseMask; 4142 baseMask;
4143 // Prevent the client from creating no mod, no copy
4144 // objects
4145 if ((_nextOwnerMask & (uint)PermissionMask.Copy) == 0)
4146 _nextOwnerMask |= (uint)PermissionMask.Transfer;
4143 break; 4147 break;
4144 } 4148 }
4145 SendFullUpdateToAllClients(); 4149 SendFullUpdateToAllClients();
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 7f98877..1e8ce22 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -3056,6 +3056,18 @@ namespace OpenSim.Region.Framework.Scenes
3056 cAgent.Attachments = attachs; 3056 cAgent.Attachments = attachs;
3057 } 3057 }
3058 3058
3059 lock (scriptedcontrols)
3060 {
3061 ControllerData[] controls = new ControllerData[scriptedcontrols.Count];
3062 int i = 0;
3063
3064 foreach (ScriptControllers c in scriptedcontrols.Values)
3065 {
3066 controls[i++] = new ControllerData(c.itemID, (uint)c.ignoreControls, (uint)c.eventControls);
3067 }
3068 cAgent.Controllers = controls;
3069 }
3070
3059 // Animations 3071 // Animations
3060 try 3072 try
3061 { 3073 {
@@ -3136,6 +3148,27 @@ namespace OpenSim.Region.Framework.Scenes
3136 } 3148 }
3137 catch { } 3149 catch { }
3138 3150
3151 try
3152 {
3153 lock (scriptedcontrols)
3154 {
3155 if (cAgent.Controllers != null)
3156 {
3157 scriptedcontrols.Clear();
3158
3159 foreach (ControllerData c in cAgent.Controllers)
3160 {
3161 ScriptControllers sc = new ScriptControllers();
3162 sc.itemID = c.ItemID;
3163 sc.ignoreControls = (ScriptControlled)c.IgnoreControls;
3164 sc.eventControls = (ScriptControlled)c.EventControls;
3165
3166 scriptedcontrols[sc.itemID] = sc;
3167 }
3168 }
3169 }
3170 }
3171 catch { }
3139 // Animations 3172 // Animations
3140 try 3173 try
3141 { 3174 {