* 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
{
/// <summary>
/// Processes requests regarding estates. Refer to EstateSettings.cs in OpenSim.Framework. Types for all of the core settings
/// </summary>
@ -48,9 +47,9 @@ namespace OpenSim.Region.Environment
private Scene m_scene;
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;
}
@ -125,7 +124,8 @@ namespace OpenSim.Region.Environment
/// <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="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
m_regInfo.estateSettings.waterHeight = WaterHeight;
@ -144,13 +144,12 @@ namespace OpenSim.Region.Environment
#region Packet Handlers
public void handleEstateOwnerMessage(EstateOwnerMessagePacket packet, IClientAPI remote_client)
{
switch (Helpers.FieldToUTF8String(packet.MethodData.Method))
{
case "getinfo":
this.sendRegionInfoPacketToAll();
sendRegionInfoPacketToAll();
break;
case "setregioninfo":
if (m_scene.PermissionsMngr.CanEditEstateTerrain(remote_client.AgentId))
@ -193,47 +192,54 @@ namespace OpenSim.Region.Environment
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))
{
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))
{
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)
{
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)));
m_regInfo.estateSettings.maxAgents = (byte)tempMaxAgents;
int 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;
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))
{
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))
{
m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | Simulator.RegionFlags.AllowParcelChanges;
m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags |
Simulator.RegionFlags.AllowParcelChanges;
}
sendRegionInfoPacketToAll();
}
}
@ -245,11 +251,13 @@ namespace OpenSim.Region.Environment
}
else
{
float WaterHeight = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[0].Parameter));
float TerrainRaiseLimit = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[1].Parameter));
float TerrainLowerLimit = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[2].Parameter));
bool UseFixedSun = this.convertParamStringToBool(packet.ParamList[4].Parameter);
float SunHour = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter));
float WaterHeight = (float) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[0].Parameter));
float TerrainRaiseLimit =
(float) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[1].Parameter));
float TerrainLowerLimit =
(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);
@ -265,10 +273,9 @@ namespace OpenSim.Region.Environment
string[] splitField = s.Split(' ');
if (splitField.Length == 3)
{
Int16 corner = Convert.ToInt16(splitField[0]);
float lowValue = (float)Convert.ToDecimal(splitField[1]);
float highValue = (float)Convert.ToDecimal(splitField[2]);
float lowValue = (float) Convert.ToDecimal(splitField[1]);
float highValue = (float) Convert.ToDecimal(splitField[2]);
setEstateTextureRange(corner, lowValue, highValue);
}
@ -279,7 +286,6 @@ namespace OpenSim.Region.Environment
{
foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList)
{
string s = Helpers.FieldToUTF8String(block.Parameter);
string[] splitField = s.Split(' ');
if (splitField.Length == 2)
@ -326,12 +332,12 @@ namespace OpenSim.Region.Environment
public void sendRegionInfoPacketToAll()
{
List<Avatar> avatars = m_scene.RequestAvatarList();
List<Avatar> avatars = m_scene.RequestAvatarList();
for (int i = 0; i < avatars.Count; i++)
{
this.sendRegionInfoPacket(avatars[i].ControllingClient);
}
for (int i = 0; i < avatars.Count; i++)
{
sendRegionInfoPacket(avatars[i].ControllingClient);
}
}
public void sendRegionHandshakeToAll()
@ -340,8 +346,8 @@ namespace OpenSim.Region.Environment
for (int i = 0; i < avatars.Count; i++)
{
this.sendRegionHandshake(avatars[i].ControllingClient);
}
sendRegionHandshake(avatars[i].ControllingClient);
}
}
public void sendRegionInfoPacket(IClientAPI remote_client)
@ -361,9 +367,9 @@ namespace OpenSim.Region.Environment
regionInfoPacket.RegionInfo.PricePerMeter = m_regInfo.estateSettings.pricePerMeter;
regionInfoPacket.RegionInfo.RedirectGridX = m_regInfo.estateSettings.redirectGridX;
regionInfoPacket.RegionInfo.RedirectGridY = m_regInfo.estateSettings.redirectGridY;
regionInfoPacket.RegionInfo.RegionFlags = (uint)m_regInfo.estateSettings.regionFlags;
regionInfoPacket.RegionInfo.SimAccess = (byte)m_regInfo.estateSettings.simAccess;
regionInfoPacket.RegionInfo.SimName = _enc.GetBytes( m_regInfo.RegionName);
regionInfoPacket.RegionInfo.RegionFlags = (uint) m_regInfo.estateSettings.regionFlags;
regionInfoPacket.RegionInfo.SimAccess = (byte) m_regInfo.estateSettings.simAccess;
regionInfoPacket.RegionInfo.SimName = _enc.GetBytes(m_regInfo.RegionName);
regionInfoPacket.RegionInfo.SunHour = m_regInfo.estateSettings.sunHour;
regionInfoPacket.RegionInfo.TerrainLowerLimit = m_regInfo.estateSettings.terrainLowerLimit;
regionInfoPacket.RegionInfo.TerrainRaiseLimit = m_regInfo.estateSettings.terrainRaiseLimit;
@ -379,6 +385,5 @@ namespace OpenSim.Region.Environment
}
#endregion
}
}
}

View File

@ -1,17 +1,18 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using libsecondlife;
using System.IO;
using libsecondlife;
namespace OpenSim.Region.Environment.Interfaces
{
public interface IDynamicTextureManager
{
void RegisterRender(string handleType, IDynamicTextureRender render);
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);
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);
}
public interface IDynamicTextureRender
@ -24,4 +25,4 @@ namespace OpenSim.Region.Environment.Interfaces
bool AsyncConvertUrl(LLUUID id, string url, string extraParams);
bool AsyncConvertData(LLUUID id, string bodyData, string extraParams);
}
}
}

View File

@ -1,12 +1,9 @@
using System;
using System.Collections.Generic;
using System.Text;
using libsecondlife;
using libsecondlife;
namespace OpenSim.Region.Environment.Interfaces
{
public interface IHttpRequests
{
LLUUID MakeHttpRequest(string url, string type, string body);
}
}
}

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 libsecondlife;
using OpenSim.Region.Environment.LandManagement;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Interfaces
{

View File

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

View File

@ -1,12 +1,9 @@
using System;
using System.Collections.Generic;
using System.Text;
using libsecondlife;
using libsecondlife;
namespace OpenSim.Region.Environment.Interfaces
{
public interface ISimChat
{
void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName, LLUUID fromAgentID);
}
}
}

View File

@ -1,16 +1,16 @@
using System;
using System.Collections.Generic;
using System.Text;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Interfaces;
namespace OpenSim.Region.Environment.Interfaces
{
public interface ITerrain
{
bool Tainted();
bool Tainted(int x, int y);
void ResetTaint();
void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west, IClientAPI remoteUser);
void ResetTaint();
void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west,
IClientAPI remoteUser);
void CheckHeightValues();
float[] GetHeights1D();
float[,] GetHeights2D();
@ -43,4 +43,4 @@ namespace OpenSim.Region.Environment.Interfaces
void ExportImage(string filename, string gradientmap);
byte[] ExportJpegImage(string gradientmap);
}
}
}

View File

@ -1,11 +1,7 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenSim.Region.Environment.Interfaces
{
public interface IXfer
{
bool AddNewFile(string fileName, byte[] data);
}
}
}

View File

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

View File

@ -36,34 +36,34 @@ using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.LandManagement
{
#region LandManager Class
/// <summary>
/// Handles Land objects and operations requiring information from other Land objects (divide, join, etc)
/// </summary>
public class LandManager
{
#region Constants
//Land types set with flags in ParcelOverlay.
//Only one of these can be used.
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_GROUP = (byte)2; //Equals 00000010
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_BEING_AUCTIONED = (byte)5; //Equals 00000101
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_GROUP = (byte) 2; //Equals 00000010
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_BEING_AUCTIONED = (byte) 5; //Equals 00000101
//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)
//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_SOUTH = (byte)128; //Equals 10000000
public const byte LAND_FLAG_PROPERTY_BORDER_WEST = (byte) 64; //Equals 01000000
public const byte LAND_FLAG_PROPERTY_BORDER_SOUTH = (byte) 128; //Equals 10000000
//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_MULTIPLE = 1; // The request they made contained more than a single peice of land
public const int LAND_RESULT_SINGLE = 0; // The request they made contained only a single piece of land
public const int LAND_RESULT_MULTIPLE = 1; // The request they made contained more than a single peice of land
//ParcelSelectObjects
public const int LAND_SELECT_OBJECTS_OWNER = 2;
@ -73,12 +73,14 @@ namespace OpenSim.Region.Environment.LandManagement
//These are other constants. Yay!
public const int START_LAND_LOCAL_ID = 1;
#endregion
#region Member Variables
public Dictionary<int, Land> landList = new Dictionary<int, Land>();
private int lastLandLocalID = START_LAND_LOCAL_ID - 1;
private int[,] landIDList = new int[64, 64];
private int[,] landIDList = new int[64,64];
/// <summary>
/// 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
#region Constructors
public LandManager(Scene scene, RegionInfo reginfo)
{
m_scene = scene;
m_regInfo = reginfo;
landIDList.Initialize();
}
#endregion
#region Member Functions
#region Parcel From Storage Functions
public void LandFromStorage(LandData data)
{
Land new_land = new Land(data.ownerID, data.isGroupOwned, m_scene);
new_land.landData = data.Copy();
new_land.setLandBitmapFromByteArray();
addLandObject(new_land);
}
public void NoLandDataFromStorage()
{
resetSimLandObjects();
}
#endregion
#region Parcel Add/Remove/Get/Create
/// <summary>
/// Creates a basic Parcel object without an owner (a zeroed key)
/// </summary>
@ -155,8 +159,8 @@ namespace OpenSim.Region.Environment.LandManagement
landList[lastLandLocalID].forceUpdateLandInfo();
return new_land;
}
/// <summary>
/// Removes a land object from the list. Will not remove if local_id is still owning an area in landIDList
/// </summary>
@ -194,6 +198,7 @@ namespace OpenSim.Region.Environment.LandManagement
}
removeLandObject(slave.landData.localID);
}
/// <summary>
/// Get the land object at the specified point
/// </summary>
@ -202,16 +207,16 @@ namespace OpenSim.Region.Environment.LandManagement
/// <returns>Land object at the point supplied</returns>
public Land getLandObject(float x_float, float y_float)
{
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 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)));
if (x > 63 || y > 63 || x < 0 || y < 0)
{
throw new Exception("Error: Parcel not found at point " + x + ", " + y);
}
else
{
// Console.WriteLine("Point (" + x + ", " + y + ") determined from point (" + x_float + ", " + y_float + ")");
// Console.WriteLine("Point (" + x + ", " + y + ") determined from point (" + x_float + ", " + y_float + ")");
return landList[landIDList[x, y]];
}
}
@ -224,12 +229,14 @@ namespace OpenSim.Region.Environment.LandManagement
}
else
{
return landList[landIDList[x / 4, y / 4]];
return landList[landIDList[x/4, y/4]];
}
}
#endregion
#region Parcel Modification
/// <summary>
/// Subdivides a piece of land
/// </summary>
@ -241,7 +248,6 @@ namespace OpenSim.Region.Environment.LandManagement
/// <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)
{
//First, lets loop through the points and make sure they are all in the same peice of land
//Get the land object at start
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
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();
this.setPrimsTainted();
setPrimsTainted();
//Now add the new land object
Land result = addLandObject(newLand);
result.sendLandUpdateToAvatarsOverMe();
return true;
}
/// <summary>
/// Join 2 land objects together
/// </summary>
@ -320,7 +326,7 @@ namespace OpenSim.Region.Environment.LandManagement
{
for (stepXSelected = start_x; stepXSelected <= end_x; stepXSelected += 4)
{
Land p = getLandObject(stepXSelected,stepYSelected);
Land p = getLandObject(stepXSelected, stepYSelected);
if (!selectedLandObjects.Contains(p))
{
selectedLandObjects.Add(p);
@ -330,7 +336,7 @@ namespace OpenSim.Region.Environment.LandManagement
Land masterLandObject = selectedLandObjects[0];
selectedLandObjects.RemoveAt(0);
if (selectedLandObjects.Count < 1)
{
return false; //Only one piece of land selected
@ -348,23 +354,23 @@ namespace OpenSim.Region.Environment.LandManagement
}
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);
}
this.setPrimsTainted();
setPrimsTainted();
masterLandObject.sendLandUpdateToAvatarsOverMe();
return true;
}
#endregion
#region Parcel Updating
/// <summary>
/// Where we send the ParcelOverlay packet to the client
/// </summary>
@ -382,15 +388,17 @@ namespace OpenSim.Region.Environment.LandManagement
{
for (x = 0; x < 64; x++)
{
byte tempByte = (byte)0; //This represents the byte for the current 4x4
Land currentParcelBlock = getLandObject(x * 4, y * 4);
byte tempByte = (byte) 0; //This represents the byte for the current 4x4
Land currentParcelBlock = getLandObject(x*4, y*4);
if (currentParcelBlock.landData.ownerID == remote_client.AgentId)
{
//Owner Flag
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
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);
}
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);
}
@ -421,7 +429,7 @@ namespace OpenSim.Region.Environment.LandManagement
{
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);
}
@ -434,17 +442,16 @@ namespace OpenSim.Region.Environment.LandManagement
packet = new ParcelOverlayPacket();
packet.ParcelData.Data = byteArray;
packet.ParcelData.SequenceID = sequenceID;
remote_client.OutPacket((Packet)packet);
remote_client.OutPacket((Packet) packet);
sequenceID++;
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
List<Land> temp = new List<Land>();
@ -486,14 +493,15 @@ namespace OpenSim.Region.Environment.LandManagement
landList[packet.ParcelData.LocalID].updateLandProperties(packet, remote_client);
}
}
public void handleParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client)
{
subdivide(west, south, east, north, remote_client.AgentId);
}
public void handleParcelJoinRequest(int west, int south, int east, int north, IClientAPI remote_client)
{
join(west, south, east, north, remote_client.AgentId);
}
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);
}
#endregion
/// <summary>
@ -523,7 +532,6 @@ namespace OpenSim.Region.Environment.LandManagement
fullSimParcel.landData.ownerID = m_regInfo.MasterAvatarAssignedUUID;
addLandObject(fullSimParcel);
}
@ -532,7 +540,7 @@ namespace OpenSim.Region.Environment.LandManagement
ScenePresence clientAvatar = m_scene.RequestAvatar(remote_client.AgentId);
if (clientAvatar != null)
{
Land over = getLandObject(clientAvatar.AbsolutePosition.X,clientAvatar.AbsolutePosition.Y);
Land over = getLandObject(clientAvatar.AbsolutePosition.X, clientAvatar.AbsolutePosition.Y);
if (over != null)
{
over.sendLandProperties(0, false, 0, remote_client);
@ -547,9 +555,10 @@ namespace OpenSim.Region.Environment.LandManagement
p.resetLandPrimCounts();
}
}
public void setPrimsTainted()
{
this.landPrimCountTainted = true;
landPrimCountTainted = true;
}
public void addPrimToLandPrimCounts(SceneObjectGroup obj)
@ -573,14 +582,14 @@ namespace OpenSim.Region.Environment.LandManagement
public void finalizeLandPrimCountUpdate()
{
//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)
{
if(!landOwnersAndParcels.ContainsKey(p.landData.ownerID))
if (!landOwnersAndParcels.ContainsKey(p.landData.ownerID))
{
List<Land> tempList = new List<Land>();
tempList.Add(p);
landOwnersAndParcels.Add(p.landData.ownerID,tempList);
landOwnersAndParcels.Add(p.landData.ownerID, tempList);
}
else
{
@ -595,7 +604,8 @@ namespace OpenSim.Region.Environment.LandManagement
foreach (Land p in landOwnersAndParcels[owner])
{
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])
@ -604,14 +614,10 @@ namespace OpenSim.Region.Environment.LandManagement
p.landData.simwidePrims = simPrims;
}
}
}
#endregion
}
#endregion
}
}

