* Modernized ScriptManager to new interface-based module calls.

* 'remove redundant this qualifier' ftw
afrisby
lbsa71 2007-09-19 00:30:55 +00:00
parent 3f6b3f6b59
commit 8f0b03597b
47 changed files with 1455 additions and 1460 deletions

View File

@ -39,7 +39,6 @@ using Avatar = OpenSim.Region.Environment.Scenes.ScenePresence;
namespace OpenSim.Region.Environment namespace OpenSim.Region.Environment
{ {
/// <summary> /// <summary>
/// Processes requests regarding estates. Refer to EstateSettings.cs in OpenSim.Framework. Types for all of the core settings /// Processes requests regarding estates. Refer to EstateSettings.cs in OpenSim.Framework. Types for all of the core settings
/// </summary> /// </summary>
@ -48,7 +47,7 @@ namespace OpenSim.Region.Environment
private Scene m_scene; private Scene m_scene;
private RegionInfo m_regInfo; private RegionInfo m_regInfo;
public EstateManager(Scene scene,RegionInfo reginfo) public EstateManager(Scene scene, RegionInfo reginfo)
{ {
m_scene = scene; m_scene = scene;
m_regInfo = reginfo; m_regInfo = reginfo;
@ -125,7 +124,8 @@ namespace OpenSim.Region.Environment
/// <param name="TerrainLowerLimit">Minimum amount terrain can be lowered from previous baking</param> /// <param name="TerrainLowerLimit">Minimum amount terrain can be lowered from previous baking</param>
/// <param name="UseFixedSun">Use a fixed time of day on the sun?</param> /// <param name="UseFixedSun">Use a fixed time of day on the sun?</param>
/// <param name="SunHour">The offset hour of the day</param> /// <param name="SunHour">The offset hour of the day</param>
public void setRegionSettings(float WaterHeight, float TerrainRaiseLimit, float TerrainLowerLimit, bool UseFixedSun, float SunHour) public void setRegionSettings(float WaterHeight, float TerrainRaiseLimit, float TerrainLowerLimit,
bool UseFixedSun, float SunHour)
{ {
// Water Height // Water Height
m_regInfo.estateSettings.waterHeight = WaterHeight; m_regInfo.estateSettings.waterHeight = WaterHeight;
@ -144,13 +144,12 @@ namespace OpenSim.Region.Environment
#region Packet Handlers #region Packet Handlers
public void handleEstateOwnerMessage(EstateOwnerMessagePacket packet, IClientAPI remote_client) public void handleEstateOwnerMessage(EstateOwnerMessagePacket packet, IClientAPI remote_client)
{ {
switch (Helpers.FieldToUTF8String(packet.MethodData.Method)) switch (Helpers.FieldToUTF8String(packet.MethodData.Method))
{ {
case "getinfo": case "getinfo":
this.sendRegionInfoPacketToAll(); sendRegionInfoPacketToAll();
break; break;
case "setregioninfo": case "setregioninfo":
if (m_scene.PermissionsMngr.CanEditEstateTerrain(remote_client.AgentId)) if (m_scene.PermissionsMngr.CanEditEstateTerrain(remote_client.AgentId))
@ -193,47 +192,54 @@ namespace OpenSim.Region.Environment
if (convertParamStringToBool(packet.ParamList[0].Parameter)) if (convertParamStringToBool(packet.ParamList[0].Parameter))
{ {
m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | Simulator.RegionFlags.BlockTerraform; m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags |
Simulator.RegionFlags.BlockTerraform;
} }
if (convertParamStringToBool(packet.ParamList[1].Parameter)) if (convertParamStringToBool(packet.ParamList[1].Parameter))
{ {
m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | Simulator.RegionFlags.NoFly; m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags |
Simulator.RegionFlags.NoFly;
} }
if (convertParamStringToBool(packet.ParamList[2].Parameter)) if (convertParamStringToBool(packet.ParamList[2].Parameter))
{ {
m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | Simulator.RegionFlags.AllowDamage; m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags |
Simulator.RegionFlags.AllowDamage;
} }
if (convertParamStringToBool(packet.ParamList[3].Parameter) == false) if (convertParamStringToBool(packet.ParamList[3].Parameter) == false)
{ {
m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | Simulator.RegionFlags.BlockLandResell; m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags |
Simulator.RegionFlags.BlockLandResell;
} }
int tempMaxAgents = Convert.ToInt16(Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[4].Parameter))); int tempMaxAgents =
m_regInfo.estateSettings.maxAgents = (byte)tempMaxAgents; Convert.ToInt16(Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[4].Parameter)));
m_regInfo.estateSettings.maxAgents = (byte) tempMaxAgents;
float tempObjectBonusFactor = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter)); float tempObjectBonusFactor =
(float) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter));
m_regInfo.estateSettings.objectBonusFactor = tempObjectBonusFactor; m_regInfo.estateSettings.objectBonusFactor = tempObjectBonusFactor;
int tempMatureLevel = Convert.ToInt16(Helpers.FieldToUTF8String(packet.ParamList[6].Parameter)); int tempMatureLevel = Convert.ToInt16(Helpers.FieldToUTF8String(packet.ParamList[6].Parameter));
m_regInfo.estateSettings.simAccess = (Simulator.SimAccess)tempMatureLevel; m_regInfo.estateSettings.simAccess = (Simulator.SimAccess) tempMatureLevel;
if (convertParamStringToBool(packet.ParamList[7].Parameter)) if (convertParamStringToBool(packet.ParamList[7].Parameter))
{ {
m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | Simulator.RegionFlags.RestrictPushObject; m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags |
Simulator.RegionFlags.RestrictPushObject;
} }
if (convertParamStringToBool(packet.ParamList[8].Parameter)) if (convertParamStringToBool(packet.ParamList[8].Parameter))
{ {
m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | Simulator.RegionFlags.AllowParcelChanges; m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags |
Simulator.RegionFlags.AllowParcelChanges;
} }
sendRegionInfoPacketToAll(); sendRegionInfoPacketToAll();
} }
} }
@ -245,11 +251,13 @@ namespace OpenSim.Region.Environment
} }
else else
{ {
float WaterHeight = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[0].Parameter)); float WaterHeight = (float) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[0].Parameter));
float TerrainRaiseLimit = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[1].Parameter)); float TerrainRaiseLimit =
float TerrainLowerLimit = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[2].Parameter)); (float) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[1].Parameter));
bool UseFixedSun = this.convertParamStringToBool(packet.ParamList[4].Parameter); float TerrainLowerLimit =
float SunHour = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter)); (float) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[2].Parameter));
bool UseFixedSun = convertParamStringToBool(packet.ParamList[4].Parameter);
float SunHour = (float) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter));
setRegionSettings(WaterHeight, TerrainRaiseLimit, TerrainLowerLimit, UseFixedSun, SunHour); setRegionSettings(WaterHeight, TerrainRaiseLimit, TerrainLowerLimit, UseFixedSun, SunHour);
@ -265,10 +273,9 @@ namespace OpenSim.Region.Environment
string[] splitField = s.Split(' '); string[] splitField = s.Split(' ');
if (splitField.Length == 3) if (splitField.Length == 3)
{ {
Int16 corner = Convert.ToInt16(splitField[0]); Int16 corner = Convert.ToInt16(splitField[0]);
float lowValue = (float)Convert.ToDecimal(splitField[1]); float lowValue = (float) Convert.ToDecimal(splitField[1]);
float highValue = (float)Convert.ToDecimal(splitField[2]); float highValue = (float) Convert.ToDecimal(splitField[2]);
setEstateTextureRange(corner, lowValue, highValue); setEstateTextureRange(corner, lowValue, highValue);
} }
@ -279,7 +286,6 @@ namespace OpenSim.Region.Environment
{ {
foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList) foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList)
{ {
string s = Helpers.FieldToUTF8String(block.Parameter); string s = Helpers.FieldToUTF8String(block.Parameter);
string[] splitField = s.Split(' '); string[] splitField = s.Split(' ');
if (splitField.Length == 2) if (splitField.Length == 2)
@ -330,7 +336,7 @@ namespace OpenSim.Region.Environment
for (int i = 0; i < avatars.Count; i++) for (int i = 0; i < avatars.Count; i++)
{ {
this.sendRegionInfoPacket(avatars[i].ControllingClient); sendRegionInfoPacket(avatars[i].ControllingClient);
} }
} }
@ -340,7 +346,7 @@ namespace OpenSim.Region.Environment
for (int i = 0; i < avatars.Count; i++) for (int i = 0; i < avatars.Count; i++)
{ {
this.sendRegionHandshake(avatars[i].ControllingClient); sendRegionHandshake(avatars[i].ControllingClient);
} }
} }
@ -361,9 +367,9 @@ namespace OpenSim.Region.Environment
regionInfoPacket.RegionInfo.PricePerMeter = m_regInfo.estateSettings.pricePerMeter; regionInfoPacket.RegionInfo.PricePerMeter = m_regInfo.estateSettings.pricePerMeter;
regionInfoPacket.RegionInfo.RedirectGridX = m_regInfo.estateSettings.redirectGridX; regionInfoPacket.RegionInfo.RedirectGridX = m_regInfo.estateSettings.redirectGridX;
regionInfoPacket.RegionInfo.RedirectGridY = m_regInfo.estateSettings.redirectGridY; regionInfoPacket.RegionInfo.RedirectGridY = m_regInfo.estateSettings.redirectGridY;
regionInfoPacket.RegionInfo.RegionFlags = (uint)m_regInfo.estateSettings.regionFlags; regionInfoPacket.RegionInfo.RegionFlags = (uint) m_regInfo.estateSettings.regionFlags;
regionInfoPacket.RegionInfo.SimAccess = (byte)m_regInfo.estateSettings.simAccess; regionInfoPacket.RegionInfo.SimAccess = (byte) m_regInfo.estateSettings.simAccess;
regionInfoPacket.RegionInfo.SimName = _enc.GetBytes( m_regInfo.RegionName); regionInfoPacket.RegionInfo.SimName = _enc.GetBytes(m_regInfo.RegionName);
regionInfoPacket.RegionInfo.SunHour = m_regInfo.estateSettings.sunHour; regionInfoPacket.RegionInfo.SunHour = m_regInfo.estateSettings.sunHour;
regionInfoPacket.RegionInfo.TerrainLowerLimit = m_regInfo.estateSettings.terrainLowerLimit; regionInfoPacket.RegionInfo.TerrainLowerLimit = m_regInfo.estateSettings.terrainLowerLimit;
regionInfoPacket.RegionInfo.TerrainRaiseLimit = m_regInfo.estateSettings.terrainRaiseLimit; regionInfoPacket.RegionInfo.TerrainRaiseLimit = m_regInfo.estateSettings.terrainRaiseLimit;
@ -379,6 +385,5 @@ namespace OpenSim.Region.Environment
} }
#endregion #endregion
} }
} }

View File

@ -1,6 +1,3 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.IO; using System.IO;
using libsecondlife; using libsecondlife;
@ -10,8 +7,12 @@ namespace OpenSim.Region.Environment.Interfaces
{ {
void RegisterRender(string handleType, IDynamicTextureRender render); void RegisterRender(string handleType, IDynamicTextureRender render);
void ReturnData(LLUUID id, byte[] data); void ReturnData(LLUUID id, byte[] data);
LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url, string extraParams, int updateTimer);
LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data, string extraParams, int updateTimer); LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url, string extraParams,
int updateTimer);
LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data, string extraParams,
int updateTimer);
} }
public interface IDynamicTextureRender public interface IDynamicTextureRender

View File

@ -1,6 +1,3 @@
using System;
using System.Collections.Generic;
using System.Text;
using libsecondlife; using libsecondlife;
namespace OpenSim.Region.Environment.Interfaces namespace OpenSim.Region.Environment.Interfaces

View File

@ -26,15 +26,10 @@
* *
*/ */
using libsecondlife;
using OpenSim.Framework.Types;
using OpenSim.Region;
using OpenSim.Region.Environment;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.LandManagement;
using System.Collections.Generic; using System.Collections.Generic;
using libsecondlife;
using OpenSim.Region.Environment.LandManagement;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Interfaces namespace OpenSim.Region.Environment.Interfaces
{ {

View File

@ -1,12 +1,10 @@
using System; using OpenSim.Region.Environment.Scenes;
using System.Collections.Generic;
using System.Text;
namespace OpenSim.Region.Environment.Interfaces namespace OpenSim.Region.Environment.Interfaces
{ {
public interface IRegionModule public interface IRegionModule
{ {
void Initialise(Scenes.Scene scene); void Initialise(Scene scene);
void PostInitialise(); void PostInitialise();
void CloseDown(); void CloseDown();
string GetName(); string GetName();

View File

@ -1,6 +1,3 @@
using System;
using System.Collections.Generic;
using System.Text;
using libsecondlife; using libsecondlife;
namespace OpenSim.Region.Environment.Interfaces namespace OpenSim.Region.Environment.Interfaces

View File

@ -1,6 +1,3 @@
using System;
using System.Collections.Generic;
using System.Text;
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
namespace OpenSim.Region.Environment.Interfaces namespace OpenSim.Region.Environment.Interfaces
@ -10,7 +7,10 @@ namespace OpenSim.Region.Environment.Interfaces
bool Tainted(); bool Tainted();
bool Tainted(int x, int y); bool Tainted(int x, int y);
void ResetTaint(); void ResetTaint();
void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west, IClientAPI remoteUser);
void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west,
IClientAPI remoteUser);
void CheckHeightValues(); void CheckHeightValues();
float[] GetHeights1D(); float[] GetHeights1D();
float[,] GetHeights2D(); float[,] GetHeights2D();

View File

@ -1,7 +1,3 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenSim.Region.Environment.Interfaces namespace OpenSim.Region.Environment.Interfaces
{ {
public interface IXfer public interface IXfer

View File

@ -8,37 +8,40 @@ using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.LandManagement namespace OpenSim.Region.Environment.LandManagement
{ {
#region Parcel Class #region Parcel Class
/// <summary> /// <summary>
/// Keeps track of a specific piece of land's information /// Keeps track of a specific piece of land's information
/// </summary> /// </summary>
public class Land public class Land
{ {
#region Member Variables #region Member Variables
public LandData landData = new LandData(); public LandData landData = new LandData();
public List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>(); public List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>();
public Scene m_scene; public Scene m_scene;
private bool[,] landBitmap = new bool[64, 64]; private bool[,] landBitmap = new bool[64,64];
#endregion #endregion
#region Constructors #region Constructors
public Land(LLUUID owner_id, bool is_group_owned, Scene scene) public Land(LLUUID owner_id, bool is_group_owned, Scene scene)
{ {
m_scene = scene; m_scene = scene;
landData.ownerID = owner_id; landData.ownerID = owner_id;
landData.isGroupOwned = is_group_owned; landData.isGroupOwned = is_group_owned;
} }
#endregion
#endregion
#region Member Functions #region Member Functions
#region General Functions #region General Functions
/// <summary> /// <summary>
/// Checks to see if this land object contains a point /// Checks to see if this land object contains a point
/// </summary> /// </summary>
@ -49,7 +52,7 @@ namespace OpenSim.Region.Environment.LandManagement
{ {
if (x >= 0 && y >= 0 && x <= 256 && x <= 256) if (x >= 0 && y >= 0 && x <= 256 && x <= 256)
{ {
return (landBitmap[x / 4, y / 4] == true); return (landBitmap[x/4, y/4] == true);
} }
else else
{ {
@ -59,10 +62,10 @@ namespace OpenSim.Region.Environment.LandManagement
public Land Copy() public Land Copy()
{ {
Land newLand = new Land(this.landData.ownerID, this.landData.isGroupOwned, m_scene); Land newLand = new Land(landData.ownerID, landData.isGroupOwned, m_scene);
//Place all new variables here! //Place all new variables here!
newLand.landBitmap = (bool[,])(this.landBitmap.Clone()); newLand.landBitmap = (bool[,]) (landBitmap.Clone());
newLand.landData = landData.Copy(); newLand.landData = landData.Copy();
return newLand; return newLand;
@ -70,17 +73,17 @@ namespace OpenSim.Region.Environment.LandManagement
#endregion #endregion
#region Packet Request Handling #region Packet Request Handling
/// <summary> /// <summary>
/// Sends land properties as requested /// Sends land properties as requested
/// </summary> /// </summary>
/// <param name="sequence_id">ID sent by client for them to keep track of</param> /// <param name="sequence_id">ID sent by client for them to keep track of</param>
/// <param name="snap_selection">Bool sent by client for them to use</param> /// <param name="snap_selection">Bool sent by client for them to use</param>
/// <param name="remote_client">Object representing the client</param> /// <param name="remote_client">Object representing the client</param>
public void sendLandProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client) public void sendLandProperties(int sequence_id, bool snap_selection, int request_result,
IClientAPI remote_client)
{ {
ParcelPropertiesPacket updatePacket = new ParcelPropertiesPacket(); ParcelPropertiesPacket updatePacket = new ParcelPropertiesPacket();
updatePacket.ParcelData.AABBMax = landData.AABBMax; updatePacket.ParcelData.AABBMax = landData.AABBMax;
updatePacket.ParcelData.AABBMin = landData.AABBMin; updatePacket.ParcelData.AABBMin = landData.AABBMin;
@ -91,17 +94,20 @@ namespace OpenSim.Region.Environment.LandManagement
updatePacket.ParcelData.Bitmap = landData.landBitmapByteArray; updatePacket.ParcelData.Bitmap = landData.landBitmapByteArray;
updatePacket.ParcelData.Desc = Helpers.StringToField(landData.landDesc); updatePacket.ParcelData.Desc = Helpers.StringToField(landData.landDesc);
updatePacket.ParcelData.Category = (byte)landData.category; updatePacket.ParcelData.Category = (byte) landData.category;
updatePacket.ParcelData.ClaimDate = landData.claimDate; updatePacket.ParcelData.ClaimDate = landData.claimDate;
updatePacket.ParcelData.ClaimPrice = landData.claimPrice; updatePacket.ParcelData.ClaimPrice = landData.claimPrice;
updatePacket.ParcelData.GroupID = landData.groupID; updatePacket.ParcelData.GroupID = landData.groupID;
updatePacket.ParcelData.GroupPrims = landData.groupPrims; updatePacket.ParcelData.GroupPrims = landData.groupPrims;
updatePacket.ParcelData.IsGroupOwned = landData.isGroupOwned; updatePacket.ParcelData.IsGroupOwned = landData.isGroupOwned;
updatePacket.ParcelData.LandingType = (byte)landData.landingType; updatePacket.ParcelData.LandingType = (byte) landData.landingType;
updatePacket.ParcelData.LocalID = landData.localID; updatePacket.ParcelData.LocalID = landData.localID;
if (landData.area > 0) if (landData.area > 0)
{ {
updatePacket.ParcelData.MaxPrims = Convert.ToInt32(Math.Round((Convert.ToDecimal(landData.area) / Convert.ToDecimal(65536)) * 15000 * Convert.ToDecimal(m_scene.RegionInfo.estateSettings.objectBonusFactor))); updatePacket.ParcelData.MaxPrims =
Convert.ToInt32(
Math.Round((Convert.ToDecimal(landData.area)/Convert.ToDecimal(65536))*15000*
Convert.ToDecimal(m_scene.RegionInfo.estateSettings.objectBonusFactor)));
} }
else else
{ {
@ -123,21 +129,28 @@ namespace OpenSim.Region.Environment.LandManagement
updatePacket.ParcelData.PassPrice = landData.passPrice; updatePacket.ParcelData.PassPrice = landData.passPrice;
updatePacket.ParcelData.PublicCount = 0; //unemplemented updatePacket.ParcelData.PublicCount = 0; //unemplemented
uint regionFlags = (uint)m_scene.RegionInfo.estateSettings.regionFlags; uint regionFlags = (uint) m_scene.RegionInfo.estateSettings.regionFlags;
updatePacket.ParcelData.RegionDenyAnonymous = ((regionFlags & (uint)Simulator.RegionFlags.DenyAnonymous) > 0); updatePacket.ParcelData.RegionDenyAnonymous = ((regionFlags & (uint) Simulator.RegionFlags.DenyAnonymous) >
updatePacket.ParcelData.RegionDenyIdentified = ((regionFlags & (uint)Simulator.RegionFlags.DenyIdentified) > 0); 0);
updatePacket.ParcelData.RegionDenyTransacted = ((regionFlags & (uint)Simulator.RegionFlags.DenyTransacted) > 0); updatePacket.ParcelData.RegionDenyIdentified = ((regionFlags & (uint) Simulator.RegionFlags.DenyIdentified) >
updatePacket.ParcelData.RegionPushOverride = ((regionFlags & (uint)Simulator.RegionFlags.RestrictPushObject) > 0); 0);
updatePacket.ParcelData.RegionDenyTransacted = ((regionFlags & (uint) Simulator.RegionFlags.DenyTransacted) >
0);
updatePacket.ParcelData.RegionPushOverride = ((regionFlags & (uint) Simulator.RegionFlags.RestrictPushObject) >
0);
updatePacket.ParcelData.RentPrice = 0; updatePacket.ParcelData.RentPrice = 0;
updatePacket.ParcelData.RequestResult = request_result; updatePacket.ParcelData.RequestResult = request_result;
updatePacket.ParcelData.SalePrice = landData.salePrice; updatePacket.ParcelData.SalePrice = landData.salePrice;
updatePacket.ParcelData.SelectedPrims = landData.selectedPrims; updatePacket.ParcelData.SelectedPrims = landData.selectedPrims;
updatePacket.ParcelData.SelfCount = 0;//unemplemented updatePacket.ParcelData.SelfCount = 0; //unemplemented
updatePacket.ParcelData.SequenceID = sequence_id; updatePacket.ParcelData.SequenceID = sequence_id;
if (landData.simwideArea > 0) if (landData.simwideArea > 0)
{ {
updatePacket.ParcelData.SimWideMaxPrims = Convert.ToInt32(Math.Round((Convert.ToDecimal(landData.simwideArea) / Convert.ToDecimal(65536)) * 15000 * Convert.ToDecimal(m_scene.RegionInfo.estateSettings.objectBonusFactor))); updatePacket.ParcelData.SimWideMaxPrims =
Convert.ToInt32(
Math.Round((Convert.ToDecimal(landData.simwideArea)/Convert.ToDecimal(65536))*15000*
Convert.ToDecimal(m_scene.RegionInfo.estateSettings.objectBonusFactor)));
} }
else else
{ {
@ -146,11 +159,12 @@ namespace OpenSim.Region.Environment.LandManagement
updatePacket.ParcelData.SimWideTotalPrims = landData.simwidePrims; updatePacket.ParcelData.SimWideTotalPrims = landData.simwidePrims;
updatePacket.ParcelData.SnapSelection = snap_selection; updatePacket.ParcelData.SnapSelection = snap_selection;
updatePacket.ParcelData.SnapshotID = landData.snapshotID; updatePacket.ParcelData.SnapshotID = landData.snapshotID;
updatePacket.ParcelData.Status = (byte)landData.landStatus; updatePacket.ParcelData.Status = (byte) landData.landStatus;
updatePacket.ParcelData.TotalPrims = landData.ownerPrims + landData.groupPrims + landData.otherPrims + landData.selectedPrims; updatePacket.ParcelData.TotalPrims = landData.ownerPrims + landData.groupPrims + landData.otherPrims +
landData.selectedPrims;
updatePacket.ParcelData.UserLocation = landData.userLocation; updatePacket.ParcelData.UserLocation = landData.userLocation;
updatePacket.ParcelData.UserLookAt = landData.userLookAt; updatePacket.ParcelData.UserLookAt = landData.userLookAt;
remote_client.OutPacket((Packet)updatePacket); remote_client.OutPacket((Packet) updatePacket);
} }
public void updateLandProperties(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client) public void updateLandProperties(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client)
@ -159,7 +173,7 @@ namespace OpenSim.Region.Environment.LandManagement
{ {
//Needs later group support //Needs later group support
landData.authBuyerID = packet.ParcelData.AuthBuyerID; landData.authBuyerID = packet.ParcelData.AuthBuyerID;
landData.category = (libsecondlife.Parcel.ParcelCategory)packet.ParcelData.Category; landData.category = (Parcel.ParcelCategory) packet.ParcelData.Category;
landData.landDesc = Helpers.FieldToUTF8String(packet.ParcelData.Desc); landData.landDesc = Helpers.FieldToUTF8String(packet.ParcelData.Desc);
landData.groupID = packet.ParcelData.GroupID; landData.groupID = packet.ParcelData.GroupID;
landData.landingType = packet.ParcelData.LandingType; landData.landingType = packet.ParcelData.LandingType;
@ -176,8 +190,6 @@ namespace OpenSim.Region.Environment.LandManagement
landData.userLocation = packet.ParcelData.UserLocation; landData.userLocation = packet.ParcelData.UserLocation;
landData.userLookAt = packet.ParcelData.UserLookAt; landData.userLookAt = packet.ParcelData.UserLookAt;
sendLandUpdateToAvatarsOverMe(); sendLandUpdateToAvatarsOverMe();
} }
} }
@ -186,17 +198,20 @@ namespace OpenSim.Region.Environment.LandManagement
List<ScenePresence> avatars = m_scene.RequestAvatarList(); List<ScenePresence> avatars = m_scene.RequestAvatarList();
for (int i = 0; i < avatars.Count; i++) for (int i = 0; i < avatars.Count; i++)
{ {
Land over = m_scene.LandManager.getLandObject((int)Math.Round(avatars[i].AbsolutePosition.X), (int)Math.Round(avatars[i].AbsolutePosition.Y)); Land over =
if (over.landData.localID == this.landData.localID) m_scene.LandManager.getLandObject((int) Math.Round(avatars[i].AbsolutePosition.X),
(int) Math.Round(avatars[i].AbsolutePosition.Y));
if (over.landData.localID == landData.localID)
{ {
sendLandProperties(0, false, 0, avatars[i].ControllingClient); sendLandProperties(0, false, 0, avatars[i].ControllingClient);
} }
} }
} }
#endregion #endregion
#region Update Functions #region Update Functions
/// <summary> /// <summary>
/// Updates the AABBMin and AABBMax values after area/shape modification of the land object /// Updates the AABBMin and AABBMax values after area/shape modification of the land object
/// </summary> /// </summary>
@ -222,8 +237,12 @@ namespace OpenSim.Region.Environment.LandManagement
} }
} }
} }
landData.AABBMin = new LLVector3((float)(min_x * 4), (float)(min_y * 4), (float)m_scene.Terrain.GetHeight((min_x * 4), (min_y * 4))); landData.AABBMin =
landData.AABBMax = new LLVector3((float)(max_x * 4), (float)(max_y * 4), (float)m_scene.Terrain.GetHeight((max_x * 4), (max_y * 4))); new LLVector3((float) (min_x*4), (float) (min_y*4),
(float) m_scene.Terrain.GetHeight((min_x*4), (min_y*4)));
landData.AABBMax =
new LLVector3((float) (max_x*4), (float) (max_y*4),
(float) m_scene.Terrain.GetHeight((max_x*4), (max_y*4)));
landData.area = tempArea; landData.area = tempArea;
} }
@ -237,18 +256,19 @@ namespace OpenSim.Region.Environment.LandManagement
/// </summary> /// </summary>
public void forceUpdateLandInfo() public void forceUpdateLandInfo()
{ {
this.updateAABBAndAreaValues(); updateAABBAndAreaValues();
this.updateLandBitmapByteArray(); updateLandBitmapByteArray();
} }
public void setLandBitmapFromByteArray() public void setLandBitmapFromByteArray()
{ {
landBitmap = convertBytesToLandBitmap(); landBitmap = convertBytesToLandBitmap();
} }
#endregion #endregion
#region Land Bitmap Functions #region Land Bitmap Functions
/// <summary> /// <summary>
/// Sets the land's bitmap manually /// Sets the land's bitmap manually
/// </summary> /// </summary>
@ -265,9 +285,9 @@ namespace OpenSim.Region.Environment.LandManagement
//Valid: Lets set it //Valid: Lets set it
landBitmap = bitmap; landBitmap = bitmap;
forceUpdateLandInfo(); forceUpdateLandInfo();
}
}
}
}
/// <summary> /// <summary>
/// Gets the land's bitmap manually /// Gets the land's bitmap manually
/// </summary> /// </summary>
@ -276,6 +296,7 @@ namespace OpenSim.Region.Environment.LandManagement
{ {
return landBitmap; return landBitmap;
} }
/// <summary> /// <summary>
/// Converts the land bitmap to a packet friendly byte array /// Converts the land bitmap to a packet friendly byte array
/// </summary> /// </summary>
@ -290,11 +311,11 @@ namespace OpenSim.Region.Environment.LandManagement
{ {
for (x = 0; x < 64; x++) for (x = 0; x < 64; x++)
{ {
tempByte = Convert.ToByte(tempByte | Convert.ToByte(landBitmap[x, y]) << (i++ % 8)); tempByte = Convert.ToByte(tempByte | Convert.ToByte(landBitmap[x, y]) << (i++%8));
if (i % 8 == 0) if (i%8 == 0)
{ {
tempConvertArr[byteNum] = tempByte; tempConvertArr[byteNum] = tempByte;
tempByte = (byte)0; tempByte = (byte) 0;
i = 0; i = 0;
byteNum++; byteNum++;
} }
@ -305,7 +326,7 @@ namespace OpenSim.Region.Environment.LandManagement
private bool[,] convertBytesToLandBitmap() private bool[,] convertBytesToLandBitmap()
{ {
bool[,] tempConvertMap = new bool[64, 64]; bool[,] tempConvertMap = new bool[64,64];
tempConvertMap.Initialize(); tempConvertMap.Initialize();
byte tempByte = 0; byte tempByte = 0;
int x = 0, y = 0, i = 0, bitNum = 0; int x = 0, y = 0, i = 0, bitNum = 0;
@ -314,7 +335,7 @@ namespace OpenSim.Region.Environment.LandManagement
tempByte = landData.landBitmapByteArray[i]; tempByte = landData.landBitmapByteArray[i];
for (bitNum = 0; bitNum < 8; bitNum++) for (bitNum = 0; bitNum < 8; bitNum++)
{ {
bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & (byte)1); bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & (byte) 1);
tempConvertMap[x, y] = bit; tempConvertMap[x, y] = bit;
x++; x++;
if (x > 63) if (x > 63)
@ -322,12 +343,11 @@ namespace OpenSim.Region.Environment.LandManagement
x = 0; x = 0;
y++; y++;
} }
} }
} }
return tempConvertMap; return tempConvertMap;
} }
/// <summary> /// <summary>
/// Full sim land object creation /// Full sim land object creation
/// </summary> /// </summary>
@ -347,8 +367,7 @@ namespace OpenSim.Region.Environment.LandManagement
/// <returns></returns> /// <returns></returns>
public static bool[,] getSquareLandBitmap(int start_x, int start_y, int end_x, int end_y) public static bool[,] getSquareLandBitmap(int start_x, int start_y, int end_x, int end_y)
{ {
bool[,] tempBitmap = new bool[64,64];
bool[,] tempBitmap = new bool[64, 64];
tempBitmap.Initialize(); tempBitmap.Initialize();
tempBitmap = modifyLandBitmapSquare(tempBitmap, start_x, start_y, end_x, end_y, true); tempBitmap = modifyLandBitmapSquare(tempBitmap, start_x, start_y, end_x, end_y, true);
@ -365,7 +384,8 @@ namespace OpenSim.Region.Environment.LandManagement
/// <param name="end_y"></param> /// <param name="end_y"></param>
/// <param name="set_value"></param> /// <param name="set_value"></param>
/// <returns></returns> /// <returns></returns>
public static bool[,] modifyLandBitmapSquare(bool[,] land_bitmap, int start_x, int start_y, int end_x, int end_y, bool set_value) public static bool[,] modifyLandBitmapSquare(bool[,] land_bitmap, int start_x, int start_y, int end_x, int end_y,
bool set_value)
{ {
if (land_bitmap.GetLength(0) != 64 || land_bitmap.GetLength(1) != 64 || land_bitmap.Rank != 2) if (land_bitmap.GetLength(0) != 64 || land_bitmap.GetLength(1) != 64 || land_bitmap.Rank != 2)
{ {
@ -378,8 +398,8 @@ namespace OpenSim.Region.Environment.LandManagement
{ {
for (x = 0; x < 64; x++) for (x = 0; x < 64; x++)
{ {
if (x >= start_x / 4 && x < end_x / 4 if (x >= start_x/4 && x < end_x/4
&& y >= start_y / 4 && y < end_y / 4) && y >= start_y/4 && y < end_y/4)
{ {
land_bitmap[x, y] = set_value; land_bitmap[x, y] = set_value;
} }
@ -387,6 +407,7 @@ namespace OpenSim.Region.Environment.LandManagement
} }
return land_bitmap; return land_bitmap;
} }
/// <summary> /// <summary>
/// Join the true values of 2 bitmaps together /// Join the true values of 2 bitmaps together
/// </summary> /// </summary>
@ -404,7 +425,6 @@ namespace OpenSim.Region.Environment.LandManagement
{ {
//Throw an exception - The bitmap is not 64x64 //Throw an exception - The bitmap is not 64x64
throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_add in mergeLandBitmaps"); throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_add in mergeLandBitmaps");
} }
int x, y; int x, y;
@ -420,9 +440,11 @@ namespace OpenSim.Region.Environment.LandManagement
} }
return bitmap_base; return bitmap_base;
} }
#endregion #endregion
#region Object Select and Object Owner Listing #region Object Select and Object Owner Listing
public void sendForceObjectSelect(int local_id, int request_type, IClientAPI remote_client) public void sendForceObjectSelect(int local_id, int request_type, IClientAPI remote_client)
{ {
List<uint> resultLocalIDs = new List<uint>(); List<uint> resultLocalIDs = new List<uint>();
@ -430,15 +452,16 @@ namespace OpenSim.Region.Environment.LandManagement
{ {
if (obj.LocalId > 0) if (obj.LocalId > 0)
{ {
if (request_type == LandManager.LAND_SELECT_OBJECTS_OWNER && obj.OwnerID == this.landData.ownerID) if (request_type == LandManager.LAND_SELECT_OBJECTS_OWNER && obj.OwnerID == landData.ownerID)
{ {
resultLocalIDs.Add(obj.LocalId); resultLocalIDs.Add(obj.LocalId);
} }
else if (request_type == LandManager.LAND_SELECT_OBJECTS_GROUP && false) //TODO: change false to group support! else if (request_type == LandManager.LAND_SELECT_OBJECTS_GROUP && false)
//TODO: change false to group support!
{ {
} }
else if (request_type == LandManager.LAND_SELECT_OBJECTS_OTHER && obj.OwnerID != remote_client.AgentId) else if (request_type == LandManager.LAND_SELECT_OBJECTS_OTHER &&
obj.OwnerID != remote_client.AgentId)
{ {
resultLocalIDs.Add(obj.LocalId); resultLocalIDs.Add(obj.LocalId);
} }
@ -479,10 +502,10 @@ namespace OpenSim.Region.Environment.LandManagement
resultLocalIDs.RemoveAt(0); resultLocalIDs.RemoveAt(0);
} }
pack.Data = data; pack.Data = data;
remote_client.OutPacket((Packet)pack); remote_client.OutPacket((Packet) pack);
}
} }
}
public void sendLandObjectOwners(IClientAPI remote_client) public void sendLandObjectOwners(IClientAPI remote_client)
{ {
Dictionary<LLUUID, int> ownersAndCount = new Dictionary<LLUUID, int>(); Dictionary<LLUUID, int> ownersAndCount = new Dictionary<LLUUID, int>();
@ -496,7 +519,6 @@ namespace OpenSim.Region.Environment.LandManagement
} }
if (ownersAndCount.Count > 0) if (ownersAndCount.Count > 0)
{ {
ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock = new ParcelObjectOwnersReplyPacket.DataBlock[32]; ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock = new ParcelObjectOwnersReplyPacket.DataBlock[32];
if (ownersAndCount.Count < 32) if (ownersAndCount.Count < 32)
@ -522,19 +544,23 @@ namespace OpenSim.Region.Environment.LandManagement
remote_client.OutPacket(pack); remote_client.OutPacket(pack);
} }
} }
#endregion #endregion
#region Object Returning #region Object Returning
public void returnObject(SceneObjectGroup obj) public void returnObject(SceneObjectGroup obj)
{ {
} }
public void returnLandObjects(int type, LLUUID owner) public void returnLandObjects(int type, LLUUID owner)
{ {
} }
#endregion #endregion
#region Object Adding/Removing from Parcel #region Object Adding/Removing from Parcel
public void resetLandPrimCounts() public void resetLandPrimCounts()
{ {
landData.groupPrims = 0; landData.groupPrims = 0;
@ -566,7 +592,6 @@ namespace OpenSim.Region.Environment.LandManagement
} }
primsOverMe.Add(obj); primsOverMe.Add(obj);
} }
public void removePrimFromCount(SceneObjectGroup obj) public void removePrimFromCount(SceneObjectGroup obj)
@ -592,11 +617,11 @@ namespace OpenSim.Region.Environment.LandManagement
primsOverMe.Remove(obj); primsOverMe.Remove(obj);
} }
} }
#endregion
#endregion #endregion
#endregion
} }
#endregion #endregion
} }

