diff options
Diffstat (limited to 'OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs')
-rw-r--r-- | OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs | 105 |
1 files changed, 88 insertions, 17 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs index fa9ef53..35b0a0f 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Security; | ||
30 | using OpenMetaverse; | 31 | using OpenMetaverse; |
31 | using OpenMetaverse.Packets; | 32 | using OpenMetaverse.Packets; |
32 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
@@ -68,6 +69,15 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
68 | return m_rootScene.GetSceneObjectPart(m_localID); | 69 | return m_rootScene.GetSceneObjectPart(m_localID); |
69 | } | 70 | } |
70 | 71 | ||
72 | private bool CanEdit() | ||
73 | { | ||
74 | if(!m_security.CanEditObject(this)) | ||
75 | { | ||
76 | throw new SecurityException("Insufficient Permission to edit object with UUID [" + GetSOP().UUID + "]"); | ||
77 | } | ||
78 | return true; | ||
79 | } | ||
80 | |||
71 | #region OnTouch | 81 | #region OnTouch |
72 | 82 | ||
73 | private event OnTouchDelegate _OnTouch; | 83 | private event OnTouchDelegate _OnTouch; |
@@ -77,14 +87,17 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
77 | { | 87 | { |
78 | add | 88 | add |
79 | { | 89 | { |
80 | if (!_OnTouchActive) | 90 | if (CanEdit()) |
81 | { | 91 | { |
82 | GetSOP().Flags |= PrimFlags.Touch; | 92 | if (!_OnTouchActive) |
83 | _OnTouchActive = true; | 93 | { |
84 | m_rootScene.EventManager.OnObjectGrab += EventManager_OnObjectGrab; | 94 | GetSOP().Flags |= PrimFlags.Touch; |
95 | _OnTouchActive = true; | ||
96 | m_rootScene.EventManager.OnObjectGrab += EventManager_OnObjectGrab; | ||
97 | } | ||
98 | |||
99 | _OnTouch += value; | ||
85 | } | 100 | } |
86 | |||
87 | _OnTouch += value; | ||
88 | } | 101 | } |
89 | remove | 102 | remove |
90 | { | 103 | { |
@@ -104,7 +117,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
104 | if (_OnTouchActive && m_localID == localID) | 117 | if (_OnTouchActive && m_localID == localID) |
105 | { | 118 | { |
106 | TouchEventArgs e = new TouchEventArgs(); | 119 | TouchEventArgs e = new TouchEventArgs(); |
107 | e.Avatar = new SPAvatar(m_rootScene, remoteClient.AgentId); | 120 | e.Avatar = new SPAvatar(m_rootScene, remoteClient.AgentId, m_security); |
108 | e.TouchBiNormal = surfaceArgs.Binormal; | 121 | e.TouchBiNormal = surfaceArgs.Binormal; |
109 | e.TouchMaterialIndex = surfaceArgs.FaceIndex; | 122 | e.TouchMaterialIndex = surfaceArgs.FaceIndex; |
110 | e.TouchNormal = surfaceArgs.Normal; | 123 | e.TouchNormal = surfaceArgs.Normal; |
@@ -139,13 +152,21 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
139 | public string Name | 152 | public string Name |
140 | { | 153 | { |
141 | get { return GetSOP().Name; } | 154 | get { return GetSOP().Name; } |
142 | set { GetSOP().Name = value; } | 155 | set |
156 | { | ||
157 | if (CanEdit()) | ||
158 | GetSOP().Name = value; | ||
159 | } | ||
143 | } | 160 | } |
144 | 161 | ||
145 | public string Description | 162 | public string Description |
146 | { | 163 | { |
147 | get { return GetSOP().Description; } | 164 | get { return GetSOP().Description; } |
148 | set { GetSOP().Description = value; } | 165 | set |
166 | { | ||
167 | if (CanEdit()) | ||
168 | GetSOP().Description = value; | ||
169 | } | ||
149 | } | 170 | } |
150 | 171 | ||
151 | public IObject[] Children | 172 | public IObject[] Children |
@@ -160,7 +181,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
160 | int i = 0; | 181 | int i = 0; |
161 | foreach (KeyValuePair<UUID, SceneObjectPart> pair in my.ParentGroup.Children) | 182 | foreach (KeyValuePair<UUID, SceneObjectPart> pair in my.ParentGroup.Children) |
162 | { | 183 | { |
163 | rets[i++] = new SOPObject(m_rootScene, pair.Value.LocalId); | 184 | rets[i++] = new SOPObject(m_rootScene, pair.Value.LocalId, m_security); |
164 | } | 185 | } |
165 | 186 | ||
166 | return rets; | 187 | return rets; |
@@ -169,7 +190,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
169 | 190 | ||
170 | public IObject Root | 191 | public IObject Root |
171 | { | 192 | { |
172 | get { return new SOPObject(m_rootScene, GetSOP().ParentGroup.RootPart.LocalId); } | 193 | get { return new SOPObject(m_rootScene, GetSOP().ParentGroup.RootPart.LocalId, m_security); } |
173 | } | 194 | } |
174 | 195 | ||
175 | public IObjectMaterial[] Materials | 196 | public IObjectMaterial[] Materials |
@@ -191,7 +212,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
191 | public Vector3 Scale | 212 | public Vector3 Scale |
192 | { | 213 | { |
193 | get { return GetSOP().Scale; } | 214 | get { return GetSOP().Scale; } |
194 | set { GetSOP().Scale = value; } | 215 | set |
216 | { | ||
217 | if (CanEdit()) | ||
218 | GetSOP().Scale = value; | ||
219 | } | ||
195 | } | 220 | } |
196 | 221 | ||
197 | public Quaternion WorldRotation | 222 | public Quaternion WorldRotation |
@@ -211,15 +236,24 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
211 | get { return GetSOP().AbsolutePosition; } | 236 | get { return GetSOP().AbsolutePosition; } |
212 | set | 237 | set |
213 | { | 238 | { |
214 | SceneObjectPart pos = GetSOP(); | 239 | if (CanEdit()) |
215 | pos.UpdateOffSet(value - pos.AbsolutePosition); | 240 | { |
241 | SceneObjectPart pos = GetSOP(); | ||
242 | pos.UpdateOffSet(value - pos.AbsolutePosition); | ||
243 | } | ||
216 | } | 244 | } |
217 | } | 245 | } |
218 | 246 | ||
219 | public Vector3 OffsetPosition | 247 | public Vector3 OffsetPosition |
220 | { | 248 | { |
221 | get { return GetSOP().OffsetPosition; } | 249 | get { return GetSOP().OffsetPosition; } |
222 | set { GetSOP().OffsetPosition = value; } | 250 | set |
251 | { | ||
252 | if (CanEdit()) | ||
253 | { | ||
254 | GetSOP().OffsetPosition = value; | ||
255 | } | ||
256 | } | ||
223 | } | 257 | } |
224 | 258 | ||
225 | public Vector3 SitTarget | 259 | public Vector3 SitTarget |
@@ -319,8 +353,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
319 | 353 | ||
320 | public void Say(string msg) | 354 | public void Say(string msg) |
321 | { | 355 | { |
322 | SceneObjectPart sop = GetSOP(); | 356 | if (!CanEdit()) |
357 | return; | ||
323 | 358 | ||
359 | SceneObjectPart sop = GetSOP(); | ||
324 | m_rootScene.SimChat(msg, ChatTypeEnum.Say, sop.AbsolutePosition, sop.Name, sop.UUID, false); | 360 | m_rootScene.SimChat(msg, ChatTypeEnum.Say, sop.AbsolutePosition, sop.Name, sop.UUID, false); |
325 | } | 361 | } |
326 | 362 | ||
@@ -512,6 +548,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
512 | } | 548 | } |
513 | set | 549 | set |
514 | { | 550 | { |
551 | if (!CanEdit()) | ||
552 | return; | ||
553 | |||
515 | GetSOP().PhysActor.RotationalVelocity = new PhysicsVector(value.X, value.Y, value.Z); | 554 | GetSOP().PhysActor.RotationalVelocity = new PhysicsVector(value.X, value.Y, value.Z); |
516 | } | 555 | } |
517 | } | 556 | } |
@@ -525,6 +564,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
525 | } | 564 | } |
526 | set | 565 | set |
527 | { | 566 | { |
567 | if (!CanEdit()) | ||
568 | return; | ||
569 | |||
528 | GetSOP().PhysActor.Velocity = new PhysicsVector(value.X, value.Y, value.Z); | 570 | GetSOP().PhysActor.Velocity = new PhysicsVector(value.X, value.Y, value.Z); |
529 | } | 571 | } |
530 | } | 572 | } |
@@ -538,6 +580,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
538 | } | 580 | } |
539 | set | 581 | set |
540 | { | 582 | { |
583 | if (!CanEdit()) | ||
584 | return; | ||
585 | |||
541 | GetSOP().PhysActor.Torque = new PhysicsVector(value.X, value.Y, value.Z); | 586 | GetSOP().PhysActor.Torque = new PhysicsVector(value.X, value.Y, value.Z); |
542 | } | 587 | } |
543 | } | 588 | } |
@@ -560,27 +605,44 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
560 | } | 605 | } |
561 | set | 606 | set |
562 | { | 607 | { |
608 | if (!CanEdit()) | ||
609 | return; | ||
610 | |||
563 | GetSOP().PhysActor.Force = new PhysicsVector(value.X, value.Y, value.Z); | 611 | GetSOP().PhysActor.Force = new PhysicsVector(value.X, value.Y, value.Z); |
564 | } | 612 | } |
565 | } | 613 | } |
566 | 614 | ||
567 | public bool FloatOnWater | 615 | public bool FloatOnWater |
568 | { | 616 | { |
569 | set { GetSOP().PhysActor.FloatOnWater = value; } | 617 | set |
618 | { | ||
619 | if (!CanEdit()) | ||
620 | return; | ||
621 | GetSOP().PhysActor.FloatOnWater = value; | ||
622 | } | ||
570 | } | 623 | } |
571 | 624 | ||
572 | public void AddForce(Vector3 force, bool pushforce) | 625 | public void AddForce(Vector3 force, bool pushforce) |
573 | { | 626 | { |
627 | if (!CanEdit()) | ||
628 | return; | ||
629 | |||
574 | GetSOP().PhysActor.AddForce(new PhysicsVector(force.X, force.Y, force.Z), pushforce); | 630 | GetSOP().PhysActor.AddForce(new PhysicsVector(force.X, force.Y, force.Z), pushforce); |
575 | } | 631 | } |
576 | 632 | ||
577 | public void AddAngularForce(Vector3 force, bool pushforce) | 633 | public void AddAngularForce(Vector3 force, bool pushforce) |
578 | { | 634 | { |
635 | if (!CanEdit()) | ||
636 | return; | ||
637 | |||
579 | GetSOP().PhysActor.AddAngularForce(new PhysicsVector(force.X, force.Y, force.Z), pushforce); | 638 | GetSOP().PhysActor.AddAngularForce(new PhysicsVector(force.X, force.Y, force.Z), pushforce); |
580 | } | 639 | } |
581 | 640 | ||
582 | public void SetMomentum(Vector3 momentum) | 641 | public void SetMomentum(Vector3 momentum) |
583 | { | 642 | { |
643 | if (!CanEdit()) | ||
644 | return; | ||
645 | |||
584 | GetSOP().PhysActor.SetMomentum(new PhysicsVector(momentum.X, momentum.Y, momentum.Z)); | 646 | GetSOP().PhysActor.SetMomentum(new PhysicsVector(momentum.X, momentum.Y, momentum.Z)); |
585 | } | 647 | } |
586 | 648 | ||
@@ -595,6 +657,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
595 | get { return m_sculptMap; } | 657 | get { return m_sculptMap; } |
596 | set | 658 | set |
597 | { | 659 | { |
660 | if (!CanEdit()) | ||
661 | return; | ||
662 | |||
598 | m_sculptMap = value; | 663 | m_sculptMap = value; |
599 | SetPrimitiveSculpted(SculptMap, (byte) SculptType); | 664 | SetPrimitiveSculpted(SculptMap, (byte) SculptType); |
600 | } | 665 | } |
@@ -607,6 +672,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
607 | get { return m_sculptType; } | 672 | get { return m_sculptType; } |
608 | set | 673 | set |
609 | { | 674 | { |
675 | if(!CanEdit()) | ||
676 | return; | ||
677 | |||
610 | m_sculptType = value; | 678 | m_sculptType = value; |
611 | SetPrimitiveSculpted(SculptMap, (byte) SculptType); | 679 | SetPrimitiveSculpted(SculptMap, (byte) SculptType); |
612 | } | 680 | } |
@@ -663,6 +731,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
663 | 731 | ||
664 | public void Play(UUID asset, double volume) | 732 | public void Play(UUID asset, double volume) |
665 | { | 733 | { |
734 | if (!CanEdit()) | ||
735 | return; | ||
736 | |||
666 | GetSOP().SendSound(asset.ToString(), volume, true, 0); | 737 | GetSOP().SendSound(asset.ToString(), volume, true, 0); |
667 | } | 738 | } |
668 | 739 | ||