From 47c682075c874f7a01970d3557528722b89a6ffd Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Sat, 24 Mar 2007 16:06:43 +0000 Subject: Applying Randomskk's patches --- OpenSim.RegionServer/SimClient.cs | 4 ++++ OpenSim.RegionServer/world/World.cs | 44 ++++++++++++++++++++++++++++++++++++- 2 files changed, 47 insertions(+), 1 deletion(-) (limited to 'OpenSim.RegionServer') diff --git a/OpenSim.RegionServer/SimClient.cs b/OpenSim.RegionServer/SimClient.cs index b62d018..d271ea9 100644 --- a/OpenSim.RegionServer/SimClient.cs +++ b/OpenSim.RegionServer/SimClient.cs @@ -307,6 +307,10 @@ namespace OpenSim FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)Pack; OpenSimRoot.Instance.InventoryCache.FetchInventoryDescendents(this, Fetch); break; + case PacketType.DeRezObject: + //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Received DeRezObject packet"); + OpenSimRoot.Instance.LocalWorld.DeRezObject((DeRezObjectPacket)Pack, this); + break; } } diff --git a/OpenSim.RegionServer/world/World.cs b/OpenSim.RegionServer/world/World.cs index c653515..80e63b3 100644 --- a/OpenSim.RegionServer/world/World.cs +++ b/OpenSim.RegionServer/world/World.cs @@ -198,7 +198,49 @@ namespace OpenSim.world //prim.PhysicsEnabled = true; this.Entities.Add(prim.uuid, prim); this._primCount++; - } + } + + public void DeRezObject(DeRezObjectPacket DeRezPacket, SimClient AgentClient) + { + //Needs to delete object from physics at a later date + + libsecondlife.LLUUID [] DeRezEnts; + DeRezEnts = new libsecondlife.LLUUID[ DeRezPacket.ObjectData.Length ]; + int i = 0; + foreach( DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData ) + { + //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString()); + foreach (Entity ent in OpenSimRoot.Instance.LocalWorld.Entities.Values) + { + if (ent.localid == Data.ObjectLocalID) + { + DeRezEnts[i++] = ent.uuid; + this.localStorage.RemovePrim(ent.uuid); + KillObjectPacket kill = new KillObjectPacket(); + kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; + kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); + kill.ObjectData[0].ID = ent.localid; + foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values) + { + client.OutPacket(kill); + } + //Uncommenting this means an old UUID will be re-used, thus crashing the asset server + //Uncomment when prim/object UUIDs are random or such + //2007-03-22 - Randomskk + //this._primCount--; + OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Deleted UUID " + ent.uuid); + } + } + } + foreach( libsecondlife.LLUUID uuid in DeRezEnts ) + { + lock (OpenSimRoot.Instance.LocalWorld.Entities) + { + //OpenSimRoot.Instance.LocalWorld.Entities.Remove(uuid); + } + } + + } public bool Backup() { -- cgit v1.1