View File

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

View File

@ -1,12 +1,7 @@
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.Framework.Interfaces;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules
{
public class AssetDownloadModule : IRegionModule
@ -14,8 +9,7 @@ namespace OpenSim.Region.Environment.Modules
private Scene m_scene;
public AssetDownloadModule()
{
{
}
public void Initialise(Scene scene)
@ -25,8 +19,7 @@ namespace OpenSim.Region.Environment.Modules
}
public void PostInitialise()
{
{
}
public void CloseDown()
@ -47,4 +40,4 @@ namespace OpenSim.Region.Environment.Modules
{
}
}
}
}

View File

@ -1,21 +1,16 @@
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 libsecondlife;
using OpenSim.Framework.Interfaces;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules
{
public class AvatarProfilesModule :IRegionModule
{
public class AvatarProfilesModule : IRegionModule
{
private Scene m_scene;
public AvatarProfilesModule()
{
{
}
public void Initialise(Scene scene)
@ -25,13 +20,11 @@ namespace OpenSim.Region.Environment.Modules
}
public void PostInitialise()
{
{
}
public void CloseDown()
{
{
}
public string GetName()
@ -65,7 +58,8 @@ namespace OpenSim.Region.Environment.Modules
string bornOn = "Before now";
string flAbout = "First life? What is one of those? OpenSim is my life!";
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,17 +1,13 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using System.IO;
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 System;
using System.IO;
using System.Net.Sockets;
using System.Threading;
using libsecondlife;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Utilities;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules
{
public class ChatModule : IRegionModule, ISimChat
@ -20,18 +16,18 @@ namespace OpenSim.Region.Environment.Modules
private string m_server = "irc2.choopa.net";
// private int m_port = 6668;
// private int m_port = 6668;
//private string m_user = "USER OpenSimBot 8 * :I'm a OpenSim to irc bot";
private string m_nick = "OSimBot";
private string m_channel = "#opensim";
// private NetworkStream m_stream;
private TcpClient m_irc;
// private NetworkStream m_stream;
private TcpClient m_irc;
private StreamWriter m_ircWriter;
private StreamReader m_ircReader;
private StreamReader m_ircReader;
// private Thread pingSender;
// private Thread listener;
// private Thread pingSender;
// private Thread listener;
private bool connected = false;
@ -127,16 +123,18 @@ namespace OpenSim.Region.Environment.Modules
{
string mess = inputLine.Substring(inputLine.IndexOf(m_channel));
m_scene.ForEachScenePresence(delegate(ScenePresence presence)
{
presence.ControllingClient.SendChatMessage(Helpers.StringToField(mess), 255, pos, "IRC:",
LLUUID.Zero);
});
{
presence.ControllingClient.SendChatMessage(
Helpers.StringToField(mess), 255, pos, "IRC:",
LLUUID.Zero);
});
}
}
}
}
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;
avatar = m_scene.RequestAvatar(fromAgentID);
@ -213,4 +211,4 @@ namespace OpenSim.Region.Environment.Modules
}
}
}
}
}

View File

@ -1,23 +1,20 @@
using System.Text;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using System.IO;
using System.Collections.Generic;
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 System;
using System.Collections.Generic;
using libsecondlife;
using OpenSim.Framework.Types;
using OpenSim.Framework.Utilities;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
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<string, IDynamicTextureRender> RenderPlugins= new Dictionary<string, IDynamicTextureRender>();
private Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>();
private Dictionary<string, IDynamicTextureRender> RenderPlugins =
new Dictionary<string, IDynamicTextureRender>();
private Dictionary<LLUUID, DynamicTextureUpdater> Updaters = new Dictionary<LLUUID, DynamicTextureUpdater>();
public void Initialise(Scene scene)
@ -30,8 +27,7 @@ namespace OpenSim.Region.Environment.Modules
}
public void PostInitialise()
{
{
}
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);
if (this.RenderPlugins.ContainsKey(contentType))
Console.WriteLine("dynamic texture being created: " + url + " of type " + contentType);
if (RenderPlugins.ContainsKey(contentType))
{
DynamicTextureUpdater updater = new DynamicTextureUpdater();
updater.SimUUID = simID;
@ -83,7 +80,7 @@ namespace OpenSim.Region.Environment.Modules
updater.UpdaterID = LLUUID.Random();
updater.Params = extraParams;
if (!this.Updaters.ContainsKey(updater.UpdaterID))
if (!Updaters.ContainsKey(updater.UpdaterID))
{
Updaters.Add(updater.UpdaterID, updater);
}
@ -94,9 +91,10 @@ namespace OpenSim.Region.Environment.Modules
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();
updater.SimUUID = simID;
@ -107,7 +105,7 @@ namespace OpenSim.Region.Environment.Modules
updater.UpdaterID = LLUUID.Random();
updater.Params = extraParams;
if (!this.Updaters.ContainsKey(updater.UpdaterID))
if (!Updaters.ContainsKey(updater.UpdaterID))
{
Updaters.Add(updater.UpdaterID, updater);
}
@ -140,7 +138,7 @@ namespace OpenSim.Region.Environment.Modules
public void DataReceived(byte[] data, Scene scene)
{
//TODO delete the last asset(data), if it was a dynamic texture
AssetBase asset = new AssetBase();
asset.FullID = LLUUID.Random();
asset.Data = data;
@ -148,7 +146,7 @@ namespace OpenSim.Region.Environment.Modules
asset.Type = 0;
scene.commsManager.AssetCache.AddAsset(asset);
this.LastAssetID = asset.FullID;
LastAssetID = asset.FullID;
SceneObjectPart part = scene.GetSceneObjectPart(PrimID);
part.Shape.TextureEntry = new LLObject.TextureEntry(asset.FullID).ToBytes();
@ -156,4 +154,4 @@ namespace OpenSim.Region.Environment.Modules
}
}
}
}
}

View File

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

View File

@ -1,12 +1,6 @@
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
{
public class FriendsModule : IRegionModule
@ -19,8 +13,7 @@ namespace OpenSim.Region.Environment.Modules
}
public void PostInitialise()
{
{
}
public void CloseDown()
@ -37,4 +30,4 @@ namespace OpenSim.Region.Environment.Modules
return false;
}
}
}
}

View File

@ -1,11 +1,6 @@
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
{
public class GroupsModule : IRegionModule
@ -18,8 +13,7 @@ namespace OpenSim.Region.Environment.Modules
}
public void PostInitialise()
{
{
}
public void CloseDown()
@ -36,5 +30,4 @@ namespace OpenSim.Region.Environment.Modules
return false;
}
}
}
}

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
{
public class InstantMessageModule :IRegionModule
public class InstantMessageModule : IRegionModule
{
private Scene m_scene;
@ -19,8 +13,7 @@ namespace OpenSim.Region.Environment.Modules
}
public void PostInitialise()
{
{
}
public void CloseDown()
@ -37,4 +30,4 @@ namespace OpenSim.Region.Environment.Modules
return false;
}
}
}
}

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
{
public class InventoryModule :IRegionModule
public class InventoryModule : IRegionModule
{
private Scene m_scene;
@ -19,8 +13,7 @@ namespace OpenSim.Region.Environment.Modules
}
public void PostInitialise()
{
{
}
public void CloseDown()
@ -37,4 +30,4 @@ namespace OpenSim.Region.Environment.Modules
return false;
}
}
}
}

View File

@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text;
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
{
class TeleportModule
internal class TeleportModule
{
}
}
}

View File

@ -1,20 +1,16 @@
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 libsecondlife;
using OpenSim.Framework.Interfaces;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules
{
public class TextureDownloadModule :IRegionModule
public class TextureDownloadModule : IRegionModule
{
private Scene m_scene;
public TextureDownloadModule()
{
{
}
public void Initialise(Scene scene)
@ -24,8 +20,7 @@ namespace OpenSim.Region.Environment.Modules
}
public void PostInitialise()
{
{
}
public void CloseDown()
@ -47,8 +42,7 @@ namespace OpenSim.Region.Environment.Modules
}
public void TextureAssetCallback(LLUUID texture, byte[] data)
{
{
}
}
}
}

