aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Examples/SimpleModule/ComplexObject.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Examples/SimpleModule/ComplexObject.cs272
1 files changed, 136 insertions, 136 deletions
diff --git a/OpenSim/Region/Examples/SimpleModule/ComplexObject.cs b/OpenSim/Region/Examples/SimpleModule/ComplexObject.cs
index 42f517c..9941304 100644
--- a/OpenSim/Region/Examples/SimpleModule/ComplexObject.cs
+++ b/OpenSim/Region/Examples/SimpleModule/ComplexObject.cs
@@ -1,137 +1,137 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using libsecondlife; 29using libsecondlife;
30using OpenSim.Framework; 30using OpenSim.Framework;
31using OpenSim.Region.Environment.Scenes; 31using OpenSim.Region.Environment.Scenes;
32 32
33namespace OpenSim.Region.Examples.SimpleModule 33namespace OpenSim.Region.Examples.SimpleModule
34{ 34{
35 public class ComplexObject : SceneObjectGroup 35 public class ComplexObject : SceneObjectGroup
36 { 36 {
37 private readonly LLQuaternion m_rotationDirection; 37 private readonly LLQuaternion m_rotationDirection;
38 38
39 protected override bool InSceneBackup 39 protected override bool InSceneBackup
40 { 40 {
41 get 41 get
42 { 42 {
43 return false; 43 return false;
44 } 44 }
45 } 45 }
46 46
47 private class RotatingWheel : SceneObjectPart 47 private class RotatingWheel : SceneObjectPart
48 { 48 {
49 private readonly LLQuaternion m_rotationDirection; 49 private readonly LLQuaternion m_rotationDirection;
50 50
51 public RotatingWheel() 51 public RotatingWheel()
52 { 52 {
53 53
54 } 54 }
55 55
56 public RotatingWheel(ulong regionHandle, SceneObjectGroup parent, LLUUID ownerID, uint localID, 56 public RotatingWheel(ulong regionHandle, SceneObjectGroup parent, LLUUID ownerID, uint localID,
57 LLVector3 groupPosition, LLVector3 offsetPosition, LLQuaternion rotationDirection) 57 LLVector3 groupPosition, LLVector3 offsetPosition, LLQuaternion rotationDirection)
58 : base( 58 : base(
59 regionHandle, parent, ownerID, localID, PrimitiveBaseShape.Default, groupPosition, offsetPosition 59 regionHandle, parent, ownerID, localID, PrimitiveBaseShape.Default, groupPosition, offsetPosition
60 ) 60 )
61 { 61 {
62 m_rotationDirection = rotationDirection; 62 m_rotationDirection = rotationDirection;
63 63
64 Flags |= LLObject.ObjectFlags.Touch; 64 Flags |= LLObject.ObjectFlags.Touch;
65 } 65 }
66 66
67 public override void UpdateMovement() 67 public override void UpdateMovement()
68 { 68 {
69 UpdateRotation(RotationOffset*m_rotationDirection); 69 UpdateRotation(RotationOffset*m_rotationDirection);
70 } 70 }
71 } 71 }
72 72
73 public override void UpdateMovement() 73 public override void UpdateMovement()
74 { 74 {
75 UpdateGroupRotation(GroupRotation*m_rotationDirection); 75 UpdateGroupRotation(GroupRotation*m_rotationDirection);
76 76
77 base.UpdateMovement(); 77 base.UpdateMovement();
78 } 78 }
79 79
80 public ComplexObject() 80 public ComplexObject()
81 { 81 {
82 82
83 } 83 }
84 84
85 public ComplexObject(Scene scene, ulong regionHandle, LLUUID ownerID, uint localID, LLVector3 pos) 85 public ComplexObject(Scene scene, ulong regionHandle, LLUUID ownerID, uint localID, LLVector3 pos)
86 : base(scene, regionHandle, ownerID, localID, pos, PrimitiveBaseShape.Default) 86 : base(scene, regionHandle, ownerID, localID, pos, PrimitiveBaseShape.Default)
87 { 87 {
88 m_rotationDirection = new LLQuaternion(0.05f, 0.1f, 0.15f); 88 m_rotationDirection = new LLQuaternion(0.05f, 0.1f, 0.15f);
89 89
90 AddPart( 90 AddPart(
91 new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, 0, 0.75f), 91 new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, 0, 0.75f),
92 new LLQuaternion(0.05f, 0, 0))); 92 new LLQuaternion(0.05f, 0, 0)));
93 AddPart( 93 AddPart(
94 new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, 0, -0.75f), 94 new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, 0, -0.75f),
95 new LLQuaternion(-0.05f, 0, 0))); 95 new LLQuaternion(-0.05f, 0, 0)));
96 96
97 AddPart( 97 AddPart(
98 new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, 0.75f, 0), 98 new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, 0.75f, 0),
99 new LLQuaternion(0.5f, 0, 0.05f))); 99 new LLQuaternion(0.5f, 0, 0.05f)));
100 AddPart( 100 AddPart(
101 new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, -0.75f, 0), 101 new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, -0.75f, 0),
102 new LLQuaternion(-0.5f, 0, -0.05f))); 102 new LLQuaternion(-0.5f, 0, -0.05f)));
103 103
104 AddPart( 104 AddPart(
105 new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0.75f, 0, 0), 105 new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0.75f, 0, 0),
106 new LLQuaternion(0, 0.5f, 0.05f))); 106 new LLQuaternion(0, 0.5f, 0.05f)));
107 AddPart( 107 AddPart(
108 new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(-0.75f, 0, 0), 108 new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(-0.75f, 0, 0),
109 new LLQuaternion(0, -0.5f, -0.05f))); 109 new LLQuaternion(0, -0.5f, -0.05f)));
110 110
111 RootPart.Flags |= LLObject.ObjectFlags.Touch; 111 RootPart.Flags |= LLObject.ObjectFlags.Touch;
112 112
113 UpdateParentIDs(); 113 UpdateParentIDs();
114 } 114 }
115 115
116 public override void OnGrabPart(SceneObjectPart part, LLVector3 offsetPos, IClientAPI remoteClient) 116 public override void OnGrabPart(SceneObjectPart part, LLVector3 offsetPos, IClientAPI remoteClient)
117 { 117 {
118 m_parts.Remove(part.UUID); 118 m_parts.Remove(part.UUID);
119 119
120 remoteClient.SendKillObject(m_regionHandle, part.LocalId); 120 remoteClient.SendKillObject(m_regionHandle, part.LocalId);
121 remoteClient.AddMoney(1); 121 remoteClient.AddMoney(1);
122 remoteClient.SendChatMessage("Poof!", 1, AbsolutePosition, "Party Party", LLUUID.Zero); 122 remoteClient.SendChatMessage("Poof!", 1, AbsolutePosition, "Party Party", LLUUID.Zero);
123 } 123 }
124 124
125 public override void OnGrabGroup(LLVector3 offsetPos, IClientAPI remoteClient) 125 public override void OnGrabGroup(LLVector3 offsetPos, IClientAPI remoteClient)
126 { 126 {
127 if (m_parts.Count == 1) 127 if (m_parts.Count == 1)
128 { 128 {
129 m_parts.Remove(m_rootPart.UUID); 129 m_parts.Remove(m_rootPart.UUID);
130 m_scene.RemoveEntity(this); 130 m_scene.RemoveEntity(this);
131 remoteClient.SendKillObject(m_regionHandle, m_rootPart.LocalId); 131 remoteClient.SendKillObject(m_regionHandle, m_rootPart.LocalId);
132 remoteClient.AddMoney(50); 132 remoteClient.AddMoney(50);
133 remoteClient.SendChatMessage("KABLAM!!!", 1, AbsolutePosition, "Groupie Groupie", LLUUID.Zero); 133 remoteClient.SendChatMessage("KABLAM!!!", 1, AbsolutePosition, "Groupie Groupie", LLUUID.Zero);
134 } 134 }
135 } 135 }
136 } 136 }
137} \ No newline at end of file 137} \ No newline at end of file