diff options
author | Teravus Ovares | 2008-04-20 04:19:44 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-04-20 04:19:44 +0000 |
commit | 3358d70c5b174b2b9ac1216e9e43497279982805 (patch) | |
tree | 3b6684a1d58912962eeda8a6b5fd1fc69ae2d00d /OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |
parent | * Added experimental "svn load <revision>" command to allow you to load a reg... (diff) | |
download | opensim-SC-3358d70c5b174b2b9ac1216e9e43497279982805.zip opensim-SC-3358d70c5b174b2b9ac1216e9e43497279982805.tar.gz opensim-SC-3358d70c5b174b2b9ac1216e9e43497279982805.tar.bz2 opensim-SC-3358d70c5b174b2b9ac1216e9e43497279982805.tar.xz |
* Updates LSL2CS converter
* All objects are not touchable by default now
* When a script listens for one of the touch events in the state, an object becomes touchable.
* All LSL scripts report which events they consume now
** This uses semi-complicated Regex to discover the events, stick them in a dictionary, and then write a method call into each script state's state_entry() event.
** Tedd may figure out a better way to do this in the future. For now, this works for LSL.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | 135 |
1 files changed, 135 insertions, 0 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 1f38e4f..7abaaee 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -41,6 +41,40 @@ using OpenSim.Region.Physics.Manager; | |||
41 | 41 | ||
42 | namespace OpenSim.Region.Environment.Scenes | 42 | namespace OpenSim.Region.Environment.Scenes |
43 | { | 43 | { |
44 | |||
45 | [Flags] | ||
46 | public enum scriptEvents : int | ||
47 | { | ||
48 | None = 0, | ||
49 | attach = 1, | ||
50 | collision = 15, | ||
51 | collision_end = 32, | ||
52 | collision_start = 64, | ||
53 | control = 128, | ||
54 | dataserver = 256, | ||
55 | email = 512, | ||
56 | http_response = 1024, | ||
57 | land_collision = 2048, | ||
58 | land_collision_end = 4096, | ||
59 | land_collision_start = 8192, | ||
60 | link_message = 16384, | ||
61 | listen = 32768, | ||
62 | money = 65536, | ||
63 | moving_end = 131072, | ||
64 | moving_start = 262144, | ||
65 | not_at_rot_target = 524288, | ||
66 | not_at_target = 1048576, | ||
67 | remote_data = 8388608, | ||
68 | run_time_permissions = 268435456, | ||
69 | state_entry = 1073741824, | ||
70 | state_exit = 2, | ||
71 | timer = 4, | ||
72 | touch = 8, | ||
73 | touch_end = 536870912, | ||
74 | touch_start = 2097152, | ||
75 | object_rez = 4194304 | ||
76 | } | ||
77 | |||
44 | public delegate void PrimCountTaintedDelegate(); | 78 | public delegate void PrimCountTaintedDelegate(); |
45 | 79 | ||
46 | public partial class SceneObjectGroup : EntityBase | 80 | public partial class SceneObjectGroup : EntityBase |
@@ -67,6 +101,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
67 | private LLVector3 lastPhysGroupPos; | 101 | private LLVector3 lastPhysGroupPos; |
68 | private LLQuaternion lastPhysGroupRot; | 102 | private LLQuaternion lastPhysGroupRot; |
69 | 103 | ||
104 | private Dictionary<LLUUID, scriptEvents> m_scriptEvents = new Dictionary<LLUUID, scriptEvents>(); | ||
105 | private scriptEvents m_aggregateScriptEvents = scriptEvents.None; | ||
106 | |||
70 | #region Properties | 107 | #region Properties |
71 | 108 | ||
72 | /// <summary> | 109 | /// <summary> |
@@ -2042,6 +2079,104 @@ namespace OpenSim.Region.Environment.Scenes | |||
2042 | d.AddActiveScripts(count); | 2079 | d.AddActiveScripts(count); |
2043 | } | 2080 | } |
2044 | 2081 | ||
2082 | public void RemoveScriptEvents(LLUUID scriptid) | ||
2083 | { | ||
2084 | lock (m_scriptEvents) | ||
2085 | { | ||
2086 | if (m_scriptEvents.ContainsKey(scriptid)) | ||
2087 | { | ||
2088 | scriptEvents oldparts = scriptEvents.None; | ||
2089 | oldparts = (scriptEvents)m_scriptEvents[scriptid]; | ||
2090 | |||
2091 | // remove values from aggregated script events | ||
2092 | m_aggregateScriptEvents &= ~oldparts; | ||
2093 | m_scriptEvents.Remove(scriptid); | ||
2094 | } | ||
2095 | |||
2096 | } | ||
2097 | aggregateScriptEvents(); | ||
2098 | } | ||
2099 | |||
2100 | public void SetScriptEvents(LLUUID scriptid, int events) | ||
2101 | { | ||
2102 | |||
2103 | scriptEvents oldparts = scriptEvents.None; | ||
2104 | lock (m_scriptEvents) | ||
2105 | { | ||
2106 | if (m_scriptEvents.ContainsKey(scriptid)) | ||
2107 | { | ||
2108 | oldparts = (scriptEvents)m_scriptEvents[scriptid]; | ||
2109 | |||
2110 | // remove values from aggregated script events | ||
2111 | m_aggregateScriptEvents &= ~oldparts; | ||
2112 | m_scriptEvents[scriptid] = (scriptEvents)events; | ||
2113 | } | ||
2114 | else | ||
2115 | { | ||
2116 | m_scriptEvents.Add(scriptid, (scriptEvents)events); | ||
2117 | } | ||
2118 | |||
2119 | } | ||
2120 | |||
2121 | aggregateScriptEvents(); | ||
2122 | } | ||
2123 | public void aggregateScriptEvents() | ||
2124 | { | ||
2125 | // Aggregate script events | ||
2126 | lock (m_scriptEvents) | ||
2127 | { | ||
2128 | foreach (scriptEvents s in m_scriptEvents.Values) | ||
2129 | { | ||
2130 | m_aggregateScriptEvents |= s; | ||
2131 | } | ||
2132 | } | ||
2133 | uint objectflagupdate = m_rootPart.ObjectFlags; | ||
2134 | |||
2135 | if ( | ||
2136 | ((m_aggregateScriptEvents & scriptEvents.touch) != 0) || | ||
2137 | ((m_aggregateScriptEvents & scriptEvents.touch_end) != 0) || | ||
2138 | ((m_aggregateScriptEvents & scriptEvents.touch_start) != 0) | ||
2139 | ) | ||
2140 | { | ||
2141 | objectflagupdate |= (uint)LLObject.ObjectFlags.Touch; | ||
2142 | } | ||
2143 | else | ||
2144 | { | ||
2145 | objectflagupdate &= ~(uint)LLObject.ObjectFlags.Touch; | ||
2146 | } | ||
2147 | |||
2148 | if ((m_aggregateScriptEvents & scriptEvents.money) != 0) | ||
2149 | { | ||
2150 | objectflagupdate |= (uint)LLObject.ObjectFlags.Money; | ||
2151 | } | ||
2152 | else | ||
2153 | { | ||
2154 | objectflagupdate &= ~(uint)LLObject.ObjectFlags.Money; | ||
2155 | } | ||
2156 | |||
2157 | if ( | ||
2158 | ((m_aggregateScriptEvents & scriptEvents.collision) != 0) || | ||
2159 | ((m_aggregateScriptEvents & scriptEvents.collision_end) != 0) || | ||
2160 | ((m_aggregateScriptEvents & scriptEvents.collision_start) != 0) | ||
2161 | ) | ||
2162 | { | ||
2163 | // subscribe to physics updates. | ||
2164 | } | ||
2165 | else | ||
2166 | { | ||
2167 | // unsubscribe to physics updates. | ||
2168 | } | ||
2169 | lock (m_parts) | ||
2170 | { | ||
2171 | foreach (SceneObjectPart part in m_parts.Values) | ||
2172 | { | ||
2173 | part.ObjectFlags = objectflagupdate; | ||
2174 | } | ||
2175 | } | ||
2176 | ScheduleGroupForFullUpdate(); | ||
2177 | |||
2178 | } | ||
2179 | |||
2045 | public override void SetText(string text, Vector3 color, double alpha) | 2180 | public override void SetText(string text, Vector3 color, double alpha) |
2046 | { | 2181 | { |
2047 | Color = Color.FromArgb(0xff - (int) (alpha*0xff), | 2182 | Color = Color.FromArgb(0xff - (int) (alpha*0xff), |