View File

@ -1,13 +1,10 @@
using System;
using System.Collections.Generic;
using System.Text;
using libsecondlife;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Utilities;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Interfaces;
using System;
using System.Collections.Generic;
using libsecondlife;
using OpenSim.Framework.Interfaces;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules
{
public class XferModule : IRegionModule, IXfer
@ -18,8 +15,7 @@ namespace OpenSim.Region.Environment.Modules
private Scene m_scene;
public XferModule()
{
{
}
public void Initialise(Scene scene)
@ -31,13 +27,11 @@ namespace OpenSim.Region.Environment.Modules
}
public void PostInitialise()
{
{
}
public void CloseDown()
{
{
}
public string GetName()
@ -67,7 +61,7 @@ namespace OpenSim.Region.Environment.Modules
lock (NewFiles)
{
if (NewFiles.ContainsKey(fileName))
{
{
if (!Transfers.ContainsKey(xferID))
{
byte[] fileData = NewFiles[fileName];
@ -82,7 +76,7 @@ namespace OpenSim.Region.Environment.Modules
public void AckPacket(IClientAPI remoteClient, ulong xferID, uint packet)
{
if (this.Transfers.ContainsKey(xferID))
if (Transfers.ContainsKey(xferID))
{
Transfers[xferID].AckPacket(packet);
}
@ -125,8 +119,7 @@ namespace OpenSim.Region.Environment.Modules
}
public XferDownLoad()
{
{
}
public void StartSend()
@ -142,10 +135,10 @@ namespace OpenSim.Region.Environment.Modules
}
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(Data, 0, transferData, 4, 1000);
Client.SendXferPacket(XferID, 0 , transferData);
Client.SendXferPacket(XferID, 0, transferData);
Packet++;
DataPointer = 1000;
}
@ -167,7 +160,7 @@ namespace OpenSim.Region.Environment.Modules
{
byte[] transferData = new byte[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);
Packet++;
DataPointer += (Data.Length - DataPointer);
@ -177,4 +170,4 @@ namespace OpenSim.Region.Environment.Modules
}
}
}
}
}

View File

@ -1,14 +1,7 @@
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
{
public class PermissionManager
@ -19,7 +12,8 @@ namespace OpenSim.Region.Environment
// disable in any production environment
// TODO: Change this to false when permissions are a desired default
// TODO: Move to configuration option.
private bool m_bypassPermissions = true;
private bool m_bypassPermissions = true;
public bool BypassPermissions
{
get { return m_bypassPermissions; }
@ -104,26 +98,27 @@ namespace OpenSim.Region.Environment
// Default: deny
bool permission = false;
if( !m_scene.Entities.ContainsKey( objId ))
if (!m_scene.Entities.ContainsKey(objId))
{
return false;
}
// If it's not an object, we cant edit it.
if (!(m_scene.Entities[objId] is SceneObjectGroup))
{
return false;
}
SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[objId];
LLUUID taskOwner = null;
SceneObjectGroup task = (SceneObjectGroup) m_scene.Entities[objId];
LLUUID taskOwner = null;
// Object owners should be able to edit their own content
if (user == taskOwner)
permission = true;
// 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;
// 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.
}
if(IsEstateManager(user))
if (IsEstateManager(user))
permission = true;
if (IsAdministrator(user))
@ -299,7 +294,6 @@ namespace OpenSim.Region.Environment
return GenericParcelPermission(user, parcel);
}
#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
{
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,30 +1,25 @@
using System.Collections.Generic;
using Axiom.Math;
using libsecondlife;
using OpenSim.Region.Environment.Scenes.Scripting;
namespace OpenSim.Region.Environment.Scenes
{
public abstract class EntityBase
public abstract class EntityBase
{
protected List<EntityBase> m_children;
protected Scene m_scene;
public LLUUID m_uuid;
public virtual LLUUID UUID
{
get
{
return m_uuid;
}
set
{
m_uuid = value;
}
get { return m_uuid; }
set { m_uuid = value; }
}
protected string m_name;
/// <summary>
///
/// </summary>
@ -35,6 +30,7 @@ namespace OpenSim.Region.Environment.Scenes
}
protected LLVector3 m_pos;
/// <summary>
///
/// </summary>
@ -45,6 +41,7 @@ namespace OpenSim.Region.Environment.Scenes
}
public LLVector3 m_velocity;
/// <summary>
///
/// </summary>
@ -55,6 +52,7 @@ namespace OpenSim.Region.Environment.Scenes
}
protected Quaternion m_rotation = new Quaternion(0, 0, 1, 0);
public virtual Quaternion Rotation
{
get { return m_rotation; }
@ -62,6 +60,7 @@ namespace OpenSim.Region.Environment.Scenes
}
protected uint m_localId;
public virtual uint LocalId
{
get { return m_localId; }
@ -125,5 +124,5 @@ namespace OpenSim.Region.Environment.Scenes
}
public abstract void SetText(string text, Vector3 color, double alpha);
}
}
}

View File

@ -11,4 +11,4 @@ namespace OpenSim.Region.Environment.Scenes
void SendOurAppearance(IClientAPI OurClient);
void SendAppearanceToOtherAgent(ScenePresence avatarInfo);
}
}
}

View File

@ -1,15 +1,13 @@
using System;
using System.IO;
using System.Collections.Generic;
using libsecondlife;
using libsecondlife.Packets;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Types;
using OpenSim.Framework.Communications.Caches;
using OpenSim.Framework.Data;
using OpenSim.Framework.Utilities;
using OpenSim.Region.Physics.Manager;
using Axiom.Math;
using libsecondlife;
using libsecondlife.Packets;
using OpenSim.Framework.Communications.Caches;
using OpenSim.Framework.Data;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Types;
using OpenSim.Framework.Utilities;
using OpenSim.Region.Physics.Manager;
namespace OpenSim.Region.Environment.Scenes
{
public partial class Scene
@ -19,9 +17,9 @@ namespace OpenSim.Region.Environment.Scenes
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)
{
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;
}
@ -57,8 +55,8 @@ namespace OpenSim.Region.Environment.Scenes
AssetBase asset;
asset = new AssetBase();
asset.FullID = LLUUID.Random();
asset.Type = (sbyte)item.assetType;
asset.InvType = (sbyte)item.invType;
asset.Type = (sbyte) item.assetType;
asset.InvType = (sbyte) item.invType;
asset.Name = item.inventoryName;
asset.Data = data;
commsManager.AssetCache.AddAsset(asset);
@ -83,7 +81,8 @@ namespace OpenSim.Region.Environment.Scenes
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);
if (userInfo != null)
@ -93,7 +92,8 @@ namespace OpenSim.Region.Environment.Scenes
InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
if (item != null)
{
AgentAssetTransactions transactions = commsManager.TransactionsManager.GetUserTransActions(remoteClient.AgentId);
AgentAssetTransactions transactions =
commsManager.TransactionsManager.GetUserTransActions(remoteClient.AgentId);
if (transactions != null)
{
AssetBase asset = null;
@ -112,8 +112,8 @@ namespace OpenSim.Region.Environment.Scenes
{
asset.Name = item.inventoryName;
asset.Description = item.inventoryDescription;
asset.InvType = (sbyte)item.invType;
asset.Type = (sbyte)item.assetType;
asset.InvType = (sbyte) item.invType;
asset.Type = (sbyte) item.assetType;
item.assetID = asset.FullID;
if (addToCache)
@ -143,7 +143,9 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="type"></param>
/// <param name="wearableType"></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)
{
@ -157,7 +159,7 @@ namespace OpenSim.Region.Environment.Scenes
asset.Type = type;
asset.FullID = LLUUID.Random();
asset.Data = new byte[1];
this.commsManager.AssetCache.AddAsset(asset);
commsManager.AssetCache.AddAsset(asset);
InventoryItemBase item = new InventoryItemBase();
item.avatarID = remoteClient.AgentId;
@ -178,7 +180,9 @@ namespace OpenSim.Region.Environment.Scenes
}
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);
}
}
@ -195,15 +199,15 @@ namespace OpenSim.Region.Environment.Scenes
{
if (ent is SceneObjectGroup)
{
hasPrim = ((SceneObjectGroup)ent).HasChildPrim(primLocalID);
hasPrim = ((SceneObjectGroup) ent).HasChildPrim(primLocalID);
if (hasPrim != false)
{
bool fileChange = ((SceneObjectGroup)ent).GetPartInventoryFileName(remoteClient, primLocalID);
bool fileChange = ((SceneObjectGroup) ent).GetPartInventoryFileName(remoteClient, primLocalID);
if (fileChange)
{
if (this.XferManager != null)
if (XferManager != null)
{
((SceneObjectGroup)ent).RequestInventoryFile(primLocalID, XferManager);
((SceneObjectGroup) ent).RequestInventoryFile(primLocalID, XferManager);
}
}
break;
@ -219,14 +223,14 @@ namespace OpenSim.Region.Environment.Scenes
{
if (ent is SceneObjectGroup)
{
hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID);
hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
if (hasPrim != false)
{
int type = ((SceneObjectGroup)ent).RemoveInventoryItem(remoteClient, localID, itemID);
((SceneObjectGroup)ent).GetProperites(remoteClient);
int type = ((SceneObjectGroup) ent).RemoveInventoryItem(remoteClient, localID, itemID);
((SceneObjectGroup) ent).GetProperites(remoteClient);
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);
//Console.WriteLine("rez script "+script);
this.EventManager.TriggerRezScript(localID, copyID, script);
EventManager.TriggerRezScript(localID, copyID, script);
rezzed = true;
}
else
@ -266,7 +270,7 @@ namespace OpenSim.Region.Environment.Scenes
{
string script = Util.FieldToString(rezAsset.Data);
// Console.WriteLine("rez script " + script);
this.EventManager.TriggerRezScript(localID, copyID, script);
EventManager.TriggerRezScript(localID, copyID, script);
rezzed = true;
}
}
@ -278,12 +282,13 @@ namespace OpenSim.Region.Environment.Scenes
{
if (ent is SceneObjectGroup)
{
hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID);
hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
if (hasPrim != false)
{
bool added = ((SceneObjectGroup)ent).AddInventoryItem(remoteClient, localID, item, copyID);
((SceneObjectGroup)ent).GetProperites(remoteClient);
{
bool added =
((SceneObjectGroup) ent).AddInventoryItem(remoteClient, localID, item,
copyID);
((SceneObjectGroup) ent).GetProperites(remoteClient);
}
}
}
@ -300,7 +305,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="simClient"></param>
public void DeRezObject(Packet packet, IClientAPI remoteClient)
{
DeRezObjectPacket DeRezPacket = (DeRezObjectPacket)packet;
DeRezObjectPacket DeRezPacket = (DeRezObjectPacket) packet;
if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero)
{
@ -312,7 +317,7 @@ namespace OpenSim.Region.Environment.Scenes
{
EntityBase selectedEnt = null;
//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)
{
@ -322,15 +327,16 @@ namespace OpenSim.Region.Environment.Scenes
}
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);
if (userInfo != null)
{
AssetBase asset = new AssetBase();
asset.Name = ((SceneObjectGroup)selectedEnt).GetPartName(selectedEnt.LocalId);
asset.Description = ((SceneObjectGroup)selectedEnt).GetPartDescription(selectedEnt.LocalId);
asset.Name = ((SceneObjectGroup) selectedEnt).GetPartName(selectedEnt.LocalId);
asset.Description =
((SceneObjectGroup) selectedEnt).GetPartDescription(selectedEnt.LocalId);
asset.InvType = 6;
asset.Type = 6;
asset.FullID = LLUUID.Random();
@ -355,21 +361,23 @@ namespace OpenSim.Region.Environment.Scenes
remoteClient.SendInventoryItemUpdate(item);
}
SceneObjectPart rootPart = ((SceneObjectGroup)selectedEnt).GetChildPart(((SceneObjectGroup)selectedEnt).UUID);
SceneObjectPart rootPart =
((SceneObjectGroup) selectedEnt).GetChildPart(((SceneObjectGroup) selectedEnt).UUID);
if (rootPart.PhysActor != null)
{
this.phyScene.RemovePrim(rootPart.PhysActor);
phyScene.RemovePrim(rootPart.PhysActor);
rootPart.PhysActor = null;
}
storageManager.DataStore.RemoveObject(((SceneObjectGroup)selectedEnt).UUID, m_regInfo.SimUUID);
((SceneObjectGroup)selectedEnt).DeleteGroup();
storageManager.DataStore.RemoveObject(((SceneObjectGroup) selectedEnt).UUID,
m_regInfo.SimUUID);
((SceneObjectGroup) selectedEnt).DeleteGroup();
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);
if (rezAsset != null)
{
this.AddRezObject(Util.FieldToString(rezAsset.Data), pos);
AddRezObject(Util.FieldToString(rezAsset.Data), pos);
userInfo.DeleteItem(remoteClient.AgentId, item);
remoteClient.SendRemoveInventoryItem(itemID);
}
@ -399,7 +407,7 @@ namespace OpenSim.Region.Environment.Scenes
rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false);
if (rezAsset != null)
{
this.AddRezObject(Util.FieldToString(rezAsset.Data), pos);
AddRezObject(Util.FieldToString(rezAsset.Data), pos);
userInfo.DeleteItem(remoteClient.AgentId, item);
remoteClient.SendRemoveInventoryItem(itemID);
}
@ -411,17 +419,17 @@ namespace OpenSim.Region.Environment.Scenes
private void AddRezObject(string xmlData, LLVector3 pos)
{
SceneObjectGroup group = new SceneObjectGroup(this, this.m_regionHandle, xmlData);
this.AddEntity(group);
SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, xmlData);
AddEntity(group);
group.AbsolutePosition = pos;
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(
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 Axiom.Math.Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
rootPart.RotationOffset.Y, rootPart.RotationOffset.Z));
new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
rootPart.RotationOffset.Y, rootPart.RotationOffset.Z));
}
}
}
}
}

