aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/OpenSim.World/World.PacketHandlers.cs
diff options
context:
space:
mode:
authorMW2007-05-27 18:52:42 +0000
committerMW2007-05-27 18:52:42 +0000
commitc746a2f9f4f0b1e7eea564effdae63472f79ab22 (patch)
tree54d23af3d168958bfec995cf2987cf5af79ac149 /OpenSim/OpenSim.World/World.PacketHandlers.cs
parentGoodbye World (diff)
downloadopensim-SC_OLD-c746a2f9f4f0b1e7eea564effdae63472f79ab22.zip
opensim-SC_OLD-c746a2f9f4f0b1e7eea564effdae63472f79ab22.tar.gz
opensim-SC_OLD-c746a2f9f4f0b1e7eea564effdae63472f79ab22.tar.bz2
opensim-SC_OLD-c746a2f9f4f0b1e7eea564effdae63472f79ab22.tar.xz
Should allow multiple worlds (and UDP servers) to be ran in one instance, just missing backend comms and working Avatar/primitives classes.
Diffstat (limited to 'OpenSim/OpenSim.World/World.PacketHandlers.cs')
-rw-r--r--OpenSim/OpenSim.World/World.PacketHandlers.cs175
1 files changed, 20 insertions, 155 deletions
diff --git a/OpenSim/OpenSim.World/World.PacketHandlers.cs b/OpenSim/OpenSim.World/World.PacketHandlers.cs
index ee5a23a..3357536 100644
--- a/OpenSim/OpenSim.World/World.PacketHandlers.cs
+++ b/OpenSim/OpenSim.World/World.PacketHandlers.cs
@@ -6,10 +6,8 @@ using libsecondlife.Packets;
6using OpenSim.Physics.Manager; 6using OpenSim.Physics.Manager;
7using OpenSim.Framework.Interfaces; 7using OpenSim.Framework.Interfaces;
8using OpenSim.Framework.Types; 8using OpenSim.Framework.Types;
9using OpenSim.Framework.Terrain;
10using OpenSim.Framework.Inventory; 9using OpenSim.Framework.Inventory;
11using OpenSim.Framework.Utilities; 10using OpenSim.Framework.Utilities;
12using OpenSim.Assets;
13 11
14namespace OpenSim.world 12namespace OpenSim.world
15{ 13{
@@ -35,10 +33,10 @@ namespace OpenSim.world
35 33
36 public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) 34 public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
37 { 35 {
38 foreach (ClientView client in m_clientThreads.Values) 36 foreach (IClientAPI client in m_clientThreads.Values)
39 { 37 {
40 // int dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X), (int)(client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y)); 38 // int dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X), (int)(client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y));
41 int dis = (int)client.ClientAvatar.Pos.GetDistanceTo(fromPos); 39 int dis = 0; // (int)client.ClientAvatar.Pos.GetDistanceTo(fromPos);
42 40
43 switch (type) 41 switch (type)
44 { 42 {
@@ -72,190 +70,57 @@ namespace OpenSim.world
72 70
73 public void RezObject(AssetBase primAsset, LLVector3 pos) 71 public void RezObject(AssetBase primAsset, LLVector3 pos)
74 { 72 {
75 PrimData primd = new PrimData(primAsset.Data); 73
76 Primitive nPrim = new Primitive(m_clientThreads, m_regionHandle, this);
77 nPrim.CreateFromStorage(primd, pos, this._primCount, true);
78 this.Entities.Add(nPrim.uuid, nPrim);
79 this._primCount++;
80 } 74 }
81 75
82 public void DeRezObject(Packet packet, ClientView simClient) 76 public void DeRezObject(Packet packet, IClientAPI simClient)
83 { 77 {
84 DeRezObjectPacket DeRezPacket = (DeRezObjectPacket)packet; 78
85
86 //Needs to delete object from physics at a later date
87 if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero)
88 {
89 //currently following code not used (or don't know of any case of destination being zero
90
91 }
92 else
93 {
94 foreach (DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData)
95 {
96 Entity selectedEnt = null;
97 //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString());
98 foreach (Entity ent in this.Entities.Values)
99 {
100 if (ent.localid == Data.ObjectLocalID)
101 {
102 AssetBase primAsset = new AssetBase();
103 primAsset.FullID = LLUUID.Random();//DeRezPacket.AgentBlock.TransactionID.Combine(LLUUID.Zero); //should be combining with securesessionid
104 primAsset.InvType = 6;
105 primAsset.Type = 6;
106 primAsset.Name = "Prim";
107 primAsset.Description = "";
108 primAsset.Data = ((Primitive)ent).GetByteArray();
109 this._assetCache.AddAsset(primAsset);
110 this._inventoryCache.AddNewInventoryItem(simClient, DeRezPacket.AgentBlock.DestinationID, primAsset);
111 selectedEnt = ent;
112 break;
113 }
114 }
115 if (selectedEnt != null)
116 {
117 this.localStorage.RemovePrim(selectedEnt.uuid);
118 KillObjectPacket kill = new KillObjectPacket();
119 kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1];
120 kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock();
121 kill.ObjectData[0].ID = selectedEnt.localid;
122 foreach (ClientView client in m_clientThreads.Values)
123 {
124 client.OutPacket(kill);
125 }
126 lock (Entities)
127 {
128 Entities.Remove(selectedEnt.uuid);
129 }
130 }
131 }
132 }
133
134 } 79 }
135 80
136 public void SendAvatarsToClient(ClientView remoteClient) 81 public void SendAvatarsToClient(IClientAPI remoteClient)
137 { 82 {
138 foreach (ClientView client in m_clientThreads.Values) 83
139 {
140 if (client.AgentID != remoteClient.AgentID)
141 {
142 // ObjectUpdatePacket objupdate = client.ClientAvatar.CreateUpdatePacket();
143 // RemoteClient.OutPacket(objupdate);
144 client.ClientAvatar.SendUpdateToOtherClient(remoteClient.ClientAvatar);
145 client.ClientAvatar.SendAppearanceToOtherAgent(remoteClient.ClientAvatar);
146 }
147 }
148 } 84 }
149 85
150 public void LinkObjects(uint parentPrim, List<uint> childPrims) 86 public void LinkObjects(uint parentPrim, List<uint> childPrims)
151 { 87 {
152 Primitive parentprim = null; 88
153 foreach (Entity ent in Entities.Values)
154 {
155 if (ent.localid == parentPrim)
156 {
157 parentprim = (OpenSim.world.Primitive)ent;
158
159 }
160 }
161
162 for (int i = 0; i < childPrims.Count; i++)
163 {
164 uint childId = childPrims[i];
165 foreach (Entity ent in Entities.Values)
166 {
167 if (ent.localid == childId)
168 {
169 ((OpenSim.world.Primitive)ent).MakeParent(parentprim);
170 }
171 }
172 }
173 89
174 } 90 }
175 91
176 public void UpdatePrimShape(uint primLocalID, ObjectShapePacket.ObjectDataBlock shapeBlock) 92 public void UpdatePrimShape(uint primLocalID, ObjectShapePacket.ObjectDataBlock shapeBlock)
177 { 93 {
178 foreach (Entity ent in Entities.Values) 94
179 {
180 if (ent.localid == primLocalID)
181 {
182 ((OpenSim.world.Primitive)ent).UpdateShape(shapeBlock);
183 break;
184 }
185 }
186 } 95 }
187 96
188 public void SelectPrim(uint primLocalID, ClientView remoteClient) 97 public void SelectPrim(uint primLocalID, IClientAPI remoteClient)
189 { 98 {
190 foreach (Entity ent in Entities.Values) 99
191 {
192 if (ent.localid == primLocalID)
193 {
194 ((OpenSim.world.Primitive)ent).GetProperites(remoteClient);
195 break;
196 }
197 }
198 } 100 }
199 101
200 public void UpdatePrimFlags(uint localID, Packet packet, ClientView remoteClient) 102 public void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient)
201 { 103 {
202 foreach (Entity ent in Entities.Values) 104
203 {
204 if (ent.localid == localID)
205 {
206 ((OpenSim.world.Primitive)ent).UpdateObjectFlags((ObjectFlagUpdatePacket) packet);
207 break;
208 }
209 }
210 } 105 }
211 106
212 public void UpdatePrimTexture(uint localID, byte[] texture, ClientView remoteClient) 107 public void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient)
213 { 108 {
214 foreach (Entity ent in Entities.Values) 109
215 {
216 if (ent.localid == localID)
217 {
218 ((OpenSim.world.Primitive)ent).UpdateTexture(texture);
219 break;
220 }
221 }
222 } 110 }
223 111
224 public void UpdatePrimPosition(uint localID, LLVector3 pos, ClientView remoteClient) 112 public void UpdatePrimPosition(uint localID, LLVector3 pos, IClientAPI remoteClient)
225 { 113 {
226 foreach (Entity ent in Entities.Values) 114
227 {
228 if (ent.localid == localID)
229 {
230 ((OpenSim.world.Primitive)ent).UpdatePosition(pos);
231 break;
232 }
233 }
234 } 115 }
235 116
236 public void UpdatePrimRotation(uint localID, LLQuaternion rot, ClientView remoteClient) 117 public void UpdatePrimRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient)
237 { 118 {
238 foreach (Entity ent in Entities.Values) 119
239 {
240 if (ent.localid == localID)
241 {
242 ent.rotation = new Axiom.MathLib.Quaternion(rot.W, rot.X, rot.Y, rot.Z);
243 ((OpenSim.world.Primitive)ent).UpdateFlag = true;
244 break;
245 }
246 }
247 } 120 }
248 121
249 public void UpdatePrimScale(uint localID, LLVector3 scale, ClientView remoteClient) 122 public void UpdatePrimScale(uint localID, LLVector3 scale, IClientAPI remoteClient)
250 { 123 {
251 foreach (Entity ent in Entities.Values)
252 {
253 if (ent.localid == localID)
254 {
255 ((OpenSim.world.Primitive)ent).Scale = scale;
256 break;
257 }
258 }
259 } 124 }
260 } 125 }
261} 126}