mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 17:05:55 +08:00
cosmetics
This commit is contained in:
@@ -249,7 +249,7 @@ namespace OpenSim.Framework
|
||||
|
||||
// All those lists...
|
||||
//
|
||||
private List<UUID> l_EstateManagers = new List<UUID>();
|
||||
private List<UUID> l_EstateManagers = new();
|
||||
|
||||
public UUID[] EstateManagers
|
||||
{
|
||||
@@ -257,7 +257,7 @@ namespace OpenSim.Framework
|
||||
set { l_EstateManagers = new List<UUID>(value); }
|
||||
}
|
||||
|
||||
private List<EstateBan> l_EstateBans = new List<EstateBan>();
|
||||
private List<EstateBan> l_EstateBans = new();
|
||||
|
||||
public EstateBan[] EstateBans
|
||||
{
|
||||
@@ -265,14 +265,14 @@ namespace OpenSim.Framework
|
||||
set { l_EstateBans = new List<EstateBan>(value); }
|
||||
}
|
||||
|
||||
private List<UUID> l_EstateAccess = new List<UUID>();
|
||||
private List<UUID> l_EstateAccess = new();
|
||||
public UUID[] EstateAccess
|
||||
{
|
||||
get { return l_EstateAccess.ToArray(); }
|
||||
set { l_EstateAccess = new List<UUID>(value); }
|
||||
}
|
||||
|
||||
private List<UUID> l_EstateGroups = new List<UUID>();
|
||||
private List<UUID> l_EstateGroups = new();
|
||||
public UUID[] EstateGroups
|
||||
{
|
||||
get { return l_EstateGroups.ToArray(); }
|
||||
@@ -288,8 +288,7 @@ namespace OpenSim.Framework
|
||||
|
||||
public void Save()
|
||||
{
|
||||
if (OnSave != null)
|
||||
OnSave(this);
|
||||
OnSave?.Invoke(this);
|
||||
}
|
||||
|
||||
public int EstateUsersCount()
|
||||
@@ -448,11 +447,11 @@ namespace OpenSim.Framework
|
||||
|
||||
public void SetFromFlags(ulong regionFlags)
|
||||
{
|
||||
ResetHomeOnTeleport = ((regionFlags & (ulong)OpenMetaverse.RegionFlags.ResetHomeOnTeleport) == (ulong)OpenMetaverse.RegionFlags.ResetHomeOnTeleport);
|
||||
BlockDwell = ((regionFlags & (ulong)OpenMetaverse.RegionFlags.BlockDwell) == (ulong)OpenMetaverse.RegionFlags.BlockDwell);
|
||||
AllowLandmark = ((regionFlags & (ulong)OpenMetaverse.RegionFlags.AllowLandmark) == (ulong)OpenMetaverse.RegionFlags.AllowLandmark);
|
||||
AllowParcelChanges = ((regionFlags & (ulong)OpenMetaverse.RegionFlags.AllowParcelChanges) == (ulong)OpenMetaverse.RegionFlags.AllowParcelChanges);
|
||||
AllowSetHome = ((regionFlags & (ulong)OpenMetaverse.RegionFlags.AllowSetHome) == (ulong)OpenMetaverse.RegionFlags.AllowSetHome);
|
||||
ResetHomeOnTeleport = (regionFlags & (ulong)OpenMetaverse.RegionFlags.ResetHomeOnTeleport) != 0;
|
||||
BlockDwell = (regionFlags & (ulong)OpenMetaverse.RegionFlags.BlockDwell) != 0;
|
||||
AllowLandmark = (regionFlags & (ulong)OpenMetaverse.RegionFlags.AllowLandmark) != 0;
|
||||
AllowParcelChanges = (regionFlags & (ulong)OpenMetaverse.RegionFlags.AllowParcelChanges) != 0;
|
||||
AllowSetHome = (regionFlags & (ulong)OpenMetaverse.RegionFlags.AllowSetHome) != 0;
|
||||
}
|
||||
|
||||
public bool GroupAccess(UUID groupID)
|
||||
@@ -462,7 +461,7 @@ namespace OpenSim.Framework
|
||||
|
||||
public Dictionary<string, object> ToMap()
|
||||
{
|
||||
Dictionary<string, object> map = new Dictionary<string, object>();
|
||||
Dictionary<string, object> map = new();
|
||||
PropertyInfo[] properties = this.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance);
|
||||
foreach (PropertyInfo p in properties)
|
||||
{
|
||||
@@ -471,7 +470,7 @@ namespace OpenSim.Framework
|
||||
continue;
|
||||
|
||||
object value = p.GetValue(this, null);
|
||||
if (value != null)
|
||||
if (value is not null)
|
||||
{
|
||||
if (p.PropertyType.IsArray) // of UUIDs
|
||||
{
|
||||
@@ -492,7 +491,7 @@ namespace OpenSim.Framework
|
||||
// EstateBans are special
|
||||
if (EstateBans.Length > 0)
|
||||
{
|
||||
Dictionary<string, object> bans = new Dictionary<string, object>();
|
||||
Dictionary<string, object> bans = new();
|
||||
int i = 0;
|
||||
foreach (EstateBan ban in EstateBans)
|
||||
bans["ban" + i++] = ban.ToMap();
|
||||
@@ -531,7 +530,7 @@ namespace OpenSim.Framework
|
||||
foreach (KeyValuePair<string, object> kvp in map)
|
||||
{
|
||||
PropertyInfo p = this.GetType().GetProperty(kvp.Key, BindingFlags.Public | BindingFlags.Instance);
|
||||
if (p == null)
|
||||
if (p is null)
|
||||
continue;
|
||||
|
||||
// EstateBans is a complex type, let's treat it as special
|
||||
@@ -562,19 +561,19 @@ namespace OpenSim.Framework
|
||||
}
|
||||
|
||||
// EstateBans are special
|
||||
if (map.ContainsKey("EstateBans"))
|
||||
if (map.TryGetValue("EstateBans", out object oEstateBans))
|
||||
{
|
||||
if(map["EstateBans"] is string)
|
||||
if(oEstateBans is string bansmap)
|
||||
{
|
||||
// JSON encoded bans map
|
||||
Dictionary<string, EstateBan> bdata = new Dictionary<string, EstateBan>();
|
||||
Dictionary<string, EstateBan> bdata = new();
|
||||
try
|
||||
{
|
||||
// bypass libovm, we dont need even more useless high level maps
|
||||
// this should only be called once.. but no problem, i hope
|
||||
// (other uses may need more..)
|
||||
LitJson.JsonMapper.RegisterImporter<string, UUID>((input) => new UUID(input));
|
||||
bdata = LitJson.JsonMapper.ToObject<Dictionary<string,EstateBan>>((string)map["EstateBans"]);
|
||||
bdata = LitJson.JsonMapper.ToObject<Dictionary<string,EstateBan>>(bansmap);
|
||||
}
|
||||
// catch(Exception e)
|
||||
catch
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace OpenSim.Framework
|
||||
// Next we need to rotate this vector into the spawn point's
|
||||
// coordinate system
|
||||
rot.W = -rot.W;
|
||||
offset = offset * rot;
|
||||
offset *= rot;
|
||||
|
||||
Vector3 dir = Vector3.Normalize(offset);
|
||||
|
||||
@@ -92,10 +92,12 @@ namespace OpenSim.Framework
|
||||
if (parts.Length != 3)
|
||||
throw new ArgumentException("Invalid string: " + str);
|
||||
|
||||
SpawnPoint sp = new SpawnPoint();
|
||||
sp.Yaw = float.Parse(parts[0]);
|
||||
sp.Pitch = float.Parse(parts[1]);
|
||||
sp.Distance = float.Parse(parts[2]);
|
||||
SpawnPoint sp = new()
|
||||
{
|
||||
Yaw = float.Parse(parts[0]),
|
||||
Pitch = float.Parse(parts[1]),
|
||||
Distance = float.Parse(parts[2])
|
||||
};
|
||||
return sp;
|
||||
}
|
||||
}
|
||||
@@ -109,15 +111,14 @@ namespace OpenSim.Framework
|
||||
/// <value>
|
||||
/// These appear to be terrain textures that are shipped with the client.
|
||||
/// </value>
|
||||
public static readonly UUID DEFAULT_TERRAIN_TEXTURE_1 = new UUID("b8d3965a-ad78-bf43-699b-bff8eca6c975");
|
||||
public static readonly UUID DEFAULT_TERRAIN_TEXTURE_2 = new UUID("abb783e6-3e93-26c0-248a-247666855da3");
|
||||
public static readonly UUID DEFAULT_TERRAIN_TEXTURE_3 = new UUID("179cdabd-398a-9b6b-1391-4dc333ba321f");
|
||||
public static readonly UUID DEFAULT_TERRAIN_TEXTURE_4 = new UUID("beb169c7-11ea-fff2-efe5-0f24dc881df2");
|
||||
public static readonly UUID DEFAULT_TERRAIN_TEXTURE_1 = new("b8d3965a-ad78-bf43-699b-bff8eca6c975");
|
||||
public static readonly UUID DEFAULT_TERRAIN_TEXTURE_2 = new("abb783e6-3e93-26c0-248a-247666855da3");
|
||||
public static readonly UUID DEFAULT_TERRAIN_TEXTURE_3 = new("179cdabd-398a-9b6b-1391-4dc333ba321f");
|
||||
public static readonly UUID DEFAULT_TERRAIN_TEXTURE_4 = new("beb169c7-11ea-fff2-efe5-0f24dc881df2");
|
||||
|
||||
public void Save()
|
||||
{
|
||||
if (OnSave != null)
|
||||
OnSave(this);
|
||||
OnSave?.Invoke(this);
|
||||
}
|
||||
|
||||
private UUID m_RegionUUID = UUID.Zero;
|
||||
@@ -426,7 +427,7 @@ namespace OpenSim.Framework
|
||||
{
|
||||
get
|
||||
{
|
||||
TimeSpan ts = new TimeSpan(0, 0, LoadedCreationDateTime);
|
||||
TimeSpan ts = new(0, 0, LoadedCreationDateTime);
|
||||
DateTime stamp = new DateTime(1970, 1, 1) + ts;
|
||||
return stamp.ToLongDateString();
|
||||
}
|
||||
@@ -436,7 +437,7 @@ namespace OpenSim.Framework
|
||||
{
|
||||
get
|
||||
{
|
||||
TimeSpan ts = new TimeSpan(0, 0, LoadedCreationDateTime);
|
||||
TimeSpan ts = new(0, 0, LoadedCreationDateTime);
|
||||
DateTime stamp = new DateTime(1970, 1, 1) + ts;
|
||||
return stamp.ToLongTimeString();
|
||||
}
|
||||
@@ -479,7 +480,7 @@ namespace OpenSim.Framework
|
||||
/// <summary>
|
||||
/// Our connected Telehub's SpawnPoints
|
||||
/// </summary>
|
||||
public List<SpawnPoint> l_SpawnPoints = new List<SpawnPoint>();
|
||||
public List<SpawnPoint> l_SpawnPoints = new();
|
||||
|
||||
// Add a SpawnPoint
|
||||
// ** These are not region coordinates **
|
||||
|
||||
Reference in New Issue
Block a user