View File

@ -25,17 +25,11 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
using System;
using System.IO;
using System.Collections.Generic;
using libsecondlife;
using libsecondlife.Packets;
using OpenSim.Framework.Console;
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
{
@ -50,7 +44,8 @@ namespace OpenSim.Region.Environment.Scenes
/// <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="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.
// random users are now no longer allowed to terraform
@ -71,17 +66,19 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="timestamp"></param>
/// <param name="fromAgentName"></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
ScenePresence fromAvatar = this.Avatars[fromAgentID];
ScenePresence toAvatar = this.Avatars[toAgentID];
ScenePresence fromAvatar = Avatars[fromAgentID];
ScenePresence toAvatar = Avatars[toAgentID];
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
{
@ -102,7 +99,8 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="fromPos"></param>
/// <param name="fromName"></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)
{
@ -123,9 +121,9 @@ namespace OpenSim.Region.Environment.Scenes
{
if (ent is SceneObjectGroup)
{
if (((SceneObjectGroup)ent).LocalId == originalPrim)
if (((SceneObjectGroup) ent).LocalId == originalPrim)
{
originPrim = (SceneObjectGroup)ent;
originPrim = (SceneObjectGroup) ent;
break;
}
}
@ -135,7 +133,7 @@ namespace OpenSim.Region.Environment.Scenes
{
SceneObjectGroup copy = originPrim.Copy();
copy.AbsolutePosition = copy.AbsolutePosition + offset;
this.Entities.Add(copy.UUID, copy);
Entities.Add(copy.UUID, copy);
copy.ScheduleGroupForFullUpdate();
/* List<ScenePresence> avatars = this.RequestAvatarList();
@ -143,13 +141,11 @@ namespace OpenSim.Region.Environment.Scenes
{
// copy.SendAllChildPrimsToClient(avatars[i].ControllingClient);
}*/
}
else
{
OpenSim.Framework.Console.MainLog.Instance.Warn("client", "Attempted to duplicate nonexistant prim");
MainLog.Instance.Warn("client", "Attempted to duplicate nonexistant prim");
}
}
/// <summary>
@ -164,9 +160,9 @@ namespace OpenSim.Region.Environment.Scenes
{
if (ent is SceneObjectGroup)
{
if (((SceneObjectGroup)ent).LocalId == parentPrim)
if (((SceneObjectGroup) ent).LocalId == parentPrim)
{
parenPrim = (SceneObjectGroup)ent;
parenPrim = (SceneObjectGroup) ent;
break;
}
}
@ -181,9 +177,9 @@ namespace OpenSim.Region.Environment.Scenes
{
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)
{
hasPrim = ((SceneObjectGroup)ent).HasChildPrim(primLocalID);
hasPrim = ((SceneObjectGroup) ent).HasChildPrim(primLocalID);
if (hasPrim != false)
{
((SceneObjectGroup)ent).UpdateShape(shapeBlock, primLocalID);
((SceneObjectGroup) ent).UpdateShape(shapeBlock, primLocalID);
break;
}
}
@ -225,10 +221,10 @@ namespace OpenSim.Region.Environment.Scenes
{
if (ent is SceneObjectGroup)
{
hasPrim = ((SceneObjectGroup)ent).HasChildPrim(primLocalID);
hasPrim = ((SceneObjectGroup) ent).HasChildPrim(primLocalID);
if (hasPrim != false)
{
((SceneObjectGroup)ent).UpdateExtraParam(primLocalID, type, inUse, data);
((SceneObjectGroup) ent).UpdateExtraParam(primLocalID, type, inUse, data);
break;
}
}
@ -246,11 +242,11 @@ namespace OpenSim.Region.Environment.Scenes
{
if (ent is SceneObjectGroup)
{
if (((SceneObjectGroup)ent).LocalId == primLocalID)
if (((SceneObjectGroup) ent).LocalId == primLocalID)
{
((SceneObjectGroup)ent).GetProperites(remoteClient);
((SceneObjectGroup)ent).IsSelected = true;
this.LandManager.setPrimsTainted();
((SceneObjectGroup) ent).GetProperites(remoteClient);
((SceneObjectGroup) ent).IsSelected = true;
LandManager.setPrimsTainted();
break;
}
}
@ -268,10 +264,10 @@ namespace OpenSim.Region.Environment.Scenes
{
if (ent is SceneObjectGroup)
{
if (((SceneObjectGroup)ent).LocalId == primLocalID)
if (((SceneObjectGroup) ent).LocalId == primLocalID)
{
((SceneObjectGroup)ent).IsSelected = false;
this.LandManager.setPrimsTainted();
((SceneObjectGroup) ent).IsSelected = false;
LandManager.setPrimsTainted();
break;
}
}
@ -290,10 +286,10 @@ namespace OpenSim.Region.Environment.Scenes
{
if (ent is SceneObjectGroup)
{
hasPrim = ((SceneObjectGroup)ent).HasChildPrim(primLocalID);
hasPrim = ((SceneObjectGroup) ent).HasChildPrim(primLocalID);
if (hasPrim != false)
{
((SceneObjectGroup)ent).SetPartDescription(description, primLocalID);
((SceneObjectGroup) ent).SetPartDescription(description, primLocalID);
break;
}
}
@ -312,10 +308,10 @@ namespace OpenSim.Region.Environment.Scenes
{
if (ent is SceneObjectGroup)
{
hasPrim = ((SceneObjectGroup)ent).HasChildPrim(primLocalID);
hasPrim = ((SceneObjectGroup) ent).HasChildPrim(primLocalID);
if (hasPrim != false)
{
((SceneObjectGroup)ent).SetPartName(name, primLocalID);
((SceneObjectGroup) ent).SetPartName(name, primLocalID);
break;
}
}
@ -331,10 +327,10 @@ namespace OpenSim.Region.Environment.Scenes
{
if (ent is SceneObjectGroup)
{
hasPrim = ((SceneObjectGroup)ent).HasChildPrim(objectID);
hasPrim = ((SceneObjectGroup) ent).HasChildPrim(objectID);
if (hasPrim != false)
{
((SceneObjectGroup)ent).GrabMovement(offset, pos, remoteClient);
((SceneObjectGroup) ent).GrabMovement(offset, pos, remoteClient);
break;
}
}
@ -350,7 +346,6 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="remoteClient"></param>
public void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient)
{
}
/// <summary>
@ -366,10 +361,10 @@ namespace OpenSim.Region.Environment.Scenes
{
if (ent is SceneObjectGroup)
{
hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID);
hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
if (hasPrim != false)
{
((SceneObjectGroup)ent).UpdateTextureEntry(localID, texture);
((SceneObjectGroup) ent).UpdateTextureEntry(localID, texture);
break;
}
}
@ -389,10 +384,10 @@ namespace OpenSim.Region.Environment.Scenes
{
if (ent is SceneObjectGroup)
{
hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID);
hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
if (hasPrim != false)
{
((SceneObjectGroup)ent).UpdateGroupPosition(pos);
((SceneObjectGroup) ent).UpdateGroupPosition(pos);
break;
}
}
@ -406,10 +401,10 @@ namespace OpenSim.Region.Environment.Scenes
{
if (ent is SceneObjectGroup)
{
hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID);
hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
if (hasPrim != false)
{
((SceneObjectGroup)ent).UpdateSinglePosition(pos, localID);
((SceneObjectGroup) ent).UpdateSinglePosition(pos, localID);
break;
}
}
@ -430,10 +425,10 @@ namespace OpenSim.Region.Environment.Scenes
{
if (ent is SceneObjectGroup)
{
hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID);
hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
if (hasPrim != false)
{
((SceneObjectGroup)ent).UpdateGroupRotation(pos, rot);
((SceneObjectGroup) ent).UpdateGroupRotation(pos, rot);
break;
}
}
@ -453,10 +448,10 @@ namespace OpenSim.Region.Environment.Scenes
{
if (ent is SceneObjectGroup)
{
hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID);
hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
if (hasPrim != false)
{
((SceneObjectGroup)ent).UpdateGroupRotation(rot);
((SceneObjectGroup) ent).UpdateGroupRotation(rot);
break;
}
}
@ -476,10 +471,10 @@ namespace OpenSim.Region.Environment.Scenes
{
if (ent is SceneObjectGroup)
{
hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID);
hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
if (hasPrim != false)
{
((SceneObjectGroup)ent).UpdateSingleRotation(rot, localID);
((SceneObjectGroup) ent).UpdateSingleRotation(rot, localID);
break;
}
}
@ -499,10 +494,10 @@ namespace OpenSim.Region.Environment.Scenes
{
if (ent is SceneObjectGroup)
{
hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID);
hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
if (hasPrim != false)
{
((SceneObjectGroup)ent).Resize(scale, localID);
((SceneObjectGroup) ent).Resize(scale, localID);
break;
}
}
@ -511,7 +506,7 @@ namespace OpenSim.Region.Environment.Scenes
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++)
{
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)
{
this.EventManager.TriggerObjectGrab(localID, offsetPos, remoteClient);
EventManager.TriggerObjectGrab(localID, offsetPos, remoteClient);
}
}
}
}

View File

@ -27,28 +27,28 @@
*/
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading;
using System.Timers;
using System.IO;
using System.Xml;
using Axiom.Math;
using libsecondlife;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Caches;
using OpenSim.Framework.Console;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Servers;
using OpenSim.Framework.Types;
using OpenSim.Framework.Utilities;
using OpenSim.Region.Physics.Manager;
using OpenSim.Framework.Communications.Caches;
using OpenSim.Region.Environment.LandManagement;
using OpenSim.Region.Environment;
using OpenSim.Region.Capabilities;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.LandManagement;
using OpenSim.Region.Environment.Scenes.Scripting;
using OpenSim.Region.Environment.Types;
using OpenSim.Region.Physics.Manager;
using OpenSim.Region.Terrain;
using OpenSim.Framework.Data;
using Caps = OpenSim.Region.Capabilities.Caps;
using Timer = System.Timers.Timer;
using Timer=System.Timers.Timer;
namespace OpenSim.Region.Environment.Scenes
{
@ -61,8 +61,11 @@ namespace OpenSim.Region.Environment.Scenes
protected Timer m_heartbeatTimer = new Timer();
protected Dictionary<LLUUID, ScenePresence> Avatars;
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;
private Random Rand = new Random();
private uint _primCount = 702000;
private Mutex _primAllocateMutex = new Mutex(false);
@ -102,8 +105,9 @@ namespace OpenSim.Region.Environment.Scenes
public AgentCircuitManager AuthenticateHandler
{
get { return this.authenticateHandler; }
get { return authenticateHandler; }
}
/// <summary>
///
/// </summary>
@ -141,7 +145,7 @@ namespace OpenSim.Region.Environment.Scenes
public int TimePhase
{
get { return this.m_timePhase; }
get { return m_timePhase; }
}
#endregion
@ -155,7 +159,8 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="regionHandle">Region Handle for this region</param>
/// <param name="regionName">Region Name for this region</param>
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);
@ -190,22 +195,21 @@ namespace OpenSim.Region.Environment.Scenes
Prims = new Dictionary<LLUUID, SceneObjectGroup>();
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();
httpListener = httpServer;
}
#endregion
public void SetModuleInterfaces()
{
m_simChatModule = this.RequestModuleInterface<ISimChat>();
m_httpRequestModule = this.RequestModuleInterface<IHttpRequests>();
m_simChatModule = RequestModuleInterface<ISimChat>();
m_httpRequestModule = RequestModuleInterface<IHttpRequests>();
XferManager = this.RequestModuleInterface<IXfer>();
XferManager = RequestModuleInterface<IXfer>();
}
#region Script Handling Methods
@ -249,7 +253,8 @@ namespace OpenSim.Region.Environment.Scenes
{
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);
@ -308,9 +313,10 @@ namespace OpenSim.Region.Environment.Scenes
{
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++;
if (m_timeUpdateCount > 600)
{
List<ScenePresence> Avatars = this.RequestAvatarList();
List<ScenePresence> Avatars = RequestAvatarList();
foreach (ScenePresence avatar in Avatars)
{
if (!avatar.childAgent)
@ -398,10 +404,7 @@ namespace OpenSim.Region.Environment.Scenes
storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD());
ForEachScenePresence(delegate(ScenePresence presence)
{
SendLayerData(presence.ControllingClient);
});
ForEachScenePresence(delegate(ScenePresence presence) { SendLayerData(presence.ControllingClient); });
foreach (LLUUID UUID in Entities.Keys)
{
@ -429,10 +432,7 @@ namespace OpenSim.Region.Environment.Scenes
}
storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD());
ForEachScenePresence(delegate(ScenePresence presence)
{
SendLayerData(presence.ControllingClient);
});
ForEachScenePresence(delegate(ScenePresence presence) { SendLayerData(presence.ControllingClient); });
foreach (LLUUID UUID in Entities.Keys)
{
@ -521,23 +521,23 @@ namespace OpenSim.Region.Environment.Scenes
public void LoadPrimsFromStorage()
{
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)
{
AddEntityFromStorage(prim);
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(
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 Axiom.Math.Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
rootPart.RotationOffset.Y, rootPart.RotationOffset.Z));
new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
rootPart.RotationOffset.Y, rootPart.RotationOffset.Z));
}
MainLog.Instance.Verbose("Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)");
}
/// <summary>
/// Returns a new unallocated primitive ID
/// </summary>
@ -561,20 +561,23 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="ownerID"></param>
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);
SceneObjectPart rootPart = sceneOb.GetChildPart(sceneOb.UUID);
// 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 ((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),
new Axiom.Math.Quaternion());
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),
new Quaternion());
}
}
@ -584,9 +587,9 @@ namespace OpenSim.Region.Environment.Scenes
{
if (obj is SceneObjectGroup)
{
if (((SceneObjectGroup)obj).LocalId == localID)
if (((SceneObjectGroup) obj).LocalId == localID)
{
RemoveEntity((SceneObjectGroup)obj);
RemoveEntity((SceneObjectGroup) obj);
return;
}
}
@ -595,21 +598,21 @@ namespace OpenSim.Region.Environment.Scenes
public void AddEntityFromStorage(SceneObjectGroup sceneObject)
{
sceneObject.RegionHandle = this.m_regionHandle;
sceneObject.RegionHandle = m_regionHandle;
sceneObject.SetScene(this);
foreach (SceneObjectPart part in sceneObject.Children.Values)
{
part.LocalID = this.PrimIDAllocate();
part.LocalID = PrimIDAllocate();
}
sceneObject.UpdateParentIDs();
this.AddEntity(sceneObject);
AddEntity(sceneObject);
}
public void AddEntity(SceneObjectGroup sceneObject)
{
if (!Entities.ContainsKey(sceneObject.UUID))
{
// QuadTree.AddObject(sceneObject);
// QuadTree.AddObject(sceneObject);
Entities.Add(sceneObject.UUID, sceneObject);
}
}
@ -648,18 +651,19 @@ namespace OpenSim.Region.Environment.Scenes
foreach (XmlNode aPrimNode in rootNode.ChildNodes)
{
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
//obj.RegenerateFullIDs();
AddEntity(obj);
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(
new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, rootPart.AbsolutePosition.Z),
new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z),
new Axiom.Math.Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
rootPart.RotationOffset.Y, rootPart.RotationOffset.Z));
new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y,
rootPart.AbsolutePosition.Z),
new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z),
new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
rootPart.RotationOffset.Y, rootPart.RotationOffset.Z));
primCount++;
}
}
@ -679,7 +683,7 @@ namespace OpenSim.Region.Environment.Scenes
{
if (ent is SceneObjectGroup)
{
stream.WriteLine(((SceneObjectGroup)ent).ToXmlString());
stream.WriteLine(((SceneObjectGroup) ent).ToXmlString());
primCount++;
}
}
@ -688,7 +692,6 @@ namespace OpenSim.Region.Environment.Scenes
file.Close();
}
#endregion
#region Add/Remove Avatar Methods
@ -703,7 +706,7 @@ namespace OpenSim.Region.Environment.Scenes
{
SubscribeToClientEvents(client);
m_estateManager.sendRegionHandshake(client);
CreateAndAddScenePresence(client, child );
CreateAndAddScenePresence(client, child);
m_LandManager.sendParcelOverlay(client);
commsManager.UserProfiles.AddNewUser(client.AgentId);
commsManager.TransactionsManager.AddUser(client.AgentId);
@ -744,9 +747,11 @@ namespace OpenSim.Region.Environment.Scenes
client.OnParcelPropertiesRequest += new ParcelPropertiesRequest(m_LandManager.handleParcelPropertiesRequest);
client.OnParcelDivideRequest += new ParcelDivideRequest(m_LandManager.handleParcelDivideRequest);
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.OnParcelObjectOwnerRequest += new ParcelObjectOwnerRequest(m_LandManager.handleParcelObjectOwnersRequest);
client.OnParcelObjectOwnerRequest +=
new ParcelObjectOwnerRequest(m_LandManager.handleParcelObjectOwnersRequest);
client.OnEstateOwnerMessage += new EstateOwnerMessageRequest(m_estateManager.handleEstateOwnerMessage);
@ -768,7 +773,7 @@ namespace OpenSim.Region.Environment.Scenes
EventManager.TriggerOnNewClient(client);
}
protected ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child )
protected ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child)
{
ScenePresence newAvatar = null;
@ -777,16 +782,18 @@ namespace OpenSim.Region.Environment.Scenes
if (child)
{
MainLog.Instance.Verbose(this.RegionInfo.RegionName + ": Creating new child agent.");
MainLog.Instance.Verbose(RegionInfo.RegionName + ": Creating new child agent.");
}
else
{
newAvatar.OnSignificantClientMovement += m_LandManager.handleSignificantClientMovement;
MainLog.Instance.Verbose(this.RegionInfo.RegionName + ": Creating new root agent.");
MainLog.Instance.Verbose(this.RegionInfo.RegionName + ": Adding Physical agent.");
MainLog.Instance.Verbose(RegionInfo.RegionName + ": Creating new root 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)
{
newAvatar.PhysActor = phyScene.AddAvatar(pVec);
@ -832,14 +839,14 @@ namespace OpenSim.Region.Environment.Scenes
ForEachScenePresence(
delegate(ScenePresence presence)
{
presence.CoarseLocationChange(avatar);
presence.ControllingClient.SendKillObject(avatar.RegionHandle, avatar.LocalId);
if (presence.PhysActor != null)
{
phyScene.RemoveAvatar(presence.PhysActor);
}
});
presence.CoarseLocationChange(avatar);
presence.ControllingClient.SendKillObject(avatar.RegionHandle, avatar.LocalId);
if (presence.PhysActor != null)
{
phyScene.RemoveAvatar(presence.PhysActor);
}
});
lock (Avatars)
{
@ -943,7 +950,7 @@ namespace OpenSim.Region.Environment.Scenes
if (Entities.ContainsKey(entID))
{
Entities.Remove(entID);
storageManager.DataStore.RemoveObject(entID, this.m_regInfo.SimUUID);
storageManager.DataStore.RemoveObject(entID, m_regInfo.SimUUID);
return true;
}
return false;
@ -951,10 +958,10 @@ namespace OpenSim.Region.Environment.Scenes
public void SendKillObject(uint localID)
{
List<ScenePresence> avatars = this.RequestAvatarList();
List<ScenePresence> avatars = RequestAvatarList();
for (int i = 0; i < avatars.Count; i++)
{
avatars[i].ControllingClient.SendKillObject(this.m_regionHandle, localID);
avatars[i].ControllingClient.SendKillObject(m_regionHandle, localID);
}
}
@ -964,8 +971,8 @@ namespace OpenSim.Region.Environment.Scenes
{
if (ent is SceneObjectGroup)
{
// ((SceneObjectGroup)ent).SendFullUpdateToClient(client);
((SceneObjectGroup)ent).ScheduleFullUpdateToAvatar(presence);
// ((SceneObjectGroup)ent).SendFullUpdateToClient(client);
((SceneObjectGroup) ent).ScheduleFullUpdateToAvatar(presence);
}
}
}
@ -999,15 +1006,19 @@ namespace OpenSim.Region.Environment.Scenes
if (agent.CapsPath != "")
{
//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);
Util.SetCapsURL(agent.AgentID, "http://" + m_regInfo.ExternalHostName + ":" + httpListener.Port.ToString() + "/CAPS/" + agent.CapsPath + "0000/");
Caps cap =
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.AddNewInventoryItem = this.AddInventoryItem;
cap.ItemUpdatedCall = this.CapsUpdateInventoryItemAsset;
cap.AddNewInventoryItem = AddInventoryItem;
cap.ItemUpdatedCall = CapsUpdateInventoryItemAsset;
if (capsHandlers.ContainsKey(agent.AgentID))
{
MainLog.Instance.Warn("client", "Adding duplicate CAPS entry for user " +
agent.AgentID.ToStringHyphenated());
agent.AgentID.ToStringHyphenated());
capsHandlers[agent.AgentID] = cap;
}
else
@ -1142,43 +1153,25 @@ namespace OpenSim.Region.Environment.Scenes
public void AddModule(string name, IRegionModule module)
{
if (!this.Modules.ContainsKey(name))
if (!Modules.ContainsKey(name))
{
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)
{
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>()
{
if (ModuleInterfaces.ContainsKey(typeof(T)))
if (ModuleInterfaces.ContainsKey(typeof (T)))
{
return (T)ModuleInterfaces[typeof(T)];
return (T) ModuleInterfaces[typeof (T)];
}
else
{
@ -1191,7 +1184,8 @@ namespace OpenSim.Region.Environment.Scenes
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))
{
@ -1201,7 +1195,7 @@ namespace OpenSim.Region.Environment.Scenes
#region Alert Methods
void SendPermissionAlert(LLUUID user, string reason)
private void SendPermissionAlert(LLUUID user, string reason)
{
SendAlertToUser(user, reason, false);
}
@ -1209,7 +1203,7 @@ namespace OpenSim.Region.Environment.Scenes
public void SendGeneralAlert(string message)
{
foreach (ScenePresence presence in this.Avatars.Values)
foreach (ScenePresence presence in Avatars.Values)
{
presence.ControllingClient.SendAlertMessage(message);
}
@ -1217,15 +1211,15 @@ namespace OpenSim.Region.Environment.Scenes
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)
{
foreach (ScenePresence presence in this.Avatars.Values)
foreach (ScenePresence presence in Avatars.Values)
{
if ((presence.Firstname == firstName) && (presence.Lastname == lastName))
{
@ -1239,13 +1233,13 @@ namespace OpenSim.Region.Environment.Scenes
{
if (commandParams[0] == "general")
{
string message = this.CombineParams(commandParams, 1);
this.SendGeneralAlert(message);
string message = CombineParams(commandParams, 1);
SendGeneralAlert(message);
}
else
{
string message = this.CombineParams(commandParams, 2);
this.SendAlertToUser(commandParams[0], commandParams[1], message, false);
string message = CombineParams(commandParams, 2);
SendAlertToUser(commandParams[0], commandParams[1], message, false);
}
}
@ -1258,36 +1252,39 @@ namespace OpenSim.Region.Environment.Scenes
}
return result;
}
#endregion
public void ForceClientUpdate()
{
foreach (EntityBase ent in this.Entities.Values)
foreach (EntityBase ent in Entities.Values)
{
if (ent is SceneObjectGroup)
{
((SceneObjectGroup)ent).ScheduleGroupForFullUpdate();
((SceneObjectGroup) ent).ScheduleGroupForFullUpdate();
}
}
}
public void HandleEditCommand(string[] cmmdparams)
{
Console.WriteLine("Searching for Primitive: '" + cmmdparams[0] + "'");
foreach (EntityBase ent in this.Entities.Values)
foreach (EntityBase ent in Entities.Values)
{
if (ent is SceneObjectGroup)
{
SceneObjectPart part = ((SceneObjectGroup)ent).GetChildPart(((SceneObjectGroup)ent).UUID);
if (part != null)
{
if (part.Name == cmmdparams[0])
{
part.Resize( new LLVector3(Convert.ToSingle(cmmdparams[1]), Convert.ToSingle(cmmdparams[2]), Convert.ToSingle(cmmdparams[3])));
Console.WriteLine("Edited scale of Primitive: " + part.Name);
}
}
SceneObjectPart part = ((SceneObjectGroup) ent).GetChildPart(((SceneObjectGroup) ent).UUID);
if (part != null)
{
if (part.Name == cmmdparams[0])
{
part.Resize(
new LLVector3(Convert.ToSingle(cmmdparams[1]), Convert.ToSingle(cmmdparams[2]),
Convert.ToSingle(cmmdparams[3])));
Console.WriteLine("Edited scale of Primitive: " + part.Name);
}
}
}
}
}
@ -1298,7 +1295,9 @@ namespace OpenSim.Region.Environment.Scenes
{
case "users":
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)
{
@ -1321,8 +1320,8 @@ namespace OpenSim.Region.Environment.Scenes
}
break;
case "modules":
MainLog.Instance.Error("The currently loaded modules in " + this.RegionInfo.RegionName + " are:");
foreach (OpenSim.Region.Environment.Interfaces.IRegionModule module in this.Modules.Values)
MainLog.Instance.Error("The currently loaded modules in " + RegionInfo.RegionName + " are:");
foreach (IRegionModule module in Modules.Values)
{
if (!module.IsSharedModule())
{
@ -1337,19 +1336,22 @@ namespace OpenSim.Region.Environment.Scenes
{
if (m_httpRequestModule != null)
{
return m_httpRequestModule.MakeHttpRequest(url, type, body);
return m_httpRequestModule.MakeHttpRequest(url, type, body);
}
return LLUUID.Zero;
}
#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);
ScriptEngine.InitializeEngine(this, m_logger);
}
#endregion
public LLUUID ConvertLocalIDToFullID(uint localID)
@ -1359,10 +1361,10 @@ namespace OpenSim.Region.Environment.Scenes
{
if (ent is SceneObjectGroup)
{
hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID);
hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
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)
{
hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID);
hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
if (hasPrim != false)
{
return ((SceneObjectGroup)ent).GetChildPart(localID);
return ((SceneObjectGroup) ent).GetChildPart(localID);
}
}
}
@ -1393,14 +1395,14 @@ namespace OpenSim.Region.Environment.Scenes
{
if (ent is SceneObjectGroup)
{
hasPrim = ((SceneObjectGroup)ent).HasChildPrim(fullID);
hasPrim = ((SceneObjectGroup) ent).HasChildPrim(fullID);
if (hasPrim != false)
{
return ((SceneObjectGroup)ent).GetChildPart(fullID);
return ((SceneObjectGroup) ent).GetChildPart(fullID);
}
}
}
return null;
}
}
}
}

View File

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

View File

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

View File

@ -1,20 +1,18 @@
using System.Collections.Generic;
using System;
using OpenSim.Framework.Console;
using OpenSim.Framework.Types;
using System;
using System.Collections.Generic;
using OpenSim.Framework.Console;
using OpenSim.Framework.Types;
namespace OpenSim.Region.Environment.Scenes
{
public class SceneManager
{
private readonly List<Scene> m_localScenes;
private Scene m_currentScene = null;
private Scene m_currentScene = null;
public Scene CurrentScene
{
get
{
return m_currentScene;
}
get { return m_currentScene; }
}
private Scene CurrentOrFirstScene
@ -83,18 +81,12 @@ namespace OpenSim.Region.Environment.Scenes
public void SendCommandToScripts(string[] cmdparams)
{
ForEach(delegate(Scene scene)
{
scene.SendCommandToScripts(cmdparams);
});
ForEach(delegate(Scene scene) { scene.SendCommandToScripts(cmdparams); });
}
public void BypassPermissions(bool bypassPermissions)
{
ForEach(delegate(Scene scene)
{
scene.PermissionsMngr.BypassPermissions = bypassPermissions;
});
ForEach(delegate(Scene scene) { scene.PermissionsMngr.BypassPermissions = bypassPermissions; });
}
private void ForEach(Action<Scene> func)
@ -111,18 +103,12 @@ namespace OpenSim.Region.Environment.Scenes
public void Backup()
{
ForEach(delegate(Scene scene)
{
scene.Backup();
});
ForEach(delegate(Scene scene) { scene.Backup(); });
}
public void HandleAlertCommand(string[] cmdparams)
{
ForEach(delegate(Scene scene)
{
scene.HandleAlertCommand(cmdparams);
});
ForEach(delegate(Scene scene) { scene.HandleAlertCommand(cmdparams); });
}
public bool TrySetCurrentRegion(string regionName)
@ -161,8 +147,8 @@ namespace OpenSim.Region.Environment.Scenes
if (!scenePrescence.childAgent)
{
log.Error(String.Format("Packet debug for {0} {1} set to {2}",
scenePrescence.Firstname, scenePrescence.Lastname,
newDebug));
scenePrescence.Firstname, scenePrescence.Lastname,
newDebug));
scenePrescence.ControllingClient.SetDebug(newDebug);
}
@ -219,18 +205,12 @@ namespace OpenSim.Region.Environment.Scenes
public void ForceClientUpdate()
{
ForEach(delegate(Scene scene)
{
scene.ForceClientUpdate();
});
ForEach(delegate(Scene scene) { scene.ForceClientUpdate(); });
}
public void HandleEditCommand(string[] cmdparams)
{
ForEach(delegate(Scene scene)
{
scene.HandleEditCommand(cmdparams);
});
ForEach(delegate(Scene scene) { 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.Text;
using System.Xml;
using System.Xml.Serialization;
using System.IO;
using System;
using Axiom.Math;
using libsecondlife;
using libsecondlife.Packets;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Types;
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.Scenes.Scripting;
using OpenSim.Region.Physics.Manager;
namespace OpenSim.Region.Environment.Scenes
{
public class SceneObjectPart : IScriptHost
{
private const uint FULL_MASK_PERMISSIONS = 2147483647;
@ -25,8 +21,7 @@ namespace OpenSim.Region.Environment.Scenes
private string m_inventoryFileName = "";
private LLUUID m_folderID = LLUUID.Zero;
[XmlIgnore]
public PhysicsActor PhysActor = null;
[XmlIgnore] public PhysicsActor PhysActor = null;
protected Dictionary<LLUUID, TaskInventoryItem> TaskInventory = new Dictionary<LLUUID, TaskInventoryItem>();
@ -57,19 +52,25 @@ namespace OpenSim.Region.Environment.Scenes
#region Properties
public LLUUID CreatorID;
public LLUUID ObjectCreator { get { return CreatorID; } }
public LLUUID ObjectCreator
{
get { return CreatorID; }
}
/// <summary>
/// Serial count for inventory file , used to tell if inventory has changed
/// no need for this to be part of Database backup
/// </summary>
protected uint m_inventorySerial = 0;
public uint InventorySerial
{
get { return m_inventorySerial; }
}
protected LLUUID m_uuid;
public LLUUID UUID
{
get { return m_uuid; }
@ -77,6 +78,7 @@ namespace OpenSim.Region.Environment.Scenes
}
protected uint m_localID;
public uint LocalID
{
get { return m_localID; }
@ -84,6 +86,7 @@ namespace OpenSim.Region.Environment.Scenes
}
protected string m_name;
public virtual string Name
{
get { return m_name; }
@ -91,20 +94,23 @@ namespace OpenSim.Region.Environment.Scenes
}
protected LLObject.ObjectFlags m_flags;
public uint ObjectFlags
{
get { return (uint)m_flags; }
set { m_flags = (LLObject.ObjectFlags)value; }
get { return (uint) m_flags; }
set { m_flags = (LLObject.ObjectFlags) value; }
}
protected LLObject.MaterialType m_material;
public byte Material
{
get { return (byte)m_material; }
set { m_material = (LLObject.MaterialType)value; }
get { return (byte) m_material; }
set { m_material = (LLObject.MaterialType) value; }
}
protected ulong m_regionHandle;
public ulong 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
protected LLVector3 m_groupPosition;
public LLVector3 GroupPosition
{
get { return m_groupPosition; }
@ -120,6 +127,7 @@ namespace OpenSim.Region.Environment.Scenes
}
protected LLVector3 m_offsetPosition;
public LLVector3 OffsetPosition
{
get { return m_offsetPosition; }
@ -132,6 +140,7 @@ namespace OpenSim.Region.Environment.Scenes
}
protected LLQuaternion m_rotationOffset;
public LLQuaternion RotationOffset
{
get { return m_rotationOffset; }
@ -139,6 +148,7 @@ namespace OpenSim.Region.Environment.Scenes
}
protected LLVector3 m_velocity;
/// <summary></summary>
public LLVector3 Velocity
{
@ -147,6 +157,7 @@ namespace OpenSim.Region.Environment.Scenes
}
protected LLVector3 m_angularVelocity;
/// <summary></summary>
public LLVector3 AngularVelocity
{
@ -155,6 +166,7 @@ namespace OpenSim.Region.Environment.Scenes
}
protected LLVector3 m_acceleration;
/// <summary></summary>
public LLVector3 Acceleration
{
@ -163,13 +175,15 @@ namespace OpenSim.Region.Environment.Scenes
}
private string m_description = "";
public string Description
{
get { return this.m_description; }
set { this.m_description = value; }
get { return m_description; }
set { m_description = value; }
}
private string m_text = "";
public string Text
{
get { return m_text; }
@ -181,6 +195,7 @@ namespace OpenSim.Region.Environment.Scenes
}
private string m_sitName = "";
public string SitName
{
get { return m_sitName; }
@ -188,6 +203,7 @@ namespace OpenSim.Region.Environment.Scenes
}
private string m_touchName = "";
public string TouchName
{
get { return m_touchName; }
@ -195,17 +211,19 @@ namespace OpenSim.Region.Environment.Scenes
}
protected PrimitiveBaseShape m_shape;
public PrimitiveBaseShape Shape
{
get { return this.m_shape; }
get { return m_shape; }
set { m_shape = value; }
}
public LLVector3 Scale
{
set { this.m_shape.Scale = value; }
get { return this.m_shape.Scale; }
set { m_shape.Scale = value; }
get { return m_shape.Scale; }
}
#endregion
public LLUUID ObjectOwner
@ -215,16 +233,16 @@ namespace OpenSim.Region.Environment.Scenes
public SceneObjectGroup ParentGroup
{
get { return m_parentGroup; }
get { return m_parentGroup; }
}
#region Constructors
/// <summary>
///
/// </summary>
public SceneObjectPart()
{
}
/// <summary>
@ -236,43 +254,44 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="localID"></param>
/// <param name="shape"></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";
this.m_regionHandle = regionHandle;
this.m_parentGroup = parent;
m_name = "Primitive";
m_regionHandle = regionHandle;
m_parentGroup = parent;
this.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
this.OwnerID = ownerID;
this.CreatorID = this.OwnerID;
this.LastOwnerID = LLUUID.Zero;
this.UUID = LLUUID.Random();
this.LocalID = (uint)(localID);
this.Shape = shape;
CreationDate = (Int32) (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
OwnerID = ownerID;
CreatorID = OwnerID;
LastOwnerID = LLUUID.Zero;
UUID = LLUUID.Random();
LocalID = (uint) (localID);
Shape = shape;
GroupPosition = groupPosition;
OffsetPosition = offsetPosition;
RotationOffset = LLQuaternion.Identity;
Velocity = new LLVector3(0, 0, 0);
AngularVelocity = new LLVector3(0, 0, 0);
Acceleration = new LLVector3(0, 0, 0);
this.GroupPosition = groupPosition;
this.OffsetPosition = offsetPosition;
this.RotationOffset = LLQuaternion.Identity;
this.Velocity = new LLVector3(0, 0, 0);
this.AngularVelocity = new LLVector3(0, 0, 0);
this.Acceleration = new LLVector3(0, 0, 0);
m_inventoryFileName = "taskinventory" + LLUUID.Random().ToString();
m_folderID = LLUUID.Random();
m_flags = 0;
m_flags |= LLObject.ObjectFlags.ObjectModify |
LLObject.ObjectFlags.ObjectCopy |
LLObject.ObjectFlags.ObjectYouOwner |
LLObject.ObjectFlags.Touch |
LLObject.ObjectFlags.ObjectMove |
LLObject.ObjectFlags.AllowInventoryDrop |
LLObject.ObjectFlags.ObjectTransfer |
LLObject.ObjectFlags.ObjectOwnerModify;
m_flags |= LLObject.ObjectFlags.ObjectModify |
LLObject.ObjectFlags.ObjectCopy |
LLObject.ObjectFlags.ObjectYouOwner |
LLObject.ObjectFlags.Touch |
LLObject.ObjectFlags.ObjectMove |
LLObject.ObjectFlags.AllowInventoryDrop |
LLObject.ObjectFlags.ObjectTransfer |
LLObject.ObjectFlags.ObjectOwnerModify;
ScheduleFullUpdate();
}
/// <summary>
/// Re/create a SceneObjectPart (prim)
/// currently not used, and maybe won't be
@ -283,23 +302,26 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="localID"></param>
/// <param name="shape"></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;
this.m_parentGroup = parent;
m_regionHandle = regionHandle;
m_parentGroup = parent;
this.CreationDate = creationDate;
this.OwnerID = ownerID;
this.CreatorID = creatorID;
this.LastOwnerID = lastOwnerID;
this.UUID = LLUUID.Random();
this.LocalID = (uint)(localID);
this.Shape = shape;
CreationDate = creationDate;
OwnerID = ownerID;
CreatorID = creatorID;
LastOwnerID = lastOwnerID;
UUID = LLUUID.Random();
LocalID = (uint) (localID);
Shape = shape;
this.OffsetPosition = position;
this.RotationOffset = rotation;
this.ObjectFlags = flags;
OffsetPosition = position;
RotationOffset = rotation;
ObjectFlags = flags;
}
#endregion
/// <summary>
@ -309,8 +331,8 @@ namespace OpenSim.Region.Environment.Scenes
/// <returns></returns>
public static SceneObjectPart FromXml(XmlReader xmlReader)
{
XmlSerializer serializer = new XmlSerializer(typeof(SceneObjectPart));
return (SceneObjectPart)serializer.Deserialize(xmlReader);
XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart));
return (SceneObjectPart) serializer.Deserialize(xmlReader);
}
/// <summary>
@ -319,7 +341,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="xmlWriter"></param>
public void ToXml(XmlWriter xmlWriter)
{
XmlSerializer serializer = new XmlSerializer(typeof(SceneObjectPart));
XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart));
serializer.Serialize(xmlWriter, this);
}
@ -329,7 +351,6 @@ namespace OpenSim.Region.Environment.Scenes
public void SetParent(SceneObjectGroup parent)
{
m_parentGroup = parent;
}
public LLUUID GetRootPartUUID()
@ -342,34 +363,38 @@ namespace OpenSim.Region.Environment.Scenes
}
#region Copying
/// <summary>
///
/// </summary>
/// <returns></returns>
public SceneObjectPart Copy(uint localID)
{
SceneObjectPart dupe = (SceneObjectPart)this.MemberwiseClone();
SceneObjectPart dupe = (SceneObjectPart) MemberwiseClone();
dupe.m_shape = m_shape.Copy();
dupe.m_regionHandle = m_regionHandle;
dupe.UUID = LLUUID.Random();
dupe.LocalID = localID;
dupe.GroupPosition = new LLVector3(GroupPosition.X, GroupPosition.Y, GroupPosition.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.Acceleration = 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];
Array.Copy(this.Shape.ExtraParams, extraP, extraP.Length);
byte[] extraP = new byte[Shape.ExtraParams.Length];
Array.Copy(Shape.ExtraParams, extraP, extraP.Length);
dupe.Shape.ExtraParams = extraP;
return dupe;
}
#endregion
#region Update Scheduling
/// <summary>
///
/// </summary>
@ -387,7 +412,7 @@ namespace OpenSim.Region.Environment.Scenes
{
m_parentGroup.HasChanged = true;
}
this.TimeStampFull =(uint) Util.UnixTimeSinceEpoch();
TimeStampFull = (uint) Util.UnixTimeSinceEpoch();
m_updateFlag = 2;
}
@ -402,7 +427,7 @@ namespace OpenSim.Region.Environment.Scenes
{
m_parentGroup.HasChanged = true;
}
this.TimeStampTerse = (uint)Util.UnixTimeSinceEpoch();
TimeStampTerse = (uint) Util.UnixTimeSinceEpoch();
m_updateFlag = 1;
}
}
@ -426,56 +451,60 @@ namespace OpenSim.Region.Environment.Scenes
}
}
}
#endregion
#region Shape
/// <summary>
///
/// </summary>
/// <param name="shapeBlock"></param>
public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock)
{
this.m_shape.PathBegin = shapeBlock.PathBegin;
this.m_shape.PathEnd = shapeBlock.PathEnd;
this.m_shape.PathScaleX = shapeBlock.PathScaleX;
this.m_shape.PathScaleY = shapeBlock.PathScaleY;
this.m_shape.PathShearX = shapeBlock.PathShearX;
this.m_shape.PathShearY = shapeBlock.PathShearY;
this.m_shape.PathSkew = shapeBlock.PathSkew;
this.m_shape.ProfileBegin = shapeBlock.ProfileBegin;
this.m_shape.ProfileEnd = shapeBlock.ProfileEnd;
this.m_shape.PathCurve = shapeBlock.PathCurve;
this.m_shape.ProfileCurve = shapeBlock.ProfileCurve;
this.m_shape.ProfileHollow = shapeBlock.ProfileHollow;
this.m_shape.PathRadiusOffset = shapeBlock.PathRadiusOffset;
this.m_shape.PathRevolutions = shapeBlock.PathRevolutions;
this.m_shape.PathTaperX = shapeBlock.PathTaperX;
this.m_shape.PathTaperY = shapeBlock.PathTaperY;
this.m_shape.PathTwist = shapeBlock.PathTwist;
this.m_shape.PathTwistBegin = shapeBlock.PathTwistBegin;
m_shape.PathBegin = shapeBlock.PathBegin;
m_shape.PathEnd = shapeBlock.PathEnd;
m_shape.PathScaleX = shapeBlock.PathScaleX;
m_shape.PathScaleY = shapeBlock.PathScaleY;
m_shape.PathShearX = shapeBlock.PathShearX;
m_shape.PathShearY = shapeBlock.PathShearY;
m_shape.PathSkew = shapeBlock.PathSkew;
m_shape.ProfileBegin = shapeBlock.ProfileBegin;
m_shape.ProfileEnd = shapeBlock.ProfileEnd;
m_shape.PathCurve = shapeBlock.PathCurve;
m_shape.ProfileCurve = shapeBlock.ProfileCurve;
m_shape.ProfileHollow = shapeBlock.ProfileHollow;
m_shape.PathRadiusOffset = shapeBlock.PathRadiusOffset;
m_shape.PathRevolutions = shapeBlock.PathRevolutions;
m_shape.PathTaperX = shapeBlock.PathTaperX;
m_shape.PathTaperY = shapeBlock.PathTaperY;
m_shape.PathTwist = shapeBlock.PathTwist;
m_shape.PathTwistBegin = shapeBlock.PathTwistBegin;
ScheduleFullUpdate();
}
#endregion
#region Inventory
public void AddInventoryItem(TaskInventoryItem item)
{
item.parent_id = m_folderID;
item.creation_date = 1000;
item.ParentPartID = this.UUID;
this.TaskInventory.Add(item.item_id, item);
this.m_inventorySerial++;
item.ParentPartID = UUID;
TaskInventory.Add(item.item_id, item);
m_inventorySerial++;
}
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;
this.TaskInventory.Remove(itemID);
this.m_inventorySerial++;
TaskInventory.Remove(itemID);
m_inventorySerial++;
if (type == "lsltext")
{
return 10;
@ -496,16 +525,17 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="localID"></param>
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;
}
else
{
client.SendTaskInventory(this.m_uuid, 0, new byte[0]);
client.SendTaskInventory(m_uuid, 0, new byte[0]);
return false;
}
}
@ -515,8 +545,8 @@ namespace OpenSim.Region.Environment.Scenes
public string RequestInventoryFile(IXfer xferManager)
{
byte[] fileData = new byte[0];
InventoryStringBuilder invString = new InventoryStringBuilder(m_folderID, this.UUID);
foreach (TaskInventoryItem item in this.TaskInventory.Values)
InventoryStringBuilder invString = new InventoryStringBuilder(m_folderID, UUID);
foreach (TaskInventoryItem item in TaskInventory.Values)
{
invString.AddItemStart();
invString.AddNameValueLine("item_id", item.item_id.ToStringHyphenated());
@ -550,49 +580,56 @@ namespace OpenSim.Region.Environment.Scenes
}
return "";
}
#endregion
#region ExtraParams
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;
uint length = (uint)data.Length;
this.m_shape.ExtraParams[i++] = 1;
this.m_shape.ExtraParams[i++] = (byte)(type % 256);
this.m_shape.ExtraParams[i++] = (byte)((type >> 8) % 256);
uint length = (uint) data.Length;
m_shape.ExtraParams[i++] = 1;
m_shape.ExtraParams[i++] = (byte) (type%256);
m_shape.ExtraParams[i++] = (byte) ((type >> 8)%256);
this.m_shape.ExtraParams[i++] = (byte)(length % 256);
this.m_shape.ExtraParams[i++] = (byte)((length >> 8) % 256);
this.m_shape.ExtraParams[i++] = (byte)((length >> 16) % 256);
this.m_shape.ExtraParams[i++] = (byte)((length >> 24) % 256);
Array.Copy(data, 0, this.m_shape.ExtraParams, i, data.Length);
this.ScheduleFullUpdate();
m_shape.ExtraParams[i++] = (byte) (length%256);
m_shape.ExtraParams[i++] = (byte) ((length >> 8)%256);
m_shape.ExtraParams[i++] = (byte) ((length >> 16)%256);
m_shape.ExtraParams[i++] = (byte) ((length >> 24)%256);
Array.Copy(data, 0, m_shape.ExtraParams, i, data.Length);
ScheduleFullUpdate();
}
#endregion
#region Texture
/// <summary>
///
/// </summary>
/// <param name="textureEntry"></param>
public void UpdateTextureEntry(byte[] textureEntry)
{
this.m_shape.TextureEntry = textureEntry;
m_shape.TextureEntry = textureEntry;
ScheduleFullUpdate();
}
#endregion
#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
#region Position
/// <summary>
///
/// </summary>
@ -600,46 +637,52 @@ namespace OpenSim.Region.Environment.Scenes
public void UpdateOffSet(LLVector3 pos)
{
LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z);
this.OffsetPosition = newPos;
OffsetPosition = newPos;
ScheduleTerseUpdate();
}
public void UpdateGroupPosition(LLVector3 pos)
{
LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z);
this.GroupPosition = newPos;
GroupPosition = newPos;
ScheduleTerseUpdate();
}
#endregion
#region rotation
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();
}
#endregion
#region Resizing/Scale
/// <summary>
///
/// </summary>
/// <param name="scale"></param>
public void Resize(LLVector3 scale)
{
this.m_shape.Scale = scale;
m_shape.Scale = scale;
ScheduleFullUpdate();
}
#endregion
#region Client Update Methods
public void AddFullUpdateToAllAvatars()
{
List<ScenePresence> avatars = this.m_parentGroup.RequestSceneAvatars();
List<ScenePresence> avatars = m_parentGroup.RequestSceneAvatars();
for (int i = 0; i < avatars.Count; i++)
{
avatars[i].AddFullPart(this);
// avatars[i].QueuePartForUpdate(this);
// avatars[i].QueuePartForUpdate(this);
}
}
@ -654,7 +697,7 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary>
public void SendFullUpdateToAllClients()
{
List<ScenePresence> avatars = this.m_parentGroup.RequestSceneAvatars();
List<ScenePresence> avatars = m_parentGroup.RequestSceneAvatars();
for (int i = 0; i < avatars.Count; i++)
{
m_parentGroup.SendPartFullUpdate(avatars[i].ControllingClient, this);
@ -691,26 +734,26 @@ namespace OpenSim.Region.Environment.Scenes
LLQuaternion lRot;
lRot = RotationOffset;
remoteClient.SendPrimitiveToClient(m_regionHandle, 64096, LocalID, m_shape, lPos, this.ObjectFlags, m_uuid, OwnerID,
m_text, ParentID, this.m_particleSystem, lRot);
remoteClient.SendPrimitiveToClient(m_regionHandle, 64096, LocalID, m_shape, lPos, ObjectFlags, m_uuid,
OwnerID,
m_text, ParentID, m_particleSystem, lRot);
}
/// Terse updates
public void AddTerseUpdateToAllAvatars()
{
List<ScenePresence> avatars = this.m_parentGroup.RequestSceneAvatars();
for (int i = 0; i < avatars.Count; i++)
{
avatars[i].AddTersePart(this);
List<ScenePresence> avatars = m_parentGroup.RequestSceneAvatars();
for (int i = 0; i < avatars.Count; i++)
{
avatars[i].AddTersePart(this);
// avatars[i].QueuePartForUpdate(this);
}
}
}
public void AddTerseUpdateToAvatar(ScenePresence presence)
{
presence.AddTersePart(this);
// presence.QueuePartForUpdate(this);
// presence.QueuePartForUpdate(this);
}
/// <summary>
@ -718,7 +761,7 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary>
public void SendTerseUpdateToAllClients()
{
List<ScenePresence> avatars = this.m_parentGroup.RequestSceneAvatars();
List<ScenePresence> avatars = m_parentGroup.RequestSceneAvatars();
for (int i = 0; i < avatars.Count; i++)
{
m_parentGroup.SendPartTerseUpdate(avatars[i].ControllingClient, this);
@ -741,8 +784,8 @@ namespace OpenSim.Region.Environment.Scenes
public void SendTerseUpdateToClient(IClientAPI remoteClient)
{
LLVector3 lPos;
lPos = this.OffsetPosition;
LLQuaternion mRot = this.RotationOffset;
lPos = OffsetPosition;
LLQuaternion mRot = RotationOffset;
remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot);
}
@ -753,9 +796,10 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="lPos"></param>
public void SendTerseUpdateToClient(IClientAPI remoteClient, LLVector3 lPos)
{
LLQuaternion mRot = this.RotationOffset;
LLQuaternion mRot = RotationOffset;
remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot);
}
#endregion
public virtual void UpdateMovement()
@ -778,11 +822,11 @@ namespace OpenSim.Region.Environment.Scenes
public InventoryStringBuilder(LLUUID folderID, LLUUID parentID)
{
BuildString += "\tinv_object\t0\n\t{\n";
this.AddNameValueLine("obj_id", folderID.ToStringHyphenated());
this.AddNameValueLine("parent_id", parentID.ToStringHyphenated());
this.AddNameValueLine("type", "category");
this.AddNameValueLine("name", "Contents");
this.AddSectionEnd();
AddNameValueLine("obj_id", folderID.ToStringHyphenated());
AddNameValueLine("parent_id", parentID.ToStringHyphenated());
AddNameValueLine("type", "category");
AddNameValueLine("name", "Contents");
AddSectionEnd();
}
public void AddItemStart()
@ -831,7 +875,7 @@ namespace OpenSim.Region.Environment.Scenes
"",
"",
"",
"",
"",
"",
"lsltext",
""
@ -865,5 +909,4 @@ namespace OpenSim.Region.Environment.Scenes
}
}
}
}
}

