diff options
author | Teravus Ovares | 2008-04-30 16:52:12 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-04-30 16:52:12 +0000 |
commit | b70da6ac1955ada29e1cb4dbe9aeb915735ec686 (patch) | |
tree | 68f6f5f3e7fe2b0fd9a8e0c9baf2dbfafeb90882 | |
parent | * Deal with a situation where the new fields in the inventory store are null ... (diff) | |
download | opensim-SC_OLD-b70da6ac1955ada29e1cb4dbe9aeb915735ec686.zip opensim-SC_OLD-b70da6ac1955ada29e1cb4dbe9aeb915735ec686.tar.gz opensim-SC_OLD-b70da6ac1955ada29e1cb4dbe9aeb915735ec686.tar.bz2 opensim-SC_OLD-b70da6ac1955ada29e1cb4dbe9aeb915735ec686.tar.xz |
* Patch by Melanie. Implements proper objectflags on child objects. Thanks Melanie!
RE: 0001079: r4387. touch() event does not fire when touch script is in root prim and child prims are touched
Diffstat (limited to '')
12 files changed, 139 insertions, 134 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLDataStore.cs b/OpenSim/Data/MSSQL/MSSQLDataStore.cs index e881cf1..6b3b8ef 100644 --- a/OpenSim/Data/MSSQL/MSSQLDataStore.cs +++ b/OpenSim/Data/MSSQL/MSSQLDataStore.cs | |||
@@ -152,7 +152,7 @@ namespace OpenSim.Data.MSSQL | |||
152 | { | 152 | { |
153 | foreach (SceneObjectPart prim in obj.Children.Values) | 153 | foreach (SceneObjectPart prim in obj.Children.Values) |
154 | { | 154 | { |
155 | if ((prim.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) == 0) | 155 | if ((prim.GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.Physics) == 0) |
156 | { | 156 | { |
157 | m_log.Info("[DATASTORE]: Adding obj: " + obj.UUID + " to region: " + regionUUID); | 157 | m_log.Info("[DATASTORE]: Adding obj: " + obj.UUID + " to region: " + regionUUID); |
158 | addPrim(prim, obj.UUID, regionUUID); | 158 | addPrim(prim, obj.UUID, regionUUID); |
diff --git a/OpenSim/Data/MySQL/MySQLDataStore.cs b/OpenSim/Data/MySQL/MySQLDataStore.cs index 08e4456..7714fdc 100644 --- a/OpenSim/Data/MySQL/MySQLDataStore.cs +++ b/OpenSim/Data/MySQL/MySQLDataStore.cs | |||
@@ -148,7 +148,7 @@ namespace OpenSim.Data.MySQL | |||
148 | { | 148 | { |
149 | foreach (SceneObjectPart prim in obj.Children.Values) | 149 | foreach (SceneObjectPart prim in obj.Children.Values) |
150 | { | 150 | { |
151 | if ((prim.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) == 0) | 151 | if ((prim.GetEffectiveObjectFlags() & (uint) LLObject.ObjectFlags.Physics) == 0) |
152 | { | 152 | { |
153 | m_log.Info("[DATASTORE]: Adding obj: " + obj.UUID + " to region: " + regionUUID); | 153 | m_log.Info("[DATASTORE]: Adding obj: " + obj.UUID + " to region: " + regionUUID); |
154 | addPrim(prim, obj.UUID, regionUUID); | 154 | addPrim(prim, obj.UUID, regionUUID); |
diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs index d385376..e075c22 100644 --- a/OpenSim/Data/SQLite/SQLiteRegionData.cs +++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs | |||
@@ -182,7 +182,7 @@ namespace OpenSim.Data.SQLite | |||
182 | { | 182 | { |
183 | foreach (SceneObjectPart prim in obj.Children.Values) | 183 | foreach (SceneObjectPart prim in obj.Children.Values) |
184 | { | 184 | { |
185 | if ((prim.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) == 0) | 185 | if ((prim.GetEffectiveObjectFlags() & (uint) LLObject.ObjectFlags.Physics) == 0) |
186 | { | 186 | { |
187 | m_log.Info("[DATASTORE]: Adding obj: " + obj.UUID + " to region: " + regionUUID); | 187 | m_log.Info("[DATASTORE]: Adding obj: " + obj.UUID + " to region: " + regionUUID); |
188 | addPrim(prim, Util.ToRawUuidString(obj.UUID), Util.ToRawUuidString(regionUUID)); | 188 | addPrim(prim, Util.ToRawUuidString(obj.UUID), Util.ToRawUuidString(regionUUID)); |
diff --git a/OpenSim/Region/Environment/PermissionManager.cs b/OpenSim/Region/Environment/PermissionManager.cs index 5658be7..fd8387b 100644 --- a/OpenSim/Region/Environment/PermissionManager.cs +++ b/OpenSim/Region/Environment/PermissionManager.cs | |||
@@ -226,21 +226,14 @@ namespace OpenSim.Region.Environment | |||
226 | // Outside of this method, they should never be added to objectflags! | 226 | // Outside of this method, they should never be added to objectflags! |
227 | // -teravus | 227 | // -teravus |
228 | 228 | ||
229 | if (!m_scene.Entities.ContainsKey(objID)) | 229 | SceneObjectPart task=m_scene.GetSceneObjectPart(objID); |
230 | { | 230 | |
231 | return 0; | 231 | // this shouldn't ever happen.. return no permissions/objectflags. |
232 | } | 232 | if (task == null) |
233 | 233 | return (uint)0; | |
234 | // If it's not an object, we cant edit it. | ||
235 | if (!(m_scene.Entities[objID] is SceneObjectGroup)) | ||
236 | { | ||
237 | return 0; | ||
238 | } | ||
239 | |||
240 | SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[objID]; | ||
241 | LLUUID objectOwner = task.OwnerID; | ||
242 | 234 | ||
243 | uint objflags = task.RootPart.ObjectFlags; | 235 | uint objflags = task.GetEffectiveObjectFlags(); |
236 | LLUUID objectOwner = task.OwnerID; | ||
244 | 237 | ||
245 | 238 | ||
246 | // Remove any of the objectFlags that are temporary. These will get added back if appropriate | 239 | // Remove any of the objectFlags that are temporary. These will get added back if appropriate |
@@ -257,14 +250,14 @@ namespace OpenSim.Region.Environment | |||
257 | 250 | ||
258 | // Creating the three ObjectFlags options for this method to choose from. | 251 | // Creating the three ObjectFlags options for this method to choose from. |
259 | // Customize the OwnerMask | 252 | // Customize the OwnerMask |
260 | uint objectOwnerMask = ApplyObjectModifyMasks(task.RootPart.OwnerMask, objflags); | 253 | uint objectOwnerMask = ApplyObjectModifyMasks(task.OwnerMask, objflags); |
261 | objectOwnerMask |= (uint)LLObject.ObjectFlags.ObjectYouOwner; | 254 | objectOwnerMask |= (uint)LLObject.ObjectFlags.ObjectYouOwner; |
262 | 255 | ||
263 | // Customize the GroupMask | 256 | // Customize the GroupMask |
264 | uint objectGroupMask = ApplyObjectModifyMasks(task.RootPart.GroupMask, objflags); | 257 | uint objectGroupMask = ApplyObjectModifyMasks(task.GroupMask, objflags); |
265 | 258 | ||
266 | // Customize the EveryoneMask | 259 | // Customize the EveryoneMask |
267 | uint objectEveryoneMask = ApplyObjectModifyMasks(task.RootPart.EveryoneMask, objflags); | 260 | uint objectEveryoneMask = ApplyObjectModifyMasks(task.EveryoneMask, objflags); |
268 | 261 | ||
269 | 262 | ||
270 | // Hack to allow collaboration until Groups and Group Permissions are implemented | 263 | // Hack to allow collaboration until Groups and Group Permissions are implemented |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index 71b2716..dccc09a 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs | |||
@@ -164,7 +164,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
164 | 164 | ||
165 | // If the touched prim handles touches, deliver it | 165 | // If the touched prim handles touches, deliver it |
166 | // If not, deliver to root prim | 166 | // If not, deliver to root prim |
167 | if ((part.ObjectFlags & (uint)LLObject.ObjectFlags.Touch) != 0) | 167 | if ((part.ScriptEvents & scriptEvents.touch_start) != 0) |
168 | EventManager.TriggerObjectGrab(part.LocalId, part.OffsetPosition, remoteClient); | 168 | EventManager.TriggerObjectGrab(part.LocalId, part.OffsetPosition, remoteClient); |
169 | else | 169 | else |
170 | EventManager.TriggerObjectGrab(obj.RootPart.LocalId, part.OffsetPosition, remoteClient); | 170 | EventManager.TriggerObjectGrab(obj.RootPart.LocalId, part.OffsetPosition, remoteClient); |
@@ -195,7 +195,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
195 | { | 195 | { |
196 | // If the touched prim handles touches, deliver it | 196 | // If the touched prim handles touches, deliver it |
197 | // If not, deliver to root prim | 197 | // If not, deliver to root prim |
198 | if ((part.ObjectFlags & (uint)LLObject.ObjectFlags.Touch) != 0) | 198 | if ((part.ScriptEvents & scriptEvents.touch_end) != 0) |
199 | EventManager.TriggerObjectDeGrab(part.LocalId, remoteClient); | 199 | EventManager.TriggerObjectDeGrab(part.LocalId, remoteClient); |
200 | else | 200 | else |
201 | EventManager.TriggerObjectDeGrab(obj.RootPart.LocalId, remoteClient); | 201 | EventManager.TriggerObjectDeGrab(obj.RootPart.LocalId, remoteClient); |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs index 2d0c636..824a536 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs | |||
@@ -118,7 +118,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
118 | if (part != null) | 118 | if (part != null) |
119 | { | 119 | { |
120 | part.StopScript(itemID); | 120 | part.StopScript(itemID); |
121 | RemoveScriptEvents(itemID); | 121 | part.RemoveScriptEvents(itemID); |
122 | } | 122 | } |
123 | else | 123 | else |
124 | { | 124 | { |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index c28e66f..863146c 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -96,8 +96,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
96 | private LLVector3 lastPhysGroupPos; | 96 | private LLVector3 lastPhysGroupPos; |
97 | private LLQuaternion lastPhysGroupRot; | 97 | private LLQuaternion lastPhysGroupRot; |
98 | 98 | ||
99 | private scriptEvents m_aggregateScriptEvents = scriptEvents.None; | ||
100 | |||
101 | /// <summary> | 99 | /// <summary> |
102 | /// The constituent parts of this group | 100 | /// The constituent parts of this group |
103 | /// </summary> | 101 | /// </summary> |
@@ -716,7 +714,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
716 | m_rootPart.SetParentLocalId(0); | 714 | m_rootPart.SetParentLocalId(0); |
717 | m_rootPart.SetAttachmentPoint((byte)0); | 715 | m_rootPart.SetAttachmentPoint((byte)0); |
718 | m_rootPart.m_IsAttachment = false; | 716 | m_rootPart.m_IsAttachment = false; |
719 | m_rootPart.ApplyPhysics(m_rootPart.ObjectFlags, m_scene.m_physicalPrim); | 717 | m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_scene.m_physicalPrim); |
720 | AttachToBackup(); | 718 | AttachToBackup(); |
721 | m_rootPart.ScheduleFullUpdate(); | 719 | m_rootPart.ScheduleFullUpdate(); |
722 | m_rootPart.ClearUndoState(); | 720 | m_rootPart.ClearUndoState(); |
@@ -737,7 +735,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
737 | //m_rootPart.SetAttachmentPoint((byte)0); | 735 | //m_rootPart.SetAttachmentPoint((byte)0); |
738 | m_rootPart.m_IsAttachment = false; | 736 | m_rootPart.m_IsAttachment = false; |
739 | AbsolutePosition = m_rootPart.m_attachedPos; | 737 | AbsolutePosition = m_rootPart.m_attachedPos; |
740 | //m_rootPart.ApplyPhysics(m_rootPart.ObjectFlags, m_scene.m_physicalPrim); | 738 | //m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_scene.m_physicalPrim); |
741 | //AttachToBackup(); | 739 | //AttachToBackup(); |
742 | //m_rootPart.ScheduleFullUpdate(); | 740 | //m_rootPart.ScheduleFullUpdate(); |
743 | 741 | ||
@@ -943,100 +941,25 @@ namespace OpenSim.Region.Environment.Scenes | |||
943 | d.AddActiveScripts(count); | 941 | d.AddActiveScripts(count); |
944 | } | 942 | } |
945 | 943 | ||
946 | public void RemoveScriptEvents(LLUUID scriptid) | ||
947 | { | ||
948 | lock (m_scriptEvents) | ||
949 | { | ||
950 | if (m_scriptEvents.ContainsKey(scriptid)) | ||
951 | { | ||
952 | scriptEvents oldparts = scriptEvents.None; | ||
953 | oldparts = (scriptEvents) m_scriptEvents[scriptid]; | ||
954 | |||
955 | // remove values from aggregated script events | ||
956 | m_aggregateScriptEvents &= ~oldparts; | ||
957 | m_scriptEvents.Remove(scriptid); | ||
958 | } | ||
959 | } | ||
960 | aggregateScriptEvents(); | ||
961 | } | ||
962 | |||
963 | public void SetScriptEvents(LLUUID scriptid, int events) | ||
964 | { | ||
965 | scriptEvents oldparts; | ||
966 | lock (m_scriptEvents) | ||
967 | { | ||
968 | if (m_scriptEvents.ContainsKey(scriptid)) | ||
969 | { | ||
970 | oldparts = m_scriptEvents[scriptid]; | ||
971 | |||
972 | // remove values from aggregated script events | ||
973 | m_aggregateScriptEvents &= ~oldparts; | ||
974 | m_scriptEvents[scriptid] = (scriptEvents) events; | ||
975 | } | ||
976 | else | ||
977 | { | ||
978 | m_scriptEvents.Add(scriptid, (scriptEvents) events); | ||
979 | } | ||
980 | } | ||
981 | |||
982 | aggregateScriptEvents(); | ||
983 | } | ||
984 | |||
985 | public void aggregateScriptEvents() | 944 | public void aggregateScriptEvents() |
986 | { | 945 | { |
987 | // Aggregate script events | 946 | uint objectflagupdate=(uint)RootPart.GetEffectiveObjectFlags(); |
988 | lock (m_scriptEvents) | ||
989 | { | ||
990 | foreach (scriptEvents s in m_scriptEvents.Values) | ||
991 | { | ||
992 | m_aggregateScriptEvents |= s; | ||
993 | } | ||
994 | } | ||
995 | uint objectflagupdate = m_rootPart.ObjectFlags; | ||
996 | |||
997 | if ( | ||
998 | ((m_aggregateScriptEvents & scriptEvents.touch) != 0) || | ||
999 | ((m_aggregateScriptEvents & scriptEvents.touch_end) != 0) || | ||
1000 | ((m_aggregateScriptEvents & scriptEvents.touch_start) != 0) | ||
1001 | ) | ||
1002 | { | ||
1003 | objectflagupdate |= (uint) LLObject.ObjectFlags.Touch; | ||
1004 | } | ||
1005 | else | ||
1006 | { | ||
1007 | objectflagupdate &= ~(uint) LLObject.ObjectFlags.Touch; | ||
1008 | } | ||
1009 | 947 | ||
1010 | if ((m_aggregateScriptEvents & scriptEvents.money) != 0) | 948 | scriptEvents aggregateScriptEvents=0; |
1011 | { | ||
1012 | objectflagupdate |= (uint) LLObject.ObjectFlags.Money; | ||
1013 | } | ||
1014 | else | ||
1015 | { | ||
1016 | objectflagupdate &= ~(uint) LLObject.ObjectFlags.Money; | ||
1017 | } | ||
1018 | 949 | ||
1019 | if ( | ||
1020 | ((m_aggregateScriptEvents & scriptEvents.collision) != 0) || | ||
1021 | ((m_aggregateScriptEvents & scriptEvents.collision_end) != 0) || | ||
1022 | ((m_aggregateScriptEvents & scriptEvents.collision_start) != 0) | ||
1023 | ) | ||
1024 | { | ||
1025 | // subscribe to physics updates. | ||
1026 | } | ||
1027 | else | ||
1028 | { | ||
1029 | // unsubscribe to physics updates. | ||
1030 | } | ||
1031 | lock (m_parts) | 950 | lock (m_parts) |
1032 | { | 951 | { |
1033 | foreach (SceneObjectPart part in m_parts.Values) | 952 | foreach (SceneObjectPart part in m_parts.Values) |
1034 | { | 953 | { |
1035 | part.ObjectFlags = objectflagupdate; | 954 | if(part == null) |
955 | continue; | ||
956 | if(part != RootPart) | ||
957 | part.ObjectFlags = objectflagupdate; | ||
958 | aggregateScriptEvents |= part.m_aggregateScriptEvents; | ||
1036 | } | 959 | } |
1037 | } | 960 | } |
1038 | 961 | ||
1039 | if ((m_aggregateScriptEvents & scriptEvents.at_target) != 0) | 962 | if ((aggregateScriptEvents & scriptEvents.at_target) != 0) |
1040 | { | 963 | { |
1041 | m_scriptListens_atTarget = true; | 964 | m_scriptListens_atTarget = true; |
1042 | } | 965 | } |
@@ -1045,7 +968,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1045 | m_scriptListens_atTarget = false; | 968 | m_scriptListens_atTarget = false; |
1046 | } | 969 | } |
1047 | 970 | ||
1048 | if ((m_aggregateScriptEvents & scriptEvents.not_at_target) != 0) | 971 | if ((aggregateScriptEvents & scriptEvents.not_at_target) != 0) |
1049 | { | 972 | { |
1050 | m_scriptListens_notAtTarget = true; | 973 | m_scriptListens_notAtTarget = true; |
1051 | } | 974 | } |
@@ -1082,12 +1005,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
1082 | { | 1005 | { |
1083 | if (m_parts.Count > 1) | 1006 | if (m_parts.Count > 1) |
1084 | { | 1007 | { |
1085 | m_rootPart.ApplyPhysics(m_rootPart.ObjectFlags, m_physicalPrim); | 1008 | m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_physicalPrim); |
1086 | foreach (SceneObjectPart part in m_parts.Values) | 1009 | foreach (SceneObjectPart part in m_parts.Values) |
1087 | { | 1010 | { |
1088 | if (part.LocalId != m_rootPart.LocalId) | 1011 | if (part.LocalId != m_rootPart.LocalId) |
1089 | { | 1012 | { |
1090 | part.ApplyPhysics(m_rootPart.ObjectFlags, m_physicalPrim); | 1013 | part.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_physicalPrim); |
1091 | } | 1014 | } |
1092 | // Hack to get the physics scene geometries in the right spot | 1015 | // Hack to get the physics scene geometries in the right spot |
1093 | ResetChildPrimPhysicsPositions(); | 1016 | ResetChildPrimPhysicsPositions(); |
@@ -1095,7 +1018,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1095 | } | 1018 | } |
1096 | else | 1019 | else |
1097 | { | 1020 | { |
1098 | m_rootPart.ApplyPhysics(m_rootPart.ObjectFlags, m_physicalPrim); | 1021 | m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_physicalPrim); |
1099 | } | 1022 | } |
1100 | } | 1023 | } |
1101 | } | 1024 | } |
@@ -1333,7 +1256,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1333 | else | 1256 | else |
1334 | { | 1257 | { |
1335 | part.RemFlag(LLObject.ObjectFlags.Phantom); | 1258 | part.RemFlag(LLObject.ObjectFlags.Phantom); |
1336 | if ((part.ObjectFlags & (int) LLObject.ObjectFlags.Physics) != 0) | 1259 | if ((part.GetEffectiveObjectFlags() & (int) LLObject.ObjectFlags.Physics) != 0) |
1337 | { | 1260 | { |
1338 | part.DoPhysicsPropertyUpdate(true, false); | 1261 | part.DoPhysicsPropertyUpdate(true, false); |
1339 | } | 1262 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs index 42047ad..0215cec 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs | |||
@@ -170,7 +170,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
170 | if (10 == item.Type) | 170 | if (10 == item.Type) |
171 | { | 171 | { |
172 | StopScript(item.ItemID); | 172 | StopScript(item.ItemID); |
173 | m_parentGroup.RemoveScriptEvents(item.ItemID); | 173 | RemoveScriptEvents(item.ItemID); |
174 | } | 174 | } |
175 | } | 175 | } |
176 | } | 176 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 6cfe3e9..8d05987 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -99,6 +99,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
99 | 99 | ||
100 | // TODO: This needs to be persisted in next XML version update! | 100 | // TODO: This needs to be persisted in next XML version update! |
101 | [XmlIgnore] public int[] PayPrice = {-2,-2,-2,-2,-2}; | 101 | [XmlIgnore] public int[] PayPrice = {-2,-2,-2,-2,-2}; |
102 | [XmlIgnore] private Dictionary<LLUUID, scriptEvents> m_scriptEvents = new Dictionary<LLUUID, scriptEvents>(); | ||
103 | [XmlIgnore] public scriptEvents m_aggregateScriptEvents=0; | ||
104 | [XmlIgnore] private LLObject.ObjectFlags LocalFlags = LLObject.ObjectFlags.None; | ||
102 | 105 | ||
103 | 106 | ||
104 | [XmlIgnore] public bool m_IsAttachment = false; | 107 | [XmlIgnore] public bool m_IsAttachment = false; |
@@ -187,7 +190,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
187 | set { m_name = value; } | 190 | set { m_name = value; } |
188 | } | 191 | } |
189 | 192 | ||
190 | 193 | public scriptEvents ScriptEvents | |
194 | { | ||
195 | get { return m_aggregateScriptEvents; } | ||
196 | } | ||
191 | 197 | ||
192 | protected LLObject.MaterialType m_material = 0; | 198 | protected LLObject.MaterialType m_material = 0; |
193 | 199 | ||
@@ -205,6 +211,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
205 | set { m_regionHandle = value; } | 211 | set { m_regionHandle = value; } |
206 | } | 212 | } |
207 | 213 | ||
214 | public uint GetEffectiveObjectFlags() | ||
215 | { | ||
216 | LLObject.ObjectFlags f=Flags; | ||
217 | if(m_parentGroup == null || m_parentGroup.RootPart == this) | ||
218 | f &= ~(LLObject.ObjectFlags.Touch | LLObject.ObjectFlags.Money); | ||
219 | |||
220 | return (uint)Flags | (uint)LocalFlags; | ||
221 | } | ||
222 | |||
208 | //unkown if this will be kept, added as a way of removing the group position from the group class | 223 | //unkown if this will be kept, added as a way of removing the group position from the group class |
209 | protected LLVector3 m_groupPosition; | 224 | protected LLVector3 m_groupPosition; |
210 | 225 | ||
@@ -2434,13 +2449,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
2434 | SetText( text ); | 2449 | SetText( text ); |
2435 | } | 2450 | } |
2436 | 2451 | ||
2437 | public void setScriptEvents(LLUUID scriptID, int events) | ||
2438 | { | ||
2439 | if (m_parentGroup != null) | ||
2440 | { | ||
2441 | m_parentGroup.SetScriptEvents(scriptID, events); | ||
2442 | } | ||
2443 | } | ||
2444 | public int registerTargetWaypoint(LLVector3 target, float tolerance) | 2452 | public int registerTargetWaypoint(LLVector3 target, float tolerance) |
2445 | { | 2453 | { |
2446 | if (m_parentGroup != null) | 2454 | if (m_parentGroup != null) |
@@ -2581,5 +2589,86 @@ namespace OpenSim.Region.Environment.Scenes | |||
2581 | goback.PlaybackState(this); | 2589 | goback.PlaybackState(this); |
2582 | } | 2590 | } |
2583 | } | 2591 | } |
2592 | |||
2593 | public void SetScriptEvents(LLUUID scriptid, int events) | ||
2594 | { | ||
2595 | scriptEvents oldparts; | ||
2596 | lock (m_scriptEvents) | ||
2597 | { | ||
2598 | if (m_scriptEvents.ContainsKey(scriptid)) | ||
2599 | { | ||
2600 | oldparts = m_scriptEvents[scriptid]; | ||
2601 | |||
2602 | // remove values from aggregated script events | ||
2603 | m_scriptEvents[scriptid] = (scriptEvents) events; | ||
2604 | } | ||
2605 | else | ||
2606 | { | ||
2607 | m_scriptEvents.Add(scriptid, (scriptEvents) events); | ||
2608 | } | ||
2609 | } | ||
2610 | aggregateScriptEvents(); | ||
2611 | } | ||
2612 | |||
2613 | public void RemoveScriptEvents(LLUUID scriptid) | ||
2614 | { | ||
2615 | lock (m_scriptEvents) | ||
2616 | { | ||
2617 | if (m_scriptEvents.ContainsKey(scriptid)) | ||
2618 | { | ||
2619 | scriptEvents oldparts = scriptEvents.None; | ||
2620 | oldparts = (scriptEvents) m_scriptEvents[scriptid]; | ||
2621 | |||
2622 | // remove values from aggregated script events | ||
2623 | m_aggregateScriptEvents &= ~oldparts; | ||
2624 | m_scriptEvents.Remove(scriptid); | ||
2625 | } | ||
2626 | } | ||
2627 | aggregateScriptEvents(); | ||
2628 | } | ||
2629 | |||
2630 | public void aggregateScriptEvents() | ||
2631 | { | ||
2632 | // Aggregate script events | ||
2633 | lock (m_scriptEvents) | ||
2634 | { | ||
2635 | foreach (scriptEvents s in m_scriptEvents.Values) | ||
2636 | { | ||
2637 | m_aggregateScriptEvents |= s; | ||
2638 | } | ||
2639 | } | ||
2640 | |||
2641 | uint objectflagupdate = 0; | ||
2642 | |||
2643 | if ( | ||
2644 | ((m_aggregateScriptEvents & scriptEvents.touch) != 0) || | ||
2645 | ((m_aggregateScriptEvents & scriptEvents.touch_end) != 0) || | ||
2646 | ((m_aggregateScriptEvents & scriptEvents.touch_start) != 0) | ||
2647 | ) | ||
2648 | { | ||
2649 | objectflagupdate |= (uint) LLObject.ObjectFlags.Touch; | ||
2650 | } | ||
2651 | |||
2652 | if ((m_aggregateScriptEvents & scriptEvents.money) != 0) | ||
2653 | { | ||
2654 | objectflagupdate |= (uint) LLObject.ObjectFlags.Money; | ||
2655 | } | ||
2656 | |||
2657 | if ( | ||
2658 | ((m_aggregateScriptEvents & scriptEvents.collision) != 0) || | ||
2659 | ((m_aggregateScriptEvents & scriptEvents.collision_end) != 0) || | ||
2660 | ((m_aggregateScriptEvents & scriptEvents.collision_start) != 0) | ||
2661 | ) | ||
2662 | { | ||
2663 | // subscribe to physics updates. | ||
2664 | } | ||
2665 | |||
2666 | LocalFlags=(LLObject.ObjectFlags)objectflagupdate; | ||
2667 | |||
2668 | if(m_parentGroup != null && m_parentGroup.RootPart == this) | ||
2669 | m_parentGroup.aggregateScriptEvents(); | ||
2670 | else | ||
2671 | ScheduleFullUpdate(); | ||
2672 | } | ||
2584 | } | 2673 | } |
2585 | } | 2674 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SceneXmlLoader.cs b/OpenSim/Region/Environment/Scenes/SceneXmlLoader.cs index 391d3f3..8390f64 100644 --- a/OpenSim/Region/Environment/Scenes/SceneXmlLoader.cs +++ b/OpenSim/Region/Environment/Scenes/SceneXmlLoader.cs | |||
@@ -76,9 +76,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
76 | SceneObjectPart rootPart = obj.GetChildPart(obj.UUID); | 76 | SceneObjectPart rootPart = obj.GetChildPart(obj.UUID); |
77 | // Apply loadOffsets for load/import and move combinations | 77 | // Apply loadOffsets for load/import and move combinations |
78 | rootPart.GroupPosition = rootPart.AbsolutePosition + loadOffset; | 78 | rootPart.GroupPosition = rootPart.AbsolutePosition + loadOffset; |
79 | bool UsePhysics = (((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) > 0) && | 79 | bool UsePhysics = (((rootPart.GetEffectiveObjectFlags() & (uint) LLObject.ObjectFlags.Physics) > 0) && |
80 | m_parentScene.m_physicalPrim); | 80 | m_parentScene.m_physicalPrim); |
81 | if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0) | 81 | if ((rootPart.GetEffectiveObjectFlags() & (uint) LLObject.ObjectFlags.Phantom) == 0) |
82 | { | 82 | { |
83 | rootPart.PhysActor = m_innerScene.PhysicsScene.AddPrimShape( | 83 | rootPart.PhysActor = m_innerScene.PhysicsScene.AddPrimShape( |
84 | rootPart.Name, | 84 | rootPart.Name, |
@@ -186,9 +186,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
186 | m_innerScene.AddEntityFromStorage(obj); | 186 | m_innerScene.AddEntityFromStorage(obj); |
187 | 187 | ||
188 | SceneObjectPart rootPart = obj.GetChildPart(obj.UUID); | 188 | SceneObjectPart rootPart = obj.GetChildPart(obj.UUID); |
189 | bool UsePhysics = (((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) > 0) && | 189 | bool UsePhysics = (((rootPart.GetEffectiveObjectFlags() & (uint) LLObject.ObjectFlags.Physics) > 0) && |
190 | m_parentScene.m_physicalPrim); | 190 | m_parentScene.m_physicalPrim); |
191 | if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0) | 191 | if ((rootPart.GetEffectiveObjectFlags() & (uint) LLObject.ObjectFlags.Phantom) == 0) |
192 | { | 192 | { |
193 | rootPart.PhysActor = m_innerScene.PhysicsScene.AddPrimShape( | 193 | rootPart.PhysActor = m_innerScene.PhysicsScene.AddPrimShape( |
194 | rootPart.Name, | 194 | rootPart.Name, |
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index 66d2700..7a3ccea 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | |||
@@ -863,23 +863,23 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
863 | public int llGetStatus(int status) | 863 | public int llGetStatus(int status) |
864 | { | 864 | { |
865 | m_host.AddScriptLPS(1); | 865 | m_host.AddScriptLPS(1); |
866 | Console.WriteLine(m_host.UUID.ToString() + " status is " + m_host.ObjectFlags.ToString()); | 866 | Console.WriteLine(m_host.UUID.ToString() + " status is " + m_host.GetEffectiveObjectFlags().ToString()); |
867 | switch (status) | 867 | switch (status) |
868 | { | 868 | { |
869 | case BuiltIn_Commands_BaseClass.STATUS_PHYSICS: | 869 | case BuiltIn_Commands_BaseClass.STATUS_PHYSICS: |
870 | if ((m_host.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) == (uint)LLObject.ObjectFlags.Physics) | 870 | if ((m_host.GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.Physics) == (uint)LLObject.ObjectFlags.Physics) |
871 | { | 871 | { |
872 | return 1; | 872 | return 1; |
873 | } | 873 | } |
874 | return 0; | 874 | return 0; |
875 | case BuiltIn_Commands_BaseClass.STATUS_PHANTOM: | 875 | case BuiltIn_Commands_BaseClass.STATUS_PHANTOM: |
876 | if ((m_host.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == (uint)LLObject.ObjectFlags.Phantom) | 876 | if ((m_host.GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.Phantom) == (uint)LLObject.ObjectFlags.Phantom) |
877 | { | 877 | { |
878 | return 1; | 878 | return 1; |
879 | } | 879 | } |
880 | return 0; | 880 | return 0; |
881 | case BuiltIn_Commands_BaseClass.STATUS_CAST_SHADOWS: | 881 | case BuiltIn_Commands_BaseClass.STATUS_CAST_SHADOWS: |
882 | if ((m_host.ObjectFlags & (uint)LLObject.ObjectFlags.CastShadows) == (uint)LLObject.ObjectFlags.CastShadows) | 882 | if ((m_host.GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.CastShadows) == (uint)LLObject.ObjectFlags.CastShadows) |
883 | { | 883 | { |
884 | return 1; | 884 | return 1; |
885 | } | 885 | } |
@@ -2154,7 +2154,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
2154 | 2154 | ||
2155 | bool attachment=false; // Attachments not implemented yet. TODO: reflect real attachemnt state | 2155 | bool attachment=false; // Attachments not implemented yet. TODO: reflect real attachemnt state |
2156 | 2156 | ||
2157 | if(attachment && agent == m_host.OwnerID) | 2157 | if(m_host.ParentGroup.RootPart.m_IsAttachment && agent == m_host.ParentGroup.RootPart.m_attachedAvatar) |
2158 | { | 2158 | { |
2159 | // When attached, certain permissions are implicit if requested from owner | 2159 | // When attached, certain permissions are implicit if requested from owner |
2160 | int implicitPerms = BuiltIn_Commands_BaseClass.PERMISSION_TAKE_CONTROLS | | 2160 | int implicitPerms = BuiltIn_Commands_BaseClass.PERMISSION_TAKE_CONTROLS | |
diff --git a/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs index e5c2173..731168d 100644 --- a/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs | |||
@@ -528,7 +528,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
528 | 528 | ||
529 | public void osSetStateEvents(int events) | 529 | public void osSetStateEvents(int events) |
530 | { | 530 | { |
531 | m_host.setScriptEvents(m_itemID, events); | 531 | m_host.SetScriptEvents(m_itemID, events); |
532 | } | 532 | } |
533 | 533 | ||
534 | } | 534 | } |