From 7f0f11304f0979355d75538ab7326b687b62e76e Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sun, 11 Jul 2010 14:26:57 +0200 Subject: Add scripted controllers into agent intersim messaging --- OpenSim/Framework/ChildAgentDataUpdate.cs | 65 ++++++++++++++++++++++ OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 4 ++ OpenSim/Region/Framework/Scenes/ScenePresence.cs | 33 +++++++++++ 3 files changed, 102 insertions(+) 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 } } + public class ControllerData + { + public UUID ItemID; + public uint IgnoreControls; + public uint EventControls; + + public ControllerData(UUID item, uint ignore, uint ev) + { + ItemID = item; + IgnoreControls = ignore; + EventControls = ev; + } + + public ControllerData(OSDMap args) + { + UnpackUpdateMessage(args); + } + + public OSDMap PackUpdateMessage() + { + OSDMap controldata = new OSDMap(); + controldata["item"] = OSD.FromUUID(ItemID); + controldata["ignore"] = OSD.FromInteger(IgnoreControls); + controldata["event"] = OSD.FromInteger(EventControls); + + return controldata; + } + + + public void UnpackUpdateMessage(OSDMap args) + { + if (args["item"] != null) + ItemID = args["item"].AsUUID(); + if (args["ignore"] != null) + IgnoreControls = (uint)args["ignore"].AsInteger(); + if (args["event"] != null) + EventControls = (uint)args["event"].AsInteger(); + } + } + public class AgentData : IAgentData { private UUID m_id; @@ -313,6 +353,9 @@ namespace OpenSim.Framework public UUID[] Wearables; public AttachmentData[] Attachments; + // Scripted + public ControllerData[] Controllers; + public string CallbackURI; public virtual OSDMap Pack() @@ -403,6 +446,14 @@ namespace OpenSim.Framework args["attachments"] = attachs; } + if ((Controllers != null) && (Controllers.Length > 0)) + { + OSDArray controls = new OSDArray(Controllers.Length); + foreach (ControllerData ctl in Controllers) + controls.Add(ctl.PackUpdateMessage()); + args["controllers"] = controls; + } + if ((CallbackURI != null) && (!CallbackURI.Equals(""))) args["callback_uri"] = OSD.FromString(CallbackURI); @@ -559,6 +610,20 @@ namespace OpenSim.Framework } } + if ((args["controllers"] != null) && (args["controllers"]).Type == OSDType.Array) + { + OSDArray controls = (OSDArray)(args["controllers"]); + Controllers = new ControllerData[controls.Count]; + int i = 0; + foreach (OSD o in controls) + { + if (o.Type == OSDType.Map) + { + Controllers[i++] = new ControllerData((OSDMap)o); + } + } + } + if (args["callback_uri"] != null) CallbackURI = args["callback_uri"].AsString(); } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index b552cdc..e87766e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4145,6 +4145,10 @@ namespace OpenSim.Region.Framework.Scenes case 16: _nextOwnerMask = ApplyMask(_nextOwnerMask, set, mask) & baseMask; + // Prevent the client from creating no mod, no copy + // objects + if ((_nextOwnerMask & (uint)PermissionMask.Copy) == 0) + _nextOwnerMask |= (uint)PermissionMask.Transfer; break; } SendFullUpdateToAllClients(); diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 5ac7755..efe3365 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3365,6 +3365,18 @@ Console.WriteLine("Scripted Sit ofset {0}", m_pos); cAgent.Attachments = attachs; } + lock (scriptedcontrols) + { + ControllerData[] controls = new ControllerData[scriptedcontrols.Count]; + int i = 0; + + foreach (ScriptControllers c in scriptedcontrols.Values) + { + controls[i++] = new ControllerData(c.itemID, (uint)c.ignoreControls, (uint)c.eventControls); + } + cAgent.Controllers = controls; + } + // Animations try { @@ -3446,6 +3458,27 @@ Console.WriteLine("Scripted Sit ofset {0}", m_pos); } catch { } + try + { + lock (scriptedcontrols) + { + if (cAgent.Controllers != null) + { + scriptedcontrols.Clear(); + + foreach (ControllerData c in cAgent.Controllers) + { + ScriptControllers sc = new ScriptControllers(); + sc.itemID = c.ItemID; + sc.ignoreControls = (ScriptControlled)c.IgnoreControls; + sc.eventControls = (ScriptControlled)c.EventControls; + + scriptedcontrols[sc.itemID] = sc; + } + } + } + } + catch { } // Animations try { -- cgit v1.1