diff options
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/SceneObjectPart.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 105 |
1 files changed, 97 insertions, 8 deletions
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 | } |