diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Framework/IClientAPI.cs | 7 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.cs | 20 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/InnerScene.cs | 147 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | 10 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs | 21 |
7 files changed, 194 insertions, 15 deletions
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index bb4fd15..b9ad348 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs | |||
@@ -234,6 +234,11 @@ namespace OpenSim.Framework | |||
234 | uint EveryoneMask, uint GroupMask, uint NextOwnerMask, uint ItemFlags, | 234 | uint EveryoneMask, uint GroupMask, uint NextOwnerMask, uint ItemFlags, |
235 | bool RezSelected, bool RemoveItem, LLUUID fromTaskID ); | 235 | bool RezSelected, bool RemoveItem, LLUUID fromTaskID ); |
236 | 236 | ||
237 | public delegate void RezSingleAttachmentFromInv(IClientAPI remoteClient, LLUUID itemID, uint AttachmentPt, | ||
238 | uint ItemFlags, uint NextOwnerMask); | ||
239 | |||
240 | public delegate void ObjectAttach(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, LLQuaternion rot); | ||
241 | |||
237 | public delegate void ModifyTerrain( | 242 | public delegate void ModifyTerrain( |
238 | float height, float seconds, byte size, byte action, float north, float west, float south, float east, | 243 | float height, float seconds, byte size, byte action, float north, float west, float south, float east, |
239 | IClientAPI remoteClient); | 244 | IClientAPI remoteClient); |
@@ -417,6 +422,8 @@ namespace OpenSim.Framework | |||
417 | event ModifyTerrain OnModifyTerrain; | 422 | event ModifyTerrain OnModifyTerrain; |
418 | event SetAppearance OnSetAppearance; | 423 | event SetAppearance OnSetAppearance; |
419 | event AvatarNowWearing OnAvatarNowWearing; | 424 | event AvatarNowWearing OnAvatarNowWearing; |
425 | event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv; | ||
426 | event ObjectAttach OnObjectAttach; | ||
420 | event StartAnim OnStartAnim; | 427 | event StartAnim OnStartAnim; |
421 | event StopAnim OnStopAnim; | 428 | event StopAnim OnStopAnim; |
422 | event LinkObjects OnLinkObjects; | 429 | event LinkObjects OnLinkObjects; |
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index a35c83c..cb076b5 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs | |||
@@ -515,6 +515,8 @@ namespace OpenSim.Region.ClientStack | |||
515 | public event GenericCall2 OnRequestWearables; | 515 | public event GenericCall2 OnRequestWearables; |
516 | public event SetAppearance OnSetAppearance; | 516 | public event SetAppearance OnSetAppearance; |
517 | public event AvatarNowWearing OnAvatarNowWearing; | 517 | public event AvatarNowWearing OnAvatarNowWearing; |
518 | public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv; | ||
519 | public event ObjectAttach OnObjectAttach; | ||
518 | public event GenericCall2 OnCompleteMovementToRegion; | 520 | public event GenericCall2 OnCompleteMovementToRegion; |
519 | public event UpdateAgent OnAgentUpdate; | 521 | public event UpdateAgent OnAgentUpdate; |
520 | public event AgentRequestSit OnAgentRequestSit; | 522 | public event AgentRequestSit OnAgentRequestSit; |
@@ -1645,6 +1647,7 @@ namespace OpenSim.Region.ClientStack | |||
1645 | public void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint) | 1647 | public void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint) |
1646 | { | 1648 | { |
1647 | ObjectAttachPacket attach = (ObjectAttachPacket)PacketPool.Instance.GetPacket(PacketType.ObjectAttach); | 1649 | ObjectAttachPacket attach = (ObjectAttachPacket)PacketPool.Instance.GetPacket(PacketType.ObjectAttach); |
1650 | System.Console.WriteLine("Attach object!"); | ||
1648 | // TODO: don't create new blocks if recycling an old packet | 1651 | // TODO: don't create new blocks if recycling an old packet |
1649 | attach.AgentData.AgentID = AgentId; | 1652 | attach.AgentData.AgentID = AgentId; |
1650 | attach.AgentData.SessionID = m_sessionId; | 1653 | attach.AgentData.SessionID = m_sessionId; |
@@ -2009,7 +2012,7 @@ namespace OpenSim.Region.ClientStack | |||
2009 | /// | 2012 | /// |
2010 | /// </summary> | 2013 | /// </summary> |
2011 | /// <returns></returns> | 2014 | /// <returns></returns> |
2012 | protected ObjectUpdatePacket.ObjectDataBlock CreateDefaultAvatarPacket(byte[] textureEntry) | 2015 | public ObjectUpdatePacket.ObjectDataBlock CreateDefaultAvatarPacket(byte[] textureEntry) |
2013 | { | 2016 | { |
2014 | ObjectUpdatePacket.ObjectDataBlock objdata = new ObjectUpdatePacket.ObjectDataBlock(); | 2017 | ObjectUpdatePacket.ObjectDataBlock objdata = new ObjectUpdatePacket.ObjectDataBlock(); |
2015 | // new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i); | 2018 | // new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i); |
@@ -2858,6 +2861,21 @@ namespace OpenSim.Region.ClientStack | |||
2858 | OnAvatarNowWearing(this, wearingArgs); | 2861 | OnAvatarNowWearing(this, wearingArgs); |
2859 | } | 2862 | } |
2860 | break; | 2863 | break; |
2864 | case PacketType.RezSingleAttachmentFromInv: | ||
2865 | if (OnRezSingleAttachmentFromInv != null) | ||
2866 | { | ||
2867 | RezSingleAttachmentFromInvPacket rez = (RezSingleAttachmentFromInvPacket) Pack; | ||
2868 | OnRezSingleAttachmentFromInv(this, rez.ObjectData.ItemID, | ||
2869 | rez.ObjectData.AttachmentPt, rez.ObjectData.ItemFlags, rez.ObjectData.NextOwnerMask); | ||
2870 | } | ||
2871 | break; | ||
2872 | case PacketType.ObjectAttach: | ||
2873 | if (OnObjectAttach != null) | ||
2874 | { | ||
2875 | ObjectAttachPacket att = (ObjectAttachPacket) Pack; | ||
2876 | OnObjectAttach(this, att.ObjectData[0].ObjectLocalID, att.AgentData.AttachmentPoint, att.ObjectData[0].Rotation); | ||
2877 | } | ||
2878 | break; | ||
2861 | case PacketType.SetAlwaysRun: | 2879 | case PacketType.SetAlwaysRun: |
2862 | SetAlwaysRunPacket run = (SetAlwaysRunPacket)Pack; | 2880 | SetAlwaysRunPacket run = (SetAlwaysRunPacket)Pack; |
2863 | 2881 | ||
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index 7421957..cb04939 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs | |||
@@ -232,6 +232,153 @@ namespace OpenSim.Region.Environment.Scenes | |||
232 | } | 232 | } |
233 | } | 233 | } |
234 | 234 | ||
235 | public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, LLQuaternion rot) | ||
236 | { | ||
237 | System.Console.WriteLine("Attaching object " + objectLocalID + " to " + AttachmentPt); | ||
238 | SceneObjectPart p = GetSceneObjectPart(objectLocalID); | ||
239 | ScenePresence av = null; | ||
240 | if (TryGetAvatar(remoteClient.AgentId, out av)) { | ||
241 | ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); | ||
242 | objupdate.RegionData.RegionHandle = m_regInfo.RegionHandle; | ||
243 | objupdate.RegionData.TimeDilation = 64096; | ||
244 | objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[2]; | ||
245 | // avatar stuff - horrible group copypaste | ||
246 | |||
247 | objupdate.ObjectData[0] = new ObjectUpdatePacket.ObjectDataBlock(); | ||
248 | objupdate.ObjectData[0].PSBlock = new byte[0]; | ||
249 | objupdate.ObjectData[0].ExtraParams = new byte[1]; | ||
250 | objupdate.ObjectData[0].MediaURL = new byte[0]; | ||
251 | objupdate.ObjectData[0].NameValue = new byte[0]; | ||
252 | objupdate.ObjectData[0].Text = new byte[0]; | ||
253 | objupdate.ObjectData[0].TextColor = new byte[4]; | ||
254 | objupdate.ObjectData[0].JointAxisOrAnchor = new LLVector3(0, 0, 0); | ||
255 | objupdate.ObjectData[0].JointPivot = new LLVector3(0, 0, 0); | ||
256 | objupdate.ObjectData[0].Material = 4; | ||
257 | objupdate.ObjectData[0].TextureAnim = new byte[0]; | ||
258 | objupdate.ObjectData[0].Sound = LLUUID.Zero; | ||
259 | |||
260 | objupdate.ObjectData[0].State = 0; | ||
261 | objupdate.ObjectData[0].Data = new byte[0]; | ||
262 | |||
263 | objupdate.ObjectData[0].ObjectData = new byte[76]; | ||
264 | objupdate.ObjectData[0].ObjectData[15] = 128; | ||
265 | objupdate.ObjectData[0].ObjectData[16] = 63; | ||
266 | objupdate.ObjectData[0].ObjectData[56] = 128; | ||
267 | objupdate.ObjectData[0].ObjectData[61] = 102; | ||
268 | objupdate.ObjectData[0].ObjectData[62] = 40; | ||
269 | objupdate.ObjectData[0].ObjectData[63] = 61; | ||
270 | objupdate.ObjectData[0].ObjectData[64] = 189; | ||
271 | |||
272 | |||
273 | objupdate.ObjectData[0].UpdateFlags = 61 + (9 << 8) + (130 << 16) + (16 << 24); | ||
274 | objupdate.ObjectData[0].PathCurve = 16; | ||
275 | objupdate.ObjectData[0].ProfileCurve = 1; | ||
276 | objupdate.ObjectData[0].PathScaleX = 100; | ||
277 | objupdate.ObjectData[0].PathScaleY = 100; | ||
278 | objupdate.ObjectData[0].ParentID = 0; | ||
279 | objupdate.ObjectData[0].OwnerID = LLUUID.Zero; | ||
280 | objupdate.ObjectData[0].Scale = new LLVector3(1, 1, 1); | ||
281 | objupdate.ObjectData[0].PCode = 47; | ||
282 | objupdate.ObjectData[0].TextureEntry = ScenePresence.DefaultTexture; | ||
283 | |||
284 | objupdate.ObjectData[0].ID = av.LocalId; | ||
285 | objupdate.ObjectData[0].FullID = remoteClient.AgentId; | ||
286 | objupdate.ObjectData[0].ParentID = 0; | ||
287 | objupdate.ObjectData[0].NameValue = | ||
288 | Helpers.StringToField("FirstName STRING RW SV " + av.Firstname + "\nLastName STRING RW SV " + av.Lastname); | ||
289 | LLVector3 pos2 = av.AbsolutePosition; | ||
290 | // new LLVector3((float) Pos.X, (float) Pos.Y, (float) Pos.Z); | ||
291 | byte[] pb = pos2.GetBytes(); | ||
292 | Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); | ||
293 | |||
294 | |||
295 | // primitive part | ||
296 | objupdate.ObjectData[1] = new ObjectUpdatePacket.ObjectDataBlock(); | ||
297 | // SetDefaultPrimPacketValues | ||
298 | objupdate.ObjectData[1].PSBlock = new byte[0]; | ||
299 | objupdate.ObjectData[1].ExtraParams = new byte[1]; | ||
300 | objupdate.ObjectData[1].MediaURL = new byte[0]; | ||
301 | objupdate.ObjectData[1].NameValue = new byte[0]; | ||
302 | objupdate.ObjectData[1].Text = new byte[0]; | ||
303 | objupdate.ObjectData[1].TextColor = new byte[4]; | ||
304 | objupdate.ObjectData[1].JointAxisOrAnchor = new LLVector3(0, 0, 0); | ||
305 | objupdate.ObjectData[1].JointPivot = new LLVector3(0, 0, 0); | ||
306 | objupdate.ObjectData[1].Material = 3; | ||
307 | objupdate.ObjectData[1].TextureAnim = new byte[0]; | ||
308 | objupdate.ObjectData[1].Sound = LLUUID.Zero; | ||
309 | objupdate.ObjectData[1].State = 0; | ||
310 | objupdate.ObjectData[1].Data = new byte[0]; | ||
311 | |||
312 | objupdate.ObjectData[1].ObjectData = new byte[60]; | ||
313 | objupdate.ObjectData[1].ObjectData[46] = 128; | ||
314 | objupdate.ObjectData[1].ObjectData[47] = 63; | ||
315 | |||
316 | // SetPrimPacketShapeData | ||
317 | PrimitiveBaseShape primData = p.Shape; | ||
318 | |||
319 | objupdate.ObjectData[1].TextureEntry = primData.TextureEntry; | ||
320 | objupdate.ObjectData[1].PCode = primData.PCode; | ||
321 | objupdate.ObjectData[1].State = (byte)(((byte)AttachmentPt) << 4) ; | ||
322 | objupdate.ObjectData[1].PathBegin = primData.PathBegin; | ||
323 | objupdate.ObjectData[1].PathEnd = primData.PathEnd; | ||
324 | objupdate.ObjectData[1].PathScaleX = primData.PathScaleX; | ||
325 | objupdate.ObjectData[1].PathScaleY = primData.PathScaleY; | ||
326 | objupdate.ObjectData[1].PathShearX = primData.PathShearX; | ||
327 | objupdate.ObjectData[1].PathShearY = primData.PathShearY; | ||
328 | objupdate.ObjectData[1].PathSkew = primData.PathSkew; | ||
329 | objupdate.ObjectData[1].ProfileBegin = primData.ProfileBegin; | ||
330 | objupdate.ObjectData[1].ProfileEnd = primData.ProfileEnd; | ||
331 | objupdate.ObjectData[1].Scale = primData.Scale; | ||
332 | objupdate.ObjectData[1].PathCurve = primData.PathCurve; | ||
333 | objupdate.ObjectData[1].ProfileCurve = primData.ProfileCurve; | ||
334 | objupdate.ObjectData[1].ProfileHollow = primData.ProfileHollow; | ||
335 | objupdate.ObjectData[1].PathRadiusOffset = primData.PathRadiusOffset; | ||
336 | objupdate.ObjectData[1].PathRevolutions = primData.PathRevolutions; | ||
337 | objupdate.ObjectData[1].PathTaperX = primData.PathTaperX; | ||
338 | objupdate.ObjectData[1].PathTaperY = primData.PathTaperY; | ||
339 | objupdate.ObjectData[1].PathTwist = primData.PathTwist; | ||
340 | objupdate.ObjectData[1].PathTwistBegin = primData.PathTwistBegin; | ||
341 | objupdate.ObjectData[1].ExtraParams = primData.ExtraParams; | ||
342 | |||
343 | |||
344 | objupdate.ObjectData[1].UpdateFlags = 276957500; // flags; // ?? | ||
345 | objupdate.ObjectData[1].ID = p.LocalID; | ||
346 | objupdate.ObjectData[1].FullID = p.UUID; | ||
347 | objupdate.ObjectData[1].OwnerID = p.OwnerID; | ||
348 | objupdate.ObjectData[1].Text = Helpers.StringToField(p.Text); | ||
349 | objupdate.ObjectData[1].TextColor[0] = 255; | ||
350 | objupdate.ObjectData[1].TextColor[1] = 255; | ||
351 | objupdate.ObjectData[1].TextColor[2] = 255; | ||
352 | objupdate.ObjectData[1].TextColor[3] = 128; | ||
353 | objupdate.ObjectData[1].ParentID = objupdate.ObjectData[0].ID; | ||
354 | //objupdate.ObjectData[1].PSBlock = particleSystem; | ||
355 | //objupdate.ObjectData[1].ClickAction = clickAction; | ||
356 | objupdate.ObjectData[1].Radius = 20; | ||
357 | objupdate.ObjectData[1].NameValue = | ||
358 | Helpers.StringToField("AttachItemID STRING RW SV " + p.UUID); | ||
359 | LLVector3 pos = new LLVector3((float) 0.0, (float) 0.0, (float) 0.0); | ||
360 | |||
361 | pb = pos.GetBytes(); | ||
362 | Array.Copy(pb, 0, objupdate.ObjectData[1].ObjectData, 0, pb.Length); | ||
363 | |||
364 | byte[] brot = rot.GetBytes(); | ||
365 | Array.Copy(brot, 0, objupdate.ObjectData[1].ObjectData, 36, brot.Length); | ||
366 | |||
367 | |||
368 | |||
369 | remoteClient.OutPacket(objupdate, ThrottleOutPacketType.Task); | ||
370 | |||
371 | |||
372 | |||
373 | |||
374 | } | ||
375 | else | ||
376 | { | ||
377 | m_log.Info("[SCENE]: Avatar " + remoteClient.AgentId + " not found"); | ||
378 | } | ||
379 | } | ||
380 | |||
381 | |||
235 | public ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child, AvatarAppearance appearance) | 382 | public ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child, AvatarAppearance appearance) |
236 | { | 383 | { |
237 | ScenePresence newAvatar = null; | 384 | ScenePresence newAvatar = null; |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index cc9d294..fee1e66 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |||
@@ -33,6 +33,10 @@ using libsecondlife.Packets; | |||
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Communications.Cache; | 34 | using OpenSim.Framework.Communications.Cache; |
35 | using OpenSim.Framework.Console; | 35 | using OpenSim.Framework.Console; |
36 | using System.IO; | ||
37 | using System.Text; | ||
38 | using System.Xml; | ||
39 | |||
36 | 40 | ||
37 | namespace OpenSim.Region.Environment.Scenes | 41 | namespace OpenSim.Region.Environment.Scenes |
38 | { | 42 | { |
@@ -766,6 +770,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
766 | } | 770 | } |
767 | } | 771 | } |
768 | } | 772 | } |
773 | public void RezSingleAttachment(IClientAPI remoteClient, LLUUID itemID, uint AttachmentPt, | ||
774 | uint ItemFlags, uint NextOwnerMask) | ||
775 | { | ||
776 | System.Console.WriteLine("RezSingleAttachment: unimplemented yet"); | ||
777 | } | ||
778 | |||
769 | 779 | ||
770 | private void AddRezObject(string xmlData, LLVector3 pos) | 780 | private void AddRezObject(string xmlData, LLVector3 pos) |
771 | { | 781 | { |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index dfbeed1..015ba12 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -1299,6 +1299,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
1299 | client.OnGrabUpdate += m_innerScene.MoveObject; | 1299 | client.OnGrabUpdate += m_innerScene.MoveObject; |
1300 | client.OnDeRezObject += DeRezObject; | 1300 | client.OnDeRezObject += DeRezObject; |
1301 | client.OnRezObject += RezObject; | 1301 | client.OnRezObject += RezObject; |
1302 | client.OnRezSingleAttachmentFromInv += RezSingleAttachment; | ||
1303 | client.OnObjectAttach += m_innerScene.AttachObject; | ||
1302 | client.OnNameFromUUIDRequest += CommsManager.HandleUUIDNameRequest; | 1304 | client.OnNameFromUUIDRequest += CommsManager.HandleUUIDNameRequest; |
1303 | client.OnObjectDescription += m_innerScene.PrimDescription; | 1305 | client.OnObjectDescription += m_innerScene.PrimDescription; |
1304 | client.OnObjectName += m_innerScene.PrimName; | 1306 | client.OnObjectName += m_innerScene.PrimName; |
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs index b15db31..2599e61 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs | |||
@@ -58,6 +58,8 @@ namespace SimpleApp | |||
58 | public event ModifyTerrain OnModifyTerrain; | 58 | public event ModifyTerrain OnModifyTerrain; |
59 | public event SetAppearance OnSetAppearance; | 59 | public event SetAppearance OnSetAppearance; |
60 | public event AvatarNowWearing OnAvatarNowWearing; | 60 | public event AvatarNowWearing OnAvatarNowWearing; |
61 | public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv; | ||
62 | public event ObjectAttach OnObjectAttach; | ||
61 | public event StartAnim OnStartAnim; | 63 | public event StartAnim OnStartAnim; |
62 | public event StopAnim OnStopAnim; | 64 | public event StopAnim OnStopAnim; |
63 | public event LinkObjects OnLinkObjects; | 65 | public event LinkObjects OnLinkObjects; |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs index 07a31d0..613aa32 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs | |||
@@ -176,9 +176,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
176 | { | 176 | { |
177 | // 0 => 1: Get last | 177 | // 0 => 1: Get last |
178 | Match m = | 178 | Match m = |
179 | //Regex.Match(cache, @"(?![a-zA-Z_]+)\s*([a-zA-Z_]+)[^a-zA-Z_\(\)]*{", | 179 | Regex.Match(cache, @"(?![a-zA-Z_]+)\s*([a-zA-Z_]+)[^a-zA-Z_\(\)]*{", |
180 | Regex.Match(cache, @"(?![a-zA-Z_]+)\s*(state\s+)?(?<statename>[a-zA-Z_]+)[^a-zA-Z_\(\)]*{", | ||
181 | |||
182 | RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | 180 | RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); |
183 | 181 | ||
184 | in_state = false; | 182 | in_state = false; |
@@ -186,14 +184,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
186 | { | 184 | { |
187 | // Go back to level 0, this is not a state | 185 | // Go back to level 0, this is not a state |
188 | in_state = true; | 186 | in_state = true; |
189 | current_statename = m.Groups["statename"].Captures[0].Value; | 187 | current_statename = m.Groups[1].Captures[0].Value; |
190 | //Console.WriteLine("Current statename: " + current_statename); | 188 | //Console.WriteLine("Current statename: " + current_statename); |
191 | cache = | 189 | cache = |
192 | //@"(?<s1>(?![a-zA-Z_]+)\s*)" + @"([a-zA-Z_]+)(?<s2>[^a-zA-Z_\(\)]*){", | ||
193 | Regex.Replace(cache, | 190 | Regex.Replace(cache, |
194 | @"(?<s1>(?![a-zA-Z_]+)\s*)" + @"(state\s+)?([a-zA-Z_]+)(?<s2>[^a-zA-Z_\(\)]*){", | 191 | @"(?<s1>(?![a-zA-Z_]+)\s*)" + @"([a-zA-Z_]+)(?<s2>[^a-zA-Z_\(\)]*){", |
195 | "${s1}${s2}", | 192 | "${s1}${s2}", |
196 | RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline | RegexOptions.IgnoreCase); | 193 | RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); |
197 | } | 194 | } |
198 | ret += cache; | 195 | ret += cache; |
199 | cache = String.Empty; | 196 | cache = String.Empty; |
@@ -214,7 +211,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
214 | Regex.Replace(cache, | 211 | Regex.Replace(cache, |
215 | @"^(\s*)((?!(if|switch|for|while)[^a-zA-Z0-9_])[a-zA-Z0-9_]*\s*\([^\)]*\)[^;]*\{)", | 212 | @"^(\s*)((?!(if|switch|for|while)[^a-zA-Z0-9_])[a-zA-Z0-9_]*\s*\([^\)]*\)[^;]*\{)", |
216 | @"$1public " + current_statename + "_event_$2", | 213 | @"$1public " + current_statename + "_event_$2", |
217 | RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline | RegexOptions.IgnoreCase); | 214 | RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); |
218 | } | 215 | } |
219 | 216 | ||
220 | ret += cache; | 217 | ret += cache; |
@@ -260,10 +257,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
260 | 257 | ||
261 | // Replace <x,y,z> and <x,y,z,r> | 258 | // Replace <x,y,z> and <x,y,z,r> |
262 | Script = | 259 | Script = |
263 | Regex.Replace(Script, @"<([^,>;]*,[^,>;]*,[^,>;]*,[^,>;]*)>", @"new LSL_Types.Quaternion($1)", | 260 | Regex.Replace(Script, @"<([^,>;]*,[^,>;\)]*,[^,>;\)]*,[^,>;\)]*)>", @"new LSL_Types.Quaternion($1)", |
264 | RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | 261 | RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); |
265 | Script = | 262 | Script = |
266 | Regex.Replace(Script, @"<([^,>;)]*,[^,>;]*,[^,>;]*)>", @"new LSL_Types.Vector3($1)", | 263 | Regex.Replace(Script, @"<([^,>;]*,[^,>;\)]*,[^,>;\)]*)>", @"new LSL_Types.Vector3($1)", |
267 | RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | 264 | RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); |
268 | 265 | ||
269 | // Replace List []'s | 266 | // Replace List []'s |
@@ -280,10 +277,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
280 | Regex.Replace(Script, @"\((float|int)\)\s*([a-zA-Z0-9_.]+(\s*\([^\)]*\))?)", @"$1.Parse($2)", | 277 | Regex.Replace(Script, @"\((float|int)\)\s*([a-zA-Z0-9_.]+(\s*\([^\)]*\))?)", @"$1.Parse($2)", |
281 | RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | 278 | RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); |
282 | 279 | ||
283 | // Replace "state STATENAME" with "state("statename")" | ||
284 | Script = | ||
285 | Regex.Replace(Script, @"(state)\s+([^;\n\r]+)([\r\n\s];)", "$1(\"$2\")$3", | ||
286 | RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline | RegexOptions.IgnoreCase); | ||
287 | 280 | ||
288 | // REPLACE BACK QUOTES | 281 | // REPLACE BACK QUOTES |
289 | foreach (string key in quotes.Keys) | 282 | foreach (string key in quotes.Keys) |