View File

@ -36,30 +36,30 @@ using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.LandManagement namespace OpenSim.Region.Environment.LandManagement
{ {
#region LandManager Class #region LandManager Class
/// <summary> /// <summary>
/// Handles Land objects and operations requiring information from other Land objects (divide, join, etc) /// Handles Land objects and operations requiring information from other Land objects (divide, join, etc)
/// </summary> /// </summary>
public class LandManager public class LandManager
{ {
#region Constants #region Constants
//Land types set with flags in ParcelOverlay. //Land types set with flags in ParcelOverlay.
//Only one of these can be used. //Only one of these can be used.
public const byte LAND_TYPE_PUBLIC = (byte)0; //Equals 00000000 public const byte LAND_TYPE_PUBLIC = (byte) 0; //Equals 00000000
public const byte LAND_TYPE_OWNED_BY_OTHER = (byte)1; //Equals 00000001 public const byte LAND_TYPE_OWNED_BY_OTHER = (byte) 1; //Equals 00000001
public const byte LAND_TYPE_OWNED_BY_GROUP = (byte)2; //Equals 00000010 public const byte LAND_TYPE_OWNED_BY_GROUP = (byte) 2; //Equals 00000010
public const byte LAND_TYPE_OWNED_BY_REQUESTER = (byte)3; //Equals 00000011 public const byte LAND_TYPE_OWNED_BY_REQUESTER = (byte) 3; //Equals 00000011
public const byte LAND_TYPE_IS_FOR_SALE = (byte)4; //Equals 00000100 public const byte LAND_TYPE_IS_FOR_SALE = (byte) 4; //Equals 00000100
public const byte LAND_TYPE_IS_BEING_AUCTIONED = (byte)5; //Equals 00000101 public const byte LAND_TYPE_IS_BEING_AUCTIONED = (byte) 5; //Equals 00000101
//Flags that when set, a border on the given side will be placed //Flags that when set, a border on the given side will be placed
//NOTE: North and East is assumable by the west and south sides (if land to east has a west border, then I have an east border; etc) //NOTE: North and East is assumable by the west and south sides (if land to east has a west border, then I have an east border; etc)
//This took forever to figure out -- jeesh. /blame LL for even having to send these //This took forever to figure out -- jeesh. /blame LL for even having to send these
public const byte LAND_FLAG_PROPERTY_BORDER_WEST = (byte)64; //Equals 01000000 public const byte LAND_FLAG_PROPERTY_BORDER_WEST = (byte) 64; //Equals 01000000
public const byte LAND_FLAG_PROPERTY_BORDER_SOUTH = (byte)128; //Equals 10000000 public const byte LAND_FLAG_PROPERTY_BORDER_SOUTH = (byte) 128; //Equals 10000000
//RequestResults (I think these are right, they seem to work): //RequestResults (I think these are right, they seem to work):
public const int LAND_RESULT_SINGLE = 0; // The request they made contained only a single piece of land public const int LAND_RESULT_SINGLE = 0; // The request they made contained only a single piece of land
@ -73,12 +73,14 @@ namespace OpenSim.Region.Environment.LandManagement
//These are other constants. Yay! //These are other constants. Yay!
public const int START_LAND_LOCAL_ID = 1; public const int START_LAND_LOCAL_ID = 1;
#endregion #endregion
#region Member Variables #region Member Variables
public Dictionary<int, Land> landList = new Dictionary<int, Land>(); public Dictionary<int, Land> landList = new Dictionary<int, Land>();
private int lastLandLocalID = START_LAND_LOCAL_ID - 1; private int lastLandLocalID = START_LAND_LOCAL_ID - 1;
private int[,] landIDList = new int[64, 64]; private int[,] landIDList = new int[64,64];
/// <summary> /// <summary>
/// Set to true when a prim is moved, created, added. Performs a prim count update /// Set to true when a prim is moved, created, added. Performs a prim count update
@ -91,35 +93,37 @@ namespace OpenSim.Region.Environment.LandManagement
#endregion #endregion
#region Constructors #region Constructors
public LandManager(Scene scene, RegionInfo reginfo) public LandManager(Scene scene, RegionInfo reginfo)
{ {
m_scene = scene; m_scene = scene;
m_regInfo = reginfo; m_regInfo = reginfo;
landIDList.Initialize(); landIDList.Initialize();
} }
#endregion #endregion
#region Member Functions #region Member Functions
#region Parcel From Storage Functions #region Parcel From Storage Functions
public void LandFromStorage(LandData data) public void LandFromStorage(LandData data)
{ {
Land new_land = new Land(data.ownerID, data.isGroupOwned, m_scene); Land new_land = new Land(data.ownerID, data.isGroupOwned, m_scene);
new_land.landData = data.Copy(); new_land.landData = data.Copy();
new_land.setLandBitmapFromByteArray(); new_land.setLandBitmapFromByteArray();
addLandObject(new_land); addLandObject(new_land);
} }
public void NoLandDataFromStorage() public void NoLandDataFromStorage()
{ {
resetSimLandObjects(); resetSimLandObjects();
} }
#endregion #endregion
#region Parcel Add/Remove/Get/Create #region Parcel Add/Remove/Get/Create
/// <summary> /// <summary>
/// Creates a basic Parcel object without an owner (a zeroed key) /// Creates a basic Parcel object without an owner (a zeroed key)
/// </summary> /// </summary>
@ -155,8 +159,8 @@ namespace OpenSim.Region.Environment.LandManagement
landList[lastLandLocalID].forceUpdateLandInfo(); landList[lastLandLocalID].forceUpdateLandInfo();
return new_land; return new_land;
} }
/// <summary> /// <summary>
/// Removes a land object from the list. Will not remove if local_id is still owning an area in landIDList /// Removes a land object from the list. Will not remove if local_id is still owning an area in landIDList
/// </summary> /// </summary>
@ -194,6 +198,7 @@ namespace OpenSim.Region.Environment.LandManagement
} }
removeLandObject(slave.landData.localID); removeLandObject(slave.landData.localID);
} }
/// <summary> /// <summary>
/// Get the land object at the specified point /// Get the land object at the specified point
/// </summary> /// </summary>
@ -202,8 +207,8 @@ namespace OpenSim.Region.Environment.LandManagement
/// <returns>Land object at the point supplied</returns> /// <returns>Land object at the point supplied</returns>
public Land getLandObject(float x_float, float y_float) public Land getLandObject(float x_float, float y_float)
{ {
int x = Convert.ToInt32(Math.Floor(Convert.ToDouble(x_float) / Convert.ToDouble(4.0))); int x = Convert.ToInt32(Math.Floor(Convert.ToDouble(x_float)/Convert.ToDouble(4.0)));
int y = Convert.ToInt32(Math.Floor(Convert.ToDouble(y_float) / Convert.ToDouble(4.0))); int y = Convert.ToInt32(Math.Floor(Convert.ToDouble(y_float)/Convert.ToDouble(4.0)));
if (x > 63 || y > 63 || x < 0 || y < 0) if (x > 63 || y > 63 || x < 0 || y < 0)
{ {
@ -224,12 +229,14 @@ namespace OpenSim.Region.Environment.LandManagement
} }
else else
{ {
return landList[landIDList[x / 4, y / 4]]; return landList[landIDList[x/4, y/4]];
} }
} }
#endregion #endregion
#region Parcel Modification #region Parcel Modification
/// <summary> /// <summary>
/// Subdivides a piece of land /// Subdivides a piece of land
/// </summary> /// </summary>
@ -241,7 +248,6 @@ namespace OpenSim.Region.Environment.LandManagement
/// <returns>Returns true if successful</returns> /// <returns>Returns true if successful</returns>
private bool subdivide(int start_x, int start_y, int end_x, int end_y, LLUUID attempting_user_id) private bool subdivide(int start_x, int start_y, int end_x, int end_y, LLUUID attempting_user_id)
{ {
//First, lets loop through the points and make sure they are all in the same peice of land //First, lets loop through the points and make sure they are all in the same peice of land
//Get the land object at start //Get the land object at start
Land startLandObject = getLandObject(start_x, start_y); Land startLandObject = getLandObject(start_x, start_y);
@ -284,21 +290,21 @@ namespace OpenSim.Region.Environment.LandManagement
//Now, lets set the subdivision area of the original to false //Now, lets set the subdivision area of the original to false
int startLandObjectIndex = startLandObject.landData.localID; int startLandObjectIndex = startLandObject.landData.localID;
landList[startLandObjectIndex].setLandBitmap(Land.modifyLandBitmapSquare(startLandObject.getLandBitmap(), start_x, start_y, end_x, end_y, false)); landList[startLandObjectIndex].setLandBitmap(
Land.modifyLandBitmapSquare(startLandObject.getLandBitmap(), start_x, start_y, end_x, end_y, false));
landList[startLandObjectIndex].forceUpdateLandInfo(); landList[startLandObjectIndex].forceUpdateLandInfo();
this.setPrimsTainted(); setPrimsTainted();
//Now add the new land object //Now add the new land object
Land result = addLandObject(newLand); Land result = addLandObject(newLand);
result.sendLandUpdateToAvatarsOverMe(); result.sendLandUpdateToAvatarsOverMe();
return true; return true;
} }
/// <summary> /// <summary>
/// Join 2 land objects together /// Join 2 land objects together
/// </summary> /// </summary>
@ -320,7 +326,7 @@ namespace OpenSim.Region.Environment.LandManagement
{ {
for (stepXSelected = start_x; stepXSelected <= end_x; stepXSelected += 4) for (stepXSelected = start_x; stepXSelected <= end_x; stepXSelected += 4)
{ {
Land p = getLandObject(stepXSelected,stepYSelected); Land p = getLandObject(stepXSelected, stepYSelected);
if (!selectedLandObjects.Contains(p)) if (!selectedLandObjects.Contains(p))
{ {
selectedLandObjects.Add(p); selectedLandObjects.Add(p);
@ -348,23 +354,23 @@ namespace OpenSim.Region.Environment.LandManagement
} }
foreach (Land slaveLandObject in selectedLandObjects) foreach (Land slaveLandObject in selectedLandObjects)
{ {
landList[masterLandObject.landData.localID].setLandBitmap(Land.mergeLandBitmaps(masterLandObject.getLandBitmap(), slaveLandObject.getLandBitmap())); landList[masterLandObject.landData.localID].setLandBitmap(
Land.mergeLandBitmaps(masterLandObject.getLandBitmap(), slaveLandObject.getLandBitmap()));
performFinalLandJoin(masterLandObject, slaveLandObject); performFinalLandJoin(masterLandObject, slaveLandObject);
} }
this.setPrimsTainted(); setPrimsTainted();
masterLandObject.sendLandUpdateToAvatarsOverMe(); masterLandObject.sendLandUpdateToAvatarsOverMe();
return true; return true;
} }
#endregion #endregion
#region Parcel Updating #region Parcel Updating
/// <summary> /// <summary>
/// Where we send the ParcelOverlay packet to the client /// Where we send the ParcelOverlay packet to the client
/// </summary> /// </summary>
@ -382,15 +388,17 @@ namespace OpenSim.Region.Environment.LandManagement
{ {
for (x = 0; x < 64; x++) for (x = 0; x < 64; x++)
{ {
byte tempByte = (byte)0; //This represents the byte for the current 4x4 byte tempByte = (byte) 0; //This represents the byte for the current 4x4
Land currentParcelBlock = getLandObject(x * 4, y * 4); Land currentParcelBlock = getLandObject(x*4, y*4);
if (currentParcelBlock.landData.ownerID == remote_client.AgentId) if (currentParcelBlock.landData.ownerID == remote_client.AgentId)
{ {
//Owner Flag //Owner Flag
tempByte = Convert.ToByte(tempByte | LAND_TYPE_OWNED_BY_REQUESTER); tempByte = Convert.ToByte(tempByte | LAND_TYPE_OWNED_BY_REQUESTER);
} }
else if (currentParcelBlock.landData.salePrice > 0 && (currentParcelBlock.landData.authBuyerID == LLUUID.Zero || currentParcelBlock.landData.authBuyerID == remote_client.AgentId)) else if (currentParcelBlock.landData.salePrice > 0 &&
(currentParcelBlock.landData.authBuyerID == LLUUID.Zero ||
currentParcelBlock.landData.authBuyerID == remote_client.AgentId))
{ {
//Sale Flag //Sale Flag
tempByte = Convert.ToByte(tempByte | LAND_TYPE_IS_FOR_SALE); tempByte = Convert.ToByte(tempByte | LAND_TYPE_IS_FOR_SALE);
@ -412,7 +420,7 @@ namespace OpenSim.Region.Environment.LandManagement
{ {
tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_WEST); tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_WEST);
} }
else if (getLandObject((x - 1) * 4, y * 4) != currentParcelBlock) else if (getLandObject((x - 1)*4, y*4) != currentParcelBlock)
{ {
tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_WEST); tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_WEST);
} }
@ -421,7 +429,7 @@ namespace OpenSim.Region.Environment.LandManagement
{ {
tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_SOUTH); tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_SOUTH);
} }
else if (getLandObject(x * 4, (y - 1) * 4) != currentParcelBlock) else if (getLandObject(x*4, (y - 1)*4) != currentParcelBlock)
{ {
tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_SOUTH); tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_SOUTH);
} }
@ -434,17 +442,16 @@ namespace OpenSim.Region.Environment.LandManagement
packet = new ParcelOverlayPacket(); packet = new ParcelOverlayPacket();
packet.ParcelData.Data = byteArray; packet.ParcelData.Data = byteArray;
packet.ParcelData.SequenceID = sequenceID; packet.ParcelData.SequenceID = sequenceID;
remote_client.OutPacket((Packet)packet); remote_client.OutPacket((Packet) packet);
sequenceID++; sequenceID++;
byteArray = new byte[LAND_BLOCKS_PER_PACKET]; byteArray = new byte[LAND_BLOCKS_PER_PACKET];
} }
} }
} }
} }
public void handleParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id, bool snap_selection, IClientAPI remote_client) public void handleParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id,
bool snap_selection, IClientAPI remote_client)
{ {
//Get the land objects within the bounds //Get the land objects within the bounds
List<Land> temp = new List<Land>(); List<Land> temp = new List<Land>();
@ -486,14 +493,15 @@ namespace OpenSim.Region.Environment.LandManagement
landList[packet.ParcelData.LocalID].updateLandProperties(packet, remote_client); landList[packet.ParcelData.LocalID].updateLandProperties(packet, remote_client);
} }
} }
public void handleParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client) public void handleParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client)
{ {
subdivide(west, south, east, north, remote_client.AgentId); subdivide(west, south, east, north, remote_client.AgentId);
} }
public void handleParcelJoinRequest(int west, int south, int east, int north, IClientAPI remote_client) public void handleParcelJoinRequest(int west, int south, int east, int north, IClientAPI remote_client)
{ {
join(west, south, east, north, remote_client.AgentId); join(west, south, east, north, remote_client.AgentId);
} }
public void handleParcelSelectObjectsRequest(int local_id, int request_type, IClientAPI remote_client) public void handleParcelSelectObjectsRequest(int local_id, int request_type, IClientAPI remote_client)
@ -505,6 +513,7 @@ namespace OpenSim.Region.Environment.LandManagement
{ {
landList[local_id].sendLandObjectOwners(remote_client); landList[local_id].sendLandObjectOwners(remote_client);
} }
#endregion #endregion
/// <summary> /// <summary>
@ -523,7 +532,6 @@ namespace OpenSim.Region.Environment.LandManagement
fullSimParcel.landData.ownerID = m_regInfo.MasterAvatarAssignedUUID; fullSimParcel.landData.ownerID = m_regInfo.MasterAvatarAssignedUUID;
addLandObject(fullSimParcel); addLandObject(fullSimParcel);
} }
@ -532,7 +540,7 @@ namespace OpenSim.Region.Environment.LandManagement
ScenePresence clientAvatar = m_scene.RequestAvatar(remote_client.AgentId); ScenePresence clientAvatar = m_scene.RequestAvatar(remote_client.AgentId);
if (clientAvatar != null) if (clientAvatar != null)
{ {
Land over = getLandObject(clientAvatar.AbsolutePosition.X,clientAvatar.AbsolutePosition.Y); Land over = getLandObject(clientAvatar.AbsolutePosition.X, clientAvatar.AbsolutePosition.Y);
if (over != null) if (over != null)
{ {
over.sendLandProperties(0, false, 0, remote_client); over.sendLandProperties(0, false, 0, remote_client);
@ -547,9 +555,10 @@ namespace OpenSim.Region.Environment.LandManagement
p.resetLandPrimCounts(); p.resetLandPrimCounts();
} }
} }
public void setPrimsTainted() public void setPrimsTainted()
{ {
this.landPrimCountTainted = true; landPrimCountTainted = true;
} }
public void addPrimToLandPrimCounts(SceneObjectGroup obj) public void addPrimToLandPrimCounts(SceneObjectGroup obj)
@ -573,14 +582,14 @@ namespace OpenSim.Region.Environment.LandManagement
public void finalizeLandPrimCountUpdate() public void finalizeLandPrimCountUpdate()
{ {
//Get Simwide prim count for owner //Get Simwide prim count for owner
Dictionary<LLUUID, List<Land>> landOwnersAndParcels = new Dictionary<LLUUID,List<Land>>(); Dictionary<LLUUID, List<Land>> landOwnersAndParcels = new Dictionary<LLUUID, List<Land>>();
foreach (Land p in landList.Values) foreach (Land p in landList.Values)
{ {
if(!landOwnersAndParcels.ContainsKey(p.landData.ownerID)) if (!landOwnersAndParcels.ContainsKey(p.landData.ownerID))
{ {
List<Land> tempList = new List<Land>(); List<Land> tempList = new List<Land>();
tempList.Add(p); tempList.Add(p);
landOwnersAndParcels.Add(p.landData.ownerID,tempList); landOwnersAndParcels.Add(p.landData.ownerID, tempList);
} }
else else
{ {
@ -595,7 +604,8 @@ namespace OpenSim.Region.Environment.LandManagement
foreach (Land p in landOwnersAndParcels[owner]) foreach (Land p in landOwnersAndParcels[owner])
{ {
simArea += p.landData.area; simArea += p.landData.area;
simPrims += p.landData.ownerPrims + p.landData.otherPrims + p.landData.groupPrims + p.landData.selectedPrims; simPrims += p.landData.ownerPrims + p.landData.otherPrims + p.landData.groupPrims +
p.landData.selectedPrims;
} }
foreach (Land p in landOwnersAndParcels[owner]) foreach (Land p in landOwnersAndParcels[owner])
@ -604,14 +614,10 @@ namespace OpenSim.Region.Environment.LandManagement
p.landData.simwidePrims = simPrims; p.landData.simwidePrims = simPrims;
} }
} }
} }
#endregion #endregion
} }
#endregion #endregion
} }