View File

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

View File

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

View File

@ -1,20 +1,18 @@
using System;
using System.Collections.Generic;
using System.Text;
using libsecondlife;
using Axiom.Math;
using libsecondlife;
namespace OpenSim.Region.Environment.Scenes.Scripting
{
public interface IScriptHost
{
string Name { get; set;}
string SitName{ get; set;}
string TouchName { get; set;}
string Name { get; set; }
string SitName { get; set; }
string TouchName { get; set; }
string Description { get; set; }
LLUUID UUID { get; }
LLUUID ObjectOwner { get;}
LLUUID ObjectOwner { get; }
LLUUID ObjectCreator { 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.Collections.Generic;
using System.Text;
using libsecondlife;
using System;
using Axiom.Math;
using libsecondlife;
namespace OpenSim.Region.Environment.Scenes.Scripting
{
public class NullScriptHost : IScriptHost
{
LLVector3 m_pos = new LLVector3( 128, 128, 30 );
{
private LLVector3 m_pos = new LLVector3(128, 128, 30);
public string Name
{
get { return "Object"; }
@ -39,18 +38,23 @@ namespace OpenSim.Region.Environment.Scenes.Scripting
}
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
{
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);
}
}
}
}

View File

@ -26,18 +26,16 @@
*
*/
/* Original code: Tedd Hansen */
using System;
using System.Collections.Generic;
using System.Text;
using OpenSim.Region.Environment.Scenes.Scripting;
//TODO: WHERE TO PLACE THIS?
using OpenSim.Framework.Console;
//TODO: WHERE TO PLACE THIS?
namespace OpenSim.Region.Environment.Scenes.Scripting
{
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 StartScript(string ScriptID, IScriptHost ObjectID);
}
}
}

