From 32438ab1b9a5c270e0a4a2d708f8c7730dc7e617 Mon Sep 17 00:00:00 2001
From: Teravus Ovares
Date: Sun, 30 Dec 2007 06:18:17 +0000
Subject: * This update rolls back the packetpool and LibSL changes. Please
retest and then patch these changes back in. Currently it's not quite ready
for 0.5. The down side to this action, is that we loose some performance to
the garbage collector for now. Given that the target date for 0.5 is *Two
days* from now, I'm taking the initiative to work towards a real stable
version. * This update also fixes scripting and some weird physics reactions
---
OpenSim/Framework/ClientManager.cs | 3 +-
OpenSim/Region/ClientStack/ClientView.cs | 178 ++++++++++-----------
OpenSim/Region/Environment/LandManagement/Land.cs | 10 +-
.../Environment/LandManagement/LandManager.cs | 2 +-
.../Region/Environment/Scenes/Scene.Inventory.cs | 4 +-
.../Environment/Scenes/Scene.PacketHandlers.cs | 2 +-
OpenSim/Region/Environment/Scenes/Scene.cs | 76 +++++----
.../Region/Environment/Scenes/SceneObjectGroup.cs | 17 +-
.../Region/Environment/Scenes/SimStatsReporter.cs | 2 +-
OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 18 +--
OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 16 +-
11 files changed, 159 insertions(+), 169 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Framework/ClientManager.cs b/OpenSim/Framework/ClientManager.cs
index 181000c..f464015 100644
--- a/OpenSim/Framework/ClientManager.cs
+++ b/OpenSim/Framework/ClientManager.cs
@@ -148,8 +148,7 @@ namespace OpenSim.Framework
public void ViewerEffectHandler(IClientAPI sender, ViewerEffectPacket.EffectBlock[] effectBlock)
{
- ViewerEffectPacket packet = (ViewerEffectPacket) PacketPool.Instance.GetPacket(PacketType.ViewerEffect);
- // TODO: don't create new blocks if recycling an old packet
+ ViewerEffectPacket packet = new ViewerEffectPacket();
packet.Effect = effectBlock;
// Wasteful, I know
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs
index 932414d..8bf807c 100644
--- a/OpenSim/Region/ClientStack/ClientView.cs
+++ b/OpenSim/Region/ClientStack/ClientView.cs
@@ -216,7 +216,7 @@ namespace OpenSim.Region.ClientStack
{
m_scene.RemoveClient(AgentId);
// Send the STOP packet
- DisableSimulatorPacket disable = (DisableSimulatorPacket) PacketPool.Instance.GetPacket(PacketType.DisableSimulator);
+ DisableSimulatorPacket disable = new DisableSimulatorPacket();
OutPacket(disable, ThrottleOutPacketType.Task);
@@ -257,7 +257,7 @@ namespace OpenSim.Region.ClientStack
public void Kick(string message)
{
- KickUserPacket kupack = (KickUserPacket) PacketPool.Instance.GetPacket(PacketType.KickUser);
+ KickUserPacket kupack = new KickUserPacket();
kupack.UserInfo.AgentID = AgentId;
kupack.UserInfo.SessionID = SessionId;
kupack.TargetBlock.TargetIP = (uint) 0;
@@ -596,7 +596,7 @@ namespace OpenSim.Region.ClientStack
///
public void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look)
{
- AgentMovementCompletePacket mov = (AgentMovementCompletePacket) PacketPool.Instance.GetPacket(PacketType.AgentMovementComplete);
+ AgentMovementCompletePacket mov = new AgentMovementCompletePacket();
mov.SimData.ChannelVersion = m_channelVersion;
mov.AgentData.SessionID = m_sessionId;
mov.AgentData.AgentID = AgentId;
@@ -631,7 +631,7 @@ namespace OpenSim.Region.ClientStack
public void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
{
- ChatFromSimulatorPacket reply = (ChatFromSimulatorPacket) PacketPool.Instance.GetPacket(PacketType.ChatFromSimulator);
+ ChatFromSimulatorPacket reply = new ChatFromSimulatorPacket();
reply.ChatData.Audible = 1;
reply.ChatData.Message = message;
reply.ChatData.ChatType = type;
@@ -652,7 +652,7 @@ namespace OpenSim.Region.ClientStack
public void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent,
LLUUID imSessionID, string fromName, byte dialog, uint timeStamp)
{
- ImprovedInstantMessagePacket msg = (ImprovedInstantMessagePacket) PacketPool.Instance.GetPacket(PacketType.ImprovedInstantMessage);
+ ImprovedInstantMessagePacket msg = new ImprovedInstantMessagePacket();
msg.AgentData.AgentID = fromAgent;
msg.AgentData.SessionID = fromAgentSession;
msg.MessageBlock.FromAgentName = Helpers.StringToField(fromName);
@@ -740,7 +740,7 @@ namespace OpenSim.Region.ClientStack
IPAddress neighbourIP = neighbourEndPoint.Address;
ushort neighbourPort = (ushort) neighbourEndPoint.Port;
- EnableSimulatorPacket enablesimpacket = (EnableSimulatorPacket) PacketPool.Instance.GetPacket(PacketType.EnableSimulator);
+ EnableSimulatorPacket enablesimpacket = new EnableSimulatorPacket();
// TODO: don't create new blocks if recycling an old packet
enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock();
enablesimpacket.SimulatorInfo.Handle = neighbourHandle;
@@ -777,7 +777,7 @@ namespace OpenSim.Region.ClientStack
{
LLVector3 look = new LLVector3(lookAt.X*10, lookAt.Y*10, lookAt.Z*10);
- CrossedRegionPacket newSimPack = (CrossedRegionPacket) PacketPool.Instance.GetPacket(PacketType.CrossedRegion);
+ CrossedRegionPacket newSimPack = new CrossedRegionPacket();
// TODO: don't create new blocks if recycling an old packet
newSimPack.AgentData = new CrossedRegionPacket.AgentDataBlock();
newSimPack.AgentData.AgentID = AgentId;
@@ -800,7 +800,7 @@ namespace OpenSim.Region.ClientStack
public void SendMapBlock(List mapBlocks)
{
- MapBlockReplyPacket mapReply = (MapBlockReplyPacket) PacketPool.Instance.GetPacket(PacketType.MapBlockReply);
+ MapBlockReplyPacket mapReply = new MapBlockReplyPacket();
// TODO: don't create new blocks if recycling an old packet
mapReply.AgentData.AgentID = AgentId;
mapReply.Data = new MapBlockReplyPacket.DataBlock[mapBlocks.Count];
@@ -823,7 +823,7 @@ namespace OpenSim.Region.ClientStack
public void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags)
{
- TeleportLocalPacket tpLocal = (TeleportLocalPacket) PacketPool.Instance.GetPacket(PacketType.TeleportLocal);
+ TeleportLocalPacket tpLocal = new TeleportLocalPacket();
tpLocal.Info.AgentID = AgentId;
tpLocal.Info.TeleportFlags = flags;
tpLocal.Info.LocationID = 2;
@@ -835,7 +835,7 @@ namespace OpenSim.Region.ClientStack
public void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint newRegionEndPoint, uint locationID,
uint flags, string capsURL)
{
- TeleportFinishPacket teleport = (TeleportFinishPacket) PacketPool.Instance.GetPacket(PacketType.TeleportFinish);
+ TeleportFinishPacket teleport = new TeleportFinishPacket();
teleport.Info.AgentID = AgentId;
teleport.Info.RegionHandle = regionHandle;
teleport.Info.SimAccess = simAccess;
@@ -861,7 +861,7 @@ namespace OpenSim.Region.ClientStack
///
public void SendTeleportFailed()
{
- TeleportFailedPacket tpFailed = (TeleportFailedPacket) PacketPool.Instance.GetPacket(PacketType.TeleportFailed);
+ TeleportFailedPacket tpFailed = new TeleportFailedPacket();
tpFailed.Info.AgentID = AgentId;
tpFailed.Info.Reason = Helpers.StringToField("unknown failure of teleport");
OutPacket(tpFailed, ThrottleOutPacketType.Task);
@@ -872,14 +872,14 @@ namespace OpenSim.Region.ClientStack
///
public void SendTeleportLocationStart()
{
- TeleportStartPacket tpStart = (TeleportStartPacket) PacketPool.Instance.GetPacket(PacketType.TeleportStart);
+ TeleportStartPacket tpStart = new TeleportStartPacket();
tpStart.Info.TeleportFlags = 16; // Teleport via location
OutPacket(tpStart, ThrottleOutPacketType.Task);
}
public void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance)
{
- MoneyBalanceReplyPacket money = (MoneyBalanceReplyPacket) PacketPool.Instance.GetPacket(PacketType.MoneyBalanceReply);
+ MoneyBalanceReplyPacket money = new MoneyBalanceReplyPacket();
money.MoneyData.AgentID = AgentId;
money.MoneyData.TransactionID = transaction;
money.MoneyData.TransactionSuccess = success;
@@ -890,7 +890,7 @@ namespace OpenSim.Region.ClientStack
public void SendStartPingCheck(byte seq)
{
- StartPingCheckPacket pc = (StartPingCheckPacket) PacketPool.Instance.GetPacket(PacketType.StartPingCheck);
+ StartPingCheckPacket pc = new StartPingCheckPacket();
pc.PingID.PingID = seq;
pc.Header.Reliable = false;
OutPacket(pc, ThrottleOutPacketType.Task);
@@ -898,7 +898,7 @@ namespace OpenSim.Region.ClientStack
public void SendKillObject(ulong regionHandle, uint localID)
{
- KillObjectPacket kill = (KillObjectPacket) PacketPool.Instance.GetPacket(PacketType.KillObject);
+ KillObjectPacket kill = new KillObjectPacket();
// TODO: don't create new blocks if recycling an old packet
kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1];
kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock();
@@ -1092,7 +1092,7 @@ namespace OpenSim.Region.ClientStack
private InventoryDescendentsPacket CreateInventoryDescendentsPacket(LLUUID ownerID, LLUUID folderID)
{
- InventoryDescendentsPacket descend = (InventoryDescendentsPacket) PacketPool.Instance.GetPacket(PacketType.InventoryDescendents);
+ InventoryDescendentsPacket descend = new InventoryDescendentsPacket();
descend.AgentData.AgentID = AgentId;
descend.AgentData.OwnerID = ownerID;
descend.AgentData.FolderID = folderID;
@@ -1105,7 +1105,7 @@ namespace OpenSim.Region.ClientStack
{
Encoding enc = Encoding.ASCII;
uint FULL_MASK_PERMISSIONS = 2147483647;
- FetchInventoryReplyPacket inventoryReply = (FetchInventoryReplyPacket) PacketPool.Instance.GetPacket(PacketType.FetchInventoryReply);
+ FetchInventoryReplyPacket inventoryReply = new FetchInventoryReplyPacket();
// TODO: don't create new blocks if recycling an old packet
inventoryReply.AgentData.AgentID = AgentId;
inventoryReply.InventoryData = new FetchInventoryReplyPacket.InventoryDataBlock[1];
@@ -1147,7 +1147,7 @@ namespace OpenSim.Region.ClientStack
{
Encoding enc = Encoding.ASCII;
uint FULL_MASK_PERMISSIONS = 2147483647;
- UpdateCreateInventoryItemPacket InventoryReply = (UpdateCreateInventoryItemPacket) PacketPool.Instance.GetPacket(PacketType.UpdateCreateInventoryItem);
+ UpdateCreateInventoryItemPacket InventoryReply = new UpdateCreateInventoryItemPacket();
// TODO: don't create new blocks if recycling an old packet
InventoryReply.AgentData.AgentID = AgentId;
InventoryReply.AgentData.SimApproved = true;
@@ -1186,7 +1186,7 @@ namespace OpenSim.Region.ClientStack
public void SendRemoveInventoryItem(LLUUID itemID)
{
- RemoveInventoryItemPacket remove = (RemoveInventoryItemPacket) PacketPool.Instance.GetPacket(PacketType.RemoveInventoryItem);
+ RemoveInventoryItemPacket remove = new RemoveInventoryItemPacket();
// TODO: don't create new blocks if recycling an old packet
remove.AgentData.AgentID = AgentId;
remove.AgentData.SessionID = m_sessionId;
@@ -1199,7 +1199,7 @@ namespace OpenSim.Region.ClientStack
public void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName)
{
- ReplyTaskInventoryPacket replytask = (ReplyTaskInventoryPacket) PacketPool.Instance.GetPacket(PacketType.ReplyTaskInventory);
+ ReplyTaskInventoryPacket replytask = new ReplyTaskInventoryPacket();
replytask.InventoryData.TaskID = taskID;
replytask.InventoryData.Serial = serial;
replytask.InventoryData.Filename = fileName;
@@ -1208,7 +1208,7 @@ namespace OpenSim.Region.ClientStack
public void SendXferPacket(ulong xferID, uint packet, byte[] data)
{
- SendXferPacketPacket sendXfer = (SendXferPacketPacket) PacketPool.Instance.GetPacket(PacketType.SendXferPacket);
+ SendXferPacketPacket sendXfer = new SendXferPacketPacket();
sendXfer.XferID.ID = xferID;
sendXfer.XferID.Packet = packet;
sendXfer.DataPacket.Data = data;
@@ -1226,7 +1226,7 @@ namespace OpenSim.Region.ClientStack
///
public void SendAlertMessage(string message)
{
- AlertMessagePacket alertPack = (AlertMessagePacket) PacketPool.Instance.GetPacket(PacketType.AlertMessage);
+ AlertMessagePacket alertPack = new AlertMessagePacket();
alertPack.AlertData.Message = Helpers.StringToField(message);
OutPacket(alertPack, ThrottleOutPacketType.Task);
}
@@ -1238,7 +1238,7 @@ namespace OpenSim.Region.ClientStack
///
public void SendAgentAlertMessage(string message, bool modal)
{
- AgentAlertMessagePacket alertPack = (AgentAlertMessagePacket) PacketPool.Instance.GetPacket(PacketType.AgentAlertMessage);
+ AgentAlertMessagePacket alertPack = new AgentAlertMessagePacket();
alertPack.AgentData.AgentID = AgentId;
alertPack.AlertData.Message = Helpers.StringToField(message);
alertPack.AlertData.Modal = modal;
@@ -1248,7 +1248,7 @@ namespace OpenSim.Region.ClientStack
public void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message,
string url)
{
- LoadURLPacket loadURL = (LoadURLPacket) PacketPool.Instance.GetPacket(PacketType.LoadURL);
+ LoadURLPacket loadURL = new LoadURLPacket();
loadURL.Data.ObjectName = Helpers.StringToField(objectname);
loadURL.Data.ObjectID = objectID;
loadURL.Data.OwnerID = ownerID;
@@ -1274,7 +1274,7 @@ namespace OpenSim.Region.ClientStack
public void SendPlayAttachedSound(LLUUID soundID, LLUUID objectID, LLUUID ownerID, float gain, byte flags)
{
- AttachedSoundPacket sound = (AttachedSoundPacket) PacketPool.Instance.GetPacket(PacketType.AttachedSound);
+ AttachedSoundPacket sound = new AttachedSoundPacket();
sound.DataBlock.SoundID = soundID;
sound.DataBlock.ObjectID = objectID;
sound.DataBlock.OwnerID = ownerID;
@@ -1286,7 +1286,7 @@ namespace OpenSim.Region.ClientStack
public void SendSunPos(LLVector3 sunPos, LLVector3 sunVel)
{
- SimulatorViewerTimeMessagePacket viewertime = (SimulatorViewerTimeMessagePacket) PacketPool.Instance.GetPacket(PacketType.SimulatorViewerTimeMessage);
+ SimulatorViewerTimeMessagePacket viewertime = new SimulatorViewerTimeMessagePacket();
viewertime.TimeInfo.SunDirection = sunPos;
viewertime.TimeInfo.SunAngVelocity = sunVel;
viewertime.TimeInfo.UsecSinceStart = (ulong) Util.UnixTimeSinceEpoch();
@@ -1296,7 +1296,7 @@ namespace OpenSim.Region.ClientStack
public void SendViewerTime(int phase)
{
Console.WriteLine("SunPhase: {0}", phase);
- SimulatorViewerTimeMessagePacket viewertime = (SimulatorViewerTimeMessagePacket) PacketPool.Instance.GetPacket(PacketType.SimulatorViewerTimeMessage);
+ SimulatorViewerTimeMessagePacket viewertime = new SimulatorViewerTimeMessagePacket();
//viewertime.TimeInfo.SecPerDay = 86400;
//viewertime.TimeInfo.SecPerYear = 31536000;
viewertime.TimeInfo.SecPerDay = 1000;
@@ -1345,7 +1345,7 @@ namespace OpenSim.Region.ClientStack
string flAbout, uint flags, LLUUID flImageID, LLUUID imageID, string profileURL,
LLUUID partnerID)
{
- AvatarPropertiesReplyPacket avatarReply = (AvatarPropertiesReplyPacket) PacketPool.Instance.GetPacket(PacketType.AvatarPropertiesReply);
+ AvatarPropertiesReplyPacket avatarReply = new AvatarPropertiesReplyPacket();
avatarReply.AgentData.AgentID = AgentId;
avatarReply.AgentData.AvatarID = avatarID;
avatarReply.PropertiesData.AboutText = Helpers.StringToField(aboutText);
@@ -1370,7 +1370,7 @@ namespace OpenSim.Region.ClientStack
///
public void SendWearables(AvatarWearable[] wearables, int serial)
{
- AgentWearablesUpdatePacket aw = (AgentWearablesUpdatePacket) PacketPool.Instance.GetPacket(PacketType.AgentWearablesUpdate);
+ AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket();
aw.AgentData.AgentID = AgentId;
aw.AgentData.SerialNum = (uint) serial;
aw.AgentData.SessionID = m_sessionId;
@@ -1398,7 +1398,7 @@ namespace OpenSim.Region.ClientStack
///
public void SendAppearance(LLUUID agentID, byte[] visualParams, byte[] textureEntry)
{
- AvatarAppearancePacket avp = (AvatarAppearancePacket) PacketPool.Instance.GetPacket(PacketType.AvatarAppearance);
+ AvatarAppearancePacket avp = new AvatarAppearancePacket();
// TODO: don't create new blocks if recycling an old packet
avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218];
avp.ObjectData.TextureEntry = textureEntry;
@@ -1418,7 +1418,7 @@ namespace OpenSim.Region.ClientStack
public void SendAnimations(LLUUID[] animations, int[] seqs, LLUUID sourceAgentId)
{
- AvatarAnimationPacket ani = (AvatarAnimationPacket) PacketPool.Instance.GetPacket(PacketType.AvatarAnimation);
+ AvatarAnimationPacket ani = new AvatarAnimationPacket();
// TODO: don't create new blocks if recycling an old packet
ani.AnimationSourceList = new AvatarAnimationPacket.AnimationSourceListBlock[1];
ani.AnimationSourceList[0] = new AvatarAnimationPacket.AnimationSourceListBlock();
@@ -1453,7 +1453,7 @@ namespace OpenSim.Region.ClientStack
public void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID,
uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID)
{
- ObjectUpdatePacket objupdate = (ObjectUpdatePacket) PacketPool.Instance.GetPacket(PacketType.ObjectUpdate);
+ ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
// TODO: don't create new blocks if recycling an old packet
objupdate.RegionData.RegionHandle = regionHandle;
objupdate.RegionData.TimeDilation = 64096;
@@ -1486,7 +1486,7 @@ namespace OpenSim.Region.ClientStack
{
ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock =
CreateAvatarImprovedBlock(localID, position, velocity, rotation);
- ImprovedTerseObjectUpdatePacket terse = (ImprovedTerseObjectUpdatePacket) PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate);
+ ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
// TODO: don't create new blocks if recycling an old packet
terse.RegionData.RegionHandle = regionHandle;
terse.RegionData.TimeDilation = timeDilation;
@@ -1498,7 +1498,7 @@ namespace OpenSim.Region.ClientStack
public void SendCoarseLocationUpdate(List CoarseLocations)
{
- CoarseLocationUpdatePacket loc = (CoarseLocationUpdatePacket) PacketPool.Instance.GetPacket(PacketType.CoarseLocationUpdate);
+ CoarseLocationUpdatePacket loc = new CoarseLocationUpdatePacket();
// TODO: don't create new blocks if recycling an old packet
int total = CoarseLocations.Count;
CoarseLocationUpdatePacket.IndexBlock ib =
@@ -1531,7 +1531,7 @@ namespace OpenSim.Region.ClientStack
///
public void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint)
{
- ObjectAttachPacket attach = (ObjectAttachPacket) PacketPool.Instance.GetPacket(PacketType.ObjectAttach);
+ ObjectAttachPacket attach = new ObjectAttachPacket();
// TODO: don't create new blocks if recycling an old packet
attach.AgentData.AgentID = AgentId;
attach.AgentData.SessionID = m_sessionId;
@@ -1551,7 +1551,7 @@ namespace OpenSim.Region.ClientStack
LLUUID objectID, LLUUID ownerID, string text, byte[] color, uint parentID, byte[] particleSystem,
LLQuaternion rotation, byte clickAction)
{
- ObjectUpdatePacket outPacket = (ObjectUpdatePacket) PacketPool.Instance.GetPacket(PacketType.ObjectUpdate);
+ ObjectUpdatePacket outPacket = new ObjectUpdatePacket();
// TODO: don't create new blocks if recycling an old packet
outPacket.RegionData.RegionHandle = regionHandle;
outPacket.RegionData.TimeDilation = timeDilation;
@@ -1595,7 +1595,7 @@ namespace OpenSim.Region.ClientStack
{
LLVector3 velocity = new LLVector3(0f, 0f, 0f);
LLVector3 rotationalvelocity = new LLVector3(0f, 0f, 0f);
- ImprovedTerseObjectUpdatePacket terse = (ImprovedTerseObjectUpdatePacket) PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate);
+ ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
// TODO: don't create new blocks if recycling an old packet
terse.RegionData.RegionHandle = regionHandle;
terse.RegionData.TimeDilation = timeDilation;
@@ -1608,7 +1608,7 @@ namespace OpenSim.Region.ClientStack
public void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position,
LLQuaternion rotation, LLVector3 velocity, LLVector3 rotationalvelocity)
{
- ImprovedTerseObjectUpdatePacket terse = (ImprovedTerseObjectUpdatePacket) PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate);
+ ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
// TODO: don't create new blocks if recycling an old packet
terse.RegionData.RegionHandle = regionHandle;
terse.RegionData.TimeDilation = timeDilation;
@@ -1946,8 +1946,8 @@ namespace OpenSim.Region.ClientStack
public void SendNameReply(LLUUID profileId, string firstname, string lastname)
{
- UUIDNameReplyPacket packet = (UUIDNameReplyPacket) PacketPool.Instance.GetPacket(PacketType.UUIDNameReply);
- // TODO: don't create new blocks if recycling an old packet
+ UUIDNameReplyPacket packet = new UUIDNameReplyPacket();
+
packet.UUIDNameBlock = new UUIDNameReplyPacket.UUIDNameBlockBlock[1];
packet.UUIDNameBlock[0] = new UUIDNameReplyPacket.UUIDNameBlockBlock();
packet.UUIDNameBlock[0].ID = profileId;
@@ -1995,7 +1995,7 @@ namespace OpenSim.Region.ClientStack
{
//System.Console.WriteLine("texture cached: " + packet.ToString());
AgentCachedTexturePacket chechedtex = (AgentCachedTexturePacket) packet;
- AgentCachedTextureResponsePacket cachedresp = (AgentCachedTextureResponsePacket) PacketPool.Instance.GetPacket(PacketType.AgentCachedTextureResponse);
+ AgentCachedTextureResponsePacket cachedresp = new AgentCachedTextureResponsePacket();
// TODO: don't create new blocks if recycling an old packet
cachedresp.AgentData.AgentID = AgentId;
cachedresp.AgentData.SessionID = m_sessionId;
@@ -2156,7 +2156,7 @@ namespace OpenSim.Region.ClientStack
{
//should be getting the map layer from the grid server
//send a layer covering the 800,800 - 1200,1200 area (should be covering the requested area)
- MapLayerReplyPacket mapReply = (MapLayerReplyPacket) PacketPool.Instance.GetPacket(PacketType.MapLayerReply);
+ MapLayerReplyPacket mapReply = new MapLayerReplyPacket();
// TODO: don't create new blocks if recycling an old packet
mapReply.AgentData.AgentID = AgentId;
mapReply.AgentData.Flags = 0;
@@ -2301,18 +2301,22 @@ namespace OpenSim.Region.ClientStack
// Actually make the byte array and send it
try
{
- byte[] sendbuffer = Pack.ToBytes();
- PacketPool.Instance.ReturnPacket(Pack);
-
- if (Pack.Header.Zerocoded)
- {
- int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer);
- m_networkServer.SendPacketTo(ZeroOutBuffer, packetsize, SocketFlags.None, m_circuitCode);
- }
- else
- {
- m_networkServer.SendPacketTo(sendbuffer, sendbuffer.Length, SocketFlags.None, m_circuitCode);
- }
+ byte[] sendbuffer = Pack.ToBytes();
+ if (Pack is RegionHandshakePacket)
+ {
+ PacketPool.Instance.ReturnPacket(Pack);
+ }
+
+ if (Pack.Header.Zerocoded)
+ {
+ byte[] ZeroOutBuffer = new byte[4096];
+ int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer);
+ m_networkServer.SendPacketTo(ZeroOutBuffer, packetsize, SocketFlags.None, m_circuitCode);
+ }
+ else
+ {
+ m_networkServer.SendPacketTo(sendbuffer, sendbuffer.Length, SocketFlags.None, m_circuitCode);
+ }
}
catch (Exception e)
{
@@ -2358,7 +2362,7 @@ namespace OpenSim.Region.ClientStack
{
//reply to pingcheck
StartPingCheckPacket startPing = (StartPingCheckPacket) NewPack;
- CompletePingCheckPacket endPing = (CompletePingCheckPacket) PacketPool.Instance.GetPacket(PacketType.CompletePingCheck);
+ CompletePingCheckPacket endPing = new CompletePingCheckPacket();
endPing.PingID.PingID = startPing.PingID.PingID;
OutPacket(endPing, ThrottleOutPacketType.Task);
}
@@ -2387,7 +2391,7 @@ namespace OpenSim.Region.ClientStack
{
if (Pack.Header.Reliable)
{
- PacketAckPacket ack_it = (PacketAckPacket) PacketPool.Instance.GetPacket(PacketType.PacketAck);
+ PacketAckPacket ack_it = new PacketAckPacket();
// TODO: don't create new blocks if recycling an old packet
ack_it.Packets = new PacketAckPacket.PacketsBlock[1];
ack_it.Packets[0] = new PacketAckPacket.PacketsBlock();
@@ -2443,7 +2447,7 @@ namespace OpenSim.Region.ClientStack
//MainLog.Instance.Verbose("NETWORK", "Sending PacketAck");
int i = 0;
- PacketAckPacket acks = (PacketAckPacket) PacketPool.Instance.GetPacket(PacketType.PacketAck);
+ PacketAckPacket acks = new PacketAckPacket();
// TODO: don't create new blocks if recycling an old packet
acks.Packets = new PacketAckPacket.PacketsBlock[m_pendingAcks.Count];
@@ -2540,14 +2544,6 @@ namespace OpenSim.Region.ClientStack
ImprovedInstantMessagePacket msgpack = (ImprovedInstantMessagePacket) Pack;
string IMfromName = Util.FieldToString(msgpack.MessageBlock.FromAgentName);
string IMmessage = Helpers.FieldToUTF8String(msgpack.MessageBlock.Message);
- //byte[] msgpack.MessageBlock.BinaryBucket;
- //bool msgpack.MessageBlock.FromGroup;
-
- //byte msgpack.MessageBlock.Offline;
- //uint msgpack.MessageBlock.ParentEstateID;
- //LLVector3 msgpack.MessageBlock.Position;
- //LLUUID msgpack.MessageBlock.RegionID;
-
if (OnInstantMessage != null)
{
OnInstantMessage(msgpack.AgentData.AgentID, msgpack.AgentData.SessionID,
@@ -2555,7 +2551,7 @@ namespace OpenSim.Region.ClientStack
msgpack.MessageBlock.Timestamp, IMfromName, IMmessage,
msgpack.MessageBlock.Dialog, msgpack.MessageBlock.FromGroup,
msgpack.MessageBlock.Offline, msgpack.MessageBlock.ParentEstateID,
- msgpack.MessageBlock.Position, msgpack.MessageBlock.RegionID,
+ msgpack.MessageBlock.Position, msgpack.MessageBlock.RegionID,
msgpack.MessageBlock.BinaryBucket);
}
break;
@@ -2571,19 +2567,14 @@ namespace OpenSim.Region.ClientStack
//rezPacket.RezData.RemoveItem;
//rezPacket.RezData.RezSelected;
//rezPacket.RezData.FromTaskID;
- //rezPacket.RezData.FromTaskID;
- //rezPacket.RezData.EveryoneMask;
- //rezPacket.RezData.GroupMask;
- //rezPacket.RezData.NextOwnerMask;
-
//MainLog.Instance.Verbose("REZData", rezPacket.ToString());
- OnRezObject(this, rezPacket.InventoryData.ItemID, rezPacket.RezData.RayEnd,
- rezPacket.RezData.RayStart,rezPacket.RezData.RayTargetID,
- rezPacket.RezData.BypassRaycast,rezPacket.RezData.RayEndIsIntersection,
- rezPacket.RezData.EveryoneMask,rezPacket.RezData.GroupMask,
- rezPacket.RezData.NextOwnerMask,rezPacket.RezData.ItemFlags,
- rezPacket.RezData.RezSelected,rezPacket.RezData.RemoveItem,
- rezPacket.RezData.FromTaskID);
+ OnRezObject(this, rezPacket.InventoryData.ItemID, rezPacket.RezData.RayEnd,
+ rezPacket.RezData.RayStart, rezPacket.RezData.RayTargetID,
+ rezPacket.RezData.BypassRaycast, rezPacket.RezData.RayEndIsIntersection,
+ rezPacket.RezData.EveryoneMask, rezPacket.RezData.GroupMask,
+ rezPacket.RezData.NextOwnerMask, rezPacket.RezData.ItemFlags,
+ rezPacket.RezData.RezSelected, rezPacket.RezData.RemoveItem,
+ rezPacket.RezData.FromTaskID);
}
break;
case PacketType.DeRezObject:
@@ -2762,6 +2753,12 @@ namespace OpenSim.Region.ClientStack
{
ObjectAddPacket addPacket = (ObjectAddPacket) Pack;
PrimitiveBaseShape shape = GetShapeFromAddPacket(addPacket);
+ MainLog.Instance.Verbose("REZData", addPacket.ToString());
+ //BypassRaycast: 1
+ //RayStart: <69.79469, 158.2652, 98.40343>
+ //RayEnd: <61.97724, 141.995, 92.58341>
+ //RayTargetID: 00000000-0000-0000-0000-000000000000
+
OnAddPrim(AgentId, addPacket.ObjectData.RayEnd, addPacket.ObjectData.Rotation, shape,addPacket.ObjectData.BypassRaycast,addPacket.ObjectData.RayStart,addPacket.ObjectData.RayTargetID,addPacket.ObjectData.RayEndIsIntersection);
}
break;
@@ -2884,9 +2881,10 @@ namespace OpenSim.Region.ClientStack
break;
case PacketType.ObjectPermissions:
MainLog.Instance.Warn("CLIENT", "unhandled packet " + PacketType.ObjectPermissions.ToString());
- ObjectPermissionsPacket newobjPerms = (ObjectPermissionsPacket)Pack;
+ ObjectPermissionsPacket newobjPerms = (ObjectPermissionsPacket) Pack;
- List permChanges = new List();
+ List permChanges =
+ new List();
for (int i = 0; i < newobjPerms.ObjectData.Length; i++)
{
@@ -2916,7 +2914,7 @@ namespace OpenSim.Region.ClientStack
case PacketType.RequestObjectPropertiesFamily:
//This powers the little tooltip that appears when you move your mouse over an object
- RequestObjectPropertiesFamilyPacket packToolTip = (RequestObjectPropertiesFamilyPacket)Pack;
+ RequestObjectPropertiesFamilyPacket packToolTip = (RequestObjectPropertiesFamilyPacket) Pack;
RequestObjectPropertiesFamilyPacket.ObjectDataBlock packObjBlock = packToolTip.ObjectData;
@@ -3020,7 +3018,7 @@ namespace OpenSim.Region.ClientStack
case PacketType.MoveInventoryFolder:
if (OnMoveInventoryFolder != null)
{
- MoveInventoryFolderPacket invFolder = (MoveInventoryFolderPacket)Pack;
+ MoveInventoryFolderPacket invFolder = (MoveInventoryFolderPacket) Pack;
for (int i = 0; i < invFolder.InventoryData.Length; i++)
{
OnMoveInventoryFolder(this, invFolder.InventoryData[i].FolderID,
@@ -3127,7 +3125,7 @@ namespace OpenSim.Region.ClientStack
}
break;
case PacketType.MoveInventoryItem:
- MoveInventoryItemPacket moveitem = (MoveInventoryItemPacket)Pack;
+ MoveInventoryItemPacket moveitem = (MoveInventoryItemPacket) Pack;
if (OnMoveInventoryItem != null)
{
foreach (MoveInventoryItemPacket.InventoryDataBlock datablock in moveitem.InventoryData)
@@ -3196,11 +3194,11 @@ namespace OpenSim.Region.ClientStack
case PacketType.TeleportLandmarkRequest:
TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket) Pack;
- TeleportStartPacket tpStart = (TeleportStartPacket) PacketPool.Instance.GetPacket(PacketType.TeleportStart);
+ TeleportStartPacket tpStart = new TeleportStartPacket();
tpStart.Info.TeleportFlags = 8; // tp via lm
OutPacket(tpStart, ThrottleOutPacketType.Task);
- TeleportProgressPacket tpProgress = (TeleportProgressPacket) PacketPool.Instance.GetPacket(PacketType.TeleportProgress);
+ TeleportProgressPacket tpProgress = new TeleportProgressPacket();
tpProgress.Info.Message = (new ASCIIEncoding()).GetBytes("sending_landmark");
tpProgress.Info.TeleportFlags = 8;
tpProgress.AgentData.AgentID = tpReq.Info.AgentID;
@@ -3215,7 +3213,7 @@ namespace OpenSim.Region.ClientStack
if (lm.RegionID == m_scene.RegionInfo.RegionID)
{
- TeleportLocalPacket tpLocal = (TeleportLocalPacket) PacketPool.Instance.GetPacket(PacketType.TeleportLocal);
+ TeleportLocalPacket tpLocal = new TeleportLocalPacket();
tpLocal.Info.AgentID = tpReq.Info.AgentID;
tpLocal.Info.TeleportFlags = 8; // Teleport via landmark
@@ -3225,7 +3223,7 @@ namespace OpenSim.Region.ClientStack
}
else
{
- TeleportCancelPacket tpCancel = (TeleportCancelPacket) PacketPool.Instance.GetPacket(PacketType.TeleportCancel);
+ TeleportCancelPacket tpCancel = new TeleportCancelPacket();
tpCancel.Info.AgentID = tpReq.Info.AgentID;
tpCancel.Info.SessionID = tpReq.Info.SessionID;
OutPacket(tpCancel, ThrottleOutPacketType.Task);
@@ -3235,7 +3233,7 @@ namespace OpenSim.Region.ClientStack
{
Console.WriteLine("Cancelling Teleport - fetch asset not yet implemented");
- TeleportCancelPacket tpCancel = (TeleportCancelPacket) PacketPool.Instance.GetPacket(PacketType.TeleportCancel);
+ TeleportCancelPacket tpCancel = new TeleportCancelPacket();
tpCancel.Info.AgentID = tpReq.Info.AgentID;
tpCancel.Info.SessionID = tpReq.Info.SessionID;
OutPacket(tpCancel, ThrottleOutPacketType.Task);
@@ -3253,7 +3251,7 @@ namespace OpenSim.Region.ClientStack
else
{
//no event handler so cancel request
- TeleportCancelPacket tpCancel = (TeleportCancelPacket) PacketPool.Instance.GetPacket(PacketType.TeleportCancel);
+ TeleportCancelPacket tpCancel = new TeleportCancelPacket();
tpCancel.Info.SessionID = tpLocReq.AgentData.SessionID;
tpCancel.Info.AgentID = tpLocReq.AgentData.AgentID;
OutPacket(tpCancel, ThrottleOutPacketType.Task);
@@ -3561,7 +3559,7 @@ namespace OpenSim.Region.ClientStack
public void SendLogoutPacket()
{
- LogoutReplyPacket logReply = (LogoutReplyPacket) PacketPool.Instance.GetPacket(PacketType.LogoutReply);
+ LogoutReplyPacket logReply = new LogoutReplyPacket();
// TODO: don't create new blocks if recycling an old packet
logReply.AgentData.AgentID = AgentId;
logReply.AgentData.SessionID = SessionId;
diff --git a/OpenSim/Region/Environment/LandManagement/Land.cs b/OpenSim/Region/Environment/LandManagement/Land.cs
index 5c99ffd..bd26fdf 100644
--- a/OpenSim/Region/Environment/LandManagement/Land.cs
+++ b/OpenSim/Region/Environment/LandManagement/Land.cs
@@ -111,7 +111,7 @@ namespace OpenSim.Region.Environment.LandManagement
public void sendLandProperties(int sequence_id, bool snap_selection, int request_result,
IClientAPI remote_client)
{
- ParcelPropertiesPacket updatePacket = (ParcelPropertiesPacket) PacketPool.Instance.GetPacket(PacketType.ParcelProperties);
+ ParcelPropertiesPacket updatePacket = new ParcelPropertiesPacket();
// TODO: don't create new blocks if recycling an old packet
updatePacket.ParcelData.AABBMax = landData.AABBMax;
@@ -337,7 +337,7 @@ namespace OpenSim.Region.Environment.LandManagement
if (flags == (uint) ParcelManager.AccessList.Access || flags == (uint) ParcelManager.AccessList.Both)
{
- replyPacket = (ParcelAccessListReplyPacket) PacketPool.Instance.GetPacket(PacketType.ParcelAccessListReply);
+ replyPacket = new ParcelAccessListReplyPacket();
replyPacket.Data.AgentID = agentID;
replyPacket.Data.Flags = (uint) ParcelManager.AccessList.Access;
replyPacket.Data.LocalID = landData.localID;
@@ -349,7 +349,7 @@ namespace OpenSim.Region.Environment.LandManagement
if (flags == (uint) ParcelManager.AccessList.Ban || flags == (uint) ParcelManager.AccessList.Both)
{
- replyPacket = (ParcelAccessListReplyPacket) PacketPool.Instance.GetPacket(PacketType.ParcelAccessListReply);
+ replyPacket = new ParcelAccessListReplyPacket();
replyPacket.Data.AgentID = agentID;
replyPacket.Data.Flags = (uint) ParcelManager.AccessList.Ban;
replyPacket.Data.LocalID = landData.localID;
@@ -660,7 +660,7 @@ namespace OpenSim.Region.Environment.LandManagement
bool firstCall = true;
int MAX_OBJECTS_PER_PACKET = 251;
- ForceObjectSelectPacket pack = (ForceObjectSelectPacket) PacketPool.Instance.GetPacket(PacketType.ForceObjectSelect);
+ ForceObjectSelectPacket pack = new ForceObjectSelectPacket();
// TODO: don't create new blocks if recycling an old packet
ForceObjectSelectPacket.DataBlock[] data;
while (resultLocalIDs.Count > 0)
@@ -699,7 +699,7 @@ namespace OpenSim.Region.Environment.LandManagement
public void sendLandObjectOwners(IClientAPI remote_client)
{
Dictionary ownersAndCount = new Dictionary();
- ParcelObjectOwnersReplyPacket pack = (ParcelObjectOwnersReplyPacket) PacketPool.Instance.GetPacket(PacketType.ParcelObjectOwnersReply);
+ ParcelObjectOwnersReplyPacket pack = new ParcelObjectOwnersReplyPacket();
// TODO: don't create new blocks if recycling an old packet
foreach (SceneObjectGroup obj in primsOverMe)
diff --git a/OpenSim/Region/Environment/LandManagement/LandManager.cs b/OpenSim/Region/Environment/LandManagement/LandManager.cs
index 22e7fc9..d463964 100644
--- a/OpenSim/Region/Environment/LandManagement/LandManager.cs
+++ b/OpenSim/Region/Environment/LandManagement/LandManager.cs
@@ -494,7 +494,7 @@ namespace OpenSim.Region.Environment.LandManagement
if (byteArrayCount >= LAND_BLOCKS_PER_PACKET)
{
byteArrayCount = 0;
- packet = (ParcelOverlayPacket) PacketPool.Instance.GetPacket(PacketType.ParcelOverlay);
+ packet = new ParcelOverlayPacket();
packet.ParcelData.Data = byteArray;
packet.ParcelData.SequenceID = sequenceID;
remote_client.OutPacket((Packet) packet, ThrottleOutPacketType.Task);
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index 1a77565..5b46040 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -557,7 +557,7 @@ namespace OpenSim.Region.Environment.Scenes
if (rezAsset != null)
{
- string script = Util.FieldToString(rezAsset.Data);
+ string script = Helpers.FieldToUTF8String(rezAsset.Data);
EventManager.TriggerRezScript(localID, copyID, script);
rezzed = true;
}
@@ -733,7 +733,7 @@ namespace OpenSim.Region.Environment.Scenes
if (rezAsset != null)
{
- AddRezObject(Util.FieldToString(rezAsset.Data), pos);
+ AddRezObject(Helpers.FieldToUTF8String(rezAsset.Data), pos);
//userInfo.DeleteItem(remoteClient.AgentId, item);
//remoteClient.SendRemoveInventoryItem(itemID);
}
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
index 647fbf4..af4573b 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
@@ -166,7 +166,7 @@ namespace OpenSim.Region.Environment.Scenes
List AvatarResponses = new List();
AvatarResponses = CommsManager.GenerateAgentPickerRequestResponse(RequestID, query);
- AvatarPickerReplyPacket replyPacket = (AvatarPickerReplyPacket) PacketPool.Instance.GetPacket(PacketType.AvatarPickerReply);
+ AvatarPickerReplyPacket replyPacket = new AvatarPickerReplyPacket();
// TODO: don't create new blocks if recycling an old packet
AvatarPickerReplyPacket.DataBlock[] searchData =
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 89b68de..d710e49 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -931,7 +931,6 @@ namespace OpenSim.Region.Environment.Scenes
if (RayEndIsIntersection == (byte)1)
{
pos = RayEnd;
- pos.Z += 0.25F;
return pos;
}
if (RayTargetID != LLUUID.Zero)
@@ -987,14 +986,13 @@ namespace OpenSim.Region.Environment.Scenes
- pos.Z += 0.25F;
+
return pos;
}
else
{
// fall back to our stupid functionality
pos = RayEnd;
- pos.Z += 0.25F;
return pos;
}
}
@@ -1002,7 +1000,6 @@ namespace OpenSim.Region.Environment.Scenes
{
// fall back to our stupid functionality
pos = RayEnd;
- pos.Z += 0.25F;
return pos;
}
@@ -1012,7 +1009,12 @@ namespace OpenSim.Region.Environment.Scenes
byte bypassRaycast, LLVector3 RayStart, LLUUID RayTargetID,
byte RayEndIsIntersection)
{
-
+ // What we're *supposed* to do is raytrace from the camera position given by the client to the nearest collision
+ // in the direction the client supplies (the ground level that we clicked)
+ // This function is pretty crappy right now.. so we're not affecting where the newly rezzed objects go
+ // Test it if you like. The console will write where it guesses a collision took place. if it thinks one did.
+ // It's wrong many times though.
+
LLVector3 pos = GetNewRezLocation(RayStart, RayEnd, RayTargetID, rot, bypassRaycast, RayEndIsIntersection);
@@ -1020,40 +1022,36 @@ namespace OpenSim.Region.Environment.Scenes
if (PermissionsMngr.CanRezObject(ownerID, pos))
{
- // rez ON the ground, not IN the ground
-
-
- AddNewPrim(ownerID, pos, rot, shape);
- }
- }
-
- public virtual void AddNewPrim(LLUUID ownerID, LLVector3 pos, LLQuaternion rot, PrimitiveBaseShape shape)
- {
- SceneObjectGroup sceneOb =
- new SceneObjectGroup(this, m_regionHandle, ownerID, PrimIDAllocate(), pos, rot, shape);
- AddEntity(sceneOb);
- SceneObjectPart rootPart = sceneOb.GetChildPart(sceneOb.UUID);
- // if grass or tree, make phantom
- //rootPart.ApplySanePermissions();
- if ((rootPart.Shape.PCode == 95) || (rootPart.Shape.PCode == 255) || (rootPart.Shape.PCode == 111))
- {
- rootPart.AddFlag(LLObject.ObjectFlags.Phantom);
- //rootPart.ObjectFlags += (uint)LLObject.ObjectFlags.Phantom;
- }
- // if not phantom, add to physics
- bool UsePhysics = (((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) > 0) && m_physicalPrim);
- if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0)
- {
- rootPart.PhysActor =
- PhysicsScene.AddPrimShape(
- rootPart.Name,
- rootPart.Shape,
- new PhysicsVector(pos.X, pos.Y, pos.Z),
- new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z),
- new Quaternion(), UsePhysics);
- // subscribe to physics events.
- rootPart.DoPhysicsPropertyUpdate(UsePhysics, true);
+ // rez ON the ground, not IN the ground
+ pos.Z += 0.25F;
+
+
+ SceneObjectGroup sceneOb =
+ new SceneObjectGroup(this, m_regionHandle, ownerID, PrimIDAllocate(), pos, rot, shape);
+ AddEntity(sceneOb);
+ SceneObjectPart rootPart = sceneOb.GetChildPart(sceneOb.UUID);
+ // if grass or tree, make phantom
+ //rootPart.ApplySanePermissions();
+ if ((rootPart.Shape.PCode == 95) || (rootPart.Shape.PCode == 255) || (rootPart.Shape.PCode == 111))
+ {
+ rootPart.AddFlag(LLObject.ObjectFlags.Phantom);
+ //rootPart.ObjectFlags += (uint)LLObject.ObjectFlags.Phantom;
+ }
+ // if not phantom, add to physics
+ bool UsePhysics = (((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) > 0) && m_physicalPrim);
+ if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0)
+ {
+ rootPart.PhysActor =
+ PhysicsScene.AddPrimShape(
+ rootPart.Name,
+ rootPart.Shape,
+ new PhysicsVector(pos.X, pos.Y, pos.Z),
+ new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z),
+ new Quaternion(), UsePhysics);
+ // subscribe to physics events.
+ rootPart.DoPhysicsPropertyUpdate(UsePhysics, true);
+ }
}
}
@@ -1500,7 +1498,7 @@ namespace OpenSim.Region.Environment.Scenes
m_innerScene.removeUserCount(true);
}
// Tell a single agent to disconnect from the region.
- libsecondlife.Packets.DisableSimulatorPacket disable = (libsecondlife.Packets.DisableSimulatorPacket) PacketPool.Instance.GetPacket(libsecondlife.Packets.PacketType.DisableSimulator);
+ DisableSimulatorPacket disable = new DisableSimulatorPacket();
presence.ControllingClient.OutPacket(disable, ThrottleOutPacketType.Task);
}
}
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 0f8ce0b..3fc7aec 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -636,7 +636,7 @@ namespace OpenSim.Region.Environment.Scenes
public void ServiceObjectPropertiesFamilyRequest(IClientAPI remoteClient, LLUUID AgentID, uint RequestFlags)
{
//RootPart.ServiceObjectPropertiesFamilyRequest(remoteClient, AgentID, RequestFlags);
- ObjectPropertiesFamilyPacket objPropFamilyPack = (ObjectPropertiesFamilyPacket) PacketPool.Instance.GetPacket(PacketType.ObjectPropertiesFamily);
+ ObjectPropertiesFamilyPacket objPropFamilyPack = new ObjectPropertiesFamilyPacket();
// TODO: don't create new blocks if recycling an old packet
ObjectPropertiesFamilyPacket.ObjectDataBlock objPropDB = new ObjectPropertiesFamilyPacket.ObjectDataBlock();
@@ -677,32 +677,26 @@ namespace OpenSim.Region.Environment.Scenes
///
public override void Update()
{
- List parts = new List(m_parts.Values);
-
if (Util.GetDistanceTo(lastPhysGroupPos, AbsolutePosition) > 0.02)
{
- foreach (SceneObjectPart part in parts)
+ foreach (SceneObjectPart part in m_parts.Values)
{
if (part.UpdateFlag == 0) part.UpdateFlag = 1;
}
-
lastPhysGroupPos = AbsolutePosition;
}
-
if ((Math.Abs(lastPhysGroupRot.W - GroupRotation.W) > 0.1)
|| (Math.Abs(lastPhysGroupRot.X - GroupRotation.X) > 0.1)
|| (Math.Abs(lastPhysGroupRot.Y - GroupRotation.Y) > 0.1)
|| (Math.Abs(lastPhysGroupRot.Z - GroupRotation.Z) > 0.1))
{
- foreach (SceneObjectPart part in parts)
+ foreach (SceneObjectPart part in m_parts.Values)
{
if (part.UpdateFlag == 0) part.UpdateFlag = 1;
}
-
lastPhysGroupRot = GroupRotation;
}
-
- foreach (SceneObjectPart part in parts)
+ foreach (SceneObjectPart part in m_parts.Values)
{
part.SendScheduledUpdates();
}
@@ -1051,7 +1045,7 @@ namespace OpenSim.Region.Environment.Scenes
///
public void GetProperites(IClientAPI client)
{
- ObjectPropertiesPacket proper = (ObjectPropertiesPacket) PacketPool.Instance.GetPacket(PacketType.ObjectProperties);
+ ObjectPropertiesPacket proper = new ObjectPropertiesPacket();
// TODO: don't create new blocks if recycling an old packet
proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1];
@@ -1086,6 +1080,7 @@ namespace OpenSim.Region.Environment.Scenes
///
public void SetPartName(string name, uint localID)
{
+ name = name.Remove(name.Length - 1, 1);
SceneObjectPart part = GetChildPart(localID);
if (part != null)
{
diff --git a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs
index 5033965..d955fe7 100644
--- a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs
+++ b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs
@@ -83,7 +83,7 @@ namespace OpenSim.Region.Environment.Scenes
private void statsHeartBeat(object sender, EventArgs e)
{
m_report.Enabled = false;
- SimStatsPacket statpack = (SimStatsPacket) PacketPool.Instance.GetPacket(PacketType.SimStats);
+ SimStatsPacket statpack = new SimStatsPacket();
// TODO: don't create new blocks if recycling an old packet
SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[11];
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index a118e7c..335c3fc 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -404,18 +404,18 @@ namespace OpenSim.Region.Physics.OdePlugin
// ok -- let's stand up straight!
//d.Matrix3 StandUpRotationalMatrix = new d.Matrix3(0.8184158f, -0.5744568f, -0.0139677f, 0.5744615f, 0.8185215f, -0.004074608f, 0.01377355f, -0.004689182f, 0.9998941f);
//d.BodySetRotation(Body, ref StandUpRotationalMatrix);
- d.BodySetRotation(Body, ref m_StandUpRotation);
+ //d.BodySetRotation(Body, ref m_StandUpRotation);
// The above matrix was generated with the amazing standup routine below by danX0r *cheer*
- //d.Vector3 feet;
- //d.Vector3 head;
- //d.BodyGetRelPointPos(Body, 0.0f, 0.0f, -1.0f, out feet);
- //d.BodyGetRelPointPos(Body, 0.0f, 0.0f, 1.0f, out head);
- //float posture = head.Z - feet.Z;
+ d.Vector3 feet;
+ d.Vector3 head;
+ d.BodyGetRelPointPos(Body, 0.0f, 0.0f, -1.0f, out feet);
+ d.BodyGetRelPointPos(Body, 0.0f, 0.0f, 1.0f, out head);
+ float posture = head.Z - feet.Z;
// restoring force proportional to lack of posture:
- //float servo = (2.5f - posture) * POSTURE_SERVO;
- //d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, servo, 0.0f, 0.0f, 1.0f);
- //d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, -servo, 0.0f, 0.0f, -1.0f);
+ float servo = (2.5f - posture) * POSTURE_SERVO;
+ d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, servo, 0.0f, 0.0f, 1.0f);
+ d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, -servo, 0.0f, 0.0f, -1.0f);
//m_lastUpdateSent = false;
}
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index 006d829..f8ab8e7 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -300,11 +300,11 @@ namespace OpenSim.Region.Physics.OdePlugin
{
if (p2.PhysicsActorType == (int) ActorTypes.Agent)
{
- p2.CollidingObj = true;
+ //p2.CollidingObj = true;
//contacts[i].depth = 0.003f;
- p2.Velocity = p2.Velocity + new PhysicsVector(0, 0, 2.5f);
- OdeCharacter character = (OdeCharacter) p2;
- character.SetPidStatus(true);
+ //p2.Velocity = p2.Velocity + new PhysicsVector(0, 0, 2.5f);
+ //OdeCharacter character = (OdeCharacter) p2;
+ //character.SetPidStatus(true);
//contacts[i].pos = new d.Vector3(contacts[i].pos.X + (p1.Size.X / 2), contacts[i].pos.Y + (p1.Size.Y / 2), contacts[i].pos.Z + (p1.Size.Z / 2));
}
@@ -316,12 +316,12 @@ namespace OpenSim.Region.Physics.OdePlugin
if (p1.PhysicsActorType == (int) ActorTypes.Agent)
{
- p1.CollidingObj = true;
+ //p1.CollidingObj = true;
//contacts[i].depth = 0.003f;
- p1.Velocity = p1.Velocity + new PhysicsVector(0, 0, 2.5f);
+ //p1.Velocity = p1.Velocity + new PhysicsVector(0, 0, 2.5f);
//contacts[i].pos = new d.Vector3(contacts[i].pos.X + (p2.Size.X / 2), contacts[i].pos.Y + (p2.Size.Y / 2), contacts[i].pos.Z + (p2.Size.Z / 2));
- OdeCharacter character = (OdeCharacter)p1;
- character.SetPidStatus(true);
+ //OdeCharacter character = (OdeCharacter)p1;
+ //character.SetPidStatus(true);
}
else
{
--
cgit v1.1