* 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>
@ -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,29 +192,35 @@ 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)));
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));
@ -224,16 +229,17 @@ namespace OpenSim.Region.Environment
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();
}
}
@ -246,9 +252,11 @@ 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 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,7 +273,6 @@ 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]);
@ -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)
@ -330,7 +336,7 @@ namespace OpenSim.Region.Environment
for (int i = 0; i < avatars.Count; i++)
{
this.sendRegionInfoPacket(avatars[i].ControllingClient);
sendRegionInfoPacket(avatars[i].ControllingClient);
}
}
@ -340,7 +346,7 @@ namespace OpenSim.Region.Environment
for (int i = 0; i < avatars.Count; i++)
{
this.sendRegionHandshake(avatars[i].ControllingClient);
sendRegionHandshake(avatars[i].ControllingClient);
}
}
@ -379,6 +385,5 @@ namespace OpenSim.Region.Environment
}
#endregion
}
}

View File

@ -1,6 +1,3 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using libsecondlife;
@ -10,8 +7,12 @@ namespace OpenSim.Region.Environment.Interfaces
{
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);
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

View File

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

View File

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

View File

@ -1,12 +1,10 @@
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();

View File

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

View File

@ -1,6 +1,3 @@
using System;
using System.Collections.Generic;
using System.Text;
using OpenSim.Framework.Interfaces;
namespace OpenSim.Region.Environment.Interfaces
@ -10,7 +7,10 @@ namespace OpenSim.Region.Environment.Interfaces
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 ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west,
IClientAPI remoteUser);
void CheckHeightValues();
float[] GetHeights1D();
float[,] GetHeights2D();

View File

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

View File

@ -8,13 +8,16 @@ 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>();
@ -24,21 +27,21 @@ namespace OpenSim.Region.Environment.LandManagement
#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>
@ -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;
@ -101,7 +104,10 @@ namespace OpenSim.Region.Environment.LandManagement
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
{
@ -124,10 +130,14 @@ namespace OpenSim.Region.Environment.LandManagement
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);
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;
@ -137,7 +147,10 @@ namespace OpenSim.Region.Environment.LandManagement
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
{
@ -147,7 +160,8 @@ namespace OpenSim.Region.Environment.LandManagement
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.TotalPrims = landData.ownerPrims + landData.groupPrims + landData.otherPrims +
landData.selectedPrims;
updatePacket.ParcelData.UserLocation = landData.userLocation;
updatePacket.ParcelData.UserLookAt = landData.userLookAt;
remote_client.OutPacket((Packet) updatePacket);
@ -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>
@ -322,12 +343,11 @@ namespace OpenSim.Region.Environment.LandManagement
x = 0;
y++;
}
}
}
return tempConvertMap;
}
/// <summary>
/// Full sim land object creation
/// </summary>
@ -347,7 +367,6 @@ 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];
tempBitmap.Initialize();
@ -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)
{
@ -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);
}
@ -481,8 +504,8 @@ namespace OpenSim.Region.Environment.LandManagement
pack.Data = data;
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,15 +36,15 @@ 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
@ -73,9 +73,11 @@ 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];
@ -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>
@ -227,9 +232,11 @@ namespace OpenSim.Region.Environment.LandManagement
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>
@ -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>
@ -390,7 +396,9 @@ namespace OpenSim.Region.Environment.LandManagement
//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);
@ -440,11 +448,10 @@ namespace OpenSim.Region.Environment.LandManagement
}
}
}
}
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);
}
@ -547,9 +555,10 @@ namespace OpenSim.Region.Environment.LandManagement
p.resetLandPrimCounts();
}
}
public void setPrimsTainted()
{
this.landPrimCountTainted = true;
landPrimCountTainted = true;
}
public void addPrimToLandPrimCounts(SceneObjectGroup obj)
@ -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,17 +1,15 @@
using System;
using System.Collections.Generic;
using System.IO;
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 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>();
@ -19,7 +17,6 @@ namespace OpenSim.Region.Environment
public ModuleLoader()
{
}
/// <summary>
@ -37,23 +34,22 @@ namespace OpenSim.Region.Environment
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;
@ -136,17 +133,16 @@ namespace OpenSim.Region.Environment
}
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,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.Scenes;
namespace OpenSim.Region.Environment.Modules
{
@ -15,7 +10,6 @@ namespace OpenSim.Region.Environment.Modules
public AssetDownloadModule()
{
}
public void Initialise(Scene scene)
@ -26,7 +20,6 @@ namespace OpenSim.Region.Environment.Modules
public void PostInitialise()
{
}
public void CloseDown()

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 OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules
{
public class AvatarProfilesModule : IRegionModule
{
private Scene m_scene;
public AvatarProfilesModule()
{
}
public void Initialise(Scene scene)
@ -26,12 +21,10 @@ 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,16 +1,12 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.IO;
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 OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules
{
@ -128,7 +124,8 @@ 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:",
presence.ControllingClient.SendChatMessage(
Helpers.StringToField(mess), 255, pos, "IRC:",
LLUUID.Zero);
});
}
@ -136,7 +133,8 @@ namespace OpenSim.Region.Environment.Modules
}
}
public void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
public void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName,
LLUUID fromAgentID)
{
ScenePresence avatar = null;
avatar = m_scene.RequestAvatar(fromAgentID);

View File

@ -1,23 +1,20 @@
using System.Text;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using System.IO;
using System;
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 OpenSim.Framework.Utilities;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules
{
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<string, IDynamicTextureRender> RenderPlugins =
new Dictionary<string, IDynamicTextureRender>();
private Dictionary<LLUUID, DynamicTextureUpdater> Updaters = new Dictionary<LLUUID, DynamicTextureUpdater>();
public void Initialise(Scene scene)
@ -31,7 +28,6 @@ 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);
}
@ -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();

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

View File

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

View File

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

View File

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

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,10 +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.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules
{
@ -14,7 +11,6 @@ namespace OpenSim.Region.Environment.Modules
public TextureDownloadModule()
{
}
public void Initialise(Scene scene)
@ -25,7 +21,6 @@ namespace OpenSim.Region.Environment.Modules
public void PostInitialise()
{
}
public void CloseDown()
@ -48,7 +43,6 @@ namespace OpenSim.Region.Environment.Modules
public void TextureAssetCallback(LLUUID texture, byte[] data)
{
}
}
}

View File

@ -1,12 +1,9 @@
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 OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules
{
@ -19,7 +16,6 @@ namespace OpenSim.Region.Environment.Modules
public XferModule()
{
}
public void Initialise(Scene scene)
@ -32,12 +28,10 @@ namespace OpenSim.Region.Environment.Modules
public void PostInitialise()
{
}
public void CloseDown()
{
}
public string GetName()
@ -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);
}
@ -126,7 +120,6 @@ namespace OpenSim.Region.Environment.Modules
public XferDownLoad()
{
}
public void StartSend()

View File