View File

@ -1,17 +1,15 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Reflection; using System.Reflection;
using System.Text;
using OpenSim.Framework.Console;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Modules; using OpenSim.Region.Environment.Modules;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment namespace OpenSim.Region.Environment
{ {
public class ModuleLoader public class ModuleLoader
{ {
public Dictionary<string, Assembly> LoadedAssemblys = new Dictionary<string, Assembly>(); public Dictionary<string, Assembly> LoadedAssemblys = new Dictionary<string, Assembly>();
public List<IRegionModule> LoadedModules = new List<IRegionModule>(); public List<IRegionModule> LoadedModules = new List<IRegionModule>();
@ -19,7 +17,6 @@ namespace OpenSim.Region.Environment
public ModuleLoader() public ModuleLoader()
{ {
} }
/// <summary> /// <summary>
@ -37,23 +34,22 @@ namespace OpenSim.Region.Environment
module = new AvatarProfilesModule(); module = new AvatarProfilesModule();
InitialiseModule(module, scene); InitialiseModule(module, scene);
this.LoadRegionModule("OpenSim.Region.ExtensionsScriptModule.dll", "ExtensionsScriptingModule", scene); LoadRegionModule("OpenSim.Region.ExtensionsScriptModule.dll", "ExtensionsScriptingModule", scene);
string lslPath = System.IO.Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine.DotNetEngine.dll");
this.LoadRegionModule(lslPath, "LSLScriptingModule", scene);
string lslPath = Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine.DotNetEngine.dll");
LoadRegionModule(lslPath, "LSLScriptingModule", scene);
} }
public void LoadDefaultSharedModules(string exceptModules) public void LoadDefaultSharedModules(string exceptModules)
{ {
DynamicTextureModule dynamicModule = new DynamicTextureModule(); DynamicTextureModule dynamicModule = new DynamicTextureModule();
this.LoadedSharedModules.Add(dynamicModule.GetName(), dynamicModule); LoadedSharedModules.Add(dynamicModule.GetName(), dynamicModule);
} }
public void InitialiseSharedModules(Scene scene) public void InitialiseSharedModules(Scene scene)
{ {
foreach (IRegionModule module in this.LoadedSharedModules.Values) foreach (IRegionModule module in LoadedSharedModules.Values)
{ {
module.Initialise(scene); module.Initialise(scene);
scene.AddModule(module.GetName(), module); //should be doing this? scene.AddModule(module.GetName(), module); //should be doing this?
@ -75,19 +71,19 @@ namespace OpenSim.Region.Environment
/// <param name="scene"></param> /// <param name="scene"></param>
public void LoadSharedModule(string dllName, string moduleName) public void LoadSharedModule(string dllName, string moduleName)
{ {
IRegionModule module = this.LoadModule(dllName, moduleName); IRegionModule module = LoadModule(dllName, moduleName);
if (module != null) if (module != null)
{ {
this.LoadedSharedModules.Add(module.GetName(), module); LoadedSharedModules.Add(module.GetName(), module);
} }
} }
public void LoadRegionModule(string dllName, string moduleName, Scene scene) public void LoadRegionModule(string dllName, string moduleName, Scene scene)
{ {
IRegionModule module = this.LoadModule(dllName, moduleName); IRegionModule module = LoadModule(dllName, moduleName);
if (module != null) if (module != null)
{ {
this.InitialiseModule(module, scene); InitialiseModule(module, scene);
} }
} }
@ -107,7 +103,7 @@ namespace OpenSim.Region.Environment
else else
{ {
pluginAssembly = Assembly.LoadFrom(dllName); pluginAssembly = Assembly.LoadFrom(dllName);
this.LoadedAssemblys.Add(dllName, pluginAssembly); LoadedAssemblys.Add(dllName, pluginAssembly);
} }
IRegionModule module = null; IRegionModule module = null;
@ -121,7 +117,8 @@ namespace OpenSim.Region.Environment
if (typeInterface != null) if (typeInterface != null)
{ {
module = (IRegionModule)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); module =
(IRegionModule) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
break; break;
} }
typeInterface = null; typeInterface = null;
@ -130,23 +127,22 @@ namespace OpenSim.Region.Environment
} }
pluginAssembly = null; pluginAssembly = null;
if ((module != null ) || (module.GetName() == moduleName)) if ((module != null) || (module.GetName() == moduleName))
{ {
return module; return module;
} }
return null; return null;
} }
public void PostInitialise() public void PostInitialise()
{ {
foreach (IRegionModule module in this.LoadedSharedModules.Values) foreach (IRegionModule module in LoadedSharedModules.Values)
{ {
module.PostInitialise(); module.PostInitialise();
} }
foreach (IRegionModule module in this.LoadedModules) foreach (IRegionModule module in LoadedModules)
{ {
module.PostInitialise(); module.PostInitialise();
} }
@ -154,7 +150,7 @@ namespace OpenSim.Region.Environment
public void ClearCache() public void ClearCache()
{ {
this.LoadedAssemblys.Clear(); LoadedAssemblys.Clear();
} }
} }
} }

View File

@ -1,11 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text;
using libsecondlife;
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules namespace OpenSim.Region.Environment.Modules
{ {
@ -15,7 +10,6 @@ namespace OpenSim.Region.Environment.Modules
public AssetDownloadModule() public AssetDownloadModule()
{ {
} }
public void Initialise(Scene scene) public void Initialise(Scene scene)
@ -26,7 +20,6 @@ namespace OpenSim.Region.Environment.Modules
public void PostInitialise() public void PostInitialise()
{ {
} }
public void CloseDown() public void CloseDown()

View File

@ -1,21 +1,16 @@
using System;
using System.Collections.Generic;
using System.Text;
using libsecondlife; using libsecondlife;
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules namespace OpenSim.Region.Environment.Modules
{ {
public class AvatarProfilesModule :IRegionModule public class AvatarProfilesModule : IRegionModule
{ {
private Scene m_scene; private Scene m_scene;
public AvatarProfilesModule() public AvatarProfilesModule()
{ {
} }
public void Initialise(Scene scene) public void Initialise(Scene scene)
@ -26,12 +21,10 @@ namespace OpenSim.Region.Environment.Modules
public void PostInitialise() public void PostInitialise()
{ {
} }
public void CloseDown() public void CloseDown()
{ {
} }
public string GetName() public string GetName()
@ -65,7 +58,8 @@ namespace OpenSim.Region.Environment.Modules
string bornOn = "Before now"; string bornOn = "Before now";
string flAbout = "First life? What is one of those? OpenSim is my life!"; string flAbout = "First life? What is one of those? OpenSim is my life!";
LLUUID partner = new LLUUID("11111111-1111-0000-0000-000100bba000"); LLUUID partner = new LLUUID("11111111-1111-0000-0000-000100bba000");
remoteClient.SendAvatarProperties(avatarID, about, bornOn, "", flAbout, 0, LLUUID.Zero, LLUUID.Zero, "", partner); remoteClient.SendAvatarProperties(avatarID, about, bornOn, "", flAbout, 0, LLUUID.Zero, LLUUID.Zero, "",
partner);
} }
} }
} }

View File

@ -1,16 +1,12 @@
using System; using System;
using System.Collections.Generic; using System.IO;
using System.Text;
using System.Net;
using System.Net.Sockets; using System.Net.Sockets;
using System.Threading; using System.Threading;
using System.IO;
using libsecondlife; using libsecondlife;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Utilities; using OpenSim.Framework.Utilities;
using OpenSim.Framework.Console; using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules namespace OpenSim.Region.Environment.Modules
{ {
@ -128,7 +124,8 @@ namespace OpenSim.Region.Environment.Modules
string mess = inputLine.Substring(inputLine.IndexOf(m_channel)); string mess = inputLine.Substring(inputLine.IndexOf(m_channel));
m_scene.ForEachScenePresence(delegate(ScenePresence presence) m_scene.ForEachScenePresence(delegate(ScenePresence presence)
{ {
presence.ControllingClient.SendChatMessage(Helpers.StringToField(mess), 255, pos, "IRC:", presence.ControllingClient.SendChatMessage(
Helpers.StringToField(mess), 255, pos, "IRC:",
LLUUID.Zero); LLUUID.Zero);
}); });
} }
@ -136,7 +133,8 @@ namespace OpenSim.Region.Environment.Modules
} }
} }
public void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName, LLUUID fromAgentID) public void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName,
LLUUID fromAgentID)
{ {
ScenePresence avatar = null; ScenePresence avatar = null;
avatar = m_scene.RequestAvatar(fromAgentID); avatar = m_scene.RequestAvatar(fromAgentID);

View File

@ -1,23 +1,20 @@
using System.Text; using System;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using System.IO;
using System.Collections.Generic; using System.Collections.Generic;
using libsecondlife; using libsecondlife;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Utilities;
using OpenSim.Framework.Console;
using OpenSim.Framework.Types; using OpenSim.Framework.Types;
using OpenSim.Framework.Utilities;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules namespace OpenSim.Region.Environment.Modules
{ {
public class DynamicTextureModule :IRegionModule, IDynamicTextureManager public class DynamicTextureModule : IRegionModule, IDynamicTextureManager
{ {
private Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>(); private Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>();
private Dictionary<string, IDynamicTextureRender> RenderPlugins= new Dictionary<string, IDynamicTextureRender>();
private Dictionary<string, IDynamicTextureRender> RenderPlugins =
new Dictionary<string, IDynamicTextureRender>();
private Dictionary<LLUUID, DynamicTextureUpdater> Updaters = new Dictionary<LLUUID, DynamicTextureUpdater>(); private Dictionary<LLUUID, DynamicTextureUpdater> Updaters = new Dictionary<LLUUID, DynamicTextureUpdater>();
public void Initialise(Scene scene) public void Initialise(Scene scene)
@ -31,7 +28,6 @@ namespace OpenSim.Region.Environment.Modules
public void PostInitialise() public void PostInitialise()
{ {
} }
public void CloseDown() public void CloseDown()
@ -69,10 +65,11 @@ namespace OpenSim.Region.Environment.Modules
} }
} }
public LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url, string extraParams, int updateTimer) public LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url,
string extraParams, int updateTimer)
{ {
System.Console.WriteLine("dynamic texture being created: " + url + " of type " + contentType); Console.WriteLine("dynamic texture being created: " + url + " of type " + contentType);
if (this.RenderPlugins.ContainsKey(contentType)) if (RenderPlugins.ContainsKey(contentType))
{ {
DynamicTextureUpdater updater = new DynamicTextureUpdater(); DynamicTextureUpdater updater = new DynamicTextureUpdater();
updater.SimUUID = simID; updater.SimUUID = simID;
@ -83,7 +80,7 @@ namespace OpenSim.Region.Environment.Modules
updater.UpdaterID = LLUUID.Random(); updater.UpdaterID = LLUUID.Random();
updater.Params = extraParams; updater.Params = extraParams;
if (!this.Updaters.ContainsKey(updater.UpdaterID)) if (!Updaters.ContainsKey(updater.UpdaterID))
{ {
Updaters.Add(updater.UpdaterID, updater); Updaters.Add(updater.UpdaterID, updater);
} }
@ -94,9 +91,10 @@ namespace OpenSim.Region.Environment.Modules
return LLUUID.Zero; return LLUUID.Zero;
} }
public LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data, string extraParams, int updateTimer) public LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data,
string extraParams, int updateTimer)
{ {
if (this.RenderPlugins.ContainsKey(contentType)) if (RenderPlugins.ContainsKey(contentType))
{ {
DynamicTextureUpdater updater = new DynamicTextureUpdater(); DynamicTextureUpdater updater = new DynamicTextureUpdater();
updater.SimUUID = simID; updater.SimUUID = simID;
@ -107,7 +105,7 @@ namespace OpenSim.Region.Environment.Modules
updater.UpdaterID = LLUUID.Random(); updater.UpdaterID = LLUUID.Random();
updater.Params = extraParams; updater.Params = extraParams;
if (!this.Updaters.ContainsKey(updater.UpdaterID)) if (!Updaters.ContainsKey(updater.UpdaterID))
{ {
Updaters.Add(updater.UpdaterID, updater); Updaters.Add(updater.UpdaterID, updater);
} }
@ -148,7 +146,7 @@ namespace OpenSim.Region.Environment.Modules
asset.Type = 0; asset.Type = 0;
scene.commsManager.AssetCache.AddAsset(asset); scene.commsManager.AssetCache.AddAsset(asset);
this.LastAssetID = asset.FullID; LastAssetID = asset.FullID;
SceneObjectPart part = scene.GetSceneObjectPart(PrimID); SceneObjectPart part = scene.GetSceneObjectPart(PrimID);
part.Shape.TextureEntry = new LLObject.TextureEntry(asset.FullID).ToBytes(); part.Shape.TextureEntry = new LLObject.TextureEntry(asset.FullID).ToBytes();

View File

@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenSim.Region.Environment.Modules namespace OpenSim.Region.Environment.Modules
{ {
class EmailModule internal class EmailModule
{ {
} }
} }

View File

@ -1,11 +1,5 @@
using System;
using System.Collections.Generic;
using System.Text;
using libsecondlife;
using OpenSim.Framework.Interfaces;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules namespace OpenSim.Region.Environment.Modules
{ {
@ -20,7 +14,6 @@ namespace OpenSim.Region.Environment.Modules
public void PostInitialise() public void PostInitialise()
{ {
} }
public void CloseDown() public void CloseDown()

View File

@ -1,10 +1,5 @@
using System;
using System.Collections.Generic;
using System.Text;
using libsecondlife;
using OpenSim.Framework.Interfaces;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules namespace OpenSim.Region.Environment.Modules
{ {
@ -19,7 +14,6 @@ namespace OpenSim.Region.Environment.Modules
public void PostInitialise() public void PostInitialise()
{ {
} }
public void CloseDown() public void CloseDown()
@ -37,4 +31,3 @@ namespace OpenSim.Region.Environment.Modules
} }
} }
} }

View File

@ -1,15 +1,9 @@
using System;
using System.Collections.Generic;
using System.Text;
using libsecondlife;
using OpenSim.Framework.Interfaces;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules namespace OpenSim.Region.Environment.Modules
{ {
public class InstantMessageModule :IRegionModule public class InstantMessageModule : IRegionModule
{ {
private Scene m_scene; private Scene m_scene;
@ -20,7 +14,6 @@ namespace OpenSim.Region.Environment.Modules
public void PostInitialise() public void PostInitialise()
{ {
} }
public void CloseDown() public void CloseDown()

View File

@ -1,15 +1,9 @@
using System;
using System.Collections.Generic;
using System.Text;
using libsecondlife;
using OpenSim.Framework.Interfaces;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules namespace OpenSim.Region.Environment.Modules
{ {
public class InventoryModule :IRegionModule public class InventoryModule : IRegionModule
{ {
private Scene m_scene; private Scene m_scene;
@ -20,7 +14,6 @@ namespace OpenSim.Region.Environment.Modules
public void PostInitialise() public void PostInitialise()
{ {
} }
public void CloseDown() public void CloseDown()

View File

@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenSim.Region.Environment.Modules namespace OpenSim.Region.Environment.Modules
{ {
class ScriptsHttpRequests internal class ScriptsHttpRequests
{ {
} }
} }

View File

@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenSim.Region.Environment.Modules namespace OpenSim.Region.Environment.Modules
{ {
class TeleportModule internal class TeleportModule
{ {
} }
} }

View File

@ -1,20 +1,16 @@
using System;
using System.Collections.Generic;
using System.Text;
using libsecondlife; using libsecondlife;
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules namespace OpenSim.Region.Environment.Modules
{ {
public class TextureDownloadModule :IRegionModule public class TextureDownloadModule : IRegionModule
{ {
private Scene m_scene; private Scene m_scene;
public TextureDownloadModule() public TextureDownloadModule()
{ {
} }
public void Initialise(Scene scene) public void Initialise(Scene scene)
@ -25,7 +21,6 @@ namespace OpenSim.Region.Environment.Modules
public void PostInitialise() public void PostInitialise()
{ {
} }
public void CloseDown() public void CloseDown()
@ -48,7 +43,6 @@ namespace OpenSim.Region.Environment.Modules
public void TextureAssetCallback(LLUUID texture, byte[] data) public void TextureAssetCallback(LLUUID texture, byte[] data)
{ {
} }
} }
} }

View File

@ -1,12 +1,9 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
using libsecondlife; using libsecondlife;
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Utilities;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules namespace OpenSim.Region.Environment.Modules
{ {
@ -19,7 +16,6 @@ namespace OpenSim.Region.Environment.Modules
public XferModule() public XferModule()
{ {
} }
public void Initialise(Scene scene) public void Initialise(Scene scene)
@ -32,12 +28,10 @@ namespace OpenSim.Region.Environment.Modules
public void PostInitialise() public void PostInitialise()
{ {
} }
public void CloseDown() public void CloseDown()
{ {
} }
public string GetName() public string GetName()
@ -82,7 +76,7 @@ namespace OpenSim.Region.Environment.Modules
public void AckPacket(IClientAPI remoteClient, ulong xferID, uint packet) public void AckPacket(IClientAPI remoteClient, ulong xferID, uint packet)
{ {
if (this.Transfers.ContainsKey(xferID)) if (Transfers.ContainsKey(xferID))
{ {
Transfers[xferID].AckPacket(packet); Transfers[xferID].AckPacket(packet);
} }
@ -126,7 +120,6 @@ namespace OpenSim.Region.Environment.Modules
public XferDownLoad() public XferDownLoad()
{ {
} }
public void StartSend() public void StartSend()
@ -142,10 +135,10 @@ namespace OpenSim.Region.Environment.Modules
} }
else else
{ {
byte[] transferData = new byte[1000 +4]; byte[] transferData = new byte[1000 + 4];
Array.Copy(Helpers.IntToBytes(Data.Length), 0, transferData, 0, 4); Array.Copy(Helpers.IntToBytes(Data.Length), 0, transferData, 0, 4);
Array.Copy(Data, 0, transferData, 4, 1000); Array.Copy(Data, 0, transferData, 4, 1000);
Client.SendXferPacket(XferID, 0 , transferData); Client.SendXferPacket(XferID, 0, transferData);
Packet++; Packet++;
DataPointer = 1000; DataPointer = 1000;
} }
@ -167,7 +160,7 @@ namespace OpenSim.Region.Environment.Modules
{ {
byte[] transferData = new byte[Data.Length - DataPointer]; byte[] transferData = new byte[Data.Length - DataPointer];
Array.Copy(Data, DataPointer, transferData, 0, Data.Length - DataPointer); Array.Copy(Data, DataPointer, transferData, 0, Data.Length - DataPointer);
uint endPacket = Packet |= (uint)0x80000000; uint endPacket = Packet |= (uint) 0x80000000;
Client.SendXferPacket(XferID, endPacket, transferData); Client.SendXferPacket(XferID, endPacket, transferData);
Packet++; Packet++;
DataPointer += (Data.Length - DataPointer); DataPointer += (Data.Length - DataPointer);

View File

@ -1,13 +1,6 @@
using System.Collections.Generic;
using OpenSim.Framework;
using OpenSim.Framework.Types;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Servers;
using OpenSim.Region.Capabilities;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.LandManagement;
using libsecondlife; using libsecondlife;
using OpenSim.Region.Environment.LandManagement;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment namespace OpenSim.Region.Environment
{ {
@ -20,6 +13,7 @@ namespace OpenSim.Region.Environment
// TODO: Change this to false when permissions are a desired default // TODO: Change this to false when permissions are a desired default
// TODO: Move to configuration option. // TODO: Move to configuration option.
private bool m_bypassPermissions = true; private bool m_bypassPermissions = true;
public bool BypassPermissions public bool BypassPermissions
{ {
get { return m_bypassPermissions; } get { return m_bypassPermissions; }
@ -104,7 +98,7 @@ namespace OpenSim.Region.Environment
// Default: deny // Default: deny
bool permission = false; bool permission = false;
if( !m_scene.Entities.ContainsKey( objId )) if (!m_scene.Entities.ContainsKey(objId))
{ {
return false; return false;
} }
@ -115,7 +109,7 @@ namespace OpenSim.Region.Environment
return false; return false;
} }
SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[objId]; SceneObjectGroup task = (SceneObjectGroup) m_scene.Entities[objId];
LLUUID taskOwner = null; LLUUID taskOwner = null;
// Object owners should be able to edit their own content // Object owners should be able to edit their own content
@ -123,7 +117,8 @@ namespace OpenSim.Region.Environment
permission = true; permission = true;
// Users should be able to edit what is over their land. // Users should be able to edit what is over their land.
if (m_scene.LandManager.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y).landData.ownerID == user) if (m_scene.LandManager.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y).landData.ownerID ==
user)
permission = true; permission = true;
// Estate users should be able to edit anything in the sim // Estate users should be able to edit anything in the sim
@ -270,7 +265,7 @@ namespace OpenSim.Region.Environment
// TODO: Need to do some extra checks here. Requires group code. // TODO: Need to do some extra checks here. Requires group code.
} }
if(IsEstateManager(user)) if (IsEstateManager(user))
permission = true; permission = true;
if (IsAdministrator(user)) if (IsAdministrator(user))
@ -300,6 +295,5 @@ namespace OpenSim.Region.Environment
} }
#endregion #endregion
} }
} }

View File

@ -1,34 +1,3 @@
using System.Collections.Generic;
using OpenSim.Framework;
using OpenSim.Framework.Types;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Servers;
using OpenSim.Region.Capabilities;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.LandManagement;
namespace OpenSim.Region.Environment namespace OpenSim.Region.Environment
{ {
public delegate TResult ModuleAPIMethod1<TResult, TParam0>(TParam0 param0);
public delegate TResult ModuleAPIMethod2<TResult, TParam0, TParam1>(TParam0 param0, TParam1 param1);
public class RegionManager
{
protected AgentCircuitManager authenticateHandler;
protected RegionCommsListener regionCommsHost;
protected CommunicationsManager commsManager;
protected List<Caps> capsHandlers = new List<Caps>();
protected BaseHttpServer httpListener;
protected Scene m_Scene;
public LandManager LandManager;
public EstateManager estateManager;
public RegionManager()
{
}
}
} }

View File

@ -1,7 +1,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using Axiom.Math; using Axiom.Math;
using libsecondlife; using libsecondlife;
using OpenSim.Region.Environment.Scenes.Scripting;
namespace OpenSim.Region.Environment.Scenes namespace OpenSim.Region.Environment.Scenes
{ {
@ -12,19 +11,15 @@ namespace OpenSim.Region.Environment.Scenes
protected Scene m_scene; protected Scene m_scene;
public LLUUID m_uuid; public LLUUID m_uuid;
public virtual LLUUID UUID public virtual LLUUID UUID
{ {
get get { return m_uuid; }
{ set { m_uuid = value; }
return m_uuid;
}
set
{
m_uuid = value;
}
} }
protected string m_name; protected string m_name;
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@ -35,6 +30,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
protected LLVector3 m_pos; protected LLVector3 m_pos;
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@ -45,6 +41,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
public LLVector3 m_velocity; public LLVector3 m_velocity;
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@ -55,6 +52,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
protected Quaternion m_rotation = new Quaternion(0, 0, 1, 0); protected Quaternion m_rotation = new Quaternion(0, 0, 1, 0);
public virtual Quaternion Rotation public virtual Quaternion Rotation
{ {
get { return m_rotation; } get { return m_rotation; }
@ -62,6 +60,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
protected uint m_localId; protected uint m_localId;
public virtual uint LocalId public virtual uint LocalId
{ {
get { return m_localId; } get { return m_localId; }

View File

@ -1,12 +1,10 @@
using System; using Axiom.Math;
using System.IO;
using System.Collections.Generic;
using libsecondlife; using libsecondlife;
using libsecondlife.Packets; using libsecondlife.Packets;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Types;
using OpenSim.Framework.Communications.Caches; using OpenSim.Framework.Communications.Caches;
using OpenSim.Framework.Data; using OpenSim.Framework.Data;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Types;
using OpenSim.Framework.Utilities; using OpenSim.Framework.Utilities;
using OpenSim.Region.Physics.Manager; using OpenSim.Region.Physics.Manager;
@ -19,9 +17,9 @@ namespace OpenSim.Region.Environment.Scenes
public void AddInventoryItem(LLUUID userID, InventoryItemBase item) public void AddInventoryItem(LLUUID userID, InventoryItemBase item)
{ {
if (this.Avatars.ContainsKey(userID)) if (Avatars.ContainsKey(userID))
{ {
this.AddInventoryItem(this.Avatars[userID].ControllingClient, item); AddInventoryItem(Avatars[userID].ControllingClient, item);
} }
} }
@ -37,9 +35,9 @@ namespace OpenSim.Region.Environment.Scenes
public LLUUID CapsUpdateInventoryItemAsset(LLUUID userID, LLUUID itemID, byte[] data) public LLUUID CapsUpdateInventoryItemAsset(LLUUID userID, LLUUID itemID, byte[] data)
{ {
if (this.Avatars.ContainsKey(userID)) if (Avatars.ContainsKey(userID))
{ {
return this.CapsUpdateInventoryItemAsset(this.Avatars[userID].ControllingClient, itemID, data); return CapsUpdateInventoryItemAsset(Avatars[userID].ControllingClient, itemID, data);
} }
return LLUUID.Zero; return LLUUID.Zero;
} }
@ -57,8 +55,8 @@ namespace OpenSim.Region.Environment.Scenes
AssetBase asset; AssetBase asset;
asset = new AssetBase(); asset = new AssetBase();
asset.FullID = LLUUID.Random(); asset.FullID = LLUUID.Random();
asset.Type = (sbyte)item.assetType; asset.Type = (sbyte) item.assetType;
asset.InvType = (sbyte)item.invType; asset.InvType = (sbyte) item.invType;
asset.Name = item.inventoryName; asset.Name = item.inventoryName;
asset.Data = data; asset.Data = data;
commsManager.AssetCache.AddAsset(asset); commsManager.AssetCache.AddAsset(asset);
@ -83,7 +81,8 @@ namespace OpenSim.Region.Environment.Scenes
return LLUUID.Zero; return LLUUID.Zero;
} }
public void UDPUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID transactionID, LLUUID assetID, LLUUID itemID) public void UDPUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID transactionID, LLUUID assetID,
LLUUID itemID)
{ {
CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId);
if (userInfo != null) if (userInfo != null)
@ -93,7 +92,8 @@ namespace OpenSim.Region.Environment.Scenes
InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
if (item != null) if (item != null)
{ {
AgentAssetTransactions transactions = commsManager.TransactionsManager.GetUserTransActions(remoteClient.AgentId); AgentAssetTransactions transactions =
commsManager.TransactionsManager.GetUserTransActions(remoteClient.AgentId);
if (transactions != null) if (transactions != null)
{ {
AssetBase asset = null; AssetBase asset = null;
@ -112,8 +112,8 @@ namespace OpenSim.Region.Environment.Scenes
{ {
asset.Name = item.inventoryName; asset.Name = item.inventoryName;
asset.Description = item.inventoryDescription; asset.Description = item.inventoryDescription;
asset.InvType = (sbyte)item.invType; asset.InvType = (sbyte) item.invType;
asset.Type = (sbyte)item.assetType; asset.Type = (sbyte) item.assetType;
item.assetID = asset.FullID; item.assetID = asset.FullID;
if (addToCache) if (addToCache)
@ -143,7 +143,9 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="type"></param> /// <param name="type"></param>
/// <param name="wearableType"></param> /// <param name="wearableType"></param>
/// <param name="nextOwnerMask"></param> /// <param name="nextOwnerMask"></param>
public void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID, uint callbackID, string description, string name, sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask) public void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID,
uint callbackID, string description, string name, sbyte invType, sbyte type,
byte wearableType, uint nextOwnerMask)
{ {
if (transActionID == LLUUID.Zero) if (transActionID == LLUUID.Zero)
{ {
@ -157,7 +159,7 @@ namespace OpenSim.Region.Environment.Scenes
asset.Type = type; asset.Type = type;
asset.FullID = LLUUID.Random(); asset.FullID = LLUUID.Random();
asset.Data = new byte[1]; asset.Data = new byte[1];
this.commsManager.AssetCache.AddAsset(asset); commsManager.AssetCache.AddAsset(asset);
InventoryItemBase item = new InventoryItemBase(); InventoryItemBase item = new InventoryItemBase();
item.avatarID = remoteClient.AgentId; item.avatarID = remoteClient.AgentId;
@ -178,7 +180,9 @@ namespace OpenSim.Region.Environment.Scenes
} }
else else
{ {
commsManager.TransactionsManager.HandleInventoryFromTransaction(remoteClient, transActionID, folderID, callbackID, description, name, invType, type, wearableType, nextOwnerMask); commsManager.TransactionsManager.HandleInventoryFromTransaction(remoteClient, transActionID, folderID,
callbackID, description, name, invType,
type, wearableType, nextOwnerMask);
//System.Console.WriteLine("request to create inventory item from transaction " + transActionID); //System.Console.WriteLine("request to create inventory item from transaction " + transActionID);
} }
} }
@ -195,15 +199,15 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
hasPrim = ((SceneObjectGroup)ent).HasChildPrim(primLocalID); hasPrim = ((SceneObjectGroup) ent).HasChildPrim(primLocalID);
if (hasPrim != false) if (hasPrim != false)
{ {
bool fileChange = ((SceneObjectGroup)ent).GetPartInventoryFileName(remoteClient, primLocalID); bool fileChange = ((SceneObjectGroup) ent).GetPartInventoryFileName(remoteClient, primLocalID);
if (fileChange) if (fileChange)
{ {
if (this.XferManager != null) if (XferManager != null)
{ {
((SceneObjectGroup)ent).RequestInventoryFile(primLocalID, XferManager); ((SceneObjectGroup) ent).RequestInventoryFile(primLocalID, XferManager);
} }
} }
break; break;
@ -219,14 +223,14 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
if (hasPrim != false) if (hasPrim != false)
{ {
int type = ((SceneObjectGroup)ent).RemoveInventoryItem(remoteClient, localID, itemID); int type = ((SceneObjectGroup) ent).RemoveInventoryItem(remoteClient, localID, itemID);
((SceneObjectGroup)ent).GetProperites(remoteClient); ((SceneObjectGroup) ent).GetProperites(remoteClient);
if (type == 10) if (type == 10)
{ {
this.EventManager.TriggerRemoveScript(localID, itemID); EventManager.TriggerRemoveScript(localID, itemID);
} }
} }
} }
@ -255,7 +259,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
string script = Util.FieldToString(rezAsset.Data); string script = Util.FieldToString(rezAsset.Data);
//Console.WriteLine("rez script "+script); //Console.WriteLine("rez script "+script);
this.EventManager.TriggerRezScript(localID, copyID, script); EventManager.TriggerRezScript(localID, copyID, script);
rezzed = true; rezzed = true;
} }
else else
@ -266,7 +270,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
string script = Util.FieldToString(rezAsset.Data); string script = Util.FieldToString(rezAsset.Data);
// Console.WriteLine("rez script " + script); // Console.WriteLine("rez script " + script);
this.EventManager.TriggerRezScript(localID, copyID, script); EventManager.TriggerRezScript(localID, copyID, script);
rezzed = true; rezzed = true;
} }
} }
@ -278,12 +282,13 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
if (hasPrim != false) if (hasPrim != false)
{ {
bool added =
bool added = ((SceneObjectGroup)ent).AddInventoryItem(remoteClient, localID, item, copyID); ((SceneObjectGroup) ent).AddInventoryItem(remoteClient, localID, item,
((SceneObjectGroup)ent).GetProperites(remoteClient); copyID);
((SceneObjectGroup) ent).GetProperites(remoteClient);
} }
} }
} }
@ -300,7 +305,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="simClient"></param> /// <param name="simClient"></param>
public void DeRezObject(Packet packet, IClientAPI remoteClient) public void DeRezObject(Packet packet, IClientAPI remoteClient)
{ {
DeRezObjectPacket DeRezPacket = (DeRezObjectPacket)packet; DeRezObjectPacket DeRezPacket = (DeRezObjectPacket) packet;
if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero) if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero)
{ {
@ -312,7 +317,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
EntityBase selectedEnt = null; EntityBase selectedEnt = null;
//OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString()); //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString());
foreach (EntityBase ent in this.Entities.Values) foreach (EntityBase ent in Entities.Values)
{ {
if (ent.LocalId == Data.ObjectLocalID) if (ent.LocalId == Data.ObjectLocalID)
{ {
@ -322,15 +327,16 @@ namespace OpenSim.Region.Environment.Scenes
} }
if (selectedEnt != null) if (selectedEnt != null)
{ {
if (PermissionsMngr.CanDeRezObject(remoteClient.AgentId, ((SceneObjectGroup)selectedEnt).UUID)) if (PermissionsMngr.CanDeRezObject(remoteClient.AgentId, ((SceneObjectGroup) selectedEnt).UUID))
{ {
string sceneObjectXml = ((SceneObjectGroup)selectedEnt).ToXmlString(); string sceneObjectXml = ((SceneObjectGroup) selectedEnt).ToXmlString();
CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId);
if (userInfo != null) if (userInfo != null)
{ {
AssetBase asset = new AssetBase(); AssetBase asset = new AssetBase();
asset.Name = ((SceneObjectGroup)selectedEnt).GetPartName(selectedEnt.LocalId); asset.Name = ((SceneObjectGroup) selectedEnt).GetPartName(selectedEnt.LocalId);
asset.Description = ((SceneObjectGroup)selectedEnt).GetPartDescription(selectedEnt.LocalId); asset.Description =
((SceneObjectGroup) selectedEnt).GetPartDescription(selectedEnt.LocalId);
asset.InvType = 6; asset.InvType = 6;
asset.Type = 6; asset.Type = 6;
asset.FullID = LLUUID.Random(); asset.FullID = LLUUID.Random();
@ -355,21 +361,23 @@ namespace OpenSim.Region.Environment.Scenes
remoteClient.SendInventoryItemUpdate(item); remoteClient.SendInventoryItemUpdate(item);
} }
SceneObjectPart rootPart = ((SceneObjectGroup)selectedEnt).GetChildPart(((SceneObjectGroup)selectedEnt).UUID); SceneObjectPart rootPart =
((SceneObjectGroup) selectedEnt).GetChildPart(((SceneObjectGroup) selectedEnt).UUID);
if (rootPart.PhysActor != null) if (rootPart.PhysActor != null)
{ {
this.phyScene.RemovePrim(rootPart.PhysActor); phyScene.RemovePrim(rootPart.PhysActor);
rootPart.PhysActor = null; rootPart.PhysActor = null;
} }
storageManager.DataStore.RemoveObject(((SceneObjectGroup)selectedEnt).UUID, m_regInfo.SimUUID); storageManager.DataStore.RemoveObject(((SceneObjectGroup) selectedEnt).UUID,
((SceneObjectGroup)selectedEnt).DeleteGroup(); m_regInfo.SimUUID);
((SceneObjectGroup) selectedEnt).DeleteGroup();
lock (Entities) lock (Entities)
{ {
Entities.Remove(((SceneObjectGroup)selectedEnt).UUID); Entities.Remove(((SceneObjectGroup) selectedEnt).UUID);
} }
((SceneObjectGroup)selectedEnt).DeleteParts(); ((SceneObjectGroup) selectedEnt).DeleteParts();
} }
} }
} }
@ -389,7 +397,7 @@ namespace OpenSim.Region.Environment.Scenes
AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false); AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false);
if (rezAsset != null) if (rezAsset != null)
{ {
this.AddRezObject(Util.FieldToString(rezAsset.Data), pos); AddRezObject(Util.FieldToString(rezAsset.Data), pos);
userInfo.DeleteItem(remoteClient.AgentId, item); userInfo.DeleteItem(remoteClient.AgentId, item);
remoteClient.SendRemoveInventoryItem(itemID); remoteClient.SendRemoveInventoryItem(itemID);
} }
@ -399,7 +407,7 @@ namespace OpenSim.Region.Environment.Scenes
rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false); rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false);
if (rezAsset != null) if (rezAsset != null)
{ {
this.AddRezObject(Util.FieldToString(rezAsset.Data), pos); AddRezObject(Util.FieldToString(rezAsset.Data), pos);
userInfo.DeleteItem(remoteClient.AgentId, item); userInfo.DeleteItem(remoteClient.AgentId, item);
remoteClient.SendRemoveInventoryItem(itemID); remoteClient.SendRemoveInventoryItem(itemID);
} }
@ -411,17 +419,17 @@ namespace OpenSim.Region.Environment.Scenes
private void AddRezObject(string xmlData, LLVector3 pos) private void AddRezObject(string xmlData, LLVector3 pos)
{ {
SceneObjectGroup group = new SceneObjectGroup(this, this.m_regionHandle, xmlData); SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, xmlData);
this.AddEntity(group); AddEntity(group);
group.AbsolutePosition = pos; group.AbsolutePosition = pos;
SceneObjectPart rootPart = group.GetChildPart(group.UUID); SceneObjectPart rootPart = group.GetChildPart(group.UUID);
if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0)
rootPart.PhysActor = phyScene.AddPrim( rootPart.PhysActor = phyScene.AddPrim(
new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, rootPart.AbsolutePosition.Z), new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y,
rootPart.AbsolutePosition.Z),
new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z),
new Axiom.Math.Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
rootPart.RotationOffset.Y, rootPart.RotationOffset.Z)); rootPart.RotationOffset.Y, rootPart.RotationOffset.Z));
} }
} }
} }