View File

@ -26,18 +26,18 @@
*
*/
/* Original code: Tedd Hansen */
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Reflection;
using System;
using System.IO;
using System.Reflection;
using OpenSim.Framework.Console;
namespace OpenSim.Region.Environment.Scenes.Scripting
{
public class ScriptEngineLoader
{
private OpenSim.Framework.Console.LogBase m_log;
public ScriptEngineLoader(OpenSim.Framework.Console.LogBase logger)
private LogBase m_log;
public ScriptEngineLoader(LogBase logger)
{
m_log = logger;
}
@ -47,12 +47,16 @@ namespace OpenSim.Region.Environment.Scenes.Scripting
ScriptEngineInterface ret = null;
try
{
ret = LoadAndInitAssembly(Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine." + EngineName + ".dll"),
"OpenSim.Region.ScriptEngine." + EngineName + ".ScriptEngine");
ret =
LoadAndInitAssembly(
Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine." + EngineName + ".dll"),
"OpenSim.Region.ScriptEngine." + EngineName + ".ScriptEngine");
}
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;
}
@ -107,18 +111,14 @@ namespace OpenSim.Region.Environment.Scenes.Scripting
ScriptEngineInterface ret;
//try
//{
ret = (ScriptEngineInterface)Activator.CreateInstance(t);
ret = (ScriptEngineInterface) Activator.CreateInstance(t);
//}
//catch (Exception e)
//{
// m_log.Error("ScriptEngine", "Error initializing type \"" + NameSpace + "\" from \"" + FileName + "\": " + e.ToString());
//}
return ret;
}
return ret;
}
}
}
}