@ -1,13 +1,6 @@
using System.Collections.Generic;
using OpenSim.Framework;
using OpenSim.Framework.Types;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Servers;
using OpenSim.Region.Capabilities;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.LandManagement;
using libsecondlife;
using OpenSim.Region.Environment.LandManagement;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment
{
@ -20,6 +13,7 @@ namespace OpenSim.Region.Environment
// TODO: Change this to false when permissions are a desired default
// TODO: Move to configuration option.
private bool m_bypassPermissions = true;
public bool BypassPermissions
{
get { return m_bypassPermissions; }
@ -123,7 +117,8 @@ namespace OpenSim.Region.Environment
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
@ -300,6 +295,5 @@ namespace OpenSim.Region.Environment
}
#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,7 +1,6 @@
using System.Collections.Generic;
using Axiom.Math;
using libsecondlife;
using OpenSim.Region.Environment.Scenes.Scripting;
namespace OpenSim.Region.Environment.Scenes
{
@ -12,19 +11,15 @@ namespace OpenSim.Region.Environment.Scenes
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; }

View File

@ -1,12 +1,10 @@
using System;
using System.IO;
using System.Collections.Generic;
using Axiom.Math;
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.Interfaces;
using OpenSim.Framework.Types;
using OpenSim.Framework.Utilities;
using OpenSim.Region.Physics.Manager;
@ -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;
}
@ -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;
@ -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);
}
}
@ -201,7 +205,7 @@ namespace OpenSim.Region.Environment.Scenes
bool fileChange = ((SceneObjectGroup) ent).GetPartInventoryFileName(remoteClient, primLocalID);
if (fileChange)
{
if (this.XferManager != null)
if (XferManager != null)
{
((SceneObjectGroup) ent).RequestInventoryFile(primLocalID, XferManager);
}
@ -226,7 +230,7 @@ namespace OpenSim.Region.Environment.Scenes
((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;
}
}
@ -281,8 +285,9 @@ namespace OpenSim.Region.Environment.Scenes
hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
if (hasPrim != false)
{
bool added = ((SceneObjectGroup)ent).AddInventoryItem(remoteClient, localID, item, copyID);
bool added =
((SceneObjectGroup) ent).AddInventoryItem(remoteClient, localID, item,
copyID);
((SceneObjectGroup) ent).GetProperites(remoteClient);
}
}
@ -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)
{
@ -330,7 +335,8 @@ namespace OpenSim.Region.Environment.Scenes
{
AssetBase asset = new AssetBase();
asset.Name = ((SceneObjectGroup) selectedEnt).GetPartName(selectedEnt.LocalId);
asset.Description = ((SceneObjectGroup)selectedEnt).GetPartDescription(selectedEnt.LocalId);
asset.Description =
((SceneObjectGroup) selectedEnt).GetPartDescription(selectedEnt.LocalId);
asset.InvType = 6;
asset.Type = 6;
asset.FullID = LLUUID.Random();
@ -355,14 +361,16 @@ 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);
storageManager.DataStore.RemoveObject(((SceneObjectGroup) selectedEnt).UUID,
m_regInfo.SimUUID);
((SceneObjectGroup) selectedEnt).DeleteGroup();
lock (Entities)
@ -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)
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,
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)
{
@ -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>
@ -250,7 +246,7 @@ namespace OpenSim.Region.Environment.Scenes
{
((SceneObjectGroup) ent).GetProperites(remoteClient);
((SceneObjectGroup) ent).IsSelected = true;
this.LandManager.setPrimsTainted();
LandManager.setPrimsTainted();
break;
}
}
@ -271,7 +267,7 @@ namespace OpenSim.Region.Environment.Scenes
if (((SceneObjectGroup) ent).LocalId == primLocalID)
{
((SceneObjectGroup) ent).IsSelected = false;
this.LandManager.setPrimsTainted();
LandManager.setPrimsTainted();
break;
}
}
@ -350,7 +346,6 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="remoteClient"></param>
public void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient)
{
}
/// <summary>
@ -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,27 +27,27 @@
*/
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;
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);
@ -310,7 +315,8 @@ namespace OpenSim.Region.Environment.Scenes
{
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)
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,
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,9 +561,10 @@ 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
@ -573,8 +574,10 @@ namespace OpenSim.Region.Environment.Scenes
}
// 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());
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());
}
}
@ -595,14 +598,14 @@ 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)
@ -648,7 +651,7 @@ 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);
@ -656,9 +659,10 @@ namespace OpenSim.Region.Environment.Scenes
SceneObjectPart rootPart = obj.GetChildPart(obj.UUID);
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,
new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
rootPart.RotationOffset.Y, rootPart.RotationOffset.Z));
primCount++;
}
@ -688,7 +692,6 @@ namespace OpenSim.Region.Environment.Scenes
file.Close();
}
#endregion
#region Add/Remove Avatar Methods
@ -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);
@ -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);
@ -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);
}
}
@ -999,11 +1006,15 @@ 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 " +
@ -1142,33 +1153,15 @@ 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);
}
@ -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,11 +1252,12 @@ 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)
{
@ -1274,7 +1269,7 @@ namespace OpenSim.Region.Environment.Scenes
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)
{
@ -1283,7 +1278,9 @@ namespace OpenSim.Region.Environment.Scenes
{
if (part.Name == cmmdparams[0])
{
part.Resize( new LLVector3(Convert.ToSingle(cmmdparams[1]), Convert.ToSingle(cmmdparams[2]), Convert.ToSingle(cmmdparams[3])));
part.Resize(
new LLVector3(Convert.ToSingle(cmmdparams[1]), Convert.ToSingle(cmmdparams[2]),
Convert.ToSingle(cmmdparams[3])));
Console.WriteLine("Edited scale of Primitive: " + part.Name);
}
@ -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())
{
@ -1343,13 +1342,16 @@ namespace OpenSim.Region.Environment.Scenes
}
#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)

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)

View File

@ -1,5 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using OpenSim.Framework.Console;
using OpenSim.Framework.Types;
@ -9,12 +9,10 @@ namespace OpenSim.Region.Environment.Scenes
{
private readonly List<Scene> m_localScenes;
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)
@ -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); });
}
}
}

View File

