Clear permissions given to the object we stand up from

avinationmerge
Melanie 2012-05-03 01:18:51 +02:00
parent a135e51d23
commit 9f9693dab8
2 changed files with 31 additions and 2 deletions

View File

@ -229,12 +229,14 @@ namespace OpenSim.Framework
public class ControllerData public class ControllerData
{ {
public UUID ObjectID;
public UUID ItemID; public UUID ItemID;
public uint IgnoreControls; public uint IgnoreControls;
public uint EventControls; public uint EventControls;
public ControllerData(UUID item, uint ignore, uint ev) public ControllerData(UUID obj, UUID item, uint ignore, uint ev)
{ {
ObjectID = obj;
ItemID = item; ItemID = item;
IgnoreControls = ignore; IgnoreControls = ignore;
EventControls = ev; EventControls = ev;
@ -248,6 +250,7 @@ namespace OpenSim.Framework
public OSDMap PackUpdateMessage() public OSDMap PackUpdateMessage()
{ {
OSDMap controldata = new OSDMap(); OSDMap controldata = new OSDMap();
controldata["object"] = OSD.FromUUID(ObjectID);
controldata["item"] = OSD.FromUUID(ItemID); controldata["item"] = OSD.FromUUID(ItemID);
controldata["ignore"] = OSD.FromInteger(IgnoreControls); controldata["ignore"] = OSD.FromInteger(IgnoreControls);
controldata["event"] = OSD.FromInteger(EventControls); controldata["event"] = OSD.FromInteger(EventControls);
@ -258,6 +261,8 @@ namespace OpenSim.Framework
public void UnpackUpdateMessage(OSDMap args) public void UnpackUpdateMessage(OSDMap args)
{ {
if (args["object"] != null)
ObjectID = args["object"].AsUUID();
if (args["item"] != null) if (args["item"] != null)
ItemID = args["item"].AsUUID(); ItemID = args["item"].AsUUID();
if (args["ignore"] != null) if (args["ignore"] != null)

View File

@ -62,6 +62,7 @@ namespace OpenSim.Region.Framework.Scenes
struct ScriptControllers struct ScriptControllers
{ {
public UUID objectID;
public UUID itemID; public UUID itemID;
public ScriptControlled ignoreControls; public ScriptControlled ignoreControls;
public ScriptControlled eventControls; public ScriptControlled eventControls;
@ -1890,6 +1891,8 @@ namespace OpenSim.Region.Framework.Scenes
if (ParentID != 0) if (ParentID != 0)
{ {
SceneObjectPart part = ParentPart; SceneObjectPart part = ParentPart;
UnRegisterSeatControls(part.ParentGroup.UUID);
TaskInventoryDictionary taskIDict = part.TaskInventory; TaskInventoryDictionary taskIDict = part.TaskInventory;
if (taskIDict != null) if (taskIDict != null)
{ {
@ -3217,7 +3220,7 @@ namespace OpenSim.Region.Framework.Scenes
foreach (ScriptControllers c in scriptedcontrols.Values) foreach (ScriptControllers c in scriptedcontrols.Values)
{ {
controls[i++] = new ControllerData(c.itemID, (uint)c.ignoreControls, (uint)c.eventControls); controls[i++] = new ControllerData(c.objectID, c.itemID, (uint)c.ignoreControls, (uint)c.eventControls);
} }
cAgent.Controllers = controls; cAgent.Controllers = controls;
} }
@ -3307,6 +3310,7 @@ namespace OpenSim.Region.Framework.Scenes
foreach (ControllerData c in cAgent.Controllers) foreach (ControllerData c in cAgent.Controllers)
{ {
ScriptControllers sc = new ScriptControllers(); ScriptControllers sc = new ScriptControllers();
sc.objectID = c.ObjectID;
sc.itemID = c.ItemID; sc.itemID = c.ItemID;
sc.ignoreControls = (ScriptControlled)c.IgnoreControls; sc.ignoreControls = (ScriptControlled)c.IgnoreControls;
sc.eventControls = (ScriptControlled)c.EventControls; sc.eventControls = (ScriptControlled)c.EventControls;
@ -3702,10 +3706,15 @@ namespace OpenSim.Region.Framework.Scenes
public void RegisterControlEventsToScript(int controls, int accept, int pass_on, uint Obj_localID, UUID Script_item_UUID) public void RegisterControlEventsToScript(int controls, int accept, int pass_on, uint Obj_localID, UUID Script_item_UUID)
{ {
SceneObjectPart p = m_scene.GetSceneObjectPart(Obj_localID);
if (p == null)
return;
ScriptControllers obj = new ScriptControllers(); ScriptControllers obj = new ScriptControllers();
obj.ignoreControls = ScriptControlled.CONTROL_ZERO; obj.ignoreControls = ScriptControlled.CONTROL_ZERO;
obj.eventControls = ScriptControlled.CONTROL_ZERO; obj.eventControls = ScriptControlled.CONTROL_ZERO;
obj.objectID = p.ParentGroup.UUID;
obj.itemID = Script_item_UUID; obj.itemID = Script_item_UUID;
if (pass_on == 0 && accept == 0) if (pass_on == 0 && accept == 0)
{ {
@ -3754,6 +3763,21 @@ namespace OpenSim.Region.Framework.Scenes
ControllingClient.SendTakeControls(int.MaxValue, false, false); ControllingClient.SendTakeControls(int.MaxValue, false, false);
} }
private void UnRegisterSeatControls(UUID obj)
{
List<UUID> takers = new List<UUID>();
foreach (ScriptControllers c in scriptedcontrols.Values)
{
if (c.objectID == obj)
takers.Add(c.itemID);
}
foreach (UUID t in takers)
{
UnRegisterControlEventsToScript(0, t);
}
}
public void UnRegisterControlEventsToScript(uint Obj_localID, UUID Script_item_UUID) public void UnRegisterControlEventsToScript(uint Obj_localID, UUID Script_item_UUID)
{ {
ScriptControllers takecontrols; ScriptControllers takecontrols;