View File

@ -25,17 +25,11 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System;
using System.IO;
using System.Collections.Generic; using System.Collections.Generic;
using libsecondlife; using libsecondlife;
using libsecondlife.Packets; using libsecondlife.Packets;
using OpenSim.Framework.Console;
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Types;
using OpenSim.Framework.Communications.Caches;
using OpenSim.Framework.Data;
using OpenSim.Framework.Utilities;
using OpenSim.Region.Environment.Interfaces;
namespace OpenSim.Region.Environment.Scenes namespace OpenSim.Region.Environment.Scenes
{ {
@ -50,7 +44,8 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="action">The action to be performed</param> /// <param name="action">The action to be performed</param>
/// <param name="north">Distance from the north border where the cursor is located</param> /// <param name="north">Distance from the north border where the cursor is located</param>
/// <param name="west">Distance from the west border where the cursor is located</param> /// <param name="west">Distance from the west border where the cursor is located</param>
public void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west, IClientAPI remoteUser) public void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west,
IClientAPI remoteUser)
{ {
// Do a permissions check before allowing terraforming. // Do a permissions check before allowing terraforming.
// random users are now no longer allowed to terraform // random users are now no longer allowed to terraform
@ -71,17 +66,19 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="timestamp"></param> /// <param name="timestamp"></param>
/// <param name="fromAgentName"></param> /// <param name="fromAgentName"></param>
/// <param name="message"></param> /// <param name="message"></param>
public void InstantMessage(LLUUID fromAgentID, LLUUID fromAgentSession, LLUUID toAgentID, LLUUID imSessionID, uint timestamp, string fromAgentName, string message, byte dialog) public void InstantMessage(LLUUID fromAgentID, LLUUID fromAgentSession, LLUUID toAgentID, LLUUID imSessionID,
uint timestamp, string fromAgentName, string message, byte dialog)
{ {
if (this.Avatars.ContainsKey(toAgentID)) if (Avatars.ContainsKey(toAgentID))
{ {
if (this.Avatars.ContainsKey(fromAgentID)) if (Avatars.ContainsKey(fromAgentID))
{ {
// Local sim message // Local sim message
ScenePresence fromAvatar = this.Avatars[fromAgentID]; ScenePresence fromAvatar = Avatars[fromAgentID];
ScenePresence toAvatar = this.Avatars[toAgentID]; ScenePresence toAvatar = Avatars[toAgentID];
string fromName = fromAvatar.Firstname + " " + fromAvatar.Lastname; string fromName = fromAvatar.Firstname + " " + fromAvatar.Lastname;
toAvatar.ControllingClient.SendInstantMessage(fromAgentID, fromAgentSession, message, toAgentID, imSessionID, fromName, dialog, timestamp); toAvatar.ControllingClient.SendInstantMessage(fromAgentID, fromAgentSession, message, toAgentID,
imSessionID, fromName, dialog, timestamp);
} }
else else
{ {
@ -102,7 +99,8 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="fromPos"></param> /// <param name="fromPos"></param>
/// <param name="fromName"></param> /// <param name="fromName"></param>
/// <param name="fromAgentID"></param> /// <param name="fromAgentID"></param>
public void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName, LLUUID fromAgentID) public void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName,
LLUUID fromAgentID)
{ {
if (m_simChatModule != null) if (m_simChatModule != null)
{ {
@ -123,9 +121,9 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
if (((SceneObjectGroup)ent).LocalId == originalPrim) if (((SceneObjectGroup) ent).LocalId == originalPrim)
{ {
originPrim = (SceneObjectGroup)ent; originPrim = (SceneObjectGroup) ent;
break; break;
} }
} }
@ -135,7 +133,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
SceneObjectGroup copy = originPrim.Copy(); SceneObjectGroup copy = originPrim.Copy();
copy.AbsolutePosition = copy.AbsolutePosition + offset; copy.AbsolutePosition = copy.AbsolutePosition + offset;
this.Entities.Add(copy.UUID, copy); Entities.Add(copy.UUID, copy);
copy.ScheduleGroupForFullUpdate(); copy.ScheduleGroupForFullUpdate();
/* List<ScenePresence> avatars = this.RequestAvatarList(); /* List<ScenePresence> avatars = this.RequestAvatarList();
@ -143,13 +141,11 @@ namespace OpenSim.Region.Environment.Scenes
{ {
// copy.SendAllChildPrimsToClient(avatars[i].ControllingClient); // copy.SendAllChildPrimsToClient(avatars[i].ControllingClient);
}*/ }*/
} }
else else
{ {
OpenSim.Framework.Console.MainLog.Instance.Warn("client", "Attempted to duplicate nonexistant prim"); MainLog.Instance.Warn("client", "Attempted to duplicate nonexistant prim");
} }
} }
/// <summary> /// <summary>
@ -164,9 +160,9 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
if (((SceneObjectGroup)ent).LocalId == parentPrim) if (((SceneObjectGroup) ent).LocalId == parentPrim)
{ {
parenPrim = (SceneObjectGroup)ent; parenPrim = (SceneObjectGroup) ent;
break; break;
} }
} }
@ -181,9 +177,9 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
if (((SceneObjectGroup)ent).LocalId == childPrims[i]) if (((SceneObjectGroup) ent).LocalId == childPrims[i])
{ {
children.Add((SceneObjectGroup)ent); children.Add((SceneObjectGroup) ent);
} }
} }
} }
@ -208,10 +204,10 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
hasPrim = ((SceneObjectGroup)ent).HasChildPrim(primLocalID); hasPrim = ((SceneObjectGroup) ent).HasChildPrim(primLocalID);
if (hasPrim != false) if (hasPrim != false)
{ {
((SceneObjectGroup)ent).UpdateShape(shapeBlock, primLocalID); ((SceneObjectGroup) ent).UpdateShape(shapeBlock, primLocalID);
break; break;
} }
} }
@ -225,10 +221,10 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
hasPrim = ((SceneObjectGroup)ent).HasChildPrim(primLocalID); hasPrim = ((SceneObjectGroup) ent).HasChildPrim(primLocalID);
if (hasPrim != false) if (hasPrim != false)
{ {
((SceneObjectGroup)ent).UpdateExtraParam(primLocalID, type, inUse, data); ((SceneObjectGroup) ent).UpdateExtraParam(primLocalID, type, inUse, data);
break; break;
} }
} }
@ -246,11 +242,11 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
if (((SceneObjectGroup)ent).LocalId == primLocalID) if (((SceneObjectGroup) ent).LocalId == primLocalID)
{ {
((SceneObjectGroup)ent).GetProperites(remoteClient); ((SceneObjectGroup) ent).GetProperites(remoteClient);
((SceneObjectGroup)ent).IsSelected = true; ((SceneObjectGroup) ent).IsSelected = true;
this.LandManager.setPrimsTainted(); LandManager.setPrimsTainted();
break; break;
} }
} }
@ -268,10 +264,10 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
if (((SceneObjectGroup)ent).LocalId == primLocalID) if (((SceneObjectGroup) ent).LocalId == primLocalID)
{ {
((SceneObjectGroup)ent).IsSelected = false; ((SceneObjectGroup) ent).IsSelected = false;
this.LandManager.setPrimsTainted(); LandManager.setPrimsTainted();
break; break;
} }
} }
@ -290,10 +286,10 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
hasPrim = ((SceneObjectGroup)ent).HasChildPrim(primLocalID); hasPrim = ((SceneObjectGroup) ent).HasChildPrim(primLocalID);
if (hasPrim != false) if (hasPrim != false)
{ {
((SceneObjectGroup)ent).SetPartDescription(description, primLocalID); ((SceneObjectGroup) ent).SetPartDescription(description, primLocalID);
break; break;
} }
} }
@ -312,10 +308,10 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
hasPrim = ((SceneObjectGroup)ent).HasChildPrim(primLocalID); hasPrim = ((SceneObjectGroup) ent).HasChildPrim(primLocalID);
if (hasPrim != false) if (hasPrim != false)
{ {
((SceneObjectGroup)ent).SetPartName(name, primLocalID); ((SceneObjectGroup) ent).SetPartName(name, primLocalID);
break; break;
} }
} }
@ -331,10 +327,10 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
hasPrim = ((SceneObjectGroup)ent).HasChildPrim(objectID); hasPrim = ((SceneObjectGroup) ent).HasChildPrim(objectID);
if (hasPrim != false) if (hasPrim != false)
{ {
((SceneObjectGroup)ent).GrabMovement(offset, pos, remoteClient); ((SceneObjectGroup) ent).GrabMovement(offset, pos, remoteClient);
break; break;
} }
} }
@ -350,7 +346,6 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="remoteClient"></param> /// <param name="remoteClient"></param>
public void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient) public void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient)
{ {
} }
/// <summary> /// <summary>
@ -366,10 +361,10 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
if (hasPrim != false) if (hasPrim != false)
{ {
((SceneObjectGroup)ent).UpdateTextureEntry(localID, texture); ((SceneObjectGroup) ent).UpdateTextureEntry(localID, texture);
break; break;
} }
} }
@ -389,10 +384,10 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
if (hasPrim != false) if (hasPrim != false)
{ {
((SceneObjectGroup)ent).UpdateGroupPosition(pos); ((SceneObjectGroup) ent).UpdateGroupPosition(pos);
break; break;
} }
} }
@ -406,10 +401,10 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
if (hasPrim != false) if (hasPrim != false)
{ {
((SceneObjectGroup)ent).UpdateSinglePosition(pos, localID); ((SceneObjectGroup) ent).UpdateSinglePosition(pos, localID);
break; break;
} }
} }
@ -430,10 +425,10 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
if (hasPrim != false) if (hasPrim != false)
{ {
((SceneObjectGroup)ent).UpdateGroupRotation(pos, rot); ((SceneObjectGroup) ent).UpdateGroupRotation(pos, rot);
break; break;
} }
} }
@ -453,10 +448,10 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
if (hasPrim != false) if (hasPrim != false)
{ {
((SceneObjectGroup)ent).UpdateGroupRotation(rot); ((SceneObjectGroup) ent).UpdateGroupRotation(rot);
break; break;
} }
} }
@ -476,10 +471,10 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
if (hasPrim != false) if (hasPrim != false)
{ {
((SceneObjectGroup)ent).UpdateSingleRotation(rot, localID); ((SceneObjectGroup) ent).UpdateSingleRotation(rot, localID);
break; break;
} }
} }
@ -499,10 +494,10 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
if (hasPrim != false) if (hasPrim != false)
{ {
((SceneObjectGroup)ent).Resize(scale, localID); ((SceneObjectGroup) ent).Resize(scale, localID);
break; break;
} }
} }
@ -511,7 +506,7 @@ namespace OpenSim.Region.Environment.Scenes
public void StartAnimation(IClientAPI client, LLUUID animID, int seq) public void StartAnimation(IClientAPI client, LLUUID animID, int seq)
{ {
List<ScenePresence> avatars = this.RequestAvatarList(); List<ScenePresence> avatars = RequestAvatarList();
for (int i = 0; i < avatars.Count; i++) for (int i = 0; i < avatars.Count; i++)
{ {
avatars[i].ControllingClient.SendAnimation(animID, seq, client.AgentId); avatars[i].ControllingClient.SendAnimation(animID, seq, client.AgentId);
@ -520,7 +515,7 @@ namespace OpenSim.Region.Environment.Scenes
public virtual void ProcessObjectGrab(uint localID, LLVector3 offsetPos, IClientAPI remoteClient) public virtual void ProcessObjectGrab(uint localID, LLVector3 offsetPos, IClientAPI remoteClient)
{ {
this.EventManager.TriggerObjectGrab(localID, offsetPos, remoteClient); EventManager.TriggerObjectGrab(localID, offsetPos, remoteClient);
} }
} }
} }

View File

@ -27,28 +27,28 @@
*/ */
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Threading; using System.Threading;
using System.Timers; using System.Timers;
using System.IO;
using System.Xml; using System.Xml;
using Axiom.Math;
using libsecondlife; using libsecondlife;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Caches;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Servers; using OpenSim.Framework.Servers;
using OpenSim.Framework.Types; using OpenSim.Framework.Types;
using OpenSim.Framework.Utilities; using OpenSim.Framework.Utilities;
using OpenSim.Region.Physics.Manager; using OpenSim.Region.Capabilities;
using OpenSim.Framework.Communications.Caches;
using OpenSim.Region.Environment.LandManagement;
using OpenSim.Region.Environment;
using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.LandManagement;
using OpenSim.Region.Environment.Scenes.Scripting;
using OpenSim.Region.Environment.Types; using OpenSim.Region.Environment.Types;
using OpenSim.Region.Physics.Manager;
using OpenSim.Region.Terrain; using OpenSim.Region.Terrain;
using OpenSim.Framework.Data; using Timer=System.Timers.Timer;
using Caps = OpenSim.Region.Capabilities.Caps;
using Timer = System.Timers.Timer;
namespace OpenSim.Region.Environment.Scenes namespace OpenSim.Region.Environment.Scenes
{ {
@ -61,8 +61,11 @@ namespace OpenSim.Region.Environment.Scenes
protected Timer m_heartbeatTimer = new Timer(); protected Timer m_heartbeatTimer = new Timer();
protected Dictionary<LLUUID, ScenePresence> Avatars; protected Dictionary<LLUUID, ScenePresence> Avatars;
protected Dictionary<LLUUID, SceneObjectGroup> Prims; protected Dictionary<LLUUID, SceneObjectGroup> Prims;
public PhysicsScene phyScene; /// publicized so it can be accessed from SceneObjectGroup. public PhysicsScene phyScene;
/// publicized so it can be accessed from SceneObjectGroup.
protected float timeStep = 0.1f; protected float timeStep = 0.1f;
private Random Rand = new Random(); private Random Rand = new Random();
private uint _primCount = 702000; private uint _primCount = 702000;
private Mutex _primAllocateMutex = new Mutex(false); private Mutex _primAllocateMutex = new Mutex(false);
@ -102,8 +105,9 @@ namespace OpenSim.Region.Environment.Scenes
public AgentCircuitManager AuthenticateHandler public AgentCircuitManager AuthenticateHandler
{ {
get { return this.authenticateHandler; } get { return authenticateHandler; }
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@ -141,7 +145,7 @@ namespace OpenSim.Region.Environment.Scenes
public int TimePhase public int TimePhase
{ {
get { return this.m_timePhase; } get { return m_timePhase; }
} }
#endregion #endregion
@ -155,7 +159,8 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="regionHandle">Region Handle for this region</param> /// <param name="regionHandle">Region Handle for this region</param>
/// <param name="regionName">Region Name for this region</param> /// <param name="regionName">Region Name for this region</param>
public Scene(RegionInfo regInfo, AgentCircuitManager authen, CommunicationsManager commsMan, public Scene(RegionInfo regInfo, AgentCircuitManager authen, CommunicationsManager commsMan,
AssetCache assetCach, StorageManager storeManager, BaseHttpServer httpServer, ModuleLoader moduleLoader) AssetCache assetCach, StorageManager storeManager, BaseHttpServer httpServer,
ModuleLoader moduleLoader)
{ {
updateLock = new Mutex(false); updateLock = new Mutex(false);
@ -190,22 +195,21 @@ namespace OpenSim.Region.Environment.Scenes
Prims = new Dictionary<LLUUID, SceneObjectGroup>(); Prims = new Dictionary<LLUUID, SceneObjectGroup>();
MainLog.Instance.Verbose("Creating LandMap"); MainLog.Instance.Verbose("Creating LandMap");
Terrain = new TerrainEngine((int)this.RegionInfo.RegionLocX, (int)this.RegionInfo.RegionLocY); Terrain = new TerrainEngine((int) RegionInfo.RegionLocX, (int) RegionInfo.RegionLocY);
ScenePresence.LoadAnims(); ScenePresence.LoadAnims();
httpListener = httpServer; httpListener = httpServer;
} }
#endregion #endregion
public void SetModuleInterfaces() public void SetModuleInterfaces()
{ {
m_simChatModule = this.RequestModuleInterface<ISimChat>(); m_simChatModule = RequestModuleInterface<ISimChat>();
m_httpRequestModule = this.RequestModuleInterface<IHttpRequests>(); m_httpRequestModule = RequestModuleInterface<IHttpRequests>();
XferManager = this.RequestModuleInterface<IXfer>(); XferManager = RequestModuleInterface<IXfer>();
} }
#region Script Handling Methods #region Script Handling Methods
@ -249,7 +253,8 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (phyScene.IsThreaded) if (phyScene.IsThreaded)
{ {
phyScene.GetResults(); /// no engines implement this, and what does it have to do with threading? possible DEAD CODE phyScene.GetResults();
/// no engines implement this, and what does it have to do with threading? possible DEAD CODE
} }
List<EntityBase> moveEntities = new List<EntityBase>(Entities.Values); List<EntityBase> moveEntities = new List<EntityBase>(Entities.Values);
@ -308,9 +313,10 @@ namespace OpenSim.Region.Environment.Scenes
{ {
for (int y = 0; y < 16; y++) for (int y = 0; y < 16; y++)
{ {
if (Terrain.Tainted(x * 16, y * 16)) if (Terrain.Tainted(x*16, y*16))
{ {
SendLayerData(x, y, presence.ControllingClient, terData); SendLayerData(x, y, presence.ControllingClient,
terData);
} }
} }
} }
@ -340,7 +346,7 @@ namespace OpenSim.Region.Environment.Scenes
m_timeUpdateCount++; m_timeUpdateCount++;
if (m_timeUpdateCount > 600) if (m_timeUpdateCount > 600)
{ {
List<ScenePresence> Avatars = this.RequestAvatarList(); List<ScenePresence> Avatars = RequestAvatarList();
foreach (ScenePresence avatar in Avatars) foreach (ScenePresence avatar in Avatars)
{ {
if (!avatar.childAgent) if (!avatar.childAgent)
@ -398,10 +404,7 @@ namespace OpenSim.Region.Environment.Scenes
storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD()); storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD());
ForEachScenePresence(delegate(ScenePresence presence) ForEachScenePresence(delegate(ScenePresence presence) { SendLayerData(presence.ControllingClient); });
{
SendLayerData(presence.ControllingClient);
});
foreach (LLUUID UUID in Entities.Keys) foreach (LLUUID UUID in Entities.Keys)
{ {
@ -429,10 +432,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD()); storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD());
ForEachScenePresence(delegate(ScenePresence presence) ForEachScenePresence(delegate(ScenePresence presence) { SendLayerData(presence.ControllingClient); });
{
SendLayerData(presence.ControllingClient);
});
foreach (LLUUID UUID in Entities.Keys) foreach (LLUUID UUID in Entities.Keys)
{ {
@ -521,23 +521,23 @@ namespace OpenSim.Region.Environment.Scenes
public void LoadPrimsFromStorage() public void LoadPrimsFromStorage()
{ {
MainLog.Instance.Verbose("Loading objects from datastore"); MainLog.Instance.Verbose("Loading objects from datastore");
List<SceneObjectGroup> PrimsFromDB = storageManager.DataStore.LoadObjects(this.m_regInfo.SimUUID); List<SceneObjectGroup> PrimsFromDB = storageManager.DataStore.LoadObjects(m_regInfo.SimUUID);
foreach (SceneObjectGroup prim in PrimsFromDB) foreach (SceneObjectGroup prim in PrimsFromDB)
{ {
AddEntityFromStorage(prim); AddEntityFromStorage(prim);
SceneObjectPart rootPart = prim.GetChildPart(prim.UUID); SceneObjectPart rootPart = prim.GetChildPart(prim.UUID);
if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0)
rootPart.PhysActor = phyScene.AddPrim( rootPart.PhysActor = phyScene.AddPrim(
new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, rootPart.AbsolutePosition.Z), new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y,
rootPart.AbsolutePosition.Z),
new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z),
new Axiom.Math.Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
rootPart.RotationOffset.Y, rootPart.RotationOffset.Z)); rootPart.RotationOffset.Y, rootPart.RotationOffset.Z));
} }
MainLog.Instance.Verbose("Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)"); MainLog.Instance.Verbose("Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)");
} }
/// <summary> /// <summary>
/// Returns a new unallocated primitive ID /// Returns a new unallocated primitive ID
/// </summary> /// </summary>
@ -561,20 +561,23 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="ownerID"></param> /// <param name="ownerID"></param>
public void AddNewPrim(LLUUID ownerID, LLVector3 pos, PrimitiveBaseShape shape) public void AddNewPrim(LLUUID ownerID, LLVector3 pos, PrimitiveBaseShape shape)
{ {
if (this.PermissionsMngr.CanRezObject(ownerID, pos)) if (PermissionsMngr.CanRezObject(ownerID, pos))
{ {
SceneObjectGroup sceneOb = new SceneObjectGroup(this, this.m_regionHandle, ownerID, PrimIDAllocate(), pos, shape); SceneObjectGroup sceneOb =
new SceneObjectGroup(this, m_regionHandle, ownerID, PrimIDAllocate(), pos, shape);
AddEntity(sceneOb); AddEntity(sceneOb);
SceneObjectPart rootPart = sceneOb.GetChildPart(sceneOb.UUID); SceneObjectPart rootPart = sceneOb.GetChildPart(sceneOb.UUID);
// if grass or tree, make phantom // if grass or tree, make phantom
if ((rootPart.Shape.PCode==95) || (rootPart.Shape.PCode==255)) if ((rootPart.Shape.PCode == 95) || (rootPart.Shape.PCode == 255))
{ {
rootPart.ObjectFlags += (uint)LLObject.ObjectFlags.Phantom; rootPart.ObjectFlags += (uint) LLObject.ObjectFlags.Phantom;
} }
// if not phantom, add to physics // if not phantom, add to physics
if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0)
rootPart.PhysActor = phyScene.AddPrim(new PhysicsVector(pos.X, pos.Y, pos.Z), new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z), rootPart.PhysActor =
new Axiom.Math.Quaternion()); phyScene.AddPrim(new PhysicsVector(pos.X, pos.Y, pos.Z),
new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z),
new Quaternion());
} }
} }
@ -584,9 +587,9 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (obj is SceneObjectGroup) if (obj is SceneObjectGroup)
{ {
if (((SceneObjectGroup)obj).LocalId == localID) if (((SceneObjectGroup) obj).LocalId == localID)
{ {
RemoveEntity((SceneObjectGroup)obj); RemoveEntity((SceneObjectGroup) obj);
return; return;
} }
} }
@ -595,14 +598,14 @@ namespace OpenSim.Region.Environment.Scenes
public void AddEntityFromStorage(SceneObjectGroup sceneObject) public void AddEntityFromStorage(SceneObjectGroup sceneObject)
{ {
sceneObject.RegionHandle = this.m_regionHandle; sceneObject.RegionHandle = m_regionHandle;
sceneObject.SetScene(this); sceneObject.SetScene(this);
foreach (SceneObjectPart part in sceneObject.Children.Values) foreach (SceneObjectPart part in sceneObject.Children.Values)
{ {
part.LocalID = this.PrimIDAllocate(); part.LocalID = PrimIDAllocate();
} }
sceneObject.UpdateParentIDs(); sceneObject.UpdateParentIDs();
this.AddEntity(sceneObject); AddEntity(sceneObject);
} }
public void AddEntity(SceneObjectGroup sceneObject) public void AddEntity(SceneObjectGroup sceneObject)
@ -648,17 +651,18 @@ namespace OpenSim.Region.Environment.Scenes
foreach (XmlNode aPrimNode in rootNode.ChildNodes) foreach (XmlNode aPrimNode in rootNode.ChildNodes)
{ {
SceneObjectGroup obj = new SceneObjectGroup(this, SceneObjectGroup obj = new SceneObjectGroup(this,
this.m_regionHandle, aPrimNode.OuterXml); m_regionHandle, aPrimNode.OuterXml);
//if we want this to be a import method then we need new uuids for the object to avoid any clashes //if we want this to be a import method then we need new uuids for the object to avoid any clashes
//obj.RegenerateFullIDs(); //obj.RegenerateFullIDs();
AddEntity(obj); AddEntity(obj);
SceneObjectPart rootPart = obj.GetChildPart(obj.UUID); SceneObjectPart rootPart = obj.GetChildPart(obj.UUID);
if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0)
rootPart.PhysActor = phyScene.AddPrim( rootPart.PhysActor = phyScene.AddPrim(
new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, rootPart.AbsolutePosition.Z), new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y,
rootPart.AbsolutePosition.Z),
new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z),
new Axiom.Math.Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
rootPart.RotationOffset.Y, rootPart.RotationOffset.Z)); rootPart.RotationOffset.Y, rootPart.RotationOffset.Z));
primCount++; primCount++;
} }
@ -679,7 +683,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
stream.WriteLine(((SceneObjectGroup)ent).ToXmlString()); stream.WriteLine(((SceneObjectGroup) ent).ToXmlString());
primCount++; primCount++;
} }
} }
@ -688,7 +692,6 @@ namespace OpenSim.Region.Environment.Scenes
file.Close(); file.Close();
} }
#endregion #endregion
#region Add/Remove Avatar Methods #region Add/Remove Avatar Methods
@ -703,7 +706,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
SubscribeToClientEvents(client); SubscribeToClientEvents(client);
m_estateManager.sendRegionHandshake(client); m_estateManager.sendRegionHandshake(client);
CreateAndAddScenePresence(client, child ); CreateAndAddScenePresence(client, child);
m_LandManager.sendParcelOverlay(client); m_LandManager.sendParcelOverlay(client);
commsManager.UserProfiles.AddNewUser(client.AgentId); commsManager.UserProfiles.AddNewUser(client.AgentId);
commsManager.TransactionsManager.AddUser(client.AgentId); commsManager.TransactionsManager.AddUser(client.AgentId);
@ -744,9 +747,11 @@ namespace OpenSim.Region.Environment.Scenes
client.OnParcelPropertiesRequest += new ParcelPropertiesRequest(m_LandManager.handleParcelPropertiesRequest); client.OnParcelPropertiesRequest += new ParcelPropertiesRequest(m_LandManager.handleParcelPropertiesRequest);
client.OnParcelDivideRequest += new ParcelDivideRequest(m_LandManager.handleParcelDivideRequest); client.OnParcelDivideRequest += new ParcelDivideRequest(m_LandManager.handleParcelDivideRequest);
client.OnParcelJoinRequest += new ParcelJoinRequest(m_LandManager.handleParcelJoinRequest); client.OnParcelJoinRequest += new ParcelJoinRequest(m_LandManager.handleParcelJoinRequest);
client.OnParcelPropertiesUpdateRequest += new ParcelPropertiesUpdateRequest(m_LandManager.handleParcelPropertiesUpdateRequest); client.OnParcelPropertiesUpdateRequest +=
new ParcelPropertiesUpdateRequest(m_LandManager.handleParcelPropertiesUpdateRequest);
client.OnParcelSelectObjects += new ParcelSelectObjects(m_LandManager.handleParcelSelectObjectsRequest); client.OnParcelSelectObjects += new ParcelSelectObjects(m_LandManager.handleParcelSelectObjectsRequest);
client.OnParcelObjectOwnerRequest += new ParcelObjectOwnerRequest(m_LandManager.handleParcelObjectOwnersRequest); client.OnParcelObjectOwnerRequest +=
new ParcelObjectOwnerRequest(m_LandManager.handleParcelObjectOwnersRequest);
client.OnEstateOwnerMessage += new EstateOwnerMessageRequest(m_estateManager.handleEstateOwnerMessage); client.OnEstateOwnerMessage += new EstateOwnerMessageRequest(m_estateManager.handleEstateOwnerMessage);
@ -768,7 +773,7 @@ namespace OpenSim.Region.Environment.Scenes
EventManager.TriggerOnNewClient(client); EventManager.TriggerOnNewClient(client);
} }
protected ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child ) protected ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child)
{ {
ScenePresence newAvatar = null; ScenePresence newAvatar = null;
@ -777,16 +782,18 @@ namespace OpenSim.Region.Environment.Scenes
if (child) if (child)
{ {
MainLog.Instance.Verbose(this.RegionInfo.RegionName + ": Creating new child agent."); MainLog.Instance.Verbose(RegionInfo.RegionName + ": Creating new child agent.");
} }
else else
{ {
newAvatar.OnSignificantClientMovement += m_LandManager.handleSignificantClientMovement; newAvatar.OnSignificantClientMovement += m_LandManager.handleSignificantClientMovement;
MainLog.Instance.Verbose(this.RegionInfo.RegionName + ": Creating new root agent."); MainLog.Instance.Verbose(RegionInfo.RegionName + ": Creating new root agent.");
MainLog.Instance.Verbose(this.RegionInfo.RegionName + ": Adding Physical agent."); MainLog.Instance.Verbose(RegionInfo.RegionName + ": Adding Physical agent.");
PhysicsVector pVec = new PhysicsVector(newAvatar.AbsolutePosition.X, newAvatar.AbsolutePosition.Y, newAvatar.AbsolutePosition.Z); PhysicsVector pVec =
new PhysicsVector(newAvatar.AbsolutePosition.X, newAvatar.AbsolutePosition.Y,
newAvatar.AbsolutePosition.Z);
lock (m_syncRoot) lock (m_syncRoot)
{ {
newAvatar.PhysActor = phyScene.AddAvatar(pVec); newAvatar.PhysActor = phyScene.AddAvatar(pVec);
@ -943,7 +950,7 @@ namespace OpenSim.Region.Environment.Scenes
if (Entities.ContainsKey(entID)) if (Entities.ContainsKey(entID))
{ {
Entities.Remove(entID); Entities.Remove(entID);
storageManager.DataStore.RemoveObject(entID, this.m_regInfo.SimUUID); storageManager.DataStore.RemoveObject(entID, m_regInfo.SimUUID);
return true; return true;
} }
return false; return false;
@ -951,10 +958,10 @@ namespace OpenSim.Region.Environment.Scenes
public void SendKillObject(uint localID) public void SendKillObject(uint localID)
{ {
List<ScenePresence> avatars = this.RequestAvatarList(); List<ScenePresence> avatars = RequestAvatarList();
for (int i = 0; i < avatars.Count; i++) for (int i = 0; i < avatars.Count; i++)
{ {
avatars[i].ControllingClient.SendKillObject(this.m_regionHandle, localID); avatars[i].ControllingClient.SendKillObject(m_regionHandle, localID);
} }
} }
@ -965,7 +972,7 @@ namespace OpenSim.Region.Environment.Scenes
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
// ((SceneObjectGroup)ent).SendFullUpdateToClient(client); // ((SceneObjectGroup)ent).SendFullUpdateToClient(client);
((SceneObjectGroup)ent).ScheduleFullUpdateToAvatar(presence); ((SceneObjectGroup) ent).ScheduleFullUpdateToAvatar(presence);
} }
} }
} }
@ -999,11 +1006,15 @@ namespace OpenSim.Region.Environment.Scenes
if (agent.CapsPath != "") if (agent.CapsPath != "")
{ {
//Console.WriteLine("new user, so creating caps handler for it"); //Console.WriteLine("new user, so creating caps handler for it");
Caps cap = new Caps(commsManager.AssetCache, httpListener, m_regInfo.ExternalHostName, httpListener.Port, agent.CapsPath, agent.AgentID); Caps cap =
Util.SetCapsURL(agent.AgentID, "http://" + m_regInfo.ExternalHostName + ":" + httpListener.Port.ToString() + "/CAPS/" + agent.CapsPath + "0000/"); new Caps(commsManager.AssetCache, httpListener, m_regInfo.ExternalHostName, httpListener.Port,
agent.CapsPath, agent.AgentID);
Util.SetCapsURL(agent.AgentID,
"http://" + m_regInfo.ExternalHostName + ":" + httpListener.Port.ToString() +
"/CAPS/" + agent.CapsPath + "0000/");
cap.RegisterHandlers(); cap.RegisterHandlers();
cap.AddNewInventoryItem = this.AddInventoryItem; cap.AddNewInventoryItem = AddInventoryItem;
cap.ItemUpdatedCall = this.CapsUpdateInventoryItemAsset; cap.ItemUpdatedCall = CapsUpdateInventoryItemAsset;
if (capsHandlers.ContainsKey(agent.AgentID)) if (capsHandlers.ContainsKey(agent.AgentID))
{ {
MainLog.Instance.Warn("client", "Adding duplicate CAPS entry for user " + MainLog.Instance.Warn("client", "Adding duplicate CAPS entry for user " +
@ -1142,43 +1153,25 @@ namespace OpenSim.Region.Environment.Scenes
public void AddModule(string name, IRegionModule module) public void AddModule(string name, IRegionModule module)
{ {
if (!this.Modules.ContainsKey(name)) if (!Modules.ContainsKey(name))
{ {
Modules.Add(name, module); Modules.Add(name, module);
} }
} }
//following delegate methods will be removed, so use the interface methods (below these)
public void RegisterAPIMethod(string name, object method)
{
if (!this.ModuleAPIMethods.ContainsKey(name))
{
this.ModuleAPIMethods.Add(name, method);
}
}
public object RequestAPIMethod(string name)
{
if (this.ModuleAPIMethods.ContainsKey(name))
{
return ModuleAPIMethods[name];
}
return false;
}
public void RegisterModuleInterface<M>(M mod) public void RegisterModuleInterface<M>(M mod)
{ {
if (!this.ModuleInterfaces.ContainsKey(typeof(M))) if (!ModuleInterfaces.ContainsKey(typeof (M)))
{ {
ModuleInterfaces.Add(typeof(M), mod); ModuleInterfaces.Add(typeof (M), mod);
} }
} }
public T RequestModuleInterface<T>() public T RequestModuleInterface<T>()
{ {
if (ModuleInterfaces.ContainsKey(typeof(T))) if (ModuleInterfaces.ContainsKey(typeof (T)))
{ {
return (T)ModuleInterfaces[typeof(T)]; return (T) ModuleInterfaces[typeof (T)];
} }
else else
{ {
@ -1191,7 +1184,8 @@ namespace OpenSim.Region.Environment.Scenes
m_timePhase = phase; m_timePhase = phase;
} }
public void SendUrlToUser(LLUUID avatarID, string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, string url) public void SendUrlToUser(LLUUID avatarID, string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned,
string message, string url)
{ {
if (Avatars.ContainsKey(avatarID)) if (Avatars.ContainsKey(avatarID))
{ {
@ -1201,7 +1195,7 @@ namespace OpenSim.Region.Environment.Scenes
#region Alert Methods #region Alert Methods
void SendPermissionAlert(LLUUID user, string reason) private void SendPermissionAlert(LLUUID user, string reason)
{ {
SendAlertToUser(user, reason, false); SendAlertToUser(user, reason, false);
} }
@ -1209,7 +1203,7 @@ namespace OpenSim.Region.Environment.Scenes
public void SendGeneralAlert(string message) public void SendGeneralAlert(string message)
{ {
foreach (ScenePresence presence in this.Avatars.Values) foreach (ScenePresence presence in Avatars.Values)
{ {
presence.ControllingClient.SendAlertMessage(message); presence.ControllingClient.SendAlertMessage(message);
} }
@ -1217,15 +1211,15 @@ namespace OpenSim.Region.Environment.Scenes
public void SendAlertToUser(LLUUID agentID, string message, bool modal) public void SendAlertToUser(LLUUID agentID, string message, bool modal)
{ {
if (this.Avatars.ContainsKey(agentID)) if (Avatars.ContainsKey(agentID))
{ {
this.Avatars[agentID].ControllingClient.SendAgentAlertMessage(message, modal); Avatars[agentID].ControllingClient.SendAgentAlertMessage(message, modal);
} }
} }
public void SendAlertToUser(string firstName, string lastName, string message, bool modal) public void SendAlertToUser(string firstName, string lastName, string message, bool modal)
{ {
foreach (ScenePresence presence in this.Avatars.Values) foreach (ScenePresence presence in Avatars.Values)
{ {
if ((presence.Firstname == firstName) && (presence.Lastname == lastName)) if ((presence.Firstname == firstName) && (presence.Lastname == lastName))
{ {
@ -1239,13 +1233,13 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (commandParams[0] == "general") if (commandParams[0] == "general")
{ {
string message = this.CombineParams(commandParams, 1); string message = CombineParams(commandParams, 1);
this.SendGeneralAlert(message); SendGeneralAlert(message);
} }
else else
{ {
string message = this.CombineParams(commandParams, 2); string message = CombineParams(commandParams, 2);
this.SendAlertToUser(commandParams[0], commandParams[1], message, false); SendAlertToUser(commandParams[0], commandParams[1], message, false);
} }
} }
@ -1258,15 +1252,16 @@ namespace OpenSim.Region.Environment.Scenes
} }
return result; return result;
} }
#endregion #endregion
public void ForceClientUpdate() public void ForceClientUpdate()
{ {
foreach (EntityBase ent in this.Entities.Values) foreach (EntityBase ent in Entities.Values)
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
((SceneObjectGroup)ent).ScheduleGroupForFullUpdate(); ((SceneObjectGroup) ent).ScheduleGroupForFullUpdate();
} }
} }
} }
@ -1274,16 +1269,18 @@ namespace OpenSim.Region.Environment.Scenes
public void HandleEditCommand(string[] cmmdparams) public void HandleEditCommand(string[] cmmdparams)
{ {
Console.WriteLine("Searching for Primitive: '" + cmmdparams[0] + "'"); Console.WriteLine("Searching for Primitive: '" + cmmdparams[0] + "'");
foreach (EntityBase ent in this.Entities.Values) foreach (EntityBase ent in Entities.Values)
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
SceneObjectPart part = ((SceneObjectGroup)ent).GetChildPart(((SceneObjectGroup)ent).UUID); SceneObjectPart part = ((SceneObjectGroup) ent).GetChildPart(((SceneObjectGroup) ent).UUID);
if (part != null) if (part != null)
{ {
if (part.Name == cmmdparams[0]) if (part.Name == cmmdparams[0])
{ {
part.Resize( new LLVector3(Convert.ToSingle(cmmdparams[1]), Convert.ToSingle(cmmdparams[2]), Convert.ToSingle(cmmdparams[3]))); part.Resize(
new LLVector3(Convert.ToSingle(cmmdparams[1]), Convert.ToSingle(cmmdparams[2]),
Convert.ToSingle(cmmdparams[3])));
Console.WriteLine("Edited scale of Primitive: " + part.Name); Console.WriteLine("Edited scale of Primitive: " + part.Name);
} }
@ -1298,7 +1295,9 @@ namespace OpenSim.Region.Environment.Scenes
{ {
case "users": case "users":
MainLog.Instance.Error("Current Region: " + RegionInfo.RegionName); MainLog.Instance.Error("Current Region: " + RegionInfo.RegionName);
MainLog.Instance.Error(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}{6,-16}", "Firstname", "Lastname", "Agent ID", "Session ID", "Circuit", "IP", "World")); MainLog.Instance.Error(
String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}{6,-16}", "Firstname", "Lastname",
"Agent ID", "Session ID", "Circuit", "IP", "World"));
foreach (EntityBase entity in Entities.Values) foreach (EntityBase entity in Entities.Values)
{ {
@ -1321,8 +1320,8 @@ namespace OpenSim.Region.Environment.Scenes
} }
break; break;
case "modules": case "modules":
MainLog.Instance.Error("The currently loaded modules in " + this.RegionInfo.RegionName + " are:"); MainLog.Instance.Error("The currently loaded modules in " + RegionInfo.RegionName + " are:");
foreach (OpenSim.Region.Environment.Interfaces.IRegionModule module in this.Modules.Values) foreach (IRegionModule module in Modules.Values)
{ {
if (!module.IsSharedModule()) if (!module.IsSharedModule())
{ {
@ -1343,13 +1342,16 @@ namespace OpenSim.Region.Environment.Scenes
} }
#region Script Engine #region Script Engine
private List<OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineInterface> ScriptEngines = new List<OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineInterface>();
public void AddScriptEngine(OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineInterface ScriptEngine, LogBase m_logger) private List<ScriptEngineInterface> ScriptEngines = new List<ScriptEngineInterface>();
public void AddScriptEngine(ScriptEngineInterface ScriptEngine, LogBase m_logger)
{ {
ScriptEngines.Add(ScriptEngine); ScriptEngines.Add(ScriptEngine);
ScriptEngine.InitializeEngine(this, m_logger); ScriptEngine.InitializeEngine(this, m_logger);
} }
#endregion #endregion
public LLUUID ConvertLocalIDToFullID(uint localID) public LLUUID ConvertLocalIDToFullID(uint localID)
@ -1359,10 +1361,10 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
if (hasPrim != false) if (hasPrim != false)
{ {
return ((SceneObjectGroup)ent).GetPartsFullID(localID); return ((SceneObjectGroup) ent).GetPartsFullID(localID);
} }
} }
} }
@ -1376,10 +1378,10 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
if (hasPrim != false) if (hasPrim != false)
{ {
return ((SceneObjectGroup)ent).GetChildPart(localID); return ((SceneObjectGroup) ent).GetChildPart(localID);
} }
} }
} }
@ -1393,10 +1395,10 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
hasPrim = ((SceneObjectGroup)ent).HasChildPrim(fullID); hasPrim = ((SceneObjectGroup) ent).HasChildPrim(fullID);
if (hasPrim != false) if (hasPrim != false)
{ {
return ((SceneObjectGroup)ent).GetChildPart(fullID); return ((SceneObjectGroup) ent).GetChildPart(fullID);
} }
} }
} }

View File

@ -27,15 +27,12 @@
*/ */
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Reflection;
using libsecondlife; using libsecondlife;
using OpenSim.Framework.Communications.Caches;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Types; using OpenSim.Framework.Types;
using OpenSim.Framework.Communications.Caches;
using OpenSim.Region.Terrain; using OpenSim.Region.Terrain;
using OpenSim.Framework;
using OpenSim.Region.Environment.Interfaces;
namespace OpenSim.Region.Environment.Scenes namespace OpenSim.Region.Environment.Scenes
{ {
@ -67,6 +64,7 @@ namespace OpenSim.Region.Environment.Scenes
protected AssetCache assetCache; protected AssetCache assetCache;
#region Update Methods #region Update Methods
/// <summary> /// <summary>
/// Normally called once every frame/tick to let the world preform anything required (like running the physics simulation) /// Normally called once every frame/tick to let the world preform anything required (like running the physics simulation)
/// </summary> /// </summary>
@ -104,6 +102,7 @@ namespace OpenSim.Region.Environment.Scenes
#endregion #endregion
#region Add/Remove Agent/Avatar #region Add/Remove Agent/Avatar
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@ -126,7 +125,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <returns></returns> /// <returns></returns>
public virtual RegionInfo RegionInfo public virtual RegionInfo RegionInfo
{ {
get { return this.m_regInfo; } get { return m_regInfo; }
} }
public object SyncRoot public object SyncRoot
@ -140,6 +139,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
#region Shutdown #region Shutdown
/// <summary> /// <summary>
/// Tidy before shutdown /// Tidy before shutdown
/// </summary> /// </summary>
@ -147,7 +147,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
try try
{ {
this.EventManager.TriggerShutdown(); EventManager.TriggerShutdown();
} }
catch (Exception e) catch (Exception e)
{ {
@ -156,7 +156,5 @@ namespace OpenSim.Region.Environment.Scenes
} }
#endregion #endregion
} }
} }

View File

@ -1,5 +1,6 @@
using libsecondlife; using libsecondlife;
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
using OpenSim.Region.Environment.Interfaces;
namespace OpenSim.Region.Environment.Scenes namespace OpenSim.Region.Environment.Scenes
{ {
@ -9,41 +10,54 @@ namespace OpenSim.Region.Environment.Scenes
public class EventManager public class EventManager
{ {
public delegate void OnFrameDelegate(); public delegate void OnFrameDelegate();
public event OnFrameDelegate OnFrame; public event OnFrameDelegate OnFrame;
public delegate void OnBackupDelegate(Interfaces.IRegionDataStore datastore); public delegate void OnBackupDelegate(IRegionDataStore datastore);
public event OnBackupDelegate OnBackup; public event OnBackupDelegate OnBackup;
public delegate void OnNewClientDelegate(IClientAPI client); public delegate void OnNewClientDelegate(IClientAPI client);
public event OnNewClientDelegate OnNewClient; public event OnNewClientDelegate OnNewClient;
public delegate void OnNewPresenceDelegate(ScenePresence presence); public delegate void OnNewPresenceDelegate(ScenePresence presence);
public event OnNewPresenceDelegate OnNewPresence; public event OnNewPresenceDelegate OnNewPresence;
public delegate void OnRemovePresenceDelegate(LLUUID uuid); public delegate void OnRemovePresenceDelegate(LLUUID uuid);
public event OnRemovePresenceDelegate OnRemovePresence; public event OnRemovePresenceDelegate OnRemovePresence;
public delegate void OnParcelPrimCountUpdateDelegate(); public delegate void OnParcelPrimCountUpdateDelegate();
public event OnParcelPrimCountUpdateDelegate OnParcelPrimCountUpdate; public event OnParcelPrimCountUpdateDelegate OnParcelPrimCountUpdate;
public delegate void OnParcelPrimCountAddDelegate(SceneObjectGroup obj); public delegate void OnParcelPrimCountAddDelegate(SceneObjectGroup obj);
public event OnParcelPrimCountAddDelegate OnParcelPrimCountAdd; public event OnParcelPrimCountAddDelegate OnParcelPrimCountAdd;
public delegate void OnScriptConsoleDelegate(string[] args); public delegate void OnScriptConsoleDelegate(string[] args);
public event OnScriptConsoleDelegate OnScriptConsole; public event OnScriptConsoleDelegate OnScriptConsole;
public delegate void OnShutdownDelegate(); public delegate void OnShutdownDelegate();
public event OnShutdownDelegate OnShutdown; public event OnShutdownDelegate OnShutdown;
public delegate void ObjectGrabDelegate(uint localID, LLVector3 offsetPos, IClientAPI remoteClient); public delegate void ObjectGrabDelegate(uint localID, LLVector3 offsetPos, IClientAPI remoteClient);
public delegate void OnPermissionErrorDelegate(LLUUID user, string reason); public delegate void OnPermissionErrorDelegate(LLUUID user, string reason);
public event ObjectGrabDelegate OnObjectGrab; public event ObjectGrabDelegate OnObjectGrab;
public event OnPermissionErrorDelegate OnPermissionError; public event OnPermissionErrorDelegate OnPermissionError;
public delegate void NewRezScript(uint localID, LLUUID itemID, string script); public delegate void NewRezScript(uint localID, LLUUID itemID, string script);
public event NewRezScript OnRezScript; public event NewRezScript OnRezScript;
public delegate void RemoveScript(uint localID, LLUUID itemID); public delegate void RemoveScript(uint localID, LLUUID itemID);
public event RemoveScript OnRemoveScript; public event RemoveScript OnRemoveScript;
public void TriggerPermissionError(LLUUID user, string reason) public void TriggerPermissionError(LLUUID user, string reason)
@ -86,7 +100,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
} }
public void TriggerOnBackup(Interfaces.IRegionDataStore dstore) public void TriggerOnBackup(IRegionDataStore dstore)
{ {
if (OnBackup != null) if (OnBackup != null)
{ {
@ -101,6 +115,7 @@ namespace OpenSim.Region.Environment.Scenes
OnParcelPrimCountUpdate(); OnParcelPrimCountUpdate();
} }
} }
public void TriggerParcelPrimCountAdd(SceneObjectGroup obj) public void TriggerParcelPrimCountAdd(SceneObjectGroup obj)
{ {
if (OnParcelPrimCountAdd != null) if (OnParcelPrimCountAdd != null)

View File

@ -1,5 +1,5 @@
using System.Collections.Generic;
using System; using System;
using System.Collections.Generic;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Framework.Types; using OpenSim.Framework.Types;
@ -9,12 +9,10 @@ namespace OpenSim.Region.Environment.Scenes
{ {
private readonly List<Scene> m_localScenes; private readonly List<Scene> m_localScenes;
private Scene m_currentScene = null; private Scene m_currentScene = null;
public Scene CurrentScene public Scene CurrentScene
{ {
get get { return m_currentScene; }
{
return m_currentScene;
}
} }
private Scene CurrentOrFirstScene private Scene CurrentOrFirstScene
@ -83,18 +81,12 @@ namespace OpenSim.Region.Environment.Scenes
public void SendCommandToScripts(string[] cmdparams) public void SendCommandToScripts(string[] cmdparams)
{ {
ForEach(delegate(Scene scene) ForEach(delegate(Scene scene) { scene.SendCommandToScripts(cmdparams); });
{
scene.SendCommandToScripts(cmdparams);
});
} }
public void BypassPermissions(bool bypassPermissions) public void BypassPermissions(bool bypassPermissions)
{ {
ForEach(delegate(Scene scene) ForEach(delegate(Scene scene) { scene.PermissionsMngr.BypassPermissions = bypassPermissions; });
{
scene.PermissionsMngr.BypassPermissions = bypassPermissions;
});
} }
private void ForEach(Action<Scene> func) private void ForEach(Action<Scene> func)
@ -111,18 +103,12 @@ namespace OpenSim.Region.Environment.Scenes
public void Backup() public void Backup()
{ {
ForEach(delegate(Scene scene) ForEach(delegate(Scene scene) { scene.Backup(); });
{
scene.Backup();
});
} }
public void HandleAlertCommand(string[] cmdparams) public void HandleAlertCommand(string[] cmdparams)
{ {
ForEach(delegate(Scene scene) ForEach(delegate(Scene scene) { scene.HandleAlertCommand(cmdparams); });
{
scene.HandleAlertCommand(cmdparams);
});
} }
public bool TrySetCurrentRegion(string regionName) public bool TrySetCurrentRegion(string regionName)
@ -219,18 +205,12 @@ namespace OpenSim.Region.Environment.Scenes
public void ForceClientUpdate() public void ForceClientUpdate()
{ {
ForEach(delegate(Scene scene) ForEach(delegate(Scene scene) { scene.ForceClientUpdate(); });
{
scene.ForceClientUpdate();
});
} }
public void HandleEditCommand(string[] cmdparams) public void HandleEditCommand(string[] cmdparams)
{ {
ForEach(delegate(Scene scene) ForEach(delegate(Scene scene) { scene.HandleEditCommand(cmdparams); });
{
scene.HandleEditCommand(cmdparams);
});
} }
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,23 +1,19 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
using System.Xml; using System.Xml;
using System.Xml.Serialization; using System.Xml.Serialization;
using System.IO;
using System;
using Axiom.Math; using Axiom.Math;
using libsecondlife; using libsecondlife;
using libsecondlife.Packets; using libsecondlife.Packets;
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Types; using OpenSim.Framework.Types;
using OpenSim.Framework.Utilities; using OpenSim.Framework.Utilities;
using OpenSim.Region.Environment.Scenes.Scripting;
using OpenSim.Framework;
using OpenSim.Region.Physics.Manager;
using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes.Scripting;
using OpenSim.Region.Physics.Manager;
namespace OpenSim.Region.Environment.Scenes namespace OpenSim.Region.Environment.Scenes
{ {
public class SceneObjectPart : IScriptHost public class SceneObjectPart : IScriptHost
{ {
private const uint FULL_MASK_PERMISSIONS = 2147483647; private const uint FULL_MASK_PERMISSIONS = 2147483647;
@ -25,8 +21,7 @@ namespace OpenSim.Region.Environment.Scenes
private string m_inventoryFileName = ""; private string m_inventoryFileName = "";
private LLUUID m_folderID = LLUUID.Zero; private LLUUID m_folderID = LLUUID.Zero;
[XmlIgnore] [XmlIgnore] public PhysicsActor PhysActor = null;
public PhysicsActor PhysActor = null;
protected Dictionary<LLUUID, TaskInventoryItem> TaskInventory = new Dictionary<LLUUID, TaskInventoryItem>(); protected Dictionary<LLUUID, TaskInventoryItem> TaskInventory = new Dictionary<LLUUID, TaskInventoryItem>();
@ -57,19 +52,25 @@ namespace OpenSim.Region.Environment.Scenes
#region Properties #region Properties
public LLUUID CreatorID; public LLUUID CreatorID;
public LLUUID ObjectCreator { get { return CreatorID; } }
public LLUUID ObjectCreator
{
get { return CreatorID; }
}
/// <summary> /// <summary>
/// Serial count for inventory file , used to tell if inventory has changed /// Serial count for inventory file , used to tell if inventory has changed
/// no need for this to be part of Database backup /// no need for this to be part of Database backup
/// </summary> /// </summary>
protected uint m_inventorySerial = 0; protected uint m_inventorySerial = 0;
public uint InventorySerial public uint InventorySerial
{ {
get { return m_inventorySerial; } get { return m_inventorySerial; }
} }
protected LLUUID m_uuid; protected LLUUID m_uuid;
public LLUUID UUID public LLUUID UUID
{ {
get { return m_uuid; } get { return m_uuid; }
@ -77,6 +78,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
protected uint m_localID; protected uint m_localID;
public uint LocalID public uint LocalID
{ {
get { return m_localID; } get { return m_localID; }
@ -84,6 +86,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
protected string m_name; protected string m_name;
public virtual string Name public virtual string Name
{ {
get { return m_name; } get { return m_name; }
@ -91,20 +94,23 @@ namespace OpenSim.Region.Environment.Scenes
} }
protected LLObject.ObjectFlags m_flags; protected LLObject.ObjectFlags m_flags;
public uint ObjectFlags public uint ObjectFlags
{ {
get { return (uint)m_flags; } get { return (uint) m_flags; }
set { m_flags = (LLObject.ObjectFlags)value; } set { m_flags = (LLObject.ObjectFlags) value; }
} }
protected LLObject.MaterialType m_material; protected LLObject.MaterialType m_material;
public byte Material public byte Material
{ {
get { return (byte)m_material; } get { return (byte) m_material; }
set { m_material = (LLObject.MaterialType)value; } set { m_material = (LLObject.MaterialType) value; }
} }
protected ulong m_regionHandle; protected ulong m_regionHandle;
public ulong RegionHandle public ulong RegionHandle
{ {
get { return m_regionHandle; } get { return m_regionHandle; }
@ -113,6 +119,7 @@ namespace OpenSim.Region.Environment.Scenes
//unkown if this will be kept, added as a way of removing the group position from the group class //unkown if this will be kept, added as a way of removing the group position from the group class
protected LLVector3 m_groupPosition; protected LLVector3 m_groupPosition;
public LLVector3 GroupPosition public LLVector3 GroupPosition
{ {
get { return m_groupPosition; } get { return m_groupPosition; }
@ -120,6 +127,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
protected LLVector3 m_offsetPosition; protected LLVector3 m_offsetPosition;
public LLVector3 OffsetPosition public LLVector3 OffsetPosition
{ {
get { return m_offsetPosition; } get { return m_offsetPosition; }
@ -132,6 +140,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
protected LLQuaternion m_rotationOffset; protected LLQuaternion m_rotationOffset;
public LLQuaternion RotationOffset public LLQuaternion RotationOffset
{ {
get { return m_rotationOffset; } get { return m_rotationOffset; }
@ -139,6 +148,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
protected LLVector3 m_velocity; protected LLVector3 m_velocity;
/// <summary></summary> /// <summary></summary>
public LLVector3 Velocity public LLVector3 Velocity
{ {
@ -147,6 +157,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
protected LLVector3 m_angularVelocity; protected LLVector3 m_angularVelocity;
/// <summary></summary> /// <summary></summary>
public LLVector3 AngularVelocity public LLVector3 AngularVelocity
{ {
@ -155,6 +166,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
protected LLVector3 m_acceleration; protected LLVector3 m_acceleration;
/// <summary></summary> /// <summary></summary>
public LLVector3 Acceleration public LLVector3 Acceleration
{ {
@ -163,13 +175,15 @@ namespace OpenSim.Region.Environment.Scenes
} }
private string m_description = ""; private string m_description = "";
public string Description public string Description
{ {
get { return this.m_description; } get { return m_description; }
set { this.m_description = value; } set { m_description = value; }
} }
private string m_text = ""; private string m_text = "";
public string Text public string Text
{ {
get { return m_text; } get { return m_text; }
@ -181,6 +195,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
private string m_sitName = ""; private string m_sitName = "";
public string SitName public string SitName
{ {
get { return m_sitName; } get { return m_sitName; }
@ -188,6 +203,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
private string m_touchName = ""; private string m_touchName = "";
public string TouchName public string TouchName
{ {
get { return m_touchName; } get { return m_touchName; }
@ -195,17 +211,19 @@ namespace OpenSim.Region.Environment.Scenes
} }
protected PrimitiveBaseShape m_shape; protected PrimitiveBaseShape m_shape;
public PrimitiveBaseShape Shape public PrimitiveBaseShape Shape
{ {
get { return this.m_shape; } get { return m_shape; }
set { m_shape = value; } set { m_shape = value; }
} }
public LLVector3 Scale public LLVector3 Scale
{ {
set { this.m_shape.Scale = value; } set { m_shape.Scale = value; }
get { return this.m_shape.Scale; } get { return m_shape.Scale; }
} }
#endregion #endregion
public LLUUID ObjectOwner public LLUUID ObjectOwner
@ -219,12 +237,12 @@ namespace OpenSim.Region.Environment.Scenes
} }
#region Constructors #region Constructors
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public SceneObjectPart() public SceneObjectPart()
{ {
} }
/// <summary> /// <summary>
@ -236,26 +254,27 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="localID"></param> /// <param name="localID"></param>
/// <param name="shape"></param> /// <param name="shape"></param>
/// <param name="position"></param> /// <param name="position"></param>
public SceneObjectPart(ulong regionHandle, SceneObjectGroup parent, LLUUID ownerID, uint localID, PrimitiveBaseShape shape, LLVector3 groupPosition, LLVector3 offsetPosition) public SceneObjectPart(ulong regionHandle, SceneObjectGroup parent, LLUUID ownerID, uint localID,
PrimitiveBaseShape shape, LLVector3 groupPosition, LLVector3 offsetPosition)
{ {
this.m_name = "Primitive"; m_name = "Primitive";
this.m_regionHandle = regionHandle; m_regionHandle = regionHandle;
this.m_parentGroup = parent; m_parentGroup = parent;
this.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; CreationDate = (Int32) (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
this.OwnerID = ownerID; OwnerID = ownerID;
this.CreatorID = this.OwnerID; CreatorID = OwnerID;
this.LastOwnerID = LLUUID.Zero; LastOwnerID = LLUUID.Zero;
this.UUID = LLUUID.Random(); UUID = LLUUID.Random();
this.LocalID = (uint)(localID); LocalID = (uint) (localID);
this.Shape = shape; Shape = shape;
this.GroupPosition = groupPosition; GroupPosition = groupPosition;
this.OffsetPosition = offsetPosition; OffsetPosition = offsetPosition;
this.RotationOffset = LLQuaternion.Identity; RotationOffset = LLQuaternion.Identity;
this.Velocity = new LLVector3(0, 0, 0); Velocity = new LLVector3(0, 0, 0);
this.AngularVelocity = new LLVector3(0, 0, 0); AngularVelocity = new LLVector3(0, 0, 0);
this.Acceleration = new LLVector3(0, 0, 0); Acceleration = new LLVector3(0, 0, 0);
m_inventoryFileName = "taskinventory" + LLUUID.Random().ToString(); m_inventoryFileName = "taskinventory" + LLUUID.Random().ToString();
m_folderID = LLUUID.Random(); m_folderID = LLUUID.Random();
@ -283,23 +302,26 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="localID"></param> /// <param name="localID"></param>
/// <param name="shape"></param> /// <param name="shape"></param>
/// <param name="position"></param> /// <param name="position"></param>
public SceneObjectPart(ulong regionHandle, SceneObjectGroup parent, int creationDate, LLUUID ownerID, LLUUID creatorID, LLUUID lastOwnerID, uint localID, PrimitiveBaseShape shape, LLVector3 position, LLQuaternion rotation, uint flags) public SceneObjectPart(ulong regionHandle, SceneObjectGroup parent, int creationDate, LLUUID ownerID,
LLUUID creatorID, LLUUID lastOwnerID, uint localID, PrimitiveBaseShape shape,
LLVector3 position, LLQuaternion rotation, uint flags)
{ {
this.m_regionHandle = regionHandle; m_regionHandle = regionHandle;
this.m_parentGroup = parent; m_parentGroup = parent;
this.CreationDate = creationDate; CreationDate = creationDate;
this.OwnerID = ownerID; OwnerID = ownerID;
this.CreatorID = creatorID; CreatorID = creatorID;
this.LastOwnerID = lastOwnerID; LastOwnerID = lastOwnerID;
this.UUID = LLUUID.Random(); UUID = LLUUID.Random();
this.LocalID = (uint)(localID); LocalID = (uint) (localID);
this.Shape = shape; Shape = shape;
this.OffsetPosition = position; OffsetPosition = position;
this.RotationOffset = rotation; RotationOffset = rotation;
this.ObjectFlags = flags; ObjectFlags = flags;
} }
#endregion #endregion
/// <summary> /// <summary>
@ -309,8 +331,8 @@ namespace OpenSim.Region.Environment.Scenes
/// <returns></returns> /// <returns></returns>
public static SceneObjectPart FromXml(XmlReader xmlReader) public static SceneObjectPart FromXml(XmlReader xmlReader)
{ {
XmlSerializer serializer = new XmlSerializer(typeof(SceneObjectPart)); XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart));
return (SceneObjectPart)serializer.Deserialize(xmlReader); return (SceneObjectPart) serializer.Deserialize(xmlReader);
} }
/// <summary> /// <summary>
@ -319,7 +341,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="xmlWriter"></param> /// <param name="xmlWriter"></param>
public void ToXml(XmlWriter xmlWriter) public void ToXml(XmlWriter xmlWriter)
{ {
XmlSerializer serializer = new XmlSerializer(typeof(SceneObjectPart)); XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart));
serializer.Serialize(xmlWriter, this); serializer.Serialize(xmlWriter, this);
} }
@ -329,7 +351,6 @@ namespace OpenSim.Region.Environment.Scenes
public void SetParent(SceneObjectGroup parent) public void SetParent(SceneObjectGroup parent)
{ {
m_parentGroup = parent; m_parentGroup = parent;
} }
public LLUUID GetRootPartUUID() public LLUUID GetRootPartUUID()
@ -342,34 +363,38 @@ namespace OpenSim.Region.Environment.Scenes
} }
#region Copying #region Copying
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public SceneObjectPart Copy(uint localID) public SceneObjectPart Copy(uint localID)
{ {
SceneObjectPart dupe = (SceneObjectPart)this.MemberwiseClone(); SceneObjectPart dupe = (SceneObjectPart) MemberwiseClone();
dupe.m_shape = m_shape.Copy(); dupe.m_shape = m_shape.Copy();
dupe.m_regionHandle = m_regionHandle; dupe.m_regionHandle = m_regionHandle;
dupe.UUID = LLUUID.Random(); dupe.UUID = LLUUID.Random();
dupe.LocalID = localID; dupe.LocalID = localID;
dupe.GroupPosition = new LLVector3(GroupPosition.X, GroupPosition.Y, GroupPosition.Z); dupe.GroupPosition = new LLVector3(GroupPosition.X, GroupPosition.Y, GroupPosition.Z);
dupe.OffsetPosition = new LLVector3(OffsetPosition.X, OffsetPosition.Y, OffsetPosition.Z); dupe.OffsetPosition = new LLVector3(OffsetPosition.X, OffsetPosition.Y, OffsetPosition.Z);
dupe.RotationOffset = new LLQuaternion(RotationOffset.X, RotationOffset.Y, RotationOffset.Z, RotationOffset.W); dupe.RotationOffset =
new LLQuaternion(RotationOffset.X, RotationOffset.Y, RotationOffset.Z, RotationOffset.W);
dupe.Velocity = new LLVector3(0, 0, 0); dupe.Velocity = new LLVector3(0, 0, 0);
dupe.Acceleration = new LLVector3(0, 0, 0); dupe.Acceleration = new LLVector3(0, 0, 0);
dupe.AngularVelocity = new LLVector3(0, 0, 0); dupe.AngularVelocity = new LLVector3(0, 0, 0);
dupe.ObjectFlags = this.ObjectFlags; dupe.ObjectFlags = ObjectFlags;
byte[] extraP = new byte[this.Shape.ExtraParams.Length]; byte[] extraP = new byte[Shape.ExtraParams.Length];
Array.Copy(this.Shape.ExtraParams, extraP, extraP.Length); Array.Copy(Shape.ExtraParams, extraP, extraP.Length);
dupe.Shape.ExtraParams = extraP; dupe.Shape.ExtraParams = extraP;
return dupe; return dupe;
} }
#endregion #endregion
#region Update Scheduling #region Update Scheduling
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@ -387,7 +412,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
m_parentGroup.HasChanged = true; m_parentGroup.HasChanged = true;
} }
this.TimeStampFull =(uint) Util.UnixTimeSinceEpoch(); TimeStampFull = (uint) Util.UnixTimeSinceEpoch();
m_updateFlag = 2; m_updateFlag = 2;
} }
@ -402,7 +427,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
m_parentGroup.HasChanged = true; m_parentGroup.HasChanged = true;
} }
this.TimeStampTerse = (uint)Util.UnixTimeSinceEpoch(); TimeStampTerse = (uint) Util.UnixTimeSinceEpoch();
m_updateFlag = 1; m_updateFlag = 1;
} }
} }
@ -426,56 +451,60 @@ namespace OpenSim.Region.Environment.Scenes
} }
} }
} }
#endregion #endregion
#region Shape #region Shape
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="shapeBlock"></param> /// <param name="shapeBlock"></param>
public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock) public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock)
{ {
this.m_shape.PathBegin = shapeBlock.PathBegin; m_shape.PathBegin = shapeBlock.PathBegin;
this.m_shape.PathEnd = shapeBlock.PathEnd; m_shape.PathEnd = shapeBlock.PathEnd;
this.m_shape.PathScaleX = shapeBlock.PathScaleX; m_shape.PathScaleX = shapeBlock.PathScaleX;
this.m_shape.PathScaleY = shapeBlock.PathScaleY; m_shape.PathScaleY = shapeBlock.PathScaleY;
this.m_shape.PathShearX = shapeBlock.PathShearX; m_shape.PathShearX = shapeBlock.PathShearX;
this.m_shape.PathShearY = shapeBlock.PathShearY; m_shape.PathShearY = shapeBlock.PathShearY;
this.m_shape.PathSkew = shapeBlock.PathSkew; m_shape.PathSkew = shapeBlock.PathSkew;
this.m_shape.ProfileBegin = shapeBlock.ProfileBegin; m_shape.ProfileBegin = shapeBlock.ProfileBegin;
this.m_shape.ProfileEnd = shapeBlock.ProfileEnd; m_shape.ProfileEnd = shapeBlock.ProfileEnd;
this.m_shape.PathCurve = shapeBlock.PathCurve; m_shape.PathCurve = shapeBlock.PathCurve;
this.m_shape.ProfileCurve = shapeBlock.ProfileCurve; m_shape.ProfileCurve = shapeBlock.ProfileCurve;
this.m_shape.ProfileHollow = shapeBlock.ProfileHollow; m_shape.ProfileHollow = shapeBlock.ProfileHollow;
this.m_shape.PathRadiusOffset = shapeBlock.PathRadiusOffset; m_shape.PathRadiusOffset = shapeBlock.PathRadiusOffset;
this.m_shape.PathRevolutions = shapeBlock.PathRevolutions; m_shape.PathRevolutions = shapeBlock.PathRevolutions;
this.m_shape.PathTaperX = shapeBlock.PathTaperX; m_shape.PathTaperX = shapeBlock.PathTaperX;
this.m_shape.PathTaperY = shapeBlock.PathTaperY; m_shape.PathTaperY = shapeBlock.PathTaperY;
this.m_shape.PathTwist = shapeBlock.PathTwist; m_shape.PathTwist = shapeBlock.PathTwist;
this.m_shape.PathTwistBegin = shapeBlock.PathTwistBegin; m_shape.PathTwistBegin = shapeBlock.PathTwistBegin;
ScheduleFullUpdate(); ScheduleFullUpdate();
} }
#endregion #endregion
#region Inventory #region Inventory
public void AddInventoryItem(TaskInventoryItem item) public void AddInventoryItem(TaskInventoryItem item)
{ {
item.parent_id = m_folderID; item.parent_id = m_folderID;
item.creation_date = 1000; item.creation_date = 1000;
item.ParentPartID = this.UUID; item.ParentPartID = UUID;
this.TaskInventory.Add(item.item_id, item); TaskInventory.Add(item.item_id, item);
this.m_inventorySerial++; m_inventorySerial++;
} }
public int RemoveInventoryItem(IClientAPI remoteClient, uint localID, LLUUID itemID) public int RemoveInventoryItem(IClientAPI remoteClient, uint localID, LLUUID itemID)
{ {
if (localID == this.LocalID) if (localID == LocalID)
{ {
if (this.TaskInventory.ContainsKey(itemID)) if (TaskInventory.ContainsKey(itemID))
{ {
string type = TaskInventory[itemID].inv_type; string type = TaskInventory[itemID].inv_type;
this.TaskInventory.Remove(itemID); TaskInventory.Remove(itemID);
this.m_inventorySerial++; m_inventorySerial++;
if (type == "lsltext") if (type == "lsltext")
{ {
return 10; return 10;
@ -496,16 +525,17 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="localID"></param> /// <param name="localID"></param>
public bool GetInventoryFileName(IClientAPI client, uint localID) public bool GetInventoryFileName(IClientAPI client, uint localID)
{ {
if (localID == this.m_localID) if (localID == m_localID)
{ {
if (this.m_inventorySerial > 0) if (m_inventorySerial > 0)
{ {
client.SendTaskInventory(this.m_uuid, (short)m_inventorySerial, Helpers.StringToField(m_inventoryFileName)); client.SendTaskInventory(m_uuid, (short) m_inventorySerial,
Helpers.StringToField(m_inventoryFileName));
return true; return true;
} }
else else
{ {
client.SendTaskInventory(this.m_uuid, 0, new byte[0]); client.SendTaskInventory(m_uuid, 0, new byte[0]);
return false; return false;
} }
} }
@ -515,8 +545,8 @@ namespace OpenSim.Region.Environment.Scenes
public string RequestInventoryFile(IXfer xferManager) public string RequestInventoryFile(IXfer xferManager)
{ {
byte[] fileData = new byte[0]; byte[] fileData = new byte[0];
InventoryStringBuilder invString = new InventoryStringBuilder(m_folderID, this.UUID); InventoryStringBuilder invString = new InventoryStringBuilder(m_folderID, UUID);
foreach (TaskInventoryItem item in this.TaskInventory.Values) foreach (TaskInventoryItem item in TaskInventory.Values)
{ {
invString.AddItemStart(); invString.AddItemStart();
invString.AddNameValueLine("item_id", item.item_id.ToStringHyphenated()); invString.AddNameValueLine("item_id", item.item_id.ToStringHyphenated());
@ -550,49 +580,56 @@ namespace OpenSim.Region.Environment.Scenes
} }
return ""; return "";
} }
#endregion #endregion
#region ExtraParams #region ExtraParams
public void UpdateExtraParam(ushort type, bool inUse, byte[] data) public void UpdateExtraParam(ushort type, bool inUse, byte[] data)
{ {
this.m_shape.ExtraParams = new byte[data.Length + 7]; m_shape.ExtraParams = new byte[data.Length + 7];
int i = 0; int i = 0;
uint length = (uint)data.Length; uint length = (uint) data.Length;
this.m_shape.ExtraParams[i++] = 1; m_shape.ExtraParams[i++] = 1;
this.m_shape.ExtraParams[i++] = (byte)(type % 256); m_shape.ExtraParams[i++] = (byte) (type%256);
this.m_shape.ExtraParams[i++] = (byte)((type >> 8) % 256); m_shape.ExtraParams[i++] = (byte) ((type >> 8)%256);
this.m_shape.ExtraParams[i++] = (byte)(length % 256); m_shape.ExtraParams[i++] = (byte) (length%256);
this.m_shape.ExtraParams[i++] = (byte)((length >> 8) % 256); m_shape.ExtraParams[i++] = (byte) ((length >> 8)%256);
this.m_shape.ExtraParams[i++] = (byte)((length >> 16) % 256); m_shape.ExtraParams[i++] = (byte) ((length >> 16)%256);
this.m_shape.ExtraParams[i++] = (byte)((length >> 24) % 256); m_shape.ExtraParams[i++] = (byte) ((length >> 24)%256);
Array.Copy(data, 0, this.m_shape.ExtraParams, i, data.Length); Array.Copy(data, 0, m_shape.ExtraParams, i, data.Length);
this.ScheduleFullUpdate();
ScheduleFullUpdate();
} }
#endregion #endregion
#region Texture #region Texture
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="textureEntry"></param> /// <param name="textureEntry"></param>
public void UpdateTextureEntry(byte[] textureEntry) public void UpdateTextureEntry(byte[] textureEntry)
{ {
this.m_shape.TextureEntry = textureEntry; m_shape.TextureEntry = textureEntry;
ScheduleFullUpdate(); ScheduleFullUpdate();
} }
#endregion #endregion
#region ParticleSystem #region ParticleSystem
public void AddNewParticleSystem(libsecondlife.Primitive.ParticleSystem pSystem)
public void AddNewParticleSystem(Primitive.ParticleSystem pSystem)
{ {
this.m_particleSystem = pSystem.GetBytes(); m_particleSystem = pSystem.GetBytes();
} }
#endregion #endregion
#region Position #region Position
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@ -600,42 +637,48 @@ namespace OpenSim.Region.Environment.Scenes
public void UpdateOffSet(LLVector3 pos) public void UpdateOffSet(LLVector3 pos)
{ {
LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z);
this.OffsetPosition = newPos; OffsetPosition = newPos;
ScheduleTerseUpdate(); ScheduleTerseUpdate();
} }
public void UpdateGroupPosition(LLVector3 pos) public void UpdateGroupPosition(LLVector3 pos)
{ {
LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z);
this.GroupPosition = newPos; GroupPosition = newPos;
ScheduleTerseUpdate(); ScheduleTerseUpdate();
} }
#endregion #endregion
#region rotation #region rotation
public void UpdateRotation(LLQuaternion rot) public void UpdateRotation(LLQuaternion rot)
{ {
this.RotationOffset = new LLQuaternion(rot.X, rot.Y, rot.Z, rot.W); RotationOffset = new LLQuaternion(rot.X, rot.Y, rot.Z, rot.W);
ScheduleTerseUpdate(); ScheduleTerseUpdate();
} }
#endregion #endregion
#region Resizing/Scale #region Resizing/Scale
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="scale"></param> /// <param name="scale"></param>
public void Resize(LLVector3 scale) public void Resize(LLVector3 scale)
{ {
this.m_shape.Scale = scale; m_shape.Scale = scale;
ScheduleFullUpdate(); ScheduleFullUpdate();
} }
#endregion #endregion
#region Client Update Methods #region Client Update Methods
public void AddFullUpdateToAllAvatars() public void AddFullUpdateToAllAvatars()
{ {
List<ScenePresence> avatars = this.m_parentGroup.RequestSceneAvatars(); List<ScenePresence> avatars = m_parentGroup.RequestSceneAvatars();
for (int i = 0; i < avatars.Count; i++) for (int i = 0; i < avatars.Count; i++)
{ {
avatars[i].AddFullPart(this); avatars[i].AddFullPart(this);
@ -654,7 +697,7 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary> /// </summary>
public void SendFullUpdateToAllClients() public void SendFullUpdateToAllClients()
{ {
List<ScenePresence> avatars = this.m_parentGroup.RequestSceneAvatars(); List<ScenePresence> avatars = m_parentGroup.RequestSceneAvatars();
for (int i = 0; i < avatars.Count; i++) for (int i = 0; i < avatars.Count; i++)
{ {
m_parentGroup.SendPartFullUpdate(avatars[i].ControllingClient, this); m_parentGroup.SendPartFullUpdate(avatars[i].ControllingClient, this);
@ -691,15 +734,15 @@ namespace OpenSim.Region.Environment.Scenes
LLQuaternion lRot; LLQuaternion lRot;
lRot = RotationOffset; lRot = RotationOffset;
remoteClient.SendPrimitiveToClient(m_regionHandle, 64096, LocalID, m_shape, lPos, this.ObjectFlags, m_uuid, OwnerID, remoteClient.SendPrimitiveToClient(m_regionHandle, 64096, LocalID, m_shape, lPos, ObjectFlags, m_uuid,
m_text, ParentID, this.m_particleSystem, lRot); OwnerID,
m_text, ParentID, m_particleSystem, lRot);
} }
/// Terse updates /// Terse updates
public void AddTerseUpdateToAllAvatars() public void AddTerseUpdateToAllAvatars()
{ {
List<ScenePresence> avatars = this.m_parentGroup.RequestSceneAvatars(); List<ScenePresence> avatars = m_parentGroup.RequestSceneAvatars();
for (int i = 0; i < avatars.Count; i++) for (int i = 0; i < avatars.Count; i++)
{ {
avatars[i].AddTersePart(this); avatars[i].AddTersePart(this);
@ -718,7 +761,7 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary> /// </summary>
public void SendTerseUpdateToAllClients() public void SendTerseUpdateToAllClients()
{ {
List<ScenePresence> avatars = this.m_parentGroup.RequestSceneAvatars(); List<ScenePresence> avatars = m_parentGroup.RequestSceneAvatars();
for (int i = 0; i < avatars.Count; i++) for (int i = 0; i < avatars.Count; i++)
{ {
m_parentGroup.SendPartTerseUpdate(avatars[i].ControllingClient, this); m_parentGroup.SendPartTerseUpdate(avatars[i].ControllingClient, this);
@ -741,8 +784,8 @@ namespace OpenSim.Region.Environment.Scenes
public void SendTerseUpdateToClient(IClientAPI remoteClient) public void SendTerseUpdateToClient(IClientAPI remoteClient)
{ {
LLVector3 lPos; LLVector3 lPos;
lPos = this.OffsetPosition; lPos = OffsetPosition;
LLQuaternion mRot = this.RotationOffset; LLQuaternion mRot = RotationOffset;
remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot); remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot);
} }
@ -753,9 +796,10 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="lPos"></param> /// <param name="lPos"></param>
public void SendTerseUpdateToClient(IClientAPI remoteClient, LLVector3 lPos) public void SendTerseUpdateToClient(IClientAPI remoteClient, LLVector3 lPos)
{ {
LLQuaternion mRot = this.RotationOffset; LLQuaternion mRot = RotationOffset;
remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot); remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot);
} }
#endregion #endregion
public virtual void UpdateMovement() public virtual void UpdateMovement()
@ -778,11 +822,11 @@ namespace OpenSim.Region.Environment.Scenes
public InventoryStringBuilder(LLUUID folderID, LLUUID parentID) public InventoryStringBuilder(LLUUID folderID, LLUUID parentID)
{ {
BuildString += "\tinv_object\t0\n\t{\n"; BuildString += "\tinv_object\t0\n\t{\n";
this.AddNameValueLine("obj_id", folderID.ToStringHyphenated()); AddNameValueLine("obj_id", folderID.ToStringHyphenated());
this.AddNameValueLine("parent_id", parentID.ToStringHyphenated()); AddNameValueLine("parent_id", parentID.ToStringHyphenated());
this.AddNameValueLine("type", "category"); AddNameValueLine("type", "category");
this.AddNameValueLine("name", "Contents"); AddNameValueLine("name", "Contents");
this.AddSectionEnd(); AddSectionEnd();
} }
public void AddItemStart() public void AddItemStart()
@ -866,4 +910,3 @@ namespace OpenSim.Region.Environment.Scenes
} }
} }
} }

View File

@ -35,7 +35,6 @@ namespace OpenSim.Region.Environment.Scenes
{ {
public class AvatarAnimations public class AvatarAnimations
{ {
public Dictionary<string, LLUUID> AnimsLLUUID = new Dictionary<string, LLUUID>(); public Dictionary<string, LLUUID> AnimsLLUUID = new Dictionary<string, LLUUID>();
public Dictionary<LLUUID, string> AnimsNames = new Dictionary<LLUUID, string>(); public Dictionary<LLUUID, string> AnimsNames = new Dictionary<LLUUID, string>();
@ -52,12 +51,10 @@ namespace OpenSim.Region.Environment.Scenes
doc.Load(reader); doc.Load(reader);
foreach (XmlNode nod in doc.DocumentElement.ChildNodes) foreach (XmlNode nod in doc.DocumentElement.ChildNodes)
{ {
if (nod.Attributes["name"] != null) if (nod.Attributes["name"] != null)
{ {
AnimsLLUUID.Add(nod.Attributes["name"].Value, nod.InnerText); AnimsLLUUID.Add(nod.Attributes["name"].Value, nod.InnerText);
} }
} }
reader.Close(); reader.Close();

View File

@ -37,7 +37,6 @@ namespace OpenSim.Region.Environment.Scenes
{ {
public Avatar() public Avatar()
{ {
} }
public void processMovement(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation) public void processMovement(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation)
@ -61,7 +60,6 @@ namespace OpenSim.Region.Environment.Scenes
{ {
public ChildAgent() public ChildAgent()
{ {
} }
public void processMovement(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation) public void processMovement(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation)
@ -81,5 +79,4 @@ namespace OpenSim.Region.Environment.Scenes
} }
} }
} }
} }

View File

@ -27,7 +27,6 @@
*/ */
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using Axiom.Math; using Axiom.Math;
using libsecondlife; using libsecondlife;
using libsecondlife.Packets; using libsecondlife.Packets;
@ -72,7 +71,8 @@ namespace OpenSim.Region.Environment.Scenes
private IScenePresenceBody m_body; private IScenePresenceBody m_body;
private Vector3[] Dir_Vectors = new Vector3[6]; private Vector3[] Dir_Vectors = new Vector3[6];
private libsecondlife.LLVector3 lastPhysPos = new libsecondlife.LLVector3(); private LLVector3 lastPhysPos = new LLVector3();
private enum Dir_ControlFlags private enum Dir_ControlFlags
{ {
DIR_CONTROL_FLAG_FOWARD = MainAvatar.ControlFlags.AGENT_CONTROL_AT_POS, DIR_CONTROL_FLAG_FOWARD = MainAvatar.ControlFlags.AGENT_CONTROL_AT_POS,
@ -82,12 +82,14 @@ namespace OpenSim.Region.Environment.Scenes
DIR_CONTROL_FLAG_UP = MainAvatar.ControlFlags.AGENT_CONTROL_UP_POS, DIR_CONTROL_FLAG_UP = MainAvatar.ControlFlags.AGENT_CONTROL_UP_POS,
DIR_CONTROL_FLAG_DOWN = MainAvatar.ControlFlags.AGENT_CONTROL_UP_NEG DIR_CONTROL_FLAG_DOWN = MainAvatar.ControlFlags.AGENT_CONTROL_UP_NEG
} }
/// <summary> /// <summary>
/// Position at which a significant movement was made /// Position at which a significant movement was made
/// </summary> /// </summary>
private LLVector3 posLastSignificantMove = new LLVector3(); private LLVector3 posLastSignificantMove = new LLVector3();
public delegate void SignificantClientMovement(IClientAPI remote_client); public delegate void SignificantClientMovement(IClientAPI remote_client);
public event SignificantClientMovement OnSignificantClientMovement; public event SignificantClientMovement OnSignificantClientMovement;
//public List<SceneObjectGroup> InterestList = new List<SceneObjectGroup>(); //public List<SceneObjectGroup> InterestList = new List<SceneObjectGroup>();
@ -99,31 +101,20 @@ namespace OpenSim.Region.Environment.Scenes
private Queue<SceneObjectPart> m_tersePartUpdates = new Queue<SceneObjectPart>(); private Queue<SceneObjectPart> m_tersePartUpdates = new Queue<SceneObjectPart>();
#region Properties #region Properties
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public PhysicsActor PhysActor public PhysicsActor PhysActor
{ {
set set { _physActor = value; }
{ get { return _physActor; }
this._physActor = value;
}
get
{
return _physActor;
}
} }
public bool Updated public bool Updated
{ {
set set { updateflag = value; }
{ get { return updateflag; }
this.updateflag = value;
}
get
{
return this.updateflag;
}
} }
public ulong RegionHandle public ulong RegionHandle
@ -132,12 +123,14 @@ namespace OpenSim.Region.Environment.Scenes
} }
private string m_firstname; private string m_firstname;
public string Firstname public string Firstname
{ {
get { return m_firstname; } get { return m_firstname; }
} }
private string m_lastname; private string m_lastname;
public string Lastname public string Lastname
{ {
get { return m_lastname; } get { return m_lastname; }
@ -146,6 +139,7 @@ namespace OpenSim.Region.Environment.Scenes
#endregion #endregion
#region Constructor(s) #region Constructor(s)
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@ -155,16 +149,15 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="regionDat"></param> /// <param name="regionDat"></param>
public ScenePresence(IClientAPI theClient, Scene world, RegionInfo reginfo) public ScenePresence(IClientAPI theClient, Scene world, RegionInfo reginfo)
{ {
m_scene = world; m_scene = world;
this.m_uuid = theClient.AgentId; m_uuid = theClient.AgentId;
m_regionInfo = reginfo; m_regionInfo = reginfo;
m_regionHandle = reginfo.RegionHandle; m_regionHandle = reginfo.RegionHandle;
MainLog.Instance.Verbose("Avatar.cs "); MainLog.Instance.Verbose("Avatar.cs ");
ControllingClient = theClient; ControllingClient = theClient;
this.m_firstname = ControllingClient.FirstName; m_firstname = ControllingClient.FirstName;
this.m_lastname = ControllingClient.LastName; m_lastname = ControllingClient.LastName;
m_localId = m_scene.NextLocalId; m_localId = m_scene.NextLocalId;
AbsolutePosition = ControllingClient.StartPos; AbsolutePosition = ControllingClient.StartPos;
@ -175,15 +168,15 @@ namespace OpenSim.Region.Environment.Scenes
} }
Wearables = AvatarWearable.DefaultWearables; Wearables = AvatarWearable.DefaultWearables;
Animations = new ScenePresence.AvatarAnimations(); Animations = new AvatarAnimations();
Animations.LoadAnims(); Animations.LoadAnims();
//register for events //register for events
ControllingClient.OnRequestWearables += this.SendOurAppearance; ControllingClient.OnRequestWearables += SendOurAppearance;
ControllingClient.OnSetAppearance += new SetAppearance(this.SetAppearance); ControllingClient.OnSetAppearance += new SetAppearance(SetAppearance);
ControllingClient.OnCompleteMovementToRegion += this.CompleteMovement; ControllingClient.OnCompleteMovementToRegion += CompleteMovement;
ControllingClient.OnCompleteMovementToRegion += this.SendInitialData; ControllingClient.OnCompleteMovementToRegion += SendInitialData;
ControllingClient.OnAgentUpdate += this.HandleAgentUpdate; ControllingClient.OnAgentUpdate += HandleAgentUpdate;
// ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack); // ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack);
// ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange);
//ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); //ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement);
@ -195,17 +188,17 @@ namespace OpenSim.Region.Environment.Scenes
Dir_Vectors[4] = new Vector3(0, 0, 1); //UP Dir_Vectors[4] = new Vector3(0, 0, 1); //UP
Dir_Vectors[5] = new Vector3(0, 0, -1); //DOWN Dir_Vectors[5] = new Vector3(0, 0, -1); //DOWN
this.m_textureEntry = new LLObject.TextureEntry(DefaultTexture, 0, DefaultTexture.Length); m_textureEntry = new LLObject.TextureEntry(DefaultTexture, 0, DefaultTexture.Length);
//temporary until we move some code into the body classes //temporary until we move some code into the body classes
this.m_body = new ChildAgent(); m_body = new ChildAgent();
if (newAvatar) if (newAvatar)
{ {
//do we need to use newAvatar? not sure so have added this to kill the compile warning //do we need to use newAvatar? not sure so have added this to kill the compile warning
} }
} }
#endregion #endregion
public void AddTersePart(SceneObjectPart part) public void AddTersePart(SceneObjectPart part)
@ -228,10 +221,10 @@ namespace OpenSim.Region.Environment.Scenes
while (terse) while (terse)
{ {
SceneObjectPart part = m_tersePartUpdates.Dequeue(); SceneObjectPart part = m_tersePartUpdates.Dequeue();
part.SendTerseUpdate(this.ControllingClient); part.SendTerseUpdate(ControllingClient);
terseCount++; terseCount++;
if ((m_tersePartUpdates.Count < 1) |(terseCount > 30)) if ((m_tersePartUpdates.Count < 1) | (terseCount > 30))
{ {
terse = false; terse = false;
} }
@ -245,31 +238,30 @@ namespace OpenSim.Region.Environment.Scenes
while (full) while (full)
{ {
SceneObjectPart part = m_fullPartUpdates.Dequeue(); SceneObjectPart part = m_fullPartUpdates.Dequeue();
part.SendFullUpdate(this.ControllingClient); part.SendFullUpdate(ControllingClient);
fullCount++; fullCount++;
if ((m_fullPartUpdates.Count < 1) | (fullCount > 40)) if ((m_fullPartUpdates.Count < 1) | (fullCount > 40))
{ {
full = false; full = false;
} }
} }
} }
} }
#region Status Methods #region Status Methods
/// <summary> /// <summary>
/// Not Used, most likely can be deleted /// Not Used, most likely can be deleted
/// </summary> /// </summary>
/// <param name="status"></param> /// <param name="status"></param>
public void ChildStatusChange(bool status) public void ChildStatusChange(bool status)
{ {
this.childAgent = status; childAgent = status;
if (this.childAgent == true) if (childAgent == true)
{ {
this.Velocity = new LLVector3(0, 0, 0); Velocity = new LLVector3(0, 0, 0);
this.AbsolutePosition = new LLVector3(128, 128, 70); AbsolutePosition = new LLVector3(128, 128, 70);
} }
} }
@ -280,17 +272,17 @@ namespace OpenSim.Region.Environment.Scenes
public void MakeAvatar(LLVector3 pos, bool isFlying) public void MakeAvatar(LLVector3 pos, bool isFlying)
{ {
//this.childAvatar = false; //this.childAvatar = false;
this.AbsolutePosition = pos; AbsolutePosition = pos;
this._physActor.Flying = isFlying; _physActor.Flying = isFlying;
this.newAvatar = true; newAvatar = true;
this.childAgent = false; childAgent = false;
this.m_scene.SendAllSceneObjectsToClient(this); m_scene.SendAllSceneObjectsToClient(this);
} }
protected void MakeChildAgent() protected void MakeChildAgent()
{ {
this.Velocity = new LLVector3(0, 0, 0); Velocity = new LLVector3(0, 0, 0);
this.childAgent = true; childAgent = true;
//this.Pos = new LLVector3(128, 128, 70); //this.Pos = new LLVector3(128, 128, 70);
} }
@ -300,8 +292,8 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="pos"></param> /// <param name="pos"></param>
public void Teleport(LLVector3 pos) public void Teleport(LLVector3 pos)
{ {
this.AbsolutePosition = pos; AbsolutePosition = pos;
this.SendTerseUpdateToALLClients(); SendTerseUpdateToALLClients();
} }
/// <summary> /// <summary>
@ -309,11 +301,12 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary> /// </summary>
public void StopMovement() public void StopMovement()
{ {
} }
#endregion #endregion
#region Event Handlers #region Event Handlers
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@ -322,14 +315,14 @@ namespace OpenSim.Region.Environment.Scenes
public void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam) public void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam)
{ {
LLObject.TextureEntry textureEnt = new LLObject.TextureEntry(texture, 0, texture.Length); LLObject.TextureEntry textureEnt = new LLObject.TextureEntry(texture, 0, texture.Length);
this.m_textureEntry = textureEnt; m_textureEntry = textureEnt;
for (int i = 0; i < visualParam.Length; i++) for (int i = 0; i < visualParam.Length; i++)
{ {
this.visualParams[i] = visualParam[i].ParamValue; visualParams[i] = visualParam[i].ParamValue;
} }
this.SendArrearanceToAllOtherAgents(); SendArrearanceToAllOtherAgents();
} }
/// <summary> /// <summary>
@ -337,15 +330,15 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary> /// </summary>
public void CompleteMovement() public void CompleteMovement()
{ {
LLVector3 look = this.Velocity; LLVector3 look = Velocity;
if ((look.X == 0) && (look.Y == 0) && (look.Z == 0)) if ((look.X == 0) && (look.Y == 0) && (look.Z == 0))
{ {
look = new LLVector3(0.99f, 0.042f, 0); look = new LLVector3(0.99f, 0.042f, 0);
} }
this.ControllingClient.MoveAgentIntoRegion(m_regionInfo, AbsolutePosition, look); ControllingClient.MoveAgentIntoRegion(m_regionInfo, AbsolutePosition, look);
if (this.childAgent) if (childAgent)
{ {
this.childAgent = false; childAgent = false;
//this.m_scene.SendAllSceneObjectsToClient(this.ControllingClient); //this.m_scene.SendAllSceneObjectsToClient(this.ControllingClient);
} }
@ -363,47 +356,45 @@ namespace OpenSim.Region.Environment.Scenes
bool DCFlagKeyPressed = false; bool DCFlagKeyPressed = false;
Vector3 agent_control_v3 = new Vector3(0, 0, 0); Vector3 agent_control_v3 = new Vector3(0, 0, 0);
Quaternion q = new Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z); Quaternion q = new Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z);
bool oldflying = this.PhysActor.Flying; bool oldflying = PhysActor.Flying;
this.PhysActor.Flying = ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0); PhysActor.Flying = ((flags & (uint) MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0);
if (this.PhysActor.Flying != oldflying) if (PhysActor.Flying != oldflying)
{ {
update_movementflag = true; update_movementflag = true;
} }
if (q != this.bodyRot) if (q != bodyRot)
{ {
this.bodyRot = q; bodyRot = q;
update_rotation = true; update_rotation = true;
} }
foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof(Dir_ControlFlags))) foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof (Dir_ControlFlags)))
{ {
if ((flags & (uint)DCF) != 0) if ((flags & (uint) DCF) != 0)
{ {
DCFlagKeyPressed = true; DCFlagKeyPressed = true;
agent_control_v3 += Dir_Vectors[i]; agent_control_v3 += Dir_Vectors[i];
if ((movementflag & (uint)DCF) == 0) if ((movementflag & (uint) DCF) == 0)
{ {
movementflag += (byte)(uint)DCF; movementflag += (byte) (uint) DCF;
update_movementflag = true; update_movementflag = true;
} }
} }
else else
{ {
if ((movementflag & (uint)DCF) != 0) if ((movementflag & (uint) DCF) != 0)
{ {
movementflag -= (byte)(uint)DCF; movementflag -= (byte) (uint) DCF;
update_movementflag = true; update_movementflag = true;
} }
} }
i++; i++;
} }
if ((update_movementflag) || (update_rotation && DCFlagKeyPressed)) if ((update_movementflag) || (update_rotation && DCFlagKeyPressed))
{ {
this.AddNewMovement(agent_control_v3, q); AddNewMovement(agent_control_v3, q);
} }
UpdateMovementAnimations(update_movementflag); UpdateMovementAnimations(update_movementflag);
} }
protected void UpdateMovementAnimations(bool update_movementflag) protected void UpdateMovementAnimations(bool update_movementflag)
@ -412,49 +403,48 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (movementflag != 0) if (movementflag != 0)
{ {
if (this._physActor.Flying) if (_physActor.Flying)
{ {
this.SendAnimPack(Animations.AnimsLLUUID["FLY"], 1); SendAnimPack(Animations.AnimsLLUUID["FLY"], 1);
} }
else else
{ {
this.SendAnimPack(Animations.AnimsLLUUID["WALK"], 1); SendAnimPack(Animations.AnimsLLUUID["WALK"], 1);
} }
} }
else else
{ {
this.SendAnimPack(Animations.AnimsLLUUID["STAND"], 1); SendAnimPack(Animations.AnimsLLUUID["STAND"], 1);
} }
} }
} }
protected void AddNewMovement(Vector3 vec, Quaternion rotation) protected void AddNewMovement(Vector3 vec, Quaternion rotation)
{ {
NewForce newVelocity = new NewForce(); NewForce newVelocity = new NewForce();
Vector3 direc = rotation * vec; Vector3 direc = rotation*vec;
direc.Normalize(); direc.Normalize();
direc = direc * ((0.03f) * 128f); direc = direc*((0.03f)*128f);
if (this._physActor.Flying) if (_physActor.Flying)
direc *= 4; direc *= 4;
newVelocity.X = direc.x; newVelocity.X = direc.x;
newVelocity.Y = direc.y; newVelocity.Y = direc.y;
newVelocity.Z = direc.z; newVelocity.Z = direc.z;
this.forcesList.Add(newVelocity); forcesList.Add(newVelocity);
} }
#endregion #endregion
#region Overridden Methods #region Overridden Methods
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public override void LandRenegerated() public override void LandRenegerated()
{ {
} }
/// <summary> /// <summary>
@ -462,20 +452,20 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary> /// </summary>
public override void Update() public override void Update()
{ {
this.SendPrimUpdates(); SendPrimUpdates();
if (this.newCoarseLocations) { if (newCoarseLocations)
this.SendCoarseLocations(); {
this.newCoarseLocations = false; SendCoarseLocations();
newCoarseLocations = false;
} }
if (this.childAgent == false) if (childAgent == false)
{ {
/// check for user movement 'forces' (ie commands to move) /// check for user movement 'forces' (ie commands to move)
if (this.newForce) if (newForce)
{ {
this.SendTerseUpdateToALLClients(); SendTerseUpdateToALLClients();
_updateCount = 0; _updateCount = 0;
} }
@ -485,40 +475,42 @@ namespace OpenSim.Region.Environment.Scenes
_updateCount++; _updateCount++;
if (_updateCount > 3) if (_updateCount > 3)
{ {
this.SendTerseUpdateToALLClients(); SendTerseUpdateToALLClients();
_updateCount = 0; _updateCount = 0;
} }
} }
/// check for physics-related movement /// check for physics-related movement
else if (this.lastPhysPos.GetDistanceTo(this.AbsolutePosition) > 0.02 ) else if (lastPhysPos.GetDistanceTo(AbsolutePosition) > 0.02)
{ {
this.SendTerseUpdateToALLClients(); SendTerseUpdateToALLClients();
_updateCount = 0; _updateCount = 0;
this.lastPhysPos = this.AbsolutePosition; lastPhysPos = AbsolutePosition;
}
CheckForSignificantMovement();
CheckForBorderCrossing();
}
} }
this.CheckForSignificantMovement();
this.CheckForBorderCrossing();
}
}
#endregion #endregion
#region Update Client(s) #region Update Client(s)
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="RemoteClient"></param> /// <param name="RemoteClient"></param>
public void SendTerseUpdateToClient(IClientAPI RemoteClient) public void SendTerseUpdateToClient(IClientAPI RemoteClient)
{ {
LLVector3 pos = this.AbsolutePosition; LLVector3 pos = AbsolutePosition;
LLVector3 vel = this.Velocity; LLVector3 vel = Velocity;
LLQuaternion rot; LLQuaternion rot;
rot.X = this.bodyRot.x; rot.X = bodyRot.x;
rot.Y = this.bodyRot.y; rot.Y = bodyRot.y;
rot.Z = this.bodyRot.z; rot.Z = bodyRot.z;
rot.W = this.bodyRot.w; rot.W = bodyRot.w;
RemoteClient.SendAvatarTerseUpdate(this.m_regionHandle, 64096, this.LocalId, new LLVector3(pos.X, pos.Y, pos.Z), new LLVector3(vel.X, vel.Y, vel.Z), rot); RemoteClient.SendAvatarTerseUpdate(m_regionHandle, 64096, LocalId, new LLVector3(pos.X, pos.Y, pos.Z),
new LLVector3(vel.X, vel.Y, vel.Z), rot);
} }
/// <summary> /// <summary>
@ -526,10 +518,10 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary> /// </summary>
public void SendTerseUpdateToALLClients() public void SendTerseUpdateToALLClients()
{ {
List<ScenePresence> avatars = this.m_scene.RequestAvatarList(); List<ScenePresence> avatars = m_scene.RequestAvatarList();
for (int i = 0; i < avatars.Count; i++) for (int i = 0; i < avatars.Count; i++)
{ {
this.SendTerseUpdateToClient(avatars[i].ControllingClient); SendTerseUpdateToClient(avatars[i].ControllingClient);
} }
} }
@ -537,14 +529,15 @@ namespace OpenSim.Region.Environment.Scenes
public void SendCoarseLocations() public void SendCoarseLocations()
{ {
List<LLVector3> CoarseLocations = new List<LLVector3>(); List<LLVector3> CoarseLocations = new List<LLVector3>();
List<ScenePresence> avatars = this.m_scene.RequestAvatarList(); List<ScenePresence> avatars = m_scene.RequestAvatarList();
for (int i = 0; i < avatars.Count; i++) for (int i = 0; i < avatars.Count; i++)
{ {
if (avatars[i] != this && (!avatars[i].childAgent) ) { if (avatars[i] != this && (!avatars[i].childAgent))
{
CoarseLocations.Add(avatars[i].AbsolutePosition); CoarseLocations.Add(avatars[i].AbsolutePosition);
} }
} }
this.ControllingClient.SendCoarseLocationUpdate(CoarseLocations); ControllingClient.SendCoarseLocationUpdate(CoarseLocations);
} }
public void CoarseLocationChange(ScenePresence avatar) public void CoarseLocationChange(ScenePresence avatar)
@ -554,13 +547,14 @@ namespace OpenSim.Region.Environment.Scenes
private void NotifyMyCoarseLocationChange() private void NotifyMyCoarseLocationChange()
{ {
List<ScenePresence> avatars = this.m_scene.RequestAvatarList(); List<ScenePresence> avatars = m_scene.RequestAvatarList();
for (int i = 0; i < avatars.Count; i++) { for (int i = 0; i < avatars.Count; i++)
if (avatars[i] != this) { {
if (avatars[i] != this)
{
avatars[i].CoarseLocationChange(this); avatars[i].CoarseLocationChange(this);
} }
} }
} }
@ -570,16 +564,17 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="remoteAvatar"></param> /// <param name="remoteAvatar"></param>
public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar) public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar)
{ {
remoteAvatar.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.m_firstname, this.m_lastname, this.m_uuid, this.LocalId, this.AbsolutePosition, this.m_textureEntry.ToBytes()); remoteAvatar.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid,
LocalId, AbsolutePosition, m_textureEntry.ToBytes());
} }
public void SendFullUpdateToALLClients() public void SendFullUpdateToALLClients()
{ {
List<ScenePresence> avatars = this.m_scene.RequestAvatarList(); List<ScenePresence> avatars = m_scene.RequestAvatarList();
foreach (ScenePresence avatar in this.m_scene.RequestAvatarList()) foreach (ScenePresence avatar in m_scene.RequestAvatarList())
{ {
this.SendFullUpdateToOtherClient(avatar); SendFullUpdateToOtherClient(avatar);
if (avatar.LocalId != this.LocalId) if (avatar.LocalId != LocalId)
{ {
if (!avatar.childAgent) if (!avatar.childAgent)
{ {
@ -595,15 +590,16 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary> /// </summary>
public void SendInitialData() public void SendInitialData()
{ {
this.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.m_firstname, this.m_lastname, this.m_uuid, this.LocalId, this.AbsolutePosition, this.m_textureEntry.ToBytes()); ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, LocalId,
if (!this.childAgent) AbsolutePosition, m_textureEntry.ToBytes());
if (!childAgent)
{ {
this.m_scene.InformClientOfNeighbours(this.ControllingClient); m_scene.InformClientOfNeighbours(ControllingClient);
this.newAvatar = false; newAvatar = false;
} }
this.SendFullUpdateToALLClients(); SendFullUpdateToALLClients();
this.SendArrearanceToAllOtherAgents(); SendArrearanceToAllOtherAgents();
} }
/// <summary> /// <summary>
@ -612,13 +608,13 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="OurClient"></param> /// <param name="OurClient"></param>
public void SendOurAppearance(IClientAPI OurClient) public void SendOurAppearance(IClientAPI OurClient)
{ {
this.ControllingClient.SendWearables(this.Wearables); ControllingClient.SendWearables(Wearables);
//this.SendFullUpdateToALLClients(); //this.SendFullUpdateToALLClients();
//this.SendArrearanceToAllOtherAgents(); //this.SendArrearanceToAllOtherAgents();
this.m_scene.SendAllSceneObjectsToClient(this); m_scene.SendAllSceneObjectsToClient(this);
this.ControllingClient.SendViewerTime(this.m_scene.TimePhase); ControllingClient.SendViewerTime(m_scene.TimePhase);
//Please don't remove the following code (at least not yet), just leave it commented out //Please don't remove the following code (at least not yet), just leave it commented out
//gives the user god powers, should help with debuging things in the future //gives the user god powers, should help with debuging things in the future
@ -636,10 +632,10 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary> /// </summary>
public void SendArrearanceToAllOtherAgents() public void SendArrearanceToAllOtherAgents()
{ {
List<ScenePresence> avatars = this.m_scene.RequestAvatarList(); List<ScenePresence> avatars = m_scene.RequestAvatarList();
foreach (ScenePresence avatar in this.m_scene.RequestAvatarList()) foreach (ScenePresence avatar in m_scene.RequestAvatarList())
{ {
this.SendAppearanceToOtherAgent(avatar); SendAppearanceToOtherAgent(avatar);
} }
} }
@ -649,7 +645,8 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="avatarInfo"></param> /// <param name="avatarInfo"></param>
public void SendAppearanceToOtherAgent(ScenePresence avatarInfo) public void SendAppearanceToOtherAgent(ScenePresence avatarInfo)
{ {
avatarInfo.ControllingClient.SendAppearance(this.ControllingClient.AgentId, this.visualParams, this.m_textureEntry.ToBytes()); avatarInfo.ControllingClient.SendAppearance(ControllingClient.AgentId, visualParams,
m_textureEntry.ToBytes());
} }
/// <summary> /// <summary>
@ -659,12 +656,12 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="seq"></param> /// <param name="seq"></param>
public void SendAnimPack(LLUUID animID, int seq) public void SendAnimPack(LLUUID animID, int seq)
{ {
this.current_anim = animID; current_anim = animID;
this.anim_seq = seq; anim_seq = seq;
List<ScenePresence> avatars = this.m_scene.RequestAvatarList(); List<ScenePresence> avatars = m_scene.RequestAvatarList();
for (int i = 0; i < avatars.Count; i++) for (int i = 0; i < avatars.Count; i++)
{ {
avatars[i].ControllingClient.SendAnimation(animID, seq, this.ControllingClient.AgentId); avatars[i].ControllingClient.SendAnimation(animID, seq, ControllingClient.AgentId);
} }
} }
@ -673,48 +670,51 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary> /// </summary>
public void SendAnimPack() public void SendAnimPack()
{ {
this.SendAnimPack(this.current_anim, this.anim_seq); SendAnimPack(current_anim, anim_seq);
} }
#endregion #endregion
#region Significant Movement Method #region Significant Movement Method
protected void CheckForSignificantMovement() protected void CheckForSignificantMovement()
{ {
if (libsecondlife.Helpers.VecDist(this.AbsolutePosition, this.posLastSignificantMove) > 2.0) if (Helpers.VecDist(AbsolutePosition, posLastSignificantMove) > 2.0)
{ {
this.posLastSignificantMove = this.AbsolutePosition; posLastSignificantMove = AbsolutePosition;
if (OnSignificantClientMovement != null) if (OnSignificantClientMovement != null)
{ {
OnSignificantClientMovement(this.ControllingClient); OnSignificantClientMovement(ControllingClient);
NotifyMyCoarseLocationChange(); NotifyMyCoarseLocationChange();
} }
} }
} }
#endregion #endregion
#region Border Crossing Methods #region Border Crossing Methods
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
protected void CheckForBorderCrossing() protected void CheckForBorderCrossing()
{ {
LLVector3 pos2 = this.AbsolutePosition; LLVector3 pos2 = AbsolutePosition;
LLVector3 vel = this.Velocity; LLVector3 vel = Velocity;
float timeStep = 0.1f; float timeStep = 0.1f;
pos2.X = pos2.X + (vel.X * timeStep); pos2.X = pos2.X + (vel.X*timeStep);
pos2.Y = pos2.Y + (vel.Y * timeStep); pos2.Y = pos2.Y + (vel.Y*timeStep);
pos2.Z = pos2.Z + (vel.Z * timeStep); pos2.Z = pos2.Z + (vel.Z*timeStep);
if ((pos2.X < 0) || (pos2.X > 256)) if ((pos2.X < 0) || (pos2.X > 256))
{ {
this.CrossToNewRegion(); CrossToNewRegion();
} }
if ((pos2.Y < 0) || (pos2.Y > 256)) if ((pos2.Y < 0) || (pos2.Y > 256))
{ {
this.CrossToNewRegion(); CrossToNewRegion();
} }
} }
@ -723,10 +723,10 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary> /// </summary>
protected void CrossToNewRegion() protected void CrossToNewRegion()
{ {
LLVector3 pos = this.AbsolutePosition; LLVector3 pos = AbsolutePosition;
LLVector3 newpos = new LLVector3(pos.X, pos.Y, pos.Z); LLVector3 newpos = new LLVector3(pos.X, pos.Y, pos.Z);
uint neighbourx = this.m_regionInfo.RegionLocX; uint neighbourx = m_regionInfo.RegionLocX;
uint neighboury = this.m_regionInfo.RegionLocY; uint neighboury = m_regionInfo.RegionLocY;
if (pos.X < 1.7F) if (pos.X < 1.7F)
{ {
@ -749,24 +749,28 @@ namespace OpenSim.Region.Environment.Scenes
newpos.Y = 0.1F; newpos.Y = 0.1F;
} }
LLVector3 vel = this.m_velocity; LLVector3 vel = m_velocity;
ulong neighbourHandle = Helpers.UIntsToLong((uint)(neighbourx * 256), (uint)(neighboury * 256)); ulong neighbourHandle = Helpers.UIntsToLong((uint) (neighbourx*256), (uint) (neighboury*256));
RegionInfo neighbourRegion = this.m_scene.RequestNeighbouringRegionInfo(neighbourHandle); RegionInfo neighbourRegion = m_scene.RequestNeighbouringRegionInfo(neighbourHandle);
if (neighbourRegion != null) if (neighbourRegion != null)
{ {
bool res = this.m_scene.InformNeighbourOfCrossing(neighbourHandle, this.ControllingClient.AgentId, newpos, this._physActor.Flying); bool res =
m_scene.InformNeighbourOfCrossing(neighbourHandle, ControllingClient.AgentId, newpos,
_physActor.Flying);
if (res) if (res)
{ {
//TODO: following line is hard coded to port 9000, really need to change this as soon as possible //TODO: following line is hard coded to port 9000, really need to change this as soon as possible
AgentCircuitData circuitdata = this.ControllingClient.RequestClientInfo(); AgentCircuitData circuitdata = ControllingClient.RequestClientInfo();
string capsPath = Util.GetCapsURL(this.ControllingClient.AgentId); string capsPath = Util.GetCapsURL(ControllingClient.AgentId);
this.ControllingClient.CrossRegion(neighbourHandle, newpos, vel, neighbourRegion.ExternalEndPoint, capsPath); ControllingClient.CrossRegion(neighbourHandle, newpos, vel, neighbourRegion.ExternalEndPoint,
this.MakeChildAgent(); capsPath);
this.m_scene.SendKillObject(this.m_localId); MakeChildAgent();
this.NotifyMyCoarseLocationChange(); m_scene.SendKillObject(m_localId);
NotifyMyCoarseLocationChange();
} }
} }
} }
#endregion #endregion
/// <summary> /// <summary>
@ -774,7 +778,6 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary> /// </summary>
public static void LoadAnims() public static void LoadAnims()
{ {
} }
/// <summary> /// <summary>
@ -783,21 +786,21 @@ namespace OpenSim.Region.Environment.Scenes
public override void UpdateMovement() public override void UpdateMovement()
{ {
newForce = false; newForce = false;
lock (this.forcesList) lock (forcesList)
{ {
if (this.forcesList.Count > 0) if (forcesList.Count > 0)
{ {
for (int i = 0; i < this.forcesList.Count; i++) for (int i = 0; i < forcesList.Count; i++)
{ {
NewForce force = this.forcesList[i]; NewForce force = forcesList[i];
this.updateflag = true; updateflag = true;
this.Velocity = new LLVector3(force.X, force.Y, force.Z); Velocity = new LLVector3(force.X, force.Y, force.Z);
this.newForce = true; newForce = true;
} }
for (int i = 0; i < this.forcesList.Count; i++) for (int i = 0; i < forcesList.Count; i++)
{ {
this.forcesList.RemoveAt(0); forcesList.RemoveAt(0);
} }
} }
} }
@ -824,7 +827,6 @@ namespace OpenSim.Region.Environment.Scenes
public NewForce() public NewForce()
{ {
} }
} }
@ -833,5 +835,4 @@ namespace OpenSim.Region.Environment.Scenes
throw new Exception("The method or operation is not implemented."); throw new Exception("The method or operation is not implemented.");
} }
} }
} }

View File

@ -1,20 +1,18 @@
using System; using Axiom.Math;
using System.Collections.Generic;
using System.Text;
using libsecondlife; using libsecondlife;
namespace OpenSim.Region.Environment.Scenes.Scripting namespace OpenSim.Region.Environment.Scenes.Scripting
{ {
public interface IScriptHost public interface IScriptHost
{ {
string Name { get; set;} string Name { get; set; }
string SitName{ get; set;} string SitName { get; set; }
string TouchName { get; set;} string TouchName { get; set; }
string Description { get; set; } string Description { get; set; }
LLUUID UUID { get; } LLUUID UUID { get; }
LLUUID ObjectOwner { get;} LLUUID ObjectOwner { get; }
LLUUID ObjectCreator { get; } LLUUID ObjectCreator { get; }
LLVector3 AbsolutePosition { get; } LLVector3 AbsolutePosition { get; }
void SetText(string text, Axiom.Math.Vector3 color, double alpha); void SetText(string text, Vector3 color, double alpha);
} }
} }

View File

@ -1,14 +1,13 @@
using System; using System;
using System.Collections.Generic; using Axiom.Math;
using System.Text;
using libsecondlife; using libsecondlife;
namespace OpenSim.Region.Environment.Scenes.Scripting namespace OpenSim.Region.Environment.Scenes.Scripting
{ {
public class NullScriptHost : IScriptHost public class NullScriptHost : IScriptHost
{ {
private LLVector3 m_pos = new LLVector3(128, 128, 30);
LLVector3 m_pos = new LLVector3( 128, 128, 30 );
public string Name public string Name
{ {
get { return "Object"; } get { return "Object"; }
@ -39,16 +38,21 @@ namespace OpenSim.Region.Environment.Scenes.Scripting
} }
public LLUUID ObjectOwner public LLUUID ObjectOwner
{ get { return LLUUID.Zero; } } {
get { return LLUUID.Zero; }
}
public LLUUID ObjectCreator { get { return LLUUID.Zero; } } public LLUUID ObjectCreator
{
get { return LLUUID.Zero; }
}
public LLVector3 AbsolutePosition public LLVector3 AbsolutePosition
{ {
get { return m_pos; } get { return m_pos; }
} }
public void SetText(string text, Axiom.Math.Vector3 color, double alpha) public void SetText(string text, Vector3 color, double alpha)
{ {
Console.WriteLine("Tried to SetText [{0}] on NullScriptHost", text); Console.WriteLine("Tried to SetText [{0}] on NullScriptHost", text);
} }

View File

@ -26,17 +26,15 @@
* *
*/ */
/* Original code: Tedd Hansen */ /* Original code: Tedd Hansen */
using System; using OpenSim.Framework.Console;
using System.Collections.Generic;
using System.Text;
using OpenSim.Region.Environment.Scenes.Scripting;
//TODO: WHERE TO PLACE THIS? //TODO: WHERE TO PLACE THIS?
namespace OpenSim.Region.Environment.Scenes.Scripting namespace OpenSim.Region.Environment.Scenes.Scripting
{ {
public interface ScriptEngineInterface public interface ScriptEngineInterface
{ {
void InitializeEngine(OpenSim.Region.Environment.Scenes.Scene Sceneworld, OpenSim.Framework.Console.LogBase logger); void InitializeEngine(Scene Sceneworld, LogBase logger);
void Shutdown(); void Shutdown();
// void StartScript(string ScriptID, IScriptHost ObjectID); // void StartScript(string ScriptID, IScriptHost ObjectID);
} }

View File

@ -27,17 +27,17 @@
*/ */
/* Original code: Tedd Hansen */ /* Original code: Tedd Hansen */
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Text;
using System.Reflection; using System.Reflection;
using OpenSim.Framework.Console;
namespace OpenSim.Region.Environment.Scenes.Scripting namespace OpenSim.Region.Environment.Scenes.Scripting
{ {
public class ScriptEngineLoader public class ScriptEngineLoader
{ {
private OpenSim.Framework.Console.LogBase m_log; private LogBase m_log;
public ScriptEngineLoader(OpenSim.Framework.Console.LogBase logger)
public ScriptEngineLoader(LogBase logger)
{ {
m_log = logger; m_log = logger;
} }
@ -47,12 +47,16 @@ namespace OpenSim.Region.Environment.Scenes.Scripting
ScriptEngineInterface ret = null; ScriptEngineInterface ret = null;
try try
{ {
ret = LoadAndInitAssembly(Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine." + EngineName + ".dll"), ret =
LoadAndInitAssembly(
Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine." + EngineName + ".dll"),
"OpenSim.Region.ScriptEngine." + EngineName + ".ScriptEngine"); "OpenSim.Region.ScriptEngine." + EngineName + ".ScriptEngine");
} }
catch (Exception e) catch (Exception e)
{ {
m_log.Error("ScriptEngine", "Error loading assembly \"" + EngineName + "\": " + e.Message + ", " + e.StackTrace.ToString()); m_log.Error("ScriptEngine",
"Error loading assembly \"" + EngineName + "\": " + e.Message + ", " +
e.StackTrace.ToString());
} }
return ret; return ret;
} }
@ -107,7 +111,7 @@ namespace OpenSim.Region.Environment.Scenes.Scripting
ScriptEngineInterface ret; ScriptEngineInterface ret;
//try //try
//{ //{
ret = (ScriptEngineInterface)Activator.CreateInstance(t); ret = (ScriptEngineInterface) Activator.CreateInstance(t);
//} //}
//catch (Exception e) //catch (Exception e)
//{ //{
@ -115,10 +119,6 @@ namespace OpenSim.Region.Environment.Scenes.Scripting
//} //}
return ret; return ret;
} }
} }
} }

View File

@ -1,15 +1,7 @@
using System; using System;
using System.Collections.Generic;
using System.Text;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Servers;
using OpenSim.Region.Capabilities;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Interfaces;
using System.Reflection; using System.Reflection;
using OpenSim.Framework.Console;
using OpenSim.Region.Environment.Interfaces;
namespace OpenSim.Region.Environment namespace OpenSim.Region.Environment
{ {
@ -19,10 +11,7 @@ namespace OpenSim.Region.Environment
public IRegionDataStore DataStore public IRegionDataStore DataStore
{ {
get get { return m_dataStore; }
{
return m_dataStore;
}
} }
public StorageManager(IRegionDataStore storage) public StorageManager(IRegionDataStore storage)
@ -32,7 +21,7 @@ namespace OpenSim.Region.Environment
public StorageManager(string dllName, string dataStoreFile, string dataStoreDB) public StorageManager(string dllName, string dataStoreFile, string dataStoreDB)
{ {
OpenSim.Framework.Console.MainLog.Instance.Verbose("DATASTORE", "Attempting to load " + dllName); MainLog.Instance.Verbose("DATASTORE", "Attempting to load " + dllName);
Assembly pluginAssembly = Assembly.LoadFrom(dllName); Assembly pluginAssembly = Assembly.LoadFrom(dllName);
foreach (Type pluginType in pluginAssembly.GetTypes()) foreach (Type pluginType in pluginAssembly.GetTypes())
@ -43,12 +32,13 @@ namespace OpenSim.Region.Environment
if (typeInterface != null) if (typeInterface != null)
{ {
IRegionDataStore plug = (IRegionDataStore)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); IRegionDataStore plug =
(IRegionDataStore) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
plug.Initialise(dataStoreFile, dataStoreDB); plug.Initialise(dataStoreFile, dataStoreDB);
m_dataStore = plug; m_dataStore = plug;
OpenSim.Framework.Console.MainLog.Instance.Verbose("DATASTORE", "Added IRegionDataStore Interface"); MainLog.Instance.Verbose("DATASTORE", "Added IRegionDataStore Interface");
} }
typeInterface = null; typeInterface = null;

View File

@ -1,6 +1,4 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Types namespace OpenSim.Region.Environment.Types
@ -36,9 +34,9 @@ namespace OpenSim.Region.Environment.Types
} }
else else
{ {
if (obj.AbsolutePosition.X < (m_leftX + (m_width / 2))) if (obj.AbsolutePosition.X < (m_leftX + (m_width/2)))
{ {
if (obj.AbsolutePosition.Y < (m_leftY + (m_height / 2))) if (obj.AbsolutePosition.Y < (m_leftY + (m_height/2)))
{ {
m_childNodes[0].AddObject(obj); m_childNodes[0].AddObject(obj);
} }
@ -49,7 +47,7 @@ namespace OpenSim.Region.Environment.Types
} }
else else
{ {
if (obj.AbsolutePosition.Y < (m_leftY + (m_height / 2))) if (obj.AbsolutePosition.Y < (m_leftY + (m_height/2)))
{ {
m_childNodes[1].AddObject(obj); m_childNodes[1].AddObject(obj);
} }
@ -66,10 +64,17 @@ namespace OpenSim.Region.Environment.Types
if (m_childNodes == null) if (m_childNodes == null)
{ {
m_childNodes = new BasicQuadTreeNode[4]; m_childNodes = new BasicQuadTreeNode[4];
m_childNodes[0] = new BasicQuadTreeNode(this, m_leftX, m_leftY,(short) (m_width / 2), (short)( m_height / 2)); m_childNodes[0] =
m_childNodes[1] = new BasicQuadTreeNode(this,(short)( m_leftX + (m_width / 2)), m_leftY,(short)( m_width / 2),(short) (m_height / 2)); new BasicQuadTreeNode(this, m_leftX, m_leftY, (short) (m_width/2), (short) (m_height/2));
m_childNodes[2] = new BasicQuadTreeNode(this, m_leftX, (short)( m_leftY + (m_height / 2)), (short)(m_width / 2),(short)( m_height / 2)); m_childNodes[1] =
m_childNodes[3] = new BasicQuadTreeNode(this, (short)( m_leftX + (m_width / 2)),(short)( m_height + (m_height / 2)),(short)( m_width / 2), (short)(m_height / 2)); new BasicQuadTreeNode(this, (short) (m_leftX + (m_width/2)), m_leftY, (short) (m_width/2),
(short) (m_height/2));
m_childNodes[2] =
new BasicQuadTreeNode(this, m_leftX, (short) (m_leftY + (m_height/2)), (short) (m_width/2),
(short) (m_height/2));
m_childNodes[3] =
new BasicQuadTreeNode(this, (short) (m_leftX + (m_width/2)), (short) (m_height + (m_height/2)),
(short) (m_width/2), (short) (m_height/2));
} }
else else
{ {
@ -88,9 +93,9 @@ namespace OpenSim.Region.Environment.Types
} }
else else
{ {
if (x < (m_leftX + (m_width / 2))) if (x < (m_leftX + (m_width/2)))
{ {
if (y < (m_leftY + (m_height / 2))) if (y < (m_leftY + (m_height/2)))
{ {
return m_childNodes[0].GetObjectsFrom(x, y); return m_childNodes[0].GetObjectsFrom(x, y);
} }
@ -101,7 +106,7 @@ namespace OpenSim.Region.Environment.Types
} }
else else
{ {
if (y < (m_leftY + (m_height / 2))) if (y < (m_leftY + (m_height/2)))
{ {
return m_childNodes[1].GetObjectsFrom(x, y); return m_childNodes[1].GetObjectsFrom(x, y);
} }
@ -127,7 +132,8 @@ namespace OpenSim.Region.Environment.Types
List<SceneObjectGroup> outBounds = new List<SceneObjectGroup>(); List<SceneObjectGroup> outBounds = new List<SceneObjectGroup>();
foreach (SceneObjectGroup group in m_objects) foreach (SceneObjectGroup group in m_objects)
{ {
if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) && ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height)))) if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) &&
((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height))))
{ {
//still in bounds //still in bounds
} }
@ -151,9 +157,10 @@ namespace OpenSim.Region.Environment.Types
public void PassUp(SceneObjectGroup group) public void PassUp(SceneObjectGroup group)
{ {
if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) && ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height)))) if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) &&
((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height))))
{ {
this.AddObject(group); AddObject(group);
} }
else else
{ {

View File

@ -1,8 +1,6 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
using OpenSim.Region.Environment.Scenes;
using libsecondlife; using libsecondlife;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Types namespace OpenSim.Region.Environment.Types
{ {
@ -49,6 +47,5 @@ namespace OpenSim.Region.Environment.Types
return part; return part;
} }
} }
} }

View File

@ -27,20 +27,19 @@
*/ */
using System.Collections.Generic; using System.Collections.Generic;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Region.Environment;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.ExtensionsScriptModule.CSharp; using OpenSim.Region.ExtensionsScriptModule.CSharp;
using OpenSim.Region.ExtensionsScriptModule.JScript; using OpenSim.Region.ExtensionsScriptModule.JScript;
using OpenSim.Region.ExtensionsScriptModule.JVMEngine; using OpenSim.Region.ExtensionsScriptModule.JVMEngine;
namespace OpenSim.Region.ExtensionsScriptModule namespace OpenSim.Region.ExtensionsScriptModule
{ {
public class ScriptManager : IRegionModule public class ScriptManager : IRegionModule, IExtensionScriptModule
{ {
List<IScript> scripts = new List<IScript>(); readonly List<IScript> scripts = new List<IScript>();
Scene m_scene; Scene m_scene;
Dictionary<string, IScriptCompiler> compilers = new Dictionary<string, IScriptCompiler>(); readonly Dictionary<string, IScriptCompiler> compilers = new Dictionary<string, IScriptCompiler>();
private void LoadFromCompiler(Dictionary<string, IScript> compiledscripts) private void LoadFromCompiler(Dictionary<string, IScript> compiledscripts)
{ {
@ -67,13 +66,15 @@ namespace OpenSim.Region.ExtensionsScriptModule
compilers.Add(javaCompiler.FileExt(), javaCompiler); compilers.Add(javaCompiler.FileExt(), javaCompiler);
} }
public delegate TResult ModuleAPIMethod1<TResult, TParam0>(TParam0 param0);
public delegate TResult ModuleAPIMethod2<TResult, TParam0, TParam1>(TParam0 param0, TParam1 param1);
public void Initialise(Scene scene) public void Initialise(Scene scene)
{ {
System.Console.WriteLine("Initialising Extensions Scripting Module"); System.Console.WriteLine("Initialising Extensions Scripting Module");
m_scene = scene; m_scene = scene;
m_scene.RegisterAPIMethod("API_CompileExtensionScript", new ModuleAPIMethod1<bool, string>(Compile)); m_scene.RegisterModuleInterface<IExtensionScriptModule>(this);
m_scene.RegisterAPIMethod("API_AddExtensionScript", new ModuleAPIMethod1<bool, IScript>(AddPreCompiledScript));
} }
public void PostInitialise() public void PostInitialise()
@ -135,6 +136,12 @@ namespace OpenSim.Region.ExtensionsScriptModule
} }
} }
public interface IExtensionScriptModule
{
bool Compile(string filename);
bool AddPreCompiledScript(IScript script);
}
interface IScriptCompiler interface IScriptCompiler
{ {
Dictionary<string, IScript> compile(string filename); Dictionary<string, IScript> compile(string filename);