View File

@ -1,15 +1,7 @@
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 OpenSim.Framework.Console;
using OpenSim.Region.Environment.Interfaces;
namespace OpenSim.Region.Environment
{
@ -19,10 +11,7 @@ namespace OpenSim.Region.Environment
public IRegionDataStore DataStore
{
get
{
return m_dataStore;
}
get { return m_dataStore; }
}
public StorageManager(IRegionDataStore storage)
@ -32,7 +21,7 @@ namespace OpenSim.Region.Environment
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);
foreach (Type pluginType in pluginAssembly.GetTypes())
@ -43,12 +32,13 @@ namespace OpenSim.Region.Environment
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);
m_dataStore = plug;
OpenSim.Framework.Console.MainLog.Instance.Verbose("DATASTORE", "Added IRegionDataStore Interface");
MainLog.Instance.Verbose("DATASTORE", "Added IRegionDataStore Interface");
}
typeInterface = null;
@ -60,4 +50,4 @@ namespace OpenSim.Region.Environment
//TODO: Add checking and warning to make sure it initialised.
}
}
}
}

View File

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

View File

@ -1,9 +1,7 @@
using System;
using System.Collections.Generic;
using System.Text;
using OpenSim.Region.Environment.Scenes;
using libsecondlife;
using System.Collections.Generic;
using libsecondlife;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Types
{
public class UpdateQueue
@ -48,7 +46,6 @@ namespace OpenSim.Region.Environment.Types
}
return part;
}
}
}
}
}