@ -1,17 +1,16 @@
using System;
using System.Collections.Generic;
using System.IO;
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.Data;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Types;
using OpenSim.Region.Physics.Manager;
using OpenSim.Framework.Data;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Physics.Manager;
namespace OpenSim.Region.Environment.Scenes
{
@ -31,6 +30,7 @@ namespace OpenSim.Region.Environment.Scenes
public bool HasChanged = false;
#region Properties
/// <summary>
///
/// </summary>
@ -54,13 +54,13 @@ namespace OpenSim.Region.Environment.Scenes
public Dictionary<LLUUID, SceneObjectPart> Children
{
get { return this.m_parts; }
get { return m_parts; }
set { m_parts = value; }
}
public SceneObjectPart RootPart
{
get { return this.m_rootPart; }
get { return m_rootPart; }
set { m_rootPart = value; }
}
@ -70,9 +70,9 @@ namespace OpenSim.Region.Environment.Scenes
set
{
m_regionHandle = value;
lock (this.m_parts)
lock (m_parts)
{
foreach (SceneObjectPart part in this.m_parts.Values)
foreach (SceneObjectPart part in m_parts.Values)
{
part.RegionHandle = m_regionHandle;
}
@ -104,16 +104,18 @@ namespace OpenSim.Region.Environment.Scenes
val.Y = 0.4f;
}
lock (this.m_parts)
lock (m_parts)
{
foreach (SceneObjectPart part in this.m_parts.Values)
foreach (SceneObjectPart part in m_parts.Values)
{
part.GroupPosition = val;
}
}
if (m_rootPart.PhysActor != null)
{
m_rootPart.PhysActor.Position = new PhysicsVector(m_rootPart.GroupPosition.X, m_rootPart.GroupPosition.Y, m_rootPart.GroupPosition.Z);
m_rootPart.PhysActor.Position =
new PhysicsVector(m_rootPart.GroupPosition.X, m_rootPart.GroupPosition.Y,
m_rootPart.GroupPosition.Z);
}
}
}
@ -152,10 +154,7 @@ namespace OpenSim.Region.Environment.Scenes
protected virtual bool InSceneBackup
{
get
{
return true;
}
get { return true; }
}
public bool IsSelected
@ -170,19 +169,22 @@ namespace OpenSim.Region.Environment.Scenes
get
{
if (m_scene != null)
{ return m_scene.RegionInfo.SimUUID; }
{
return m_scene.RegionInfo.SimUUID;
}
return LLUUID.Zero;
}
}
#endregion
#region Constructors
/// <summary>
///
/// </summary>
public SceneObjectGroup()
{
}
/// <summary>
@ -198,7 +200,7 @@ namespace OpenSim.Region.Environment.Scenes
reader.Read();
reader.ReadStartElement("SceneObjectGroup");
reader.ReadStartElement("RootPart");
this.m_rootPart = SceneObjectPart.FromXml(reader);
m_rootPart = SceneObjectPart.FromXml(reader);
reader.ReadEndElement();
while (reader.Read())
@ -211,7 +213,7 @@ namespace OpenSim.Region.Environment.Scenes
reader.Read();
SceneObjectPart Part = SceneObjectPart.FromXml(reader);
Part.LocalID = m_scene.PrimIDAllocate();
this.AddPart(Part);
AddPart(Part);
Part.RegionHandle = m_regionHandle;
}
break;
@ -221,23 +223,23 @@ namespace OpenSim.Region.Environment.Scenes
}
reader.Close();
sr.Close();
this.m_rootPart.SetParent(this);
this.m_parts.Add(m_rootPart.UUID, m_rootPart);
this.m_rootPart.LocalID = m_scene.PrimIDAllocate();
this.m_rootPart.ParentID = 0;
this.m_rootPart.RegionHandle = m_regionHandle;
this.UpdateParentIDs();
m_rootPart.SetParent(this);
m_parts.Add(m_rootPart.UUID, m_rootPart);
m_rootPart.LocalID = m_scene.PrimIDAllocate();
m_rootPart.ParentID = 0;
m_rootPart.RegionHandle = m_regionHandle;
UpdateParentIDs();
AttachToBackup();
this.ScheduleGroupForFullUpdate();
ScheduleGroupForFullUpdate();
}
private void AttachToBackup()
{
if (InSceneBackup)
{
m_scene.EventManager.OnBackup += this.ProcessBackup;
m_scene.EventManager.OnBackup += ProcessBackup;
}
}
@ -246,25 +248,27 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary>
public SceneObjectGroup(byte[] data)
{
}
/// <summary>
///
/// </summary>
public SceneObjectGroup(Scene scene, ulong regionHandle, LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape)
public SceneObjectGroup(Scene scene, ulong regionHandle, LLUUID ownerID, uint localID, LLVector3 pos,
PrimitiveBaseShape shape)
{
m_regionHandle = regionHandle;
m_scene = scene;
// this.Pos = pos;
LLVector3 rootOffset = new LLVector3(0, 0, 0);
SceneObjectPart newPart = new SceneObjectPart(m_regionHandle, this, ownerID, localID, shape, pos, rootOffset);
this.m_parts.Add(newPart.UUID, newPart);
this.SetPartAsRoot(newPart);
SceneObjectPart newPart =
new SceneObjectPart(m_regionHandle, this, ownerID, localID, shape, pos, rootOffset);
m_parts.Add(newPart.UUID, newPart);
SetPartAsRoot(newPart);
AttachToBackup();
}
#endregion
public string ToXmlString()
@ -276,9 +280,9 @@ namespace OpenSim.Region.Environment.Scenes
m_rootPart.ToXml(writer);
writer.WriteEndElement();
writer.WriteStartElement(String.Empty, "OtherParts", String.Empty);
foreach (SceneObjectPart part in this.m_parts.Values)
foreach (SceneObjectPart part in m_parts.Values)
{
if (part.UUID != this.m_rootPart.UUID)
if (part.UUID != m_rootPart.UUID)
{
writer.WriteStartElement(String.Empty, "Part", String.Empty);
part.ToXml(writer);
@ -292,35 +296,36 @@ namespace OpenSim.Region.Environment.Scenes
}
#region Copying
/// <summary>
///
/// </summary>
/// <returns></returns>
public new SceneObjectGroup Copy()
{
SceneObjectGroup dupe = (SceneObjectGroup)this.MemberwiseClone();
SceneObjectGroup dupe = (SceneObjectGroup) MemberwiseClone();
dupe.m_parts = new Dictionary<LLUUID, SceneObjectPart>();
dupe.m_parts.Clear();
dupe.AbsolutePosition = new LLVector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z);
dupe.m_scene = m_scene;
dupe.m_regionHandle = this.m_regionHandle;
dupe.CopyRootPart(this.m_rootPart);
dupe.m_regionHandle = m_regionHandle;
dupe.CopyRootPart(m_rootPart);
/// may need to create a new Physics actor.
if (dupe.RootPart.PhysActor != null)
{
dupe.RootPart.PhysActor = m_scene.phyScene.AddPrim(
new PhysicsVector(dupe.RootPart.AbsolutePosition.X, dupe.RootPart.AbsolutePosition.Y, dupe.RootPart.AbsolutePosition.Z),
new PhysicsVector(dupe.RootPart.AbsolutePosition.X, dupe.RootPart.AbsolutePosition.Y,
dupe.RootPart.AbsolutePosition.Z),
new PhysicsVector(dupe.RootPart.Scale.X, dupe.RootPart.Scale.Y, dupe.RootPart.Scale.Z),
new Axiom.Math.Quaternion(dupe.RootPart.RotationOffset.W, dupe.RootPart.RotationOffset.X,
new Quaternion(dupe.RootPart.RotationOffset.W, dupe.RootPart.RotationOffset.X,
dupe.RootPart.RotationOffset.Y, dupe.RootPart.RotationOffset.Z));
}
List<SceneObjectPart> partList = new List<SceneObjectPart>(this.m_parts.Values);
List<SceneObjectPart> partList = new List<SceneObjectPart>(m_parts.Values);
foreach (SceneObjectPart part in partList)
{
if (part.UUID != this.m_rootPart.UUID)
if (part.UUID != m_rootPart.UUID)
{
dupe.CopyPart(part);
}
@ -340,8 +345,8 @@ namespace OpenSim.Region.Environment.Scenes
{
SceneObjectPart newPart = part.Copy(m_scene.PrimIDAllocate());
newPart.SetParent(this);
this.m_parts.Add(newPart.UUID, newPart);
this.SetPartAsRoot(newPart);
m_parts.Add(newPart.UUID, newPart);
SetPartAsRoot(newPart);
}
/// <summary>
@ -352,18 +357,20 @@ namespace OpenSim.Region.Environment.Scenes
{
SceneObjectPart newPart = part.Copy(m_scene.PrimIDAllocate());
newPart.SetParent(this);
this.m_parts.Add(newPart.UUID, newPart);
this.SetPartAsNonRoot(newPart);
m_parts.Add(newPart.UUID, newPart);
SetPartAsNonRoot(newPart);
}
#endregion
#region Scheduling
/// <summary>
///
/// </summary>
public override void Update()
{
foreach (SceneObjectPart part in this.m_parts.Values)
foreach (SceneObjectPart part in m_parts.Values)
{
part.SendScheduledUpdates();
}
@ -371,7 +378,7 @@ namespace OpenSim.Region.Environment.Scenes
public void ScheduleFullUpdateToAvatar(ScenePresence presence)
{
foreach (SceneObjectPart part in this.m_parts.Values)
foreach (SceneObjectPart part in m_parts.Values)
{
part.AddFullUpdateToAvatar(presence);
}
@ -379,7 +386,7 @@ namespace OpenSim.Region.Environment.Scenes
public void ScheduleTerseUpdateToAvatar(ScenePresence presence)
{
foreach (SceneObjectPart part in this.m_parts.Values)
foreach (SceneObjectPart part in m_parts.Values)
{
part.AddTerseUpdateToAvatar(presence);
}
@ -391,7 +398,7 @@ namespace OpenSim.Region.Environment.Scenes
public void ScheduleGroupForFullUpdate()
{
HasChanged = true;
foreach (SceneObjectPart part in this.m_parts.Values)
foreach (SceneObjectPart part in m_parts.Values)
{
part.ScheduleFullUpdate();
}
@ -403,7 +410,7 @@ namespace OpenSim.Region.Environment.Scenes
public void ScheduleGroupForTerseUpdate()
{
HasChanged = true;
foreach (SceneObjectPart part in this.m_parts.Values)
foreach (SceneObjectPart part in m_parts.Values)
{
part.ScheduleTerseUpdate();
}
@ -415,7 +422,7 @@ namespace OpenSim.Region.Environment.Scenes
public void SendGroupFullUpdate()
{
HasChanged = true;
foreach (SceneObjectPart part in this.m_parts.Values)
foreach (SceneObjectPart part in m_parts.Values)
{
part.SendFullUpdateToAllClients();
}
@ -427,7 +434,7 @@ namespace OpenSim.Region.Environment.Scenes
public void SendGroupTerseUpdate()
{
HasChanged = true;
foreach (SceneObjectPart part in this.m_parts.Values)
foreach (SceneObjectPart part in m_parts.Values)
{
part.SendTerseUpdateToAllClients();
}
@ -436,6 +443,7 @@ namespace OpenSim.Region.Environment.Scenes
#endregion
#region SceneGroupPart Methods
/// <summary>
///
/// </summary>
@ -444,9 +452,9 @@ namespace OpenSim.Region.Environment.Scenes
public SceneObjectPart GetChildPart(LLUUID primID)
{
SceneObjectPart childPart = null;
if (this.m_parts.ContainsKey(primID))
if (m_parts.ContainsKey(primID))
{
childPart = this.m_parts[primID];
childPart = m_parts[primID];
}
return childPart;
}
@ -458,7 +466,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <returns></returns>
public SceneObjectPart GetChildPart(uint localID)
{
foreach (SceneObjectPart part in this.m_parts.Values)
foreach (SceneObjectPart part in m_parts.Values)
{
if (part.LocalID == localID)
{
@ -477,9 +485,9 @@ namespace OpenSim.Region.Environment.Scenes
public bool HasChildPrim(LLUUID primID)
{
SceneObjectPart childPart = null;
if (this.m_parts.ContainsKey(primID))
if (m_parts.ContainsKey(primID))
{
childPart = this.m_parts[primID];
childPart = m_parts[primID];
return true;
}
return false;
@ -493,7 +501,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <returns></returns>
public bool HasChildPrim(uint localID)
{
foreach (SceneObjectPart part in this.m_parts.Values)
foreach (SceneObjectPart part in m_parts.Values)
{
if (part.LocalID == localID)
{
@ -502,9 +510,11 @@ namespace OpenSim.Region.Environment.Scenes
}
return false;
}
#endregion
#region Packet Handlers
/// <summary>
///
/// </summary>
@ -512,21 +522,28 @@ namespace OpenSim.Region.Environment.Scenes
public void LinkToGroup(SceneObjectGroup objectGroup)
{
SceneObjectPart linkPart = objectGroup.m_rootPart;
Axiom.Math.Vector3 oldGroupPosition = new Vector3(linkPart.GroupPosition.X, linkPart.GroupPosition.Y, linkPart.GroupPosition.Z);
Axiom.Math.Quaternion oldRootRotation = new Quaternion(linkPart.RotationOffset.W, linkPart.RotationOffset.X, linkPart.RotationOffset.Y, linkPart.RotationOffset.Z);
Vector3 oldGroupPosition =
new Vector3(linkPart.GroupPosition.X, linkPart.GroupPosition.Y, linkPart.GroupPosition.Z);
Quaternion oldRootRotation =
new Quaternion(linkPart.RotationOffset.W, linkPart.RotationOffset.X, linkPart.RotationOffset.Y,
linkPart.RotationOffset.Z);
linkPart.OffsetPosition = linkPart.GroupPosition - this.AbsolutePosition;
linkPart.GroupPosition = this.AbsolutePosition;
linkPart.OffsetPosition = linkPart.GroupPosition - AbsolutePosition;
linkPart.GroupPosition = AbsolutePosition;
Vector3 axPos = new Vector3(linkPart.OffsetPosition.X, linkPart.OffsetPosition.Y, linkPart.OffsetPosition.Z);
Quaternion parentRot = new Quaternion(this.m_rootPart.RotationOffset.W, this.m_rootPart.RotationOffset.X, this.m_rootPart.RotationOffset.Y, this.m_rootPart.RotationOffset.Z);
Quaternion parentRot =
new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y,
m_rootPart.RotationOffset.Z);
axPos = parentRot.Inverse()*axPos;
linkPart.OffsetPosition = new LLVector3(axPos.x, axPos.y, axPos.z);
Quaternion oldRot = new Quaternion(linkPart.RotationOffset.W, linkPart.RotationOffset.X, linkPart.RotationOffset.Y, linkPart.RotationOffset.Z);
Quaternion oldRot =
new Quaternion(linkPart.RotationOffset.W, linkPart.RotationOffset.X, linkPart.RotationOffset.Y,
linkPart.RotationOffset.Z);
Quaternion newRot = parentRot.Inverse()*oldRot;
linkPart.RotationOffset = new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w);
linkPart.ParentID = this.m_rootPart.LocalID;
this.m_parts.Add(linkPart.UUID, linkPart);
linkPart.ParentID = m_rootPart.LocalID;
m_parts.Add(linkPart.UUID, linkPart);
linkPart.SetParent(this);
if (linkPart.PhysActor != null)
@ -540,7 +557,7 @@ namespace OpenSim.Region.Environment.Scenes
{
if (part.UUID != objectGroup.m_rootPart.UUID)
{
this.LinkNonRootPart(part, oldGroupPosition, oldRootRotation);
LinkNonRootPart(part, oldGroupPosition, oldRootRotation);
}
}
@ -549,7 +566,7 @@ namespace OpenSim.Region.Environment.Scenes
m_scene.DeleteEntity(objectGroup.UUID);
objectGroup.DeleteParts();
this.ScheduleGroupForFullUpdate();
ScheduleGroupForFullUpdate();
}
private void DetachFromBackup(SceneObjectGroup objectGroup)
@ -561,26 +578,31 @@ namespace OpenSim.Region.Environment.Scenes
private void LinkNonRootPart(SceneObjectPart part, Vector3 oldGroupPosition, Quaternion oldGroupRotation)
{
part.SetParent(this);
part.ParentID = this.m_rootPart.LocalID;
this.m_parts.Add(part.UUID, part);
part.ParentID = m_rootPart.LocalID;
m_parts.Add(part.UUID, part);
Vector3 axiomOldPos = new Vector3(part.OffsetPosition.X, part.OffsetPosition.Y, part.OffsetPosition.Z);
axiomOldPos = oldGroupRotation*axiomOldPos;
axiomOldPos += oldGroupPosition;
LLVector3 oldAbsolutePosition = new LLVector3(axiomOldPos.x, axiomOldPos.y, axiomOldPos.z);
part.OffsetPosition = oldAbsolutePosition - this.AbsolutePosition;
part.OffsetPosition = oldAbsolutePosition - AbsolutePosition;
Quaternion axiomRootRotation = new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y, m_rootPart.RotationOffset.Z);
Quaternion axiomRootRotation =
new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y,
m_rootPart.RotationOffset.Z);
Vector3 axiomPos = new Vector3(part.OffsetPosition.X, part.OffsetPosition.Y, part.OffsetPosition.Z);
axiomPos = axiomRootRotation.Inverse()*axiomPos;
part.OffsetPosition = new LLVector3(axiomPos.x, axiomPos.y, axiomPos.z);
Quaternion axiomPartRotation = new Quaternion(part.RotationOffset.W, part.RotationOffset.X, part.RotationOffset.Y, part.RotationOffset.Z);
Quaternion axiomPartRotation =
new Quaternion(part.RotationOffset.W, part.RotationOffset.X, part.RotationOffset.Y,
part.RotationOffset.Z);
axiomPartRotation = oldGroupRotation*axiomPartRotation;
axiomPartRotation = axiomRootRotation.Inverse()*axiomPartRotation;
part.RotationOffset = new LLQuaternion(axiomPartRotation.x, axiomPartRotation.y, axiomPartRotation.z, axiomPartRotation.w);
part.RotationOffset =
new LLQuaternion(axiomPartRotation.x, axiomPartRotation.y, axiomPartRotation.z, axiomPartRotation.w);
}
/// <summary>
@ -591,8 +613,8 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="remoteClient"></param>
public void GrabMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient)
{
this.AbsolutePosition = pos;
this.m_rootPart.SendTerseUpdateToAllClients();
AbsolutePosition = pos;
m_rootPart.SendTerseUpdateToAllClients();
}
/// <summary>
@ -605,25 +627,25 @@ namespace OpenSim.Region.Environment.Scenes
proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1];
proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock();
proper.ObjectData[0].ItemID = LLUUID.Zero;
proper.ObjectData[0].CreationDate = (ulong)this.m_rootPart.CreationDate;
proper.ObjectData[0].CreatorID = this.m_rootPart.CreatorID;
proper.ObjectData[0].CreationDate = (ulong) m_rootPart.CreationDate;
proper.ObjectData[0].CreatorID = m_rootPart.CreatorID;
proper.ObjectData[0].FolderID = LLUUID.Zero;
proper.ObjectData[0].FromTaskID = LLUUID.Zero;
proper.ObjectData[0].GroupID = LLUUID.Zero;
proper.ObjectData[0].InventorySerial = (short)this.m_rootPart.InventorySerial;
proper.ObjectData[0].LastOwnerID = this.m_rootPart.LastOwnerID;
proper.ObjectData[0].ObjectID = this.UUID;
proper.ObjectData[0].OwnerID = this.m_rootPart.OwnerID;
proper.ObjectData[0].TouchName = enc.GetBytes(this.m_rootPart.TouchName + "\0");
proper.ObjectData[0].InventorySerial = (short) m_rootPart.InventorySerial;
proper.ObjectData[0].LastOwnerID = m_rootPart.LastOwnerID;
proper.ObjectData[0].ObjectID = UUID;
proper.ObjectData[0].OwnerID = m_rootPart.OwnerID;
proper.ObjectData[0].TouchName = enc.GetBytes(m_rootPart.TouchName + "\0");
proper.ObjectData[0].TextureID = new byte[0];
proper.ObjectData[0].SitName = enc.GetBytes(this.m_rootPart.SitName + "\0");
proper.ObjectData[0].Name = enc.GetBytes(this.m_rootPart.Name + "\0");
proper.ObjectData[0].Description = enc.GetBytes(this.m_rootPart.Description + "\0");
proper.ObjectData[0].OwnerMask = this.m_rootPart.OwnerMask;
proper.ObjectData[0].NextOwnerMask = this.m_rootPart.NextOwnerMask;
proper.ObjectData[0].GroupMask = this.m_rootPart.GroupMask;
proper.ObjectData[0].EveryoneMask = this.m_rootPart.EveryoneMask;
proper.ObjectData[0].BaseMask = this.m_rootPart.BaseMask;
proper.ObjectData[0].SitName = enc.GetBytes(m_rootPart.SitName + "\0");
proper.ObjectData[0].Name = enc.GetBytes(m_rootPart.Name + "\0");
proper.ObjectData[0].Description = enc.GetBytes(m_rootPart.Description + "\0");
proper.ObjectData[0].OwnerMask = m_rootPart.OwnerMask;
proper.ObjectData[0].NextOwnerMask = m_rootPart.NextOwnerMask;
proper.ObjectData[0].GroupMask = m_rootPart.GroupMask;
proper.ObjectData[0].EveryoneMask = m_rootPart.EveryoneMask;
proper.ObjectData[0].BaseMask = m_rootPart.BaseMask;
client.OutPacket(proper);
}
@ -635,7 +657,7 @@ namespace OpenSim.Region.Environment.Scenes
public void SetPartName(string name, uint localID)
{
name = name.Remove(name.Length - 1, 1);
SceneObjectPart part = this.GetChildPart(localID);
SceneObjectPart part = GetChildPart(localID);
if (part != null)
{
part.Name = name;
@ -644,7 +666,7 @@ namespace OpenSim.Region.Environment.Scenes
public void SetPartDescription(string des, uint localID)
{
SceneObjectPart part = this.GetChildPart(localID);
SceneObjectPart part = GetChildPart(localID);
if (part != null)
{
part.Description = des;
@ -653,7 +675,7 @@ namespace OpenSim.Region.Environment.Scenes
public void SetPartText(string text, uint localID)
{
SceneObjectPart part = this.GetChildPart(localID);
SceneObjectPart part = GetChildPart(localID);
if (part != null)
{
part.Text = text;
@ -662,7 +684,7 @@ namespace OpenSim.Region.Environment.Scenes
public void SetPartText(string text, LLUUID partID)
{
SceneObjectPart part = this.GetChildPart(partID);
SceneObjectPart part = GetChildPart(partID);
if (part != null)
{
part.Text = text;
@ -671,7 +693,7 @@ namespace OpenSim.Region.Environment.Scenes
public string GetPartName(uint localID)
{
SceneObjectPart part = this.GetChildPart(localID);
SceneObjectPart part = GetChildPart(localID);
if (part != null)
{
return part.Name;
@ -681,7 +703,7 @@ namespace OpenSim.Region.Environment.Scenes
public string GetPartDescription(uint localID)
{
SceneObjectPart part = this.GetChildPart(localID);
SceneObjectPart part = GetChildPart(localID);
if (part != null)
{
return part.Description;
@ -696,7 +718,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="localID"></param>
public bool GetPartInventoryFileName(IClientAPI remoteClient, uint localID)
{
SceneObjectPart part = this.GetChildPart(localID);
SceneObjectPart part = GetChildPart(localID);
if (part != null)
{
return part.GetInventoryFileName(remoteClient, localID);
@ -706,7 +728,7 @@ namespace OpenSim.Region.Environment.Scenes
public string RequestInventoryFile(uint localID, IXfer xferManager)
{
SceneObjectPart part = this.GetChildPart(localID);
SceneObjectPart part = GetChildPart(localID);
if (part != null)
{
part.RequestInventoryFile(xferManager);
@ -716,7 +738,7 @@ namespace OpenSim.Region.Environment.Scenes
public bool AddInventoryItem(IClientAPI remoteClient, uint localID, InventoryItemBase item)
{
SceneObjectPart part = this.GetChildPart(localID);
SceneObjectPart part = GetChildPart(localID);
if (part != null)
{
SceneObjectPart.TaskInventoryItem taskItem = new SceneObjectPart.TaskInventoryItem();
@ -732,14 +754,13 @@ namespace OpenSim.Region.Environment.Scenes
return true;
}
return false;
}
public bool AddInventoryItem(IClientAPI remoteClient, uint localID, InventoryItemBase item, LLUUID copyItemID)
{
if (copyItemID != LLUUID.Zero)
{
SceneObjectPart part = this.GetChildPart(localID);
SceneObjectPart part = GetChildPart(localID);
if (part != null)
{
SceneObjectPart.TaskInventoryItem taskItem = new SceneObjectPart.TaskInventoryItem();
@ -764,7 +785,7 @@ namespace OpenSim.Region.Environment.Scenes
public int RemoveInventoryItem(IClientAPI remoteClient, uint localID, LLUUID itemID)
{
SceneObjectPart part = this.GetChildPart(localID);
SceneObjectPart part = GetChildPart(localID);
if (part != null)
{
return part.RemoveInventoryItem(remoteClient, localID, itemID);
@ -781,7 +802,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="data"></param>
public void UpdateExtraParam(uint localID, ushort type, bool inUse, byte[] data)
{
SceneObjectPart part = this.GetChildPart(localID);
SceneObjectPart part = GetChildPart(localID);
if (part != null)
{
part.UpdateExtraParam(type, inUse, data);
@ -795,30 +816,34 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="textureEntry"></param>
public void UpdateTextureEntry(uint localID, byte[] textureEntry)
{
SceneObjectPart part = this.GetChildPart(localID);
SceneObjectPart part = GetChildPart(localID);
if (part != null)
{
part.UpdateTextureEntry(textureEntry);
}
}
#endregion
#region Shape
/// <summary>
///
/// </summary>
/// <param name="shapeBlock"></param>
public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock, uint localID)
{
SceneObjectPart part = this.GetChildPart(localID);
SceneObjectPart part = GetChildPart(localID);
if (part != null)
{
part.UpdateShape(shapeBlock);
}
}
#endregion
#region Resize
/// <summary>
///
/// </summary>
@ -826,30 +851,33 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="localID"></param>
public void Resize(LLVector3 scale, uint localID)
{
SceneObjectPart part = this.GetChildPart(localID);
SceneObjectPart part = GetChildPart(localID);
if (part != null)
{
part.Resize(scale);
if (part.UUID == this.m_rootPart.UUID)
if (part.UUID == m_rootPart.UUID)
{
if (m_rootPart.PhysActor != null)
{
m_rootPart.PhysActor.Size = new PhysicsVector(m_rootPart.Scale.X, m_rootPart.Scale.Y, m_rootPart.Scale.Z);
m_rootPart.PhysActor.Size =
new PhysicsVector(m_rootPart.Scale.X, m_rootPart.Scale.Y, m_rootPart.Scale.Z);
}
}
}
}
#endregion
#region Position
/// <summary>
///
/// </summary>
/// <param name="pos"></param>
public void UpdateGroupPosition(LLVector3 pos)
{
this.AbsolutePosition = pos;
this.ScheduleGroupForTerseUpdate();
AbsolutePosition = pos;
ScheduleGroupForTerseUpdate();
}
/// <summary>
@ -859,12 +887,12 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="localID"></param>
public void UpdateSinglePosition(LLVector3 pos, uint localID)
{
SceneObjectPart part = this.GetChildPart(localID);
SceneObjectPart part = GetChildPart(localID);
if (part != null)
{
if (part.UUID == this.m_rootPart.UUID)
if (part.UUID == m_rootPart.UUID)
{
this.UpdateRootPosition(pos);
UpdateRootPosition(pos);
}
else
{
@ -880,40 +908,49 @@ namespace OpenSim.Region.Environment.Scenes
private void UpdateRootPosition(LLVector3 pos)
{
LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z);
LLVector3 oldPos = new LLVector3(this.AbsolutePosition.X + this.m_rootPart.OffsetPosition.X, this.AbsolutePosition.Y + this.m_rootPart.OffsetPosition.Y, this.AbsolutePosition.Z + this.m_rootPart.OffsetPosition.Z);
LLVector3 oldPos =
new LLVector3(AbsolutePosition.X + m_rootPart.OffsetPosition.X,
AbsolutePosition.Y + m_rootPart.OffsetPosition.Y,
AbsolutePosition.Z + m_rootPart.OffsetPosition.Z);
LLVector3 diff = oldPos - newPos;
Axiom.Math.Vector3 axDiff = new Vector3(diff.X, diff.Y, diff.Z);
Axiom.Math.Quaternion partRotation = new Quaternion(this.m_rootPart.RotationOffset.W, this.m_rootPart.RotationOffset.X, this.m_rootPart.RotationOffset.Y, this.m_rootPart.RotationOffset.Z);
Vector3 axDiff = new Vector3(diff.X, diff.Y, diff.Z);
Quaternion partRotation =
new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y,
m_rootPart.RotationOffset.Z);
axDiff = partRotation.Inverse()*axDiff;
diff.X = axDiff.x;
diff.Y = axDiff.y;
diff.Z = axDiff.z;
foreach (SceneObjectPart obPart in this.m_parts.Values)
foreach (SceneObjectPart obPart in m_parts.Values)
{
if (obPart.UUID != this.m_rootPart.UUID)
if (obPart.UUID != m_rootPart.UUID)
{
obPart.OffsetPosition = obPart.OffsetPosition + diff;
}
}
this.AbsolutePosition = newPos;
this.ScheduleGroupForTerseUpdate();
AbsolutePosition = newPos;
ScheduleGroupForTerseUpdate();
}
#endregion
#region Rotation
/// <summary>
///
/// </summary>
/// <param name="rot"></param>
public void UpdateGroupRotation(LLQuaternion rot)
{
this.m_rootPart.UpdateRotation(rot);
m_rootPart.UpdateRotation(rot);
if (m_rootPart.PhysActor != null)
{
m_rootPart.PhysActor.Orientation = new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y, m_rootPart.RotationOffset.Z);
m_rootPart.PhysActor.Orientation =
new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y,
m_rootPart.RotationOffset.Z);
}
this.ScheduleGroupForTerseUpdate();
ScheduleGroupForTerseUpdate();
}
/// <summary>
@ -923,13 +960,15 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="rot"></param>
public void UpdateGroupRotation(LLVector3 pos, LLQuaternion rot)
{
this.m_rootPart.UpdateRotation(rot);
m_rootPart.UpdateRotation(rot);
if (m_rootPart.PhysActor != null)
{
m_rootPart.PhysActor.Orientation = new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y, m_rootPart.RotationOffset.Z);
m_rootPart.PhysActor.Orientation =
new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y,
m_rootPart.RotationOffset.Z);
}
this.AbsolutePosition = pos;
this.ScheduleGroupForTerseUpdate();
AbsolutePosition = pos;
ScheduleGroupForTerseUpdate();
}
/// <summary>
@ -939,12 +978,12 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="localID"></param>
public void UpdateSingleRotation(LLQuaternion rot, uint localID)
{
SceneObjectPart part = this.GetChildPart(localID);
SceneObjectPart part = GetChildPart(localID);
if (part != null)
{
if (part.UUID == this.m_rootPart.UUID)
if (part.UUID == m_rootPart.UUID)
{
this.UpdateRootRotation(rot);
UpdateRootRotation(rot);
}
else
{
@ -959,40 +998,48 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="rot"></param>
private void UpdateRootRotation(LLQuaternion rot)
{
Axiom.Math.Quaternion axRot = new Quaternion(rot.W, rot.X, rot.Y, rot.Z);
Axiom.Math.Quaternion oldParentRot = new Quaternion(this.m_rootPart.RotationOffset.W, this.m_rootPart.RotationOffset.X, this.m_rootPart.RotationOffset.Y, this.m_rootPart.RotationOffset.Z);
Quaternion axRot = new Quaternion(rot.W, rot.X, rot.Y, rot.Z);
Quaternion oldParentRot =
new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y,
m_rootPart.RotationOffset.Z);
this.m_rootPart.UpdateRotation(rot);
m_rootPart.UpdateRotation(rot);
if (m_rootPart.PhysActor != null)
{
m_rootPart.PhysActor.Orientation = new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y, m_rootPart.RotationOffset.Z);
m_rootPart.PhysActor.Orientation =
new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y,
m_rootPart.RotationOffset.Z);
}
foreach (SceneObjectPart prim in this.m_parts.Values)
foreach (SceneObjectPart prim in m_parts.Values)
{
if (prim.UUID != this.m_rootPart.UUID)
if (prim.UUID != m_rootPart.UUID)
{
Vector3 axPos = new Vector3(prim.OffsetPosition.X, prim.OffsetPosition.Y, prim.OffsetPosition.Z);
axPos = oldParentRot*axPos;
axPos = axRot.Inverse()*axPos;
prim.OffsetPosition = new LLVector3(axPos.x, axPos.y, axPos.z);
Axiom.Math.Quaternion primsRot = new Quaternion(prim.RotationOffset.W, prim.RotationOffset.X, prim.RotationOffset.Y, prim.RotationOffset.Z);
Axiom.Math.Quaternion newRot = oldParentRot * primsRot;
Quaternion primsRot =
new Quaternion(prim.RotationOffset.W, prim.RotationOffset.X, prim.RotationOffset.Y,
prim.RotationOffset.Z);
Quaternion newRot = oldParentRot*primsRot;
newRot = axRot.Inverse()*newRot;
prim.RotationOffset = new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w);
prim.ScheduleTerseUpdate();
}
}
this.m_rootPart.ScheduleTerseUpdate();
m_rootPart.ScheduleTerseUpdate();
}
#endregion
/// <summary>
///
/// </summary>
/// <param name="part"></param>
private void SetPartAsRoot(SceneObjectPart part)
{
this.m_rootPart = part;
m_rootPart = part;
}
/// <summary>
@ -1001,7 +1048,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="part"></param>
private void SetPartAsNonRoot(SceneObjectPart part)
{
part.ParentID = this.m_rootPart.LocalID;
part.ParentID = m_rootPart.LocalID;
}
/// <summary>
@ -1014,6 +1061,7 @@ namespace OpenSim.Region.Environment.Scenes
}
#region Events
/// <summary>
///
/// </summary>
@ -1021,7 +1069,7 @@ namespace OpenSim.Region.Environment.Scenes
{
if (OnPrimCountTainted != null)
{
this.OnPrimCountTainted();
OnPrimCountTainted();
}
}
@ -1029,7 +1077,7 @@ namespace OpenSim.Region.Environment.Scenes
/// Processes backup
/// </summary>
/// <param name="datastore"></param>
public void ProcessBackup(OpenSim.Region.Environment.Interfaces.IRegionDataStore datastore)
public void ProcessBackup(IRegionDataStore datastore)
{
if (HasChanged)
{
@ -1037,16 +1085,18 @@ namespace OpenSim.Region.Environment.Scenes
HasChanged = false;
}
}
#endregion
#region Client Updating
public void SendFullUpdateToClient(IClientAPI remoteClient)
{
lock (this.m_parts)
lock (m_parts)
{
foreach (SceneObjectPart part in this.m_parts.Values)
foreach (SceneObjectPart part in m_parts.Values)
{
this.SendPartFullUpdate(remoteClient, part);
SendPartFullUpdate(remoteClient, part);
}
}
}
@ -1084,6 +1134,7 @@ namespace OpenSim.Region.Environment.Scenes
part.SendTerseUpdateToClient(remoteClient);
}
}
#endregion
public override void UpdateMovement()
@ -1114,7 +1165,7 @@ namespace OpenSim.Region.Environment.Scenes
public void AddPart(SceneObjectPart part)
{
part.SetParent(this);
this.m_parts.Add(part.UUID, part);
m_parts.Add(part.UUID, part);
}
/// <summary>
@ -1122,18 +1173,18 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary>
public void UpdateParentIDs()
{
foreach (SceneObjectPart part in this.m_parts.Values)
foreach (SceneObjectPart part in m_parts.Values)
{
if (part.UUID != this.m_rootPart.UUID)
if (part.UUID != m_rootPart.UUID)
{
part.ParentID = this.m_rootPart.LocalID;
part.ParentID = m_rootPart.LocalID;
}
}
}
public void RegenerateFullIDs()
{
foreach (SceneObjectPart part in this.m_parts.Values)
foreach (SceneObjectPart part in m_parts.Values)
{
part.UUID = LLUUID.Random();
}
@ -1141,7 +1192,7 @@ namespace OpenSim.Region.Environment.Scenes
public LLUUID GetPartsFullID(uint localID)
{
SceneObjectPart part = this.GetChildPart(localID);
SceneObjectPart part = GetChildPart(localID);
if (part != null)
{
return part.UUID;
@ -1175,26 +1226,25 @@ namespace OpenSim.Region.Environment.Scenes
public virtual void OnGrabGroup(LLVector3 offsetPos, IClientAPI remoteClient)
{
}
public void DeleteGroup()
{
DetachFromBackup(this);
foreach (SceneObjectPart part in this.m_parts.Values)
foreach (SceneObjectPart part in m_parts.Values)
{
List<ScenePresence> avatars = this.RequestSceneAvatars();
List<ScenePresence> avatars = RequestSceneAvatars();
for (int i = 0; i < avatars.Count; i++)
{
avatars[i].ControllingClient.SendKillObject(this.m_regionHandle, part.LocalID);
avatars[i].ControllingClient.SendKillObject(m_regionHandle, part.LocalID);
}
}
}
public void DeleteParts()
{
this.m_rootPart = null;
this.m_parts.Clear();
m_rootPart = null;
m_parts.Clear();
}
public override void SetText(string text, Vector3 color, double alpha)

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,6 +94,7 @@ namespace OpenSim.Region.Environment.Scenes
}
protected LLObject.ObjectFlags m_flags;
public uint ObjectFlags
{
get { return (uint) m_flags; }
@ -98,6 +102,7 @@ namespace OpenSim.Region.Environment.Scenes
}
protected LLObject.MaterialType m_material;
public byte Material
{
get { return (byte) m_material; }
@ -105,6 +110,7 @@ namespace OpenSim.Region.Environment.Scenes
}
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
@ -219,12 +237,12 @@ namespace OpenSim.Region.Environment.Scenes
}
#region Constructors
/// <summary>
///
/// </summary>
public SceneObjectPart()
{
}
/// <summary>
@ -236,26 +254,27 @@ 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;
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);
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);
m_inventoryFileName = "taskinventory" + LLUUID.Random().ToString();
m_folderID = LLUUID.Random();
@ -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>
@ -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);
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,42 +637,48 @@ 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);
@ -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,15 +734,15 @@ 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();
List<ScenePresence> avatars = m_parentGroup.RequestSceneAvatars();
for (int i = 0; i < avatars.Count; i++)
{
avatars[i].AddTersePart(this);
@ -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()
@ -866,4 +910,3 @@ 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();

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,12 +82,14 @@ 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>();
@ -99,31 +101,20 @@ namespace OpenSim.Region.Environment.Scenes
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,16 +149,15 @@ 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;
@ -175,15 +168,15 @@ 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);
@ -195,17 +188,17 @@ namespace OpenSim.Region.Environment.Scenes
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,7 +221,7 @@ 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))
@ -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,15 +330,15 @@ 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,16 +356,16 @@ 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)))
@ -393,17 +386,15 @@ namespace OpenSim.Region.Environment.Scenes
{
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,21 +403,20 @@ 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);
}
}
}
@ -437,24 +427,24 @@ namespace OpenSim.Region.Environment.Scenes
direc.Normalize();
direc = direc*((0.03f)*128f);
if (this._physActor.Flying)
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,20 +452,20 @@ 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;
}
@ -485,40 +475,42 @@ namespace OpenSim.Region.Environment.Scenes
_updateCount++;
if (_updateCount > 3)
{
this.SendTerseUpdateToALLClients();
SendTerseUpdateToALLClients();
_updateCount = 0;
}
}
/// check for physics-related movement
else if (this.lastPhysPos.GetDistanceTo(this.AbsolutePosition) > 0.02 )
else if (lastPhysPos.GetDistanceTo(AbsolutePosition) > 0.02)
{
this.SendTerseUpdateToALLClients();
SendTerseUpdateToALLClients();
_updateCount = 0;
this.lastPhysPos = this.AbsolutePosition;
lastPhysPos = AbsolutePosition;
}
CheckForSignificantMovement();
CheckForBorderCrossing();
}
}
this.CheckForSignificantMovement();
this.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,10 +518,10 @@ 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);
}
}
@ -537,14 +529,15 @@ namespace OpenSim.Region.Environment.Scenes
public void SendCoarseLocations()
{
List<LLVector3> CoarseLocations = new List<LLVector3>();
List<ScenePresence> avatars = this.m_scene.RequestAvatarList();
List<ScenePresence> avatars = m_scene.RequestAvatarList();
for (int i = 0; i < avatars.Count; i++)
{
if (avatars[i] != this && (!avatars[i].childAgent) ) {
if (avatars[i] != this && (!avatars[i].childAgent))
{
CoarseLocations.Add(avatars[i].AbsolutePosition);
}
}
this.ControllingClient.SendCoarseLocationUpdate(CoarseLocations);
ControllingClient.SendCoarseLocationUpdate(CoarseLocations);
}
public void CoarseLocationChange(ScenePresence avatar)
@ -554,13 +547,14 @@ namespace OpenSim.Region.Environment.Scenes
private void NotifyMyCoarseLocationChange()
{
List<ScenePresence> avatars = this.m_scene.RequestAvatarList();
for (int i = 0; i < avatars.Count; i++) {
if (avatars[i] != this) {
List<ScenePresence> avatars = m_scene.RequestAvatarList();
for (int i = 0; i < avatars.Count; i++)
{
if (avatars[i] != this)
{
avatars[i].CoarseLocationChange(this);
}
}
}
@ -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,34 +670,37 @@ 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);
@ -709,12 +709,12 @@ namespace OpenSim.Region.Environment.Scenes
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;
LLVector3 vel = m_velocity;
ulong neighbourHandle = Helpers.UIntsToLong((uint) (neighbourx*256), (uint) (neighboury*256));
RegionInfo neighbourRegion = this.m_scene.RequestNeighbouringRegionInfo(neighbourHandle);
RegionInfo neighbourRegion = m_scene.RequestNeighbouringRegionInfo(neighbourHandle);
if (neighbourRegion != null)
{
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,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using Axiom.Math;
using libsecondlife;
namespace OpenSim.Region.Environment.Scenes.Scripting
@ -15,6 +13,6 @@ namespace OpenSim.Region.Environment.Scenes.Scripting
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 Axiom.Math;
using libsecondlife;
namespace OpenSim.Region.Environment.Scenes.Scripting
{
public class NullScriptHost : IScriptHost
{
private LLVector3 m_pos = new LLVector3(128, 128, 30);
LLVector3 m_pos = new LLVector3( 128, 128, 30 );
public string Name
{
get { return "Object"; }
@ -39,16 +38,21 @@ 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,17 +26,15 @@
*
*/
/* Original code: Tedd Hansen */
using System;
using System.Collections.Generic;
using System.Text;
using OpenSim.Region.Environment.Scenes.Scripting;
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

@ -27,17 +27,17 @@
*/
/* Original code: Tedd Hansen */
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
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"),
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;
}
@ -115,10 +119,6 @@ namespace OpenSim.Region.Environment.Scenes.Scripting
//}
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;

View File

@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Types
@ -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
{
@ -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
{

View File

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

View File

@ -27,20 +27,19 @@
*/
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.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)
{
@ -67,13 +66,15 @@ namespace OpenSim.Region.ExtensionsScriptModule
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.RegisterModuleInterface<IExtensionScriptModule>(this);
}
public void PostInitialise()
@ -135,6 +136,12 @@ namespace OpenSim.Region.ExtensionsScriptModule
}
}
public interface IExtensionScriptModule
{
bool Compile(string filename);
bool AddPreCompiledScript(IScript script);
}
interface IScriptCompiler
{
Dictionary<string, IScript> compile(string filename);