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