View File

@ -25,22 +25,21 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
using System.Collections.Generic;
using OpenSim.Framework.Console;
using OpenSim.Region.Environment;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.ExtensionsScriptModule.CSharp;
using OpenSim.Region.ExtensionsScriptModule.JScript;
using OpenSim.Region.ExtensionsScriptModule.JVMEngine;
using System.Collections.Generic;
using OpenSim.Framework.Console;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.ExtensionsScriptModule.CSharp;
using OpenSim.Region.ExtensionsScriptModule.JScript;
using OpenSim.Region.ExtensionsScriptModule.JVMEngine;
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;
Dictionary<string, IScriptCompiler> compilers = new Dictionary<string, IScriptCompiler>();
readonly Dictionary<string, IScriptCompiler> compilers = new Dictionary<string, IScriptCompiler>();
private void LoadFromCompiler(Dictionary<string, IScript> compiledscripts)
{
@ -65,15 +64,17 @@ namespace OpenSim.Region.ExtensionsScriptModule
JavaEngine javaCompiler = new JavaEngine();
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)
{
System.Console.WriteLine("Initialising Extensions Scripting Module");
m_scene = scene;
m_scene.RegisterAPIMethod("API_CompileExtensionScript", new ModuleAPIMethod1<bool, string>(Compile));
m_scene.RegisterAPIMethod("API_AddExtensionScript", new ModuleAPIMethod1<bool, IScript>(AddPreCompiledScript));
m_scene = scene;
m_scene.RegisterModuleInterface<IExtensionScriptModule>(this);
}
public void PostInitialise()
@ -133,6 +134,12 @@ namespace OpenSim.Region.ExtensionsScriptModule
return true;
}
}
public interface IExtensionScriptModule
{
bool Compile(string filename);
bool AddPreCompiledScript(IScript script);
}
interface IScriptCompiler