diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Examples/SimpleModule/ComplexObject.cs | 131 |
1 files changed, 0 insertions, 131 deletions
diff --git a/OpenSim/Region/Examples/SimpleModule/ComplexObject.cs b/OpenSim/Region/Examples/SimpleModule/ComplexObject.cs deleted file mode 100644 index 7a0ce51..0000000 --- a/OpenSim/Region/Examples/SimpleModule/ComplexObject.cs +++ /dev/null | |||
@@ -1,131 +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 System.Collections.Generic; | ||
29 | using OpenMetaverse; | ||
30 | using OpenSim.Framework; | ||
31 | using OpenSim.Region.Framework.Scenes; | ||
32 | |||
33 | namespace OpenSim.Region.Examples.SimpleModule | ||
34 | { | ||
35 | public class ComplexObject : SceneObjectGroup | ||
36 | { | ||
37 | private readonly Quaternion m_rotationDirection; | ||
38 | |||
39 | protected override bool InSceneBackup | ||
40 | { | ||
41 | get | ||
42 | { | ||
43 | return false; | ||
44 | } | ||
45 | } | ||
46 | |||
47 | private class RotatingWheel : SceneObjectPart | ||
48 | { | ||
49 | private readonly Quaternion m_rotationDirection; | ||
50 | |||
51 | public RotatingWheel() | ||
52 | { | ||
53 | } | ||
54 | |||
55 | public RotatingWheel( | ||
56 | UUID ownerID, Vector3 groupPosition, Vector3 offsetPosition, Quaternion rotationDirection) | ||
57 | : base(ownerID, PrimitiveBaseShape.Default, groupPosition, Quaternion.Identity, offsetPosition) | ||
58 | { | ||
59 | m_rotationDirection = rotationDirection; | ||
60 | |||
61 | Flags |= PrimFlags.Touch; | ||
62 | } | ||
63 | |||
64 | public override void UpdateMovement() | ||
65 | { | ||
66 | UpdateRotation(RotationOffset * m_rotationDirection); | ||
67 | } | ||
68 | } | ||
69 | |||
70 | public override void UpdateMovement() | ||
71 | { | ||
72 | UpdateGroupRotationR(GroupRotation * m_rotationDirection); | ||
73 | |||
74 | base.UpdateMovement(); | ||
75 | } | ||
76 | |||
77 | public ComplexObject() | ||
78 | { | ||
79 | } | ||
80 | |||
81 | public ComplexObject(Scene scene, ulong regionHandle, UUID ownerID, uint localID, Vector3 pos) | ||
82 | : base(ownerID, pos, PrimitiveBaseShape.Default) | ||
83 | { | ||
84 | m_rotationDirection = new Quaternion(0.05f, 0.1f, 0.15f); | ||
85 | |||
86 | AddPart( | ||
87 | new RotatingWheel(ownerID, pos, new Vector3(0, 0, 0.75f), | ||
88 | new Quaternion(0.05f, 0, 0))); | ||
89 | AddPart( | ||
90 | new RotatingWheel(ownerID, pos, new Vector3(0, 0, -0.75f), | ||
91 | new Quaternion(-0.05f, 0, 0))); | ||
92 | |||
93 | AddPart( | ||
94 | new RotatingWheel(ownerID, pos, new Vector3(0, 0.75f, 0), | ||
95 | new Quaternion(0.5f, 0, 0.05f))); | ||
96 | AddPart( | ||
97 | new RotatingWheel(ownerID, pos, new Vector3(0, -0.75f, 0), | ||
98 | new Quaternion(-0.5f, 0, -0.05f))); | ||
99 | |||
100 | AddPart( | ||
101 | new RotatingWheel(ownerID, pos, new Vector3(0.75f, 0, 0), | ||
102 | new Quaternion(0, 0.5f, 0.05f))); | ||
103 | AddPart( | ||
104 | new RotatingWheel(ownerID, pos, new Vector3(-0.75f, 0, 0), | ||
105 | new Quaternion(0, -0.5f, -0.05f))); | ||
106 | |||
107 | RootPart.Flags |= PrimFlags.Touch; | ||
108 | } | ||
109 | |||
110 | public override void OnGrabPart(SceneObjectPart part, Vector3 offsetPos, IClientAPI remoteClient) | ||
111 | { | ||
112 | m_parts.Remove(part.UUID); | ||
113 | |||
114 | remoteClient.SendKillObject(m_regionHandle, new List<uint>() { part.LocalId} ); | ||
115 | remoteClient.AddMoney(1); | ||
116 | remoteClient.SendChatMessage("Poof!", 1, AbsolutePosition, "Party Party", UUID.Zero, (byte)ChatSourceType.Object, (byte)ChatAudibleLevel.Fully); | ||
117 | } | ||
118 | |||
119 | public override void OnGrabGroup(Vector3 offsetPos, IClientAPI remoteClient) | ||
120 | { | ||
121 | if (m_parts.Count == 1) | ||
122 | { | ||
123 | m_parts.Remove(m_rootPart.UUID); | ||
124 | m_scene.DeleteSceneObject(this, false); | ||
125 | remoteClient.SendKillObject(m_regionHandle, new List<uint>() { m_rootPart.LocalId }); | ||
126 | remoteClient.AddMoney(50); | ||
127 | remoteClient.SendChatMessage("KABLAM!!!", 1, AbsolutePosition, "Groupie Groupie", UUID.Zero, (byte)ChatSourceType.Object, (byte)ChatAudibleLevel.Fully); | ||
128 | } | ||
129 | } | ||
130 | } | ||
131 | } | ||