Add scripted controllers into agent intersim messaging
parent
922e874653
commit
7f0f11304f
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue