mirror of
https://github.com/opensim/opensim.git
synced 2026-08-01 06:06:06 +08:00
cosmetics
This commit is contained in:
@@ -177,11 +177,11 @@ namespace OpenSim.Framework
|
||||
"[SHAPE]: Attempt to set a ProfileCurve with a hollow shape value of {0}, which isn't a valid enum. Replacing with default shape.",
|
||||
hollowShapeByte);
|
||||
|
||||
this._hollowShape = HollowShape.Same;
|
||||
_hollowShape = HollowShape.Same;
|
||||
}
|
||||
else
|
||||
{
|
||||
this._hollowShape = (HollowShape)hollowShapeByte;
|
||||
_hollowShape = (HollowShape)hollowShapeByte;
|
||||
}
|
||||
|
||||
// Handle profile shape component
|
||||
@@ -193,11 +193,11 @@ namespace OpenSim.Framework
|
||||
"[SHAPE]: Attempt to set a ProfileCurve with a profile shape value of {0}, which isn't a valid enum. Replacing with square.",
|
||||
profileShapeByte);
|
||||
|
||||
this._profileShape = ProfileShape.Square;
|
||||
_profileShape = ProfileShape.Square;
|
||||
}
|
||||
else
|
||||
{
|
||||
this._profileShape = (ProfileShape)profileShapeByte;
|
||||
_profileShape = (ProfileShape)profileShapeByte;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -305,55 +305,56 @@ namespace OpenSim.Framework
|
||||
|
||||
public static PrimitiveBaseShape Create()
|
||||
{
|
||||
PrimitiveBaseShape shape = new PrimitiveBaseShape();
|
||||
return shape;
|
||||
return new PrimitiveBaseShape();
|
||||
}
|
||||
|
||||
public static PrimitiveBaseShape CreateBox()
|
||||
{
|
||||
PrimitiveBaseShape shape = Create();
|
||||
|
||||
shape._pathCurve = (byte) Extrusion.Straight;
|
||||
shape._profileShape = ProfileShape.Square;
|
||||
shape._pathScaleX = 100;
|
||||
shape._pathScaleY = 100;
|
||||
PrimitiveBaseShape shape = new()
|
||||
{
|
||||
_pathCurve = (byte)Extrusion.Straight,
|
||||
_profileShape = ProfileShape.Square,
|
||||
_pathScaleX = 100,
|
||||
_pathScaleY = 100
|
||||
};
|
||||
|
||||
return shape;
|
||||
}
|
||||
|
||||
public static PrimitiveBaseShape CreateSphere()
|
||||
{
|
||||
PrimitiveBaseShape shape = Create();
|
||||
|
||||
shape._pathCurve = (byte) Extrusion.Curve1;
|
||||
shape._profileShape = ProfileShape.HalfCircle;
|
||||
shape._pathScaleX = 100;
|
||||
shape._pathScaleY = 100;
|
||||
PrimitiveBaseShape shape = new()
|
||||
{
|
||||
_pathCurve = (byte)Extrusion.Curve1,
|
||||
_profileShape = ProfileShape.HalfCircle,
|
||||
_pathScaleX = 100,
|
||||
_pathScaleY = 100
|
||||
};
|
||||
|
||||
return shape;
|
||||
}
|
||||
|
||||
public static PrimitiveBaseShape CreateCylinder()
|
||||
{
|
||||
PrimitiveBaseShape shape = Create();
|
||||
|
||||
shape._pathCurve = (byte) Extrusion.Curve1;
|
||||
shape._profileShape = ProfileShape.Square;
|
||||
|
||||
shape._pathScaleX = 100;
|
||||
shape._pathScaleY = 100;
|
||||
|
||||
PrimitiveBaseShape shape = new()
|
||||
{
|
||||
_pathCurve = (byte)Extrusion.Curve1,
|
||||
_profileShape = ProfileShape.Square,
|
||||
_pathScaleX = 100,
|
||||
_pathScaleY = 100
|
||||
};
|
||||
return shape;
|
||||
}
|
||||
|
||||
public static PrimitiveBaseShape CreateMesh(int numberOfFaces, UUID meshAssetID)
|
||||
{
|
||||
PrimitiveBaseShape shape = new PrimitiveBaseShape();
|
||||
PrimitiveBaseShape shape = new()
|
||||
{
|
||||
_pathScaleX = 100,
|
||||
_pathScaleY = 100
|
||||
};
|
||||
|
||||
shape._pathScaleX = 100;
|
||||
shape._pathScaleY = 100;
|
||||
|
||||
if(numberOfFaces <= 0) // oops ?
|
||||
if (numberOfFaces <= 0) // oops ?
|
||||
numberOfFaces = 1;
|
||||
|
||||
switch(numberOfFaces)
|
||||
@@ -1025,20 +1026,20 @@ namespace OpenSim.Framework
|
||||
return hash;
|
||||
}
|
||||
|
||||
private ulong djb2(ulong hash, byte c)
|
||||
private static ulong djb2(ulong hash, byte c)
|
||||
{
|
||||
//return ((hash << 5) + hash) + (ulong)c;
|
||||
return 33 * hash + (ulong)c;
|
||||
}
|
||||
|
||||
private ulong djb2(ulong hash, ushort c)
|
||||
private static ulong djb2(ulong hash, ushort c)
|
||||
{
|
||||
//hash = ((hash << 5) + hash) + (ulong)((byte)c);
|
||||
//return ((hash << 5) + hash) + (ulong)(c >> 8);
|
||||
return 33 * hash + c;
|
||||
}
|
||||
|
||||
private ulong djb2(ulong hash, float c)
|
||||
private static ulong djb2(ulong hash, float c)
|
||||
{
|
||||
//hash = ((hash << 5) + hash) + (ulong)((byte)c);
|
||||
//return ((hash << 5) + hash) + (ulong)(c >> 8);
|
||||
@@ -1427,7 +1428,7 @@ namespace OpenSim.Framework
|
||||
if (data.Length - pos >= 16)
|
||||
{
|
||||
_lightEntry = true;
|
||||
Color4 lColor = new Color4(data, pos, false);
|
||||
Color4 lColor = new(data, pos, false);
|
||||
_lightIntensity = lColor.A;
|
||||
_lightColorA = 1f;
|
||||
_lightColorR = lColor.R;
|
||||
@@ -1547,80 +1548,89 @@ namespace OpenSim.Framework
|
||||
/// <returns></returns>
|
||||
public Primitive ToOmvPrimitive(Vector3 position, Quaternion rotation)
|
||||
{
|
||||
OpenMetaverse.Primitive prim = new OpenMetaverse.Primitive();
|
||||
|
||||
prim.Scale = this.Scale;
|
||||
prim.Position = position;
|
||||
prim.Rotation = rotation;
|
||||
OpenMetaverse.Primitive prim = new()
|
||||
{
|
||||
Scale = this.Scale,
|
||||
Position = position,
|
||||
Rotation = rotation
|
||||
};
|
||||
|
||||
if (this.SculptEntry)
|
||||
{
|
||||
prim.Sculpt = new Primitive.SculptData();
|
||||
prim.Sculpt.Type = (OpenMetaverse.SculptType)this.SculptType;
|
||||
prim.Sculpt.SculptTexture = this.SculptTexture;
|
||||
prim.Sculpt = new Primitive.SculptData
|
||||
{
|
||||
Type = (OpenMetaverse.SculptType)SculptType,
|
||||
SculptTexture = SculptTexture
|
||||
};
|
||||
}
|
||||
|
||||
prim.PrimData.PathShearX = this.PathShearX < 128 ? (float)this.PathShearX * 0.01f : (float)(this.PathShearX - 256) * 0.01f;
|
||||
prim.PrimData.PathShearY = this.PathShearY < 128 ? (float)this.PathShearY * 0.01f : (float)(this.PathShearY - 256) * 0.01f;
|
||||
prim.PrimData.PathBegin = (float)this.PathBegin * 2.0e-5f;
|
||||
prim.PrimData.PathEnd = 1.0f - (float)this.PathEnd * 2.0e-5f;
|
||||
prim.PrimData.PathShearX = PathShearX < 128 ? (float)PathShearX * 0.01f : (float)(PathShearX - 256) * 0.01f;
|
||||
prim.PrimData.PathShearY = PathShearY < 128 ? (float)PathShearY * 0.01f : (float)(PathShearY - 256) * 0.01f;
|
||||
prim.PrimData.PathBegin = (float)PathBegin * 2.0e-5f;
|
||||
prim.PrimData.PathEnd = 1.0f - (float)PathEnd * 2.0e-5f;
|
||||
|
||||
prim.PrimData.PathScaleX = (200 - this.PathScaleX) * 0.01f;
|
||||
prim.PrimData.PathScaleY = (200 - this.PathScaleY) * 0.01f;
|
||||
prim.PrimData.PathScaleX = (200 - PathScaleX) * 0.01f;
|
||||
prim.PrimData.PathScaleY = (200 - PathScaleY) * 0.01f;
|
||||
|
||||
prim.PrimData.PathTaperX = this.PathTaperX * 0.01f;
|
||||
prim.PrimData.PathTaperY = this.PathTaperY * 0.01f;
|
||||
prim.PrimData.PathTaperX = PathTaperX * 0.01f;
|
||||
prim.PrimData.PathTaperY = PathTaperY * 0.01f;
|
||||
|
||||
prim.PrimData.PathTwistBegin = this.PathTwistBegin * 0.01f;
|
||||
prim.PrimData.PathTwist = this.PathTwist * 0.01f;
|
||||
prim.PrimData.PathTwistBegin = PathTwistBegin * 0.01f;
|
||||
prim.PrimData.PathTwist = PathTwist * 0.01f;
|
||||
|
||||
prim.PrimData.ProfileBegin = (float)this.ProfileBegin * 2.0e-5f;
|
||||
prim.PrimData.ProfileEnd = 1.0f - (float)this.ProfileEnd * 2.0e-5f;
|
||||
prim.PrimData.ProfileHollow = (float)this.ProfileHollow * 2.0e-5f;
|
||||
prim.PrimData.ProfileBegin = (float)ProfileBegin * 2.0e-5f;
|
||||
prim.PrimData.ProfileEnd = 1.0f - (float)ProfileEnd * 2.0e-5f;
|
||||
prim.PrimData.ProfileHollow = (float)ProfileHollow * 2.0e-5f;
|
||||
|
||||
prim.PrimData.profileCurve = this.ProfileCurve;
|
||||
prim.PrimData.ProfileHole = (HoleType)this.HollowShape;
|
||||
prim.PrimData.profileCurve = ProfileCurve;
|
||||
prim.PrimData.ProfileHole = (HoleType)HollowShape;
|
||||
|
||||
prim.PrimData.PathCurve = (PathCurve)this.PathCurve;
|
||||
prim.PrimData.PathRadiusOffset = 0.01f * this.PathRadiusOffset;
|
||||
prim.PrimData.PathRevolutions = 1.0f + 0.015f * this.PathRevolutions;
|
||||
prim.PrimData.PathSkew = 0.01f * this.PathSkew;
|
||||
prim.PrimData.PathCurve = (PathCurve)PathCurve;
|
||||
prim.PrimData.PathRadiusOffset = 0.01f * PathRadiusOffset;
|
||||
prim.PrimData.PathRevolutions = 1.0f + 0.015f * PathRevolutions;
|
||||
prim.PrimData.PathSkew = 0.01f * PathSkew;
|
||||
|
||||
prim.PrimData.PCode = OpenMetaverse.PCode.Prim;
|
||||
prim.PrimData.State = 0;
|
||||
|
||||
if (this.FlexiEntry)
|
||||
if (FlexiEntry)
|
||||
{
|
||||
prim.Flexible = new Primitive.FlexibleData();
|
||||
prim.Flexible.Drag = this.FlexiDrag;
|
||||
prim.Flexible.Force = new Vector3(this.FlexiForceX, this.FlexiForceY, this.FlexiForceZ);
|
||||
prim.Flexible.Gravity = this.FlexiGravity;
|
||||
prim.Flexible.Softness = this.FlexiSoftness;
|
||||
prim.Flexible.Tension = this.FlexiTension;
|
||||
prim.Flexible.Wind = this.FlexiWind;
|
||||
prim.Flexible = new Primitive.FlexibleData
|
||||
{
|
||||
Drag = FlexiDrag,
|
||||
Force = new Vector3(FlexiForceX, FlexiForceY, FlexiForceZ),
|
||||
Gravity = FlexiGravity,
|
||||
Softness = FlexiSoftness,
|
||||
Tension = FlexiTension,
|
||||
Wind = FlexiWind
|
||||
};
|
||||
}
|
||||
|
||||
if (this.LightEntry)
|
||||
if (LightEntry)
|
||||
{
|
||||
prim.Light = new Primitive.LightData();
|
||||
prim.Light.Color = new Color4(this.LightColorR, this.LightColorG, this.LightColorB, this.LightColorA);
|
||||
prim.Light.Cutoff = this.LightCutoff;
|
||||
prim.Light.Falloff = this.LightFalloff;
|
||||
prim.Light.Intensity = this.LightIntensity;
|
||||
prim.Light.Radius = this.LightRadius;
|
||||
prim.Light = new Primitive.LightData
|
||||
{
|
||||
Color = new Color4(LightColorR, LightColorG, LightColorB, LightColorA),
|
||||
Cutoff = LightCutoff,
|
||||
Falloff = LightFalloff,
|
||||
Intensity = LightIntensity,
|
||||
Radius = LightRadius
|
||||
};
|
||||
}
|
||||
|
||||
prim.Textures = this.Textures;
|
||||
prim.Textures = Textures;
|
||||
|
||||
prim.Properties = new Primitive.ObjectProperties();
|
||||
prim.Properties.Name = "Object";
|
||||
prim.Properties.Description = "";
|
||||
prim.Properties.CreatorID = UUID.Zero;
|
||||
prim.Properties.GroupID = UUID.Zero;
|
||||
prim.Properties.OwnerID = UUID.Zero;
|
||||
prim.Properties.Permissions = new Permissions();
|
||||
prim.Properties.SalePrice = 10;
|
||||
prim.Properties.SaleType = new SaleType();
|
||||
prim.Properties = new Primitive.ObjectProperties
|
||||
{
|
||||
Name = "Object",
|
||||
Description = "",
|
||||
CreatorID = UUID.Zero,
|
||||
GroupID = UUID.Zero,
|
||||
OwnerID = UUID.Zero,
|
||||
Permissions = new Permissions(),
|
||||
SalePrice = 10,
|
||||
SaleType = new SaleType()
|
||||
};
|
||||
|
||||
return prim;
|
||||
}
|
||||
@@ -1647,15 +1657,15 @@ namespace OpenSim.Framework
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
using (StringWriter sw = new StringWriter())
|
||||
using (StringWriter sw = new())
|
||||
{
|
||||
using (XmlTextWriter xtw = new XmlTextWriter(sw))
|
||||
using (XmlTextWriter xtw = new(sw))
|
||||
{
|
||||
xtw.WriteStartElement("OSMedia");
|
||||
xtw.WriteAttributeString("type", MEDIA_TEXTURE_TYPE);
|
||||
xtw.WriteAttributeString("version", "0.1");
|
||||
|
||||
OSDArray meArray = new OSDArray();
|
||||
OSDArray meArray = new();
|
||||
foreach (MediaEntry me in this)
|
||||
{
|
||||
OSD osd = (null == me ? new OSD() : me.GetOSD());
|
||||
@@ -1684,7 +1694,7 @@ namespace OpenSim.Framework
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static MediaList FromXml(string rawXml)
|
||||
{
|
||||
MediaList ml = new MediaList();
|
||||
MediaList ml = new();
|
||||
ml.ReadXml(rawXml);
|
||||
if(ml.Count == 0)
|
||||
return null;
|
||||
@@ -1695,9 +1705,9 @@ namespace OpenSim.Framework
|
||||
{
|
||||
try
|
||||
{
|
||||
using (StringReader sr = new StringReader(rawXml))
|
||||
using (StringReader sr = new(rawXml))
|
||||
{
|
||||
using (XmlTextReader xtr = new XmlTextReader(sr))
|
||||
using (XmlTextReader xtr = new(sr))
|
||||
{
|
||||
xtr.DtdProcessing = DtdProcessing.Ignore;
|
||||
xtr.MoveToContent();
|
||||
@@ -1710,10 +1720,9 @@ namespace OpenSim.Framework
|
||||
|
||||
xtr.ReadStartElement("OSMedia");
|
||||
OSD osdp = OSDParser.DeserializeLLSDXml(xtr.ReadInnerXml());
|
||||
if(osdp == null || !(osdp is OSDArray))
|
||||
if(osdp is not OSDArray osdMeArray)
|
||||
return;
|
||||
|
||||
OSDArray osdMeArray = osdp as OSDArray;
|
||||
if(osdMeArray.Count == 0)
|
||||
return;
|
||||
|
||||
|
||||
@@ -38,78 +38,19 @@ namespace OpenSim.Framework
|
||||
public class TaskInventoryItem : ICloneable
|
||||
{
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
/// <summary>
|
||||
/// XXX This should really be factored out into some constants class.
|
||||
/// </summary>
|
||||
private const uint FULL_MASK_PERMISSIONS_GENERAL = 2147483647;
|
||||
|
||||
private UUID _assetID = UUID.Zero;
|
||||
public UUID AssetID { get; set; }
|
||||
public uint CreationDate { get; set; }
|
||||
|
||||
private uint _baseMask = FULL_MASK_PERMISSIONS_GENERAL;
|
||||
private uint _creationDate = 0;
|
||||
private UUID _creatorID = UUID.Zero;
|
||||
private string _creatorData = String.Empty;
|
||||
private string _description = String.Empty;
|
||||
private uint _everyoneMask = FULL_MASK_PERMISSIONS_GENERAL;
|
||||
private uint _flags = 0;
|
||||
private UUID _groupID = UUID.Zero;
|
||||
private uint _groupMask = FULL_MASK_PERMISSIONS_GENERAL;
|
||||
|
||||
private int _invType = 0;
|
||||
private UUID _itemID = UUID.Zero;
|
||||
private UUID _lastOwnerID = UUID.Zero;
|
||||
private UUID _rezzerID = UUID.Zero;
|
||||
private string _name = String.Empty;
|
||||
private uint _nextOwnerMask = FULL_MASK_PERMISSIONS_GENERAL;
|
||||
private UUID _ownerID = UUID.Zero;
|
||||
private uint _ownerMask = FULL_MASK_PERMISSIONS_GENERAL;
|
||||
private UUID _parentID = UUID.Zero; //parent folder id
|
||||
private UUID _parentPartID = UUID.Zero; // SceneObjectPart this is inside
|
||||
private UUID _permsGranter;
|
||||
private int _permsMask;
|
||||
private int _type = 0;
|
||||
private UUID _oldID;
|
||||
private UUID _loadedID = UUID.Zero;
|
||||
|
||||
private bool _ownerChanged = false;
|
||||
|
||||
public UUID AssetID {
|
||||
get {
|
||||
return _assetID;
|
||||
}
|
||||
set {
|
||||
_assetID = value;
|
||||
}
|
||||
}
|
||||
|
||||
public uint BasePermissions {
|
||||
get {
|
||||
return _baseMask;
|
||||
}
|
||||
set {
|
||||
_baseMask = value;
|
||||
}
|
||||
}
|
||||
|
||||
public uint CreationDate {
|
||||
get {
|
||||
return _creationDate;
|
||||
}
|
||||
set {
|
||||
_creationDate = value;
|
||||
}
|
||||
}
|
||||
|
||||
public UUID CreatorID {
|
||||
get {
|
||||
return _creatorID;
|
||||
}
|
||||
set {
|
||||
_creatorID = value;
|
||||
}
|
||||
UUID _creatorID = UUID.Zero;
|
||||
public UUID CreatorID
|
||||
{
|
||||
get { return _creatorID; }
|
||||
set { _creatorID = value; }
|
||||
}
|
||||
|
||||
private string _creatorData = string.Empty;
|
||||
public string CreatorData // = <profile url>;<name>
|
||||
{
|
||||
get { return _creatorData; }
|
||||
@@ -138,11 +79,9 @@ namespace OpenSim.Framework
|
||||
return;
|
||||
}
|
||||
|
||||
if (!value.Contains(";")) // plain UUID
|
||||
if (!value.Contains(';')) // plain UUID
|
||||
{
|
||||
UUID uuid = UUID.Zero;
|
||||
UUID.TryParse(value, out uuid);
|
||||
_creatorID = uuid;
|
||||
_= UUID.TryParse(value, out _creatorID);
|
||||
}
|
||||
else // <uuid>[;<endpoint>[;name]]
|
||||
{
|
||||
@@ -150,9 +89,7 @@ namespace OpenSim.Framework
|
||||
string[] parts = value.Split(';');
|
||||
if (parts.Length >= 1)
|
||||
{
|
||||
UUID uuid = UUID.Zero;
|
||||
UUID.TryParse(parts[0], out uuid);
|
||||
_creatorID = uuid;
|
||||
_ = UUID.TryParse(parts[0], out _creatorID);
|
||||
}
|
||||
if (parts.Length >= 2)
|
||||
_creatorData = parts[1];
|
||||
@@ -165,199 +102,38 @@ namespace OpenSim.Framework
|
||||
}
|
||||
}
|
||||
|
||||
public string Description {
|
||||
get {
|
||||
return _description;
|
||||
}
|
||||
set {
|
||||
_description = value;
|
||||
}
|
||||
}
|
||||
|
||||
public uint EveryonePermissions {
|
||||
get {
|
||||
return _everyoneMask;
|
||||
}
|
||||
set {
|
||||
_everyoneMask = value;
|
||||
}
|
||||
}
|
||||
|
||||
public uint Flags {
|
||||
get {
|
||||
return _flags;
|
||||
}
|
||||
set {
|
||||
_flags = value;
|
||||
}
|
||||
}
|
||||
|
||||
public UUID GroupID {
|
||||
get {
|
||||
return _groupID;
|
||||
}
|
||||
set {
|
||||
_groupID = value;
|
||||
}
|
||||
}
|
||||
|
||||
public uint GroupPermissions {
|
||||
get {
|
||||
return _groupMask;
|
||||
}
|
||||
set {
|
||||
_groupMask = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int InvType {
|
||||
get {
|
||||
return _invType;
|
||||
}
|
||||
set {
|
||||
_invType = value;
|
||||
}
|
||||
}
|
||||
|
||||
public UUID ItemID {
|
||||
get {
|
||||
return _itemID;
|
||||
}
|
||||
set {
|
||||
_itemID = value;
|
||||
}
|
||||
}
|
||||
|
||||
public UUID OldItemID {
|
||||
get {
|
||||
return _oldID;
|
||||
}
|
||||
set {
|
||||
_oldID = value;
|
||||
}
|
||||
}
|
||||
|
||||
public UUID LoadedItemID {
|
||||
get {
|
||||
return _loadedID;
|
||||
}
|
||||
set {
|
||||
_loadedID = value;
|
||||
}
|
||||
}
|
||||
|
||||
public UUID LastOwnerID {
|
||||
get {
|
||||
return _lastOwnerID;
|
||||
}
|
||||
set {
|
||||
_lastOwnerID = value;
|
||||
}
|
||||
}
|
||||
|
||||
public UUID RezzerID
|
||||
{
|
||||
get {
|
||||
return _rezzerID;
|
||||
}
|
||||
set {
|
||||
_rezzerID = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string Name {
|
||||
get {
|
||||
return _name;
|
||||
}
|
||||
set {
|
||||
_name = value;
|
||||
}
|
||||
}
|
||||
|
||||
public uint NextPermissions {
|
||||
get {
|
||||
return _nextOwnerMask;
|
||||
}
|
||||
set {
|
||||
_nextOwnerMask = value;
|
||||
}
|
||||
}
|
||||
|
||||
public UUID OwnerID {
|
||||
get {
|
||||
return _ownerID;
|
||||
}
|
||||
set {
|
||||
_ownerID = value;
|
||||
}
|
||||
}
|
||||
|
||||
public uint CurrentPermissions {
|
||||
get {
|
||||
return _ownerMask;
|
||||
}
|
||||
set {
|
||||
_ownerMask = value;
|
||||
}
|
||||
}
|
||||
|
||||
public UUID ParentID {
|
||||
get {
|
||||
return _parentID;
|
||||
}
|
||||
set {
|
||||
_parentID = value;
|
||||
}
|
||||
}
|
||||
|
||||
public UUID ParentPartID {
|
||||
get {
|
||||
return _parentPartID;
|
||||
}
|
||||
set {
|
||||
_parentPartID = value;
|
||||
}
|
||||
}
|
||||
|
||||
public UUID PermsGranter {
|
||||
get {
|
||||
return _permsGranter;
|
||||
}
|
||||
set {
|
||||
_permsGranter = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int PermsMask {
|
||||
get {
|
||||
return _permsMask;
|
||||
}
|
||||
set {
|
||||
_permsMask = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int Type {
|
||||
get {
|
||||
return _type;
|
||||
}
|
||||
set {
|
||||
_type = value;
|
||||
}
|
||||
}
|
||||
public uint Flags { get; set; }
|
||||
public int Type { get; set; }
|
||||
public int InvType { get; set; }
|
||||
public UUID ItemID { get; set; }
|
||||
public UUID OldItemID { get; set; }
|
||||
public UUID LoadedItemID { get; set; }
|
||||
public UUID RezzerID { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Description { get; set; }
|
||||
public UUID OwnerID { get; set; }
|
||||
public UUID LastOwnerID { get; set; }
|
||||
public UUID GroupID { get; set; }
|
||||
public UUID ParentID { get; set; }
|
||||
public UUID ParentPartID { get; set; }
|
||||
public uint BasePermissions { get; set; } = FULL_MASK_PERMISSIONS_GENERAL;
|
||||
public uint CurrentPermissions { get; set; } = FULL_MASK_PERMISSIONS_GENERAL;
|
||||
public uint EveryonePermissions { get; set; } = FULL_MASK_PERMISSIONS_GENERAL;
|
||||
public uint GroupPermissions { get; set; } = FULL_MASK_PERMISSIONS_GENERAL;
|
||||
public uint NextPermissions { get; set; } = FULL_MASK_PERMISSIONS_GENERAL;
|
||||
public UUID PermsGranter { get; set; }
|
||||
public int PermsMask { get; set; }
|
||||
|
||||
private bool _ownerChanged = false;
|
||||
public bool OwnerChanged
|
||||
{
|
||||
get
|
||||
{
|
||||
return _ownerChanged;
|
||||
}
|
||||
get { return _ownerChanged; }
|
||||
set
|
||||
{
|
||||
_ownerChanged = value;
|
||||
// m_log.DebugFormat(
|
||||
// "[TASK INVENTORY ITEM]: Owner changed set {0} for {1} {2} owned by {3}",
|
||||
// _ownerChanged, Name, ItemID, OwnerID);
|
||||
//m_log.DebugFormat(
|
||||
// "[TASK INVENTORY ITEM]: Owner changed set {0} for {1} {2} owned by {3}",
|
||||
// _ownerChanged, Name, ItemID, OwnerID);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -70,13 +70,13 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
/// <summary>
|
||||
/// Simulator features
|
||||
/// </summary>
|
||||
private OSDMap m_features = new OSDMap();
|
||||
private readonly OSDMap m_features = new();
|
||||
|
||||
private bool m_ExportSupported = false;
|
||||
|
||||
private bool m_doScriptSyntax;
|
||||
|
||||
static private object m_scriptSyntaxLock = new object();
|
||||
static private readonly object m_scriptSyntaxLock = new();
|
||||
static private UUID m_scriptSyntaxID = UUID.Zero;
|
||||
static private byte[] m_scriptSyntaxXML = null;
|
||||
|
||||
@@ -142,7 +142,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
m_features["BakesOnMeshEnabled"] = true;
|
||||
|
||||
m_features["PhysicsMaterialsEnabled"] = true;
|
||||
OSDMap typesMap = new OSDMap();
|
||||
OSDMap typesMap = new();
|
||||
typesMap["convex"] = true;
|
||||
typesMap["none"] = true;
|
||||
typesMap["prim"] = true;
|
||||
@@ -151,7 +151,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
if(m_doScriptSyntax && !m_scriptSyntaxID.IsZero())
|
||||
m_features["LSLSyntaxId"] = OSD.FromUUID(m_scriptSyntaxID);
|
||||
|
||||
OSDMap meshAnim = new OSDMap();
|
||||
OSDMap meshAnim = new();
|
||||
meshAnim["AnimatedObjectMaxTris"] = OSD.FromInteger(150000);
|
||||
meshAnim["MaxAgentAnimatedObjectAttachments"] = OSD.FromInteger(2);
|
||||
m_features["AnimatedObjects"] = meshAnim;
|
||||
@@ -385,7 +385,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
default:
|
||||
if (key == "ExportSupported")
|
||||
{
|
||||
bool.TryParse(val, out m_ExportSupported);
|
||||
_ = bool.TryParse(val, out m_ExportSupported);
|
||||
extrasMap[key] = m_ExportSupported;
|
||||
}
|
||||
else
|
||||
@@ -419,20 +419,18 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
{
|
||||
using (StreamReader sr = File.OpenText("ScriptSyntax.xml"))
|
||||
{
|
||||
StringBuilder sb = new StringBuilder(400*1024);
|
||||
|
||||
string s="";
|
||||
StringBuilder sb = new(400*1024);
|
||||
char[] trimc = new char[] {' ','\t', '\n', '\r'};
|
||||
|
||||
s = sr.ReadLine();
|
||||
if(s == null)
|
||||
return;
|
||||
s = s.Trim(trimc);
|
||||
UUID id;
|
||||
if(!UUID.TryParse(s,out id))
|
||||
|
||||
if(!UUID.TryParse(s, out UUID id))
|
||||
return;
|
||||
|
||||
while ((s = sr.ReadLine()) != null)
|
||||
while ((s = sr.ReadLine()) is not null)
|
||||
{
|
||||
s = s.Trim(trimc);
|
||||
if (String.IsNullOrEmpty(s) || s.StartsWith("<!--"))
|
||||
|
||||
@@ -152,8 +152,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
// to the grid service.
|
||||
private class BannedRegionCache
|
||||
{
|
||||
private ExpiringCacheOS<ulong, Dictionary<UUID, double>> m_bannedRegions =
|
||||
new ExpiringCacheOS<ulong, Dictionary<UUID, double>>(15000);
|
||||
private ExpiringCacheOS<ulong, Dictionary<UUID, double>> m_bannedRegions = new(15000);
|
||||
|
||||
public BannedRegionCache()
|
||||
{
|
||||
@@ -210,8 +209,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
}
|
||||
else
|
||||
{
|
||||
idCache = new Dictionary<UUID, double>();
|
||||
idCache[pAgentID] = Util.GetTimeStamp() + newTime;
|
||||
idCache = new Dictionary<UUID, double>
|
||||
{
|
||||
[pAgentID] = Util.GetTimeStamp() + newTime
|
||||
};
|
||||
m_bannedRegions.AddOrUpdate(pRegionHandle, idCache, newTime);
|
||||
}
|
||||
}
|
||||
@@ -227,7 +228,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
}
|
||||
}
|
||||
|
||||
private BannedRegionCache m_bannedRegionCache = new BannedRegionCache();
|
||||
private BannedRegionCache m_bannedRegionCache = new();
|
||||
|
||||
private IEventQueue m_eqModule;
|
||||
|
||||
@@ -498,7 +499,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
// Teleport within the same region
|
||||
if (!m_scene.PositionIsInCurrentRegion(position) || position.Z < 0)
|
||||
{
|
||||
Vector3 emergencyPos = new Vector3(128, 128, 128);
|
||||
Vector3 emergencyPos = new(128, 128, 128);
|
||||
|
||||
m_log.WarnFormat(
|
||||
"[ENTITY TRANSFER MODULE]: RequestTeleportToLocation() was given an illegal position of {0} for avatar {1}, {2} in {3}. Substituting {4}",
|
||||
@@ -584,16 +585,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
sp.ControllingClient.SendTeleportFailed("The region you tried to teleport to was not found");
|
||||
|
||||
// and set the map-tile to '(Offline)'
|
||||
uint regX, regY;
|
||||
Util.RegionHandleToRegionLoc(regionHandle, out regX, out regY);
|
||||
Util.RegionHandleToRegionLoc(regionHandle, out uint regX, out uint regY);
|
||||
|
||||
MapBlockData block = new MapBlockData();
|
||||
block.X = (ushort)(regX);
|
||||
block.Y = (ushort)(regY);
|
||||
block.Access = (byte)SimAccess.Down; // == not there
|
||||
MapBlockData block = new()
|
||||
{
|
||||
X = (ushort)(regX),
|
||||
Y = (ushort)(regY),
|
||||
Access = (byte)SimAccess.Down // == not there
|
||||
};
|
||||
|
||||
List<MapBlockData> blocks = new List<MapBlockData>();
|
||||
blocks.Add(block);
|
||||
List<MapBlockData> blocks = new() { block };
|
||||
sp.ControllingClient.SendMapBlock(blocks, 0);
|
||||
return;
|
||||
}
|
||||
@@ -601,7 +602,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
string homeURI = m_scene.GetAgentHomeURI(sp.ControllingClient.AgentId);
|
||||
|
||||
string reason = String.Empty;
|
||||
finalDestination = GetFinalDestination(reg, sp.ControllingClient.AgentId, homeURI, out reason);
|
||||
finalDestination = GetFinalDestination(reg, sp.ControllingClient.AgentId, homeURI, out _);
|
||||
|
||||
if (finalDestination == null)
|
||||
{
|
||||
@@ -612,7 +613,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ValidateGenericConditions(sp, reg, finalDestination, teleportFlags, out reason))
|
||||
if (!ValidateGenericConditions(sp, reg, finalDestination, teleportFlags, out _))
|
||||
{
|
||||
sp.ControllingClient.SendTeleportFailed(reason);
|
||||
return;
|
||||
@@ -629,8 +630,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
// larger region.
|
||||
private GridRegion GetTeleportDestinationRegion(IGridService gridService, UUID scope, ulong regionHandle, ref Vector3 position)
|
||||
{
|
||||
uint x = 0, y = 0;
|
||||
Util.RegionHandleToWorldLoc(regionHandle, out x, out y);
|
||||
Util.RegionHandleToWorldLoc(regionHandle, out uint x, out uint y);
|
||||
|
||||
GridRegion reg;
|
||||
|
||||
@@ -747,11 +747,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
"[ENTITY TRANSFER MODULE]: Failed validation of all attachments for teleport of {0} from {1} to {2}. Continuing.",
|
||||
sp.Name, sp.Scene.Name, finalDestination.RegionName);
|
||||
|
||||
string reason;
|
||||
EntityTransferContext ctx = new EntityTransferContext();
|
||||
|
||||
EntityTransferContext ctx = new();
|
||||
if (!m_scene.SimulationService.QueryAccess(
|
||||
finalDestination, sp.UUID, homeURI, true, position, m_scene.GetFormatsOffered(), ctx, out reason))
|
||||
finalDestination, sp.UUID, homeURI, true, position, m_scene.GetFormatsOffered(), ctx, out string reason))
|
||||
{
|
||||
sp.ControllingClient.SendTeleportFailed(reason);
|
||||
|
||||
@@ -805,10 +803,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
agentCircuit.startpos = position;
|
||||
agentCircuit.child = true;
|
||||
|
||||
agentCircuit.Appearance = new AvatarAppearance();
|
||||
agentCircuit.Appearance.AvatarHeight = sp.Appearance.AvatarHeight;
|
||||
agentCircuit.Appearance = new() { AvatarHeight = sp.Appearance.AvatarHeight };
|
||||
|
||||
if (currentAgentCircuit != null)
|
||||
if (currentAgentCircuit is not null)
|
||||
{
|
||||
agentCircuit.ServiceURLs = currentAgentCircuit.ServiceURLs;
|
||||
agentCircuit.IPAddress = currentAgentCircuit.IPAddress;
|
||||
@@ -818,8 +815,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
agentCircuit.Id0 = currentAgentCircuit.Id0;
|
||||
}
|
||||
|
||||
uint newRegionX, newRegionY;
|
||||
Util.RegionHandleToRegionLoc(destinationHandle, out newRegionX, out newRegionY);
|
||||
Util.RegionHandleToRegionLoc(destinationHandle, out uint newRegionX, out uint newRegionY);
|
||||
int oldSizeX = (int)m_sceneRegionInfo.RegionSizeX;
|
||||
int oldSizeY = (int)m_sceneRegionInfo.RegionSizeY;
|
||||
int newSizeX = finalDestination.RegionSizeX;
|
||||
@@ -841,15 +837,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
else
|
||||
{
|
||||
agentCircuit.CapsPath = sp.Scene.CapsModule.GetChildSeed(sp.UUID, reg.RegionHandle);
|
||||
if (agentCircuit.CapsPath == null)
|
||||
agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath();
|
||||
agentCircuit.CapsPath ??= CapsUtil.GetRandomCapsObjectPath();
|
||||
}
|
||||
|
||||
// We're going to fallback to V1 if the destination gives us anything smaller than 0.2
|
||||
if (ctx.OutboundVersion >= 0.2f)
|
||||
TransferAgent_V2(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, OutSideViewRange, lookAt, ctx, out reason);
|
||||
TransferAgent_V2(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, OutSideViewRange, lookAt, ctx, out _);
|
||||
else
|
||||
TransferAgent_V1(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, OutSideViewRange, lookAt, ctx, out reason);
|
||||
TransferAgent_V1(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, OutSideViewRange, lookAt, ctx, out _);
|
||||
}
|
||||
|
||||
private void TransferAgent_V1(ScenePresence sp, AgentCircuitData agentCircuit, GridRegion reg, GridRegion finalDestination,
|
||||
@@ -874,8 +869,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
|
||||
// Let's create an agent there if one doesn't exist yet.
|
||||
// NOTE: logout will always be false for a non-HG teleport.
|
||||
bool logout = false;
|
||||
if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, ctx, out reason, out logout))
|
||||
if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, ctx, out reason, out bool logout))
|
||||
{
|
||||
m_interRegionTeleportFailures.Value++;
|
||||
|
||||
@@ -948,7 +942,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
}
|
||||
|
||||
// Let's send a full update of the agent. This is a synchronous call.
|
||||
AgentData agent = new AgentData();
|
||||
AgentData agent = new();
|
||||
sp.CopyTo(agent,false);
|
||||
agent.SetLookAt(lookAt);
|
||||
|
||||
@@ -1118,8 +1112,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
|
||||
// Let's create an agent there if one doesn't exist yet.
|
||||
// NOTE: logout will always be false for a non-HG teleport.
|
||||
bool logout = false;
|
||||
if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, ctx, out reason, out logout))
|
||||
if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, ctx, out reason, out bool logout))
|
||||
{
|
||||
m_interRegionTeleportFailures.Value++;
|
||||
|
||||
@@ -1177,7 +1170,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
capsPath, m_sceneName, sp.Name);
|
||||
|
||||
// Let's send a full update of the agent.
|
||||
AgentData agent = new AgentData();
|
||||
AgentData agent = new();
|
||||
sp.CopyTo(agent,false);
|
||||
agent.SetLookAt(lookAt);
|
||||
agent.Position = agentCircuit.startpos;
|
||||
@@ -1320,8 +1313,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
|
||||
protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, EntityTransferContext ctx, out string reason, out bool logout)
|
||||
{
|
||||
GridRegion source = new GridRegion(m_sceneRegionInfo);
|
||||
source.RawServerURI = m_thisGridInfo.GateKeeperURL;
|
||||
GridRegion source = new(m_sceneRegionInfo)
|
||||
{
|
||||
RawServerURI = m_thisGridInfo.GateKeeperURL
|
||||
};
|
||||
|
||||
logout = false;
|
||||
bool success = m_scene.SimulationService.CreateAgent(source, finalDestination, agentCircuit, teleportFlags, ctx, out reason);
|
||||
@@ -1645,9 +1640,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
if(agent.RegionViewDistance == 0)
|
||||
return agent;
|
||||
|
||||
Vector3 newpos;
|
||||
EntityTransferContext ctx = new EntityTransferContext();
|
||||
string failureReason;
|
||||
EntityTransferContext ctx = new();
|
||||
|
||||
// We need this because of decimal number parsing of the protocols.
|
||||
Culture.SetCurrentCulture();
|
||||
@@ -1655,8 +1648,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
Vector3 pos = agent.AbsolutePosition + agent.Velocity * 0.2f;
|
||||
|
||||
GridRegion neighbourRegion = GetDestination(agent.UUID, pos,
|
||||
ctx, out newpos, out failureReason);
|
||||
if (neighbourRegion == null)
|
||||
ctx, out Vector3 newpos, out string failureReason);
|
||||
if (neighbourRegion is null)
|
||||
{
|
||||
if (!agent.IsDeleted && failureReason != String.Empty && agent.ControllingClient != null)
|
||||
agent.ControllingClient.SendAlertMessage(failureReason);
|
||||
@@ -1664,7 +1657,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
}
|
||||
if (!agent.Appearance.CanTeleport(ctx.OutboundVersion))
|
||||
{
|
||||
if (agent.ControllingClient != null)
|
||||
if (agent.ControllingClient is null)
|
||||
agent.ControllingClient.SendAlertMessage(OutfitTPError);
|
||||
return agent;
|
||||
}
|
||||
@@ -1681,18 +1674,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
if(agent.knowsNeighbourRegion(regionhandler))
|
||||
return true;
|
||||
|
||||
string reason;
|
||||
GridRegion source = new GridRegion(m_sceneRegionInfo);
|
||||
GridRegion source = new(m_sceneRegionInfo);
|
||||
AgentCircuitData currentAgentCircuit =
|
||||
m_scene.AuthenticateHandler.GetAgentCircuitData(agent.ControllingClient.CircuitCode);
|
||||
AgentCircuitData agentCircuit = agent.ControllingClient.RequestClientInfo();
|
||||
agentCircuit.startpos = pos;
|
||||
agentCircuit.child = true;
|
||||
|
||||
agentCircuit.Appearance = new AvatarAppearance();
|
||||
agentCircuit.Appearance.AvatarHeight = agent.Appearance.AvatarHeight;
|
||||
agentCircuit.Appearance = new() { AvatarHeight = agent.Appearance.AvatarHeight };
|
||||
|
||||
if (currentAgentCircuit != null)
|
||||
if (currentAgentCircuit is not null)
|
||||
{
|
||||
agentCircuit.ServiceURLs = currentAgentCircuit.ServiceURLs;
|
||||
agentCircuit.IPAddress = currentAgentCircuit.IPAddress;
|
||||
@@ -1706,12 +1697,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
agent.AddNeighbourRegion(neighbourRegion, agentCircuit.CapsPath);
|
||||
|
||||
IPEndPoint endPoint = neighbourRegion.ExternalEndPoint;
|
||||
if(endPoint == null)
|
||||
if(endPoint is null)
|
||||
{
|
||||
m_log.DebugFormat("CrossAgentCreateFarChild failed to resolve neighbour address {0}", neighbourRegion.ExternalHostName);
|
||||
return false;
|
||||
}
|
||||
if (!m_scene.SimulationService.CreateAgent(source, neighbourRegion, agentCircuit, (int)TeleportFlags.Default, ctx, out reason))
|
||||
if (!m_scene.SimulationService.CreateAgent(source, neighbourRegion, agentCircuit, (int)TeleportFlags.Default, ctx, out string _ ))
|
||||
{
|
||||
agent.RemoveNeighbourRegion(regionhandler);
|
||||
return false;
|
||||
@@ -1792,7 +1783,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
UUID agentUUID = agent.UUID;
|
||||
try
|
||||
{
|
||||
AgentData cAgent = new AgentData();
|
||||
AgentData cAgent = new();
|
||||
agent.CopyTo(cAgent,true);
|
||||
|
||||
cAgent.Position = pos;
|
||||
@@ -1853,8 +1844,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
return false;
|
||||
}
|
||||
|
||||
string agentcaps;
|
||||
if (!agent.KnownRegions.TryGetValue(neighbourRegion.RegionHandle, out agentcaps))
|
||||
if (!agent.KnownRegions.TryGetValue(neighbourRegion.RegionHandle, out string agentcaps))
|
||||
{
|
||||
m_log.ErrorFormat("[ENTITY TRANSFER MODULE]: No ENTITY TRANSFER MODULE information for region handle {0}, exiting CrossToNewRegion.",
|
||||
neighbourRegion.RegionHandle);
|
||||
@@ -1960,7 +1950,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
|
||||
ulong regionhandler = region.RegionHandle;
|
||||
|
||||
Dictionary<ulong, string> seeds = new Dictionary<ulong, string>(capsModule.GetChildrenSeeds(sp.UUID));
|
||||
Dictionary<ulong, string> seeds = new(capsModule.GetChildrenSeeds(sp.UUID));
|
||||
|
||||
if (seeds.ContainsKey(regionhandler))
|
||||
seeds.Remove(regionhandler);
|
||||
@@ -1975,8 +1965,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
agent.startpos = sp.AbsolutePosition + CalculateOffset(sp, region);
|
||||
agent.startfar = sp.DrawDistance;
|
||||
agent.child = true;
|
||||
agent.Appearance = new AvatarAppearance();
|
||||
agent.Appearance.AvatarHeight = sp.Appearance.AvatarHeight;
|
||||
agent.Appearance = new AvatarAppearance
|
||||
{
|
||||
AvatarHeight = sp.Appearance.AvatarHeight
|
||||
};
|
||||
|
||||
agent.CapsPath = CapsUtil.GetRandomCapsObjectPath();
|
||||
|
||||
@@ -2026,7 +2018,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
int minY = itmp - (int)viewrange;
|
||||
int maxY = itmp + (int)viewrange;
|
||||
|
||||
List<GridRegion> ret = new List<GridRegion>(fullneighbours.Count);
|
||||
List<GridRegion> ret = new(fullneighbours.Count);
|
||||
foreach (GridRegion r in fullneighbours)
|
||||
{
|
||||
OpenSim.Framework.RegionFlags? regionFlags = r.RegionFlags;
|
||||
@@ -2069,7 +2061,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
int minY = itmp - viewrange;
|
||||
int maxY = itmp + viewrange;
|
||||
|
||||
List<GridRegion> ret = new List<GridRegion>(fullneighbours.Count);
|
||||
List<GridRegion> ret = new(fullneighbours.Count);
|
||||
foreach (GridRegion r in fullneighbours)
|
||||
{
|
||||
OpenSim.Framework.RegionFlags? regionFlags = r.RegionFlags;
|
||||
@@ -2130,8 +2122,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
AgentCircuitData currentAgentCircuit =
|
||||
m_scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode);
|
||||
|
||||
List<AgentCircuitData> cagents = new List<AgentCircuitData>();
|
||||
List<ulong> newneighbours = new List<ulong>();
|
||||
List<AgentCircuitData> cagents = new();
|
||||
List<ulong> newneighbours = new();
|
||||
|
||||
foreach (GridRegion neighbour in neighbours)
|
||||
{
|
||||
@@ -2153,10 +2145,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
agent.InventoryFolder = UUID.Zero;
|
||||
agent.startpos = sp.AbsolutePosition + CalculateOffset(sp, neighbour);
|
||||
agent.child = true;
|
||||
agent.Appearance = new AvatarAppearance();
|
||||
agent.Appearance.AvatarHeight = sp.Appearance.AvatarHeight;
|
||||
agent.Appearance = new AvatarAppearance { AvatarHeight = sp.Appearance.AvatarHeight };
|
||||
agent.startfar = sp.DrawDistance;
|
||||
if (currentAgentCircuit != null)
|
||||
if (currentAgentCircuit is not null)
|
||||
{
|
||||
agent.ServiceURLs = currentAgentCircuit.ServiceURLs;
|
||||
agent.IPAddress = currentAgentCircuit.IPAddress;
|
||||
@@ -2192,27 +2183,28 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
// foreach (AgentCircuitData a in cagents)
|
||||
// a.ChildrenCapSeeds = new Dictionary<ulong, string>(seeds);
|
||||
|
||||
if (capsModule != null)
|
||||
capsModule.SetChildrenSeed(sp.UUID, seeds);
|
||||
capsModule?.SetChildrenSeed(sp.UUID, seeds);
|
||||
|
||||
sp.KnownRegions = seeds;
|
||||
sp.SetNeighbourRegionSizeInfo(neighbours);
|
||||
|
||||
if (neighbours.Count > 0 || toclose.Count > 0)
|
||||
{
|
||||
AgentPosition agentpos = new AgentPosition();
|
||||
agentpos.AgentID = new UUID(sp.UUID.Guid);
|
||||
agentpos.SessionID = spClient.SessionId;
|
||||
agentpos.Size = sp.Appearance.AvatarSize;
|
||||
agentpos.Center = sp.CameraPosition;
|
||||
agentpos.Far = sp.DrawDistance;
|
||||
agentpos.Position = sp.AbsolutePosition;
|
||||
agentpos.Velocity = sp.Velocity;
|
||||
agentpos.RegionHandle = m_sceneRegionHandler;
|
||||
//agentpos.GodLevel = sp.GodLevel;
|
||||
agentpos.GodData = sp.GodController.State();
|
||||
agentpos.Throttles = spClient.GetThrottlesPacked(1);
|
||||
// agentpos.ChildrenCapSeeds = seeds;
|
||||
AgentPosition agentpos = new()
|
||||
{
|
||||
AgentID = new UUID(sp.UUID.Guid),
|
||||
SessionID = spClient.SessionId,
|
||||
Size = sp.Appearance.AvatarSize,
|
||||
Center = sp.CameraPosition,
|
||||
Far = sp.DrawDistance,
|
||||
Position = sp.AbsolutePosition,
|
||||
Velocity = sp.Velocity,
|
||||
RegionHandle = m_sceneRegionHandler,
|
||||
//agentpos.GodLevel = sp.GodLevel;
|
||||
GodData = sp.GodController.State(),
|
||||
Throttles = spClient.GetThrottlesPacked(1)
|
||||
};
|
||||
//agentpos.ChildrenCapSeeds = seeds;
|
||||
|
||||
Util.FireAndForget(delegate
|
||||
{
|
||||
@@ -2270,8 +2262,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
IClientAPI spClient = sp.ControllingClient;
|
||||
AgentCircuitData currentAgentCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(spClient.CircuitCode);
|
||||
|
||||
List<AgentCircuitData> cagents = new List<AgentCircuitData>(neighbours.Count);
|
||||
List<GridRegion> newneighbours = new List<GridRegion>(neighbours.Count);
|
||||
List<AgentCircuitData> cagents = new(neighbours.Count);
|
||||
List<GridRegion> newneighbours = new(neighbours.Count);
|
||||
|
||||
foreach (GridRegion neighbour in neighbours)
|
||||
{
|
||||
@@ -2292,10 +2284,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
agent.InventoryFolder = UUID.Zero;
|
||||
agent.startpos = sp.AbsolutePosition + CalculateOffset(sp, neighbour);
|
||||
agent.child = true;
|
||||
agent.Appearance = new AvatarAppearance();
|
||||
agent.Appearance.AvatarHeight = sp.Appearance.AvatarHeight;
|
||||
agent.Appearance = new AvatarAppearance { AvatarHeight = sp.Appearance.AvatarHeight };
|
||||
agent.startfar = sp.DrawDistance;
|
||||
if (currentAgentCircuit != null)
|
||||
if (currentAgentCircuit is not null)
|
||||
{
|
||||
agent.ServiceURLs = currentAgentCircuit.ServiceURLs;
|
||||
agent.IPAddress = currentAgentCircuit.IPAddress;
|
||||
@@ -2316,13 +2307,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
// previousRegionNeighbourHandles now contains regions to forget
|
||||
if (previousRegionNeighbour.Count > 0)
|
||||
{
|
||||
List<ulong> toclose = new List<ulong>(previousRegionNeighbour.Keys);
|
||||
List<ulong> toclose = new(previousRegionNeighbour.Keys);
|
||||
sp.CloseChildAgents(toclose);
|
||||
}
|
||||
|
||||
ICapabilitiesModule capsModule = m_scene.CapsModule;
|
||||
if (capsModule != null)
|
||||
capsModule.SetChildrenSeed(sp.UUID, sp.KnownRegions);
|
||||
capsModule?.SetChildrenSeed(sp.UUID, sp.KnownRegions);
|
||||
|
||||
if (newneighbours.Count > 0)
|
||||
{
|
||||
@@ -2377,7 +2367,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
if (seeds.Count == 0)
|
||||
return;
|
||||
|
||||
List<ulong> toclose = new List<ulong>(seeds.Keys);
|
||||
List<ulong> toclose = new(seeds.Keys);
|
||||
Util.FireAndForget(delegate
|
||||
{
|
||||
sp.CloseChildAgents(toclose);
|
||||
@@ -2402,7 +2392,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
// contains that point. A conservitive estimate.
|
||||
private class NotFoundLocationCache
|
||||
{
|
||||
private Dictionary<ulong, DateTime> m_notFoundLocations = new Dictionary<ulong, DateTime>();
|
||||
private readonly Dictionary<ulong, DateTime> m_notFoundLocations = new();
|
||||
public NotFoundLocationCache()
|
||||
{
|
||||
}
|
||||
@@ -2438,7 +2428,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
|
||||
private void DoExpiration()
|
||||
{
|
||||
List<ulong> m_toRemove = new List<ulong>();
|
||||
List<ulong> m_toRemove = new();
|
||||
DateTime now = DateTime.UtcNow;
|
||||
lock (m_notFoundLocations)
|
||||
{
|
||||
@@ -2460,7 +2450,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
|
||||
#endregion // NotFoundLocationCache class
|
||||
#region getregions
|
||||
private NotFoundLocationCache m_notFoundLocationCache = new NotFoundLocationCache();
|
||||
private readonly NotFoundLocationCache m_notFoundLocationCache = new();
|
||||
|
||||
protected GridRegion GetRegionContainingWorldLocation(IGridService pGridService, UUID pScopeID, double px, double py)
|
||||
{
|
||||
@@ -2532,10 +2522,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
|
||||
string capsPath = reg.ServerURI + CapsUtil.GetCapsSeedPath(agentCircData.CapsPath);
|
||||
|
||||
string reason = string.Empty;
|
||||
|
||||
EntityTransferContext ctx = new EntityTransferContext();
|
||||
bool regionAccepted = scene.SimulationService.CreateAgent(reg, reg, agentCircData, (uint)TeleportFlags.Default, null, out reason);
|
||||
bool regionAccepted = scene.SimulationService.CreateAgent(reg, reg, agentCircData, (uint)TeleportFlags.Default, null, out string reason);
|
||||
|
||||
if (regionAccepted)
|
||||
{
|
||||
|
||||
@@ -212,7 +212,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
IClientAPI cli = sp.ControllingClient;
|
||||
InventoryFolderBase parent = InventoryService.GetFolder(f.Owner, f.ParentID);
|
||||
cli.SendRemoveInventoryItems(new UUID[] { item.ID });
|
||||
cli.SendBulkUpdateInventory(new InventoryFolderBase[0], new InventoryItemBase[] { item });
|
||||
cli.SendBulkUpdateInventory(Array.Empty<InventoryFolderBase>(), new InventoryItemBase[] { item });
|
||||
string message = "The item was placed in folder " + f.Name;
|
||||
if (parent != null)
|
||||
message += " under " + parent.Name;
|
||||
|
||||
@@ -174,8 +174,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// </remarks>
|
||||
private readonly object m_completeMovementLock = new();
|
||||
|
||||
private static readonly Vector3 HEAD_ADJUSTMENT = new(0f, 0f, 0.3f);
|
||||
|
||||
/// <summary>
|
||||
/// Experimentally determined "fudge factor" to make sit-target positions
|
||||
/// the same as in SecondLife. Fudge factor was tested for 36 different
|
||||
@@ -1975,7 +1973,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
|
||||
private Dictionary<ulong, spRegionSizeInfo> m_knownChildRegionsSizeInfo = new();
|
||||
private readonly Dictionary<ulong, spRegionSizeInfo> m_knownChildRegionsSizeInfo = new();
|
||||
|
||||
public void AddNeighbourRegion(GridRegion region, string capsPath)
|
||||
{
|
||||
@@ -4790,17 +4788,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
m_pos = cAgentData.Position + offset;
|
||||
CameraPosition = cAgentData.Center + offset;
|
||||
|
||||
if (cAgentData.ChildrenCapSeeds != null && cAgentData.ChildrenCapSeeds.Count > 0)
|
||||
if (cAgentData.ChildrenCapSeeds is not null && cAgentData.ChildrenCapSeeds.Count > 0)
|
||||
{
|
||||
if (Scene.CapsModule != null)
|
||||
{
|
||||
Scene.CapsModule.SetChildrenSeed(UUID, cAgentData.ChildrenCapSeeds);
|
||||
}
|
||||
|
||||
Scene.CapsModule?.SetChildrenSeed(UUID, cAgentData.ChildrenCapSeeds);
|
||||
KnownRegions = cAgentData.ChildrenCapSeeds;
|
||||
}
|
||||
|
||||
if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0)
|
||||
if ((cAgentData.Throttles is not null) && cAgentData.Throttles.Length > 0)
|
||||
{
|
||||
// some scaling factor
|
||||
float x = m_pos.X;
|
||||
|
||||
@@ -181,76 +181,72 @@ namespace OpenSim.Region.ScriptEngine.Yengine
|
||||
{
|
||||
CompValu cv = null;
|
||||
|
||||
if(value is char)
|
||||
if(value is char cvalue)
|
||||
{
|
||||
cv = new CompValuChar(new TokenTypeChar(null), (char)value);
|
||||
cv = new CompValuChar(new TokenTypeChar(null), cvalue);
|
||||
}
|
||||
else if (value is double)
|
||||
else if (value is double dvalue)
|
||||
{
|
||||
cv = new CompValuFloat(new TokenTypeFloat(null), (double)(double)value);
|
||||
cv = new CompValuFloat(new TokenTypeFloat(null), dvalue);
|
||||
}
|
||||
else if (value is float)
|
||||
else if (value is float fvalue)
|
||||
{
|
||||
cv = new CompValuFloat(new TokenTypeFloat(null), (double)(float)value);
|
||||
cv = new CompValuFloat(new TokenTypeFloat(null), (double)fvalue);
|
||||
}
|
||||
else if (value is int)
|
||||
else if (value is int ivalue)
|
||||
{
|
||||
cv = new CompValuInteger(new TokenTypeInt(null), (int)value);
|
||||
cv = new CompValuInteger(new TokenTypeInt(null), ivalue);
|
||||
}
|
||||
else if (value is string)
|
||||
else if (value is string svalue)
|
||||
{
|
||||
cv = new CompValuString(new TokenTypeStr(null), (string)value);
|
||||
cv = new CompValuString(new TokenTypeStr(null), svalue);
|
||||
}
|
||||
|
||||
else if (value is LSL_Float)
|
||||
else if (value is LSL_Float lfvalue)
|
||||
{
|
||||
cv = new CompValuFloat(new TokenTypeFloat(null), (double)((LSL_Float)value).value);
|
||||
cv = new CompValuFloat(new TokenTypeFloat(null), lfvalue.value);
|
||||
}
|
||||
else if (value is LSL_Integer)
|
||||
else if (value is LSL_Integer livalue)
|
||||
{
|
||||
cv = new CompValuInteger(new TokenTypeInt(null), ((LSL_Integer)value).value);
|
||||
cv = new CompValuInteger(new TokenTypeInt(null), livalue.value);
|
||||
}
|
||||
else if (value is LSL_Rotation)
|
||||
else if (value is LSL_Rotation r)
|
||||
{
|
||||
LSL_Rotation r = (LSL_Rotation)value;
|
||||
CompValu x = new CompValuFloat(new TokenTypeFloat(null), r.x);
|
||||
CompValu y = new CompValuFloat(new TokenTypeFloat(null), r.y);
|
||||
CompValu z = new CompValuFloat(new TokenTypeFloat(null), r.z);
|
||||
CompValu s = new CompValuFloat(new TokenTypeFloat(null), r.s);
|
||||
cv = new CompValuRot(new TokenTypeRot(null), x, y, z, s);
|
||||
}
|
||||
else if (value is LSL_String)
|
||||
else if (value is LSL_String lsvalue)
|
||||
{
|
||||
cv = new CompValuString(new TokenTypeStr(null), (string)(LSL_String)value);
|
||||
cv = new CompValuString(new TokenTypeStr(null), lsvalue.m_string);
|
||||
}
|
||||
else if (value is LSL_Vector)
|
||||
else if (value is LSL_Vector v)
|
||||
{
|
||||
LSL_Vector v = (LSL_Vector)value;
|
||||
CompValu x = new CompValuFloat(new TokenTypeFloat(null), v.x);
|
||||
CompValu y = new CompValuFloat(new TokenTypeFloat(null), v.y);
|
||||
CompValu z = new CompValuFloat(new TokenTypeFloat(null), v.z);
|
||||
cv = new CompValuVec(new TokenTypeVec(null), x, y, z);
|
||||
}
|
||||
|
||||
else if (value is OpenMetaverse.Quaternion)
|
||||
else if (value is OpenMetaverse.Quaternion or)
|
||||
{
|
||||
OpenMetaverse.Quaternion r = (OpenMetaverse.Quaternion)value;
|
||||
CompValu x = new CompValuFloat(new TokenTypeFloat(null), r.X);
|
||||
CompValu y = new CompValuFloat(new TokenTypeFloat(null), r.Y);
|
||||
CompValu z = new CompValuFloat(new TokenTypeFloat(null), r.Z);
|
||||
CompValu s = new CompValuFloat(new TokenTypeFloat(null), r.W);
|
||||
CompValu x = new CompValuFloat(new TokenTypeFloat(null), or.X);
|
||||
CompValu y = new CompValuFloat(new TokenTypeFloat(null), or.Y);
|
||||
CompValu z = new CompValuFloat(new TokenTypeFloat(null), or.Z);
|
||||
CompValu s = new CompValuFloat(new TokenTypeFloat(null), or.W);
|
||||
cv = new CompValuRot(new TokenTypeRot(null), x, y, z, s);
|
||||
}
|
||||
else if (value is OpenMetaverse.UUID)
|
||||
else if (value is OpenMetaverse.UUID uvalue)
|
||||
{
|
||||
cv = new CompValuString(new TokenTypeKey(null), value.ToString());
|
||||
cv = new CompValuString(new TokenTypeKey(null), uvalue.ToString());
|
||||
}
|
||||
else if (value is OpenMetaverse.Vector3)
|
||||
else if (value is OpenMetaverse.Vector3 ov)
|
||||
{
|
||||
OpenMetaverse.Vector3 v = (OpenMetaverse.Vector3)value;
|
||||
CompValu x = new CompValuFloat(new TokenTypeFloat(null), v.X);
|
||||
CompValu y = new CompValuFloat(new TokenTypeFloat(null), v.Y);
|
||||
CompValu z = new CompValuFloat(new TokenTypeFloat(null), v.Z);
|
||||
CompValu x = new CompValuFloat(new TokenTypeFloat(null), ov.X);
|
||||
CompValu y = new CompValuFloat(new TokenTypeFloat(null), ov.Y);
|
||||
CompValu z = new CompValuFloat(new TokenTypeFloat(null), ov.Z);
|
||||
cv = new CompValuVec(new TokenTypeVec(null), x, y, z);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user