aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
diff options
context:
space:
mode:
authorTeravus Ovares2008-01-17 02:23:48 +0000
committerTeravus Ovares2008-01-17 02:23:48 +0000
commitc2863df49d3bd1f4f7c2f4c17d897d9f66b36b26 (patch)
tree8d2c29d6623d9e5c61634e8f7a742858eee2a5db /OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
parent* Fixed standing up so that you're at the new position of the prim if you mov... (diff)
downloadopensim-SC_OLD-c2863df49d3bd1f4f7c2f4c17d897d9f66b36b26.zip
opensim-SC_OLD-c2863df49d3bd1f4f7c2f4c17d897d9f66b36b26.tar.gz
opensim-SC_OLD-c2863df49d3bd1f4f7c2f4c17d897d9f66b36b26.tar.bz2
opensim-SC_OLD-c2863df49d3bd1f4f7c2f4c17d897d9f66b36b26.tar.xz
* Added and implemented the LSL changed event.
* An example changed event syntax is at: http://opensimulator.org/wiki/Changed_Event_Example * You can use this to trigger actions in your script if someone sits on your object_rez * You can use this to figure out all of the CHANGED_ constants except for CHANGED_REGION, CHANGED_TELEPORT, and CHANGED_ALLOW_DROP
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/SceneObjectPart.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs59
1 files changed, 54 insertions, 5 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index 7866739..0cb4ae7 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -42,6 +42,23 @@ using OpenSim.Region.Physics.Manager;
42 42
43namespace OpenSim.Region.Environment.Scenes 43namespace OpenSim.Region.Environment.Scenes
44{ 44{
45 // I don't really know where to put this except here.
46 // Can't access the OpenSim.Region.ScriptEngine.Common.LSL_BaseClass.Changed constants
47
48 [Flags]
49 public enum Changed : uint
50 {
51 INVENTORY = 1,
52 COLOR = 2,
53 SHAPE = 4,
54 SCALE = 8,
55 TEXTURE = 16,
56 LINK = 32,
57 ALLOWED_DROP = 64,
58 OWNER = 128
59 }
60
61
45 public partial class SceneObjectPart : IScriptHost 62 public partial class SceneObjectPart : IScriptHost
46 { 63 {
47 private const PermissionMask OBJFULL_MASK_GENERAL = 64 private const PermissionMask OBJFULL_MASK_GENERAL =
@@ -94,7 +111,7 @@ namespace OpenSim.Region.Environment.Scenes
94 private byte m_updateFlag; 111 private byte m_updateFlag;
95 112
96 #region Properties 113 #region Properties
97 114
98 public LLUUID CreatorID; 115 public LLUUID CreatorID;
99 116
100 public LLUUID ObjectCreator 117 public LLUUID ObjectCreator
@@ -160,7 +177,7 @@ namespace OpenSim.Region.Environment.Scenes
160 /// <returns>A Linked Child Prim objects position in world</returns> 177 /// <returns>A Linked Child Prim objects position in world</returns>
161 public LLVector3 GetWorldPosition() 178 public LLVector3 GetWorldPosition()
162 { 179 {
163 180
164 Quaternion parentRot = new Quaternion( 181 Quaternion parentRot = new Quaternion(
165 ParentGroup.RootPart.RotationOffset.W, 182 ParentGroup.RootPart.RotationOffset.W,
166 ParentGroup.RootPart.RotationOffset.X, 183 ParentGroup.RootPart.RotationOffset.X,
@@ -186,6 +203,7 @@ namespace OpenSim.Region.Environment.Scenes
186 /// <returns></returns> 203 /// <returns></returns>
187 public LLQuaternion GetWorldRotation() 204 public LLQuaternion GetWorldRotation()
188 { 205 {
206
189 Quaternion newRot; 207 Quaternion newRot;
190 208
191 if (this.LinkNum == 0) 209 if (this.LinkNum == 0)
@@ -277,6 +295,7 @@ namespace OpenSim.Region.Environment.Scenes
277 { 295 {
278 // Hack to get the child prim to update world positions in the physics engine 296 // Hack to get the child prim to update world positions in the physics engine
279 ParentGroup.ResetChildPrimPhysicsPositions(); 297 ParentGroup.ResetChildPrimPhysicsPositions();
298
280 } 299 }
281 catch (System.NullReferenceException) 300 catch (System.NullReferenceException)
282 { 301 {
@@ -427,6 +446,8 @@ namespace OpenSim.Region.Environment.Scenes
427 set 446 set
428 { 447 {
429 m_color = value; 448 m_color = value;
449 TriggerScriptChangedEvent(Changed.COLOR);
450
430 /* ScheduleFullUpdate() need not be called b/c after 451 /* ScheduleFullUpdate() need not be called b/c after
431 * setting the color, the text will be set, so then 452 * setting the color, the text will be set, so then
432 * ScheduleFullUpdate() will be called. */ 453 * ScheduleFullUpdate() will be called. */
@@ -477,7 +498,12 @@ namespace OpenSim.Region.Environment.Scenes
477 public int LinkNum 498 public int LinkNum
478 { 499 {
479 get { return m_linkNum; } 500 get { return m_linkNum; }
480 set { m_linkNum = value; } 501 set
502 {
503 m_linkNum = value;
504 TriggerScriptChangedEvent(Changed.LINK);
505
506 }
481 } 507 }
482 508
483 private byte m_clickAction = 0; 509 private byte m_clickAction = 0;
@@ -494,16 +520,35 @@ namespace OpenSim.Region.Environment.Scenes
494 520
495 protected PrimitiveBaseShape m_shape; 521 protected PrimitiveBaseShape m_shape;
496 522
523 public void TriggerScriptChangedEvent(Changed val)
524 {
525 if (m_parentGroup != null)
526 {
527 if (m_parentGroup.Scene != null)
528 m_parentGroup.Scene.TriggerObjectChanged(LocalID, (uint)val);
529 }
530
531 }
532
497 public PrimitiveBaseShape Shape 533 public PrimitiveBaseShape Shape
498 { 534 {
499 get { return m_shape; } 535 get { return m_shape; }
500 set { m_shape = value; } 536 set
537 {
538
539 m_shape = value;
540 TriggerScriptChangedEvent(Changed.SHAPE);
541 }
501 } 542 }
502 543
503 public LLVector3 Scale 544 public LLVector3 Scale
504 { 545 {
505 set { m_shape.Scale = value; }
506 get { return m_shape.Scale; } 546 get { return m_shape.Scale; }
547 set
548 {
549 m_shape.Scale = value;
550 TriggerScriptChangedEvent(Changed.SCALE);
551 }
507 } 552 }
508 553
509 public bool Stopped 554 public bool Stopped
@@ -692,6 +737,8 @@ namespace OpenSim.Region.Environment.Scenes
692 { 737 {
693 BaseMask = NextOwnerMask; 738 BaseMask = NextOwnerMask;
694 OwnerMask = NextOwnerMask; 739 OwnerMask = NextOwnerMask;
740 TriggerScriptChangedEvent(Changed.OWNER);
741
695 } 742 }
696 743
697 public void ApplySanePermissions() 744 public void ApplySanePermissions()
@@ -918,6 +965,7 @@ namespace OpenSim.Region.Environment.Scenes
918 public void SetAvatarOnSitTarget(LLUUID avatarID) 965 public void SetAvatarOnSitTarget(LLUUID avatarID)
919 { 966 {
920 m_SitTargetAvatar = avatarID; 967 m_SitTargetAvatar = avatarID;
968 TriggerScriptChangedEvent(Changed.LINK);
921 } 969 }
922 970
923 public LLUUID GetAvatarOnSitTarget() 971 public LLUUID GetAvatarOnSitTarget()
@@ -1328,6 +1376,7 @@ namespace OpenSim.Region.Environment.Scenes
1328 public void UpdateTextureEntry(byte[] textureEntry) 1376 public void UpdateTextureEntry(byte[] textureEntry)
1329 { 1377 {
1330 m_shape.TextureEntry = textureEntry; 1378 m_shape.TextureEntry = textureEntry;
1379 TriggerScriptChangedEvent(Changed.TEXTURE);
1331 ScheduleFullUpdate(); 1380 ScheduleFullUpdate();
1332 } 1381 }
1333 1382