mirror of
https://github.com/opensim/opensim.git
synced 2026-08-04 08:06:27 +08:00
add helper SimulatorFeaturesModulr OpenSimExtraFeatureContains plus cosmetics
This commit is contained in:
@@ -145,7 +145,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
|
||||
try
|
||||
{
|
||||
Vector3 pos = avatar.AbsolutePosition + (Vector3.UnitX * avatar.Rotation);
|
||||
Vector3 pos = avatar.AbsolutePosition + Vector3.UnitXRotated(avatar.Rotation);
|
||||
Quaternion rot = Quaternion.Identity;
|
||||
Vector3 rootpos = Vector3.Zero;
|
||||
|
||||
|
||||
@@ -215,9 +215,9 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
else
|
||||
{
|
||||
extrasMap = new OSDMap();
|
||||
m_features["OpenSimExtras"] = extrasMap;
|
||||
}
|
||||
extrasMap[name] = value;
|
||||
m_features["OpenSimExtras"] = extrasMap;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -238,12 +238,19 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
value = null;
|
||||
lock (m_features)
|
||||
{
|
||||
if (!m_features.TryGetValue("OpenSimExtras", out OSD extra))
|
||||
return false;
|
||||
if(!(extra is OSDMap))
|
||||
return false;
|
||||
return (extra as OSDMap).TryGetValue(name, out value);
|
||||
if (m_features.TryGetValue("OpenSimExtras", out OSD extra) && extra is OSDMap exm)
|
||||
return exm.TryGetValue(name, out value);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public bool OpenSimExtraFeatureContains(string name)
|
||||
{
|
||||
lock (m_features)
|
||||
{
|
||||
if (m_features.TryGetValue("OpenSimExtras", out OSD extra) && extra is OSDMap exm)
|
||||
return exm.ContainsKey(name);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public OSDMap GetFeatures()
|
||||
|
||||
@@ -611,8 +611,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
m_asyncPacketProcess.Stop();
|
||||
|
||||
// Flush all of the packets out of the UDP server for this client
|
||||
if (m_udpServer != null)
|
||||
m_udpServer.Flush(m_udpClient);
|
||||
m_udpServer?.Flush(m_udpClient);
|
||||
|
||||
// Remove ourselves from the scene
|
||||
m_scene.RemoveClient(m_agentId, true);
|
||||
|
||||
@@ -511,16 +511,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
if (position.X == 128f && position.Y == 128f && position.Z == 22.5f)
|
||||
position = m_sceneRegionInfo.DefaultLandingPoint;
|
||||
|
||||
// TODO: Get proper AVG Height
|
||||
float localHalfAVHeight = 0.8f;
|
||||
if (sp.Appearance != null)
|
||||
localHalfAVHeight = sp.Appearance.AvatarHeight / 2;
|
||||
|
||||
float posZLimit = 22;
|
||||
|
||||
// TODO: Check other Scene HeightField
|
||||
posZLimit = m_scene.Heightmap[(int)position.X, (int)position.Y];
|
||||
|
||||
float localHalfAVHeight = sp.Appearance is null ? 0.8f : sp.Appearance.AvatarHeight / 2;
|
||||
float posZLimit = m_scene.GetGroundHeight(position.X, position.Y);
|
||||
posZLimit += localHalfAVHeight + 0.1f;
|
||||
|
||||
if ((position.Z < posZLimit) && !(Single.IsInfinity(posZLimit) || Single.IsNaN(posZLimit)))
|
||||
|
||||
@@ -44,6 +44,7 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||
bool RemoveFeature(string name);
|
||||
bool TryGetFeature(string name, out OSD value);
|
||||
bool TryGetOpenSimExtraFeature(string name, out OSD value);
|
||||
bool OpenSimExtraFeatureContains(string name);
|
||||
OSDMap GetFeatures();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1222,38 +1222,33 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
if(SceneGridInfo is not null)
|
||||
{
|
||||
OSD osdtmp;
|
||||
string tmp;
|
||||
if (!fm.TryGetOpenSimExtraFeature("GridName", out osdtmp))
|
||||
if (!fm.OpenSimExtraFeatureContains("GridName"))
|
||||
{
|
||||
tmp = SceneGridInfo.GridName;
|
||||
if (!string.IsNullOrEmpty(tmp))
|
||||
fm.AddOpenSimExtraFeature("GridName", tmp);
|
||||
if (!string.IsNullOrEmpty(SceneGridInfo.GridName))
|
||||
fm.AddOpenSimExtraFeature("GridName", SceneGridInfo.GridName);
|
||||
}
|
||||
|
||||
if (!fm.TryGetOpenSimExtraFeature("GridNick", out osdtmp))
|
||||
if (!fm.OpenSimExtraFeatureContains("GridNick"))
|
||||
{
|
||||
tmp = SceneGridInfo.GridNick;
|
||||
if (!string.IsNullOrEmpty(tmp))
|
||||
fm.AddOpenSimExtraFeature("GridNick", tmp);
|
||||
if (!string.IsNullOrEmpty(SceneGridInfo.GridNick))
|
||||
fm.AddOpenSimExtraFeature("GridNick", SceneGridInfo.GridNick);
|
||||
}
|
||||
|
||||
if (!fm.TryGetOpenSimExtraFeature("GridURL", out osdtmp))
|
||||
if (!fm.OpenSimExtraFeatureContains("GridURL"))
|
||||
{
|
||||
tmp = SceneGridInfo.GridUrl;
|
||||
fm.AddOpenSimExtraFeature("GridURL", tmp);
|
||||
fm.AddOpenSimExtraFeature("GridURL", SceneGridInfo.GridUrl);
|
||||
}
|
||||
|
||||
if (!fm.TryGetOpenSimExtraFeature("GridURLAlias", out osdtmp))
|
||||
if (!fm.OpenSimExtraFeatureContains("GridURLAlias"))
|
||||
{
|
||||
string[] alias = SceneGridInfo.GridUrlAlias;
|
||||
if(alias is not null && alias.Length > 0)
|
||||
{
|
||||
StringBuilder sb = osStringBuilderCache.Acquire();
|
||||
int i = 0;
|
||||
for(; i < alias.Length - 1; ++i)
|
||||
while(i < alias.Length - 1)
|
||||
{
|
||||
sb.Append(alias[i]);
|
||||
sb.Append(alias[i++]);
|
||||
sb.Append(',');
|
||||
}
|
||||
sb.Append(alias[i]);
|
||||
@@ -1263,25 +1258,22 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
fm.AddOpenSimExtraFeature("GridURLAlias", string.Empty);
|
||||
}
|
||||
|
||||
if (!fm.TryGetOpenSimExtraFeature("search-server-url", out osdtmp))
|
||||
if (!fm.OpenSimExtraFeatureContains("search-server-url"))
|
||||
{
|
||||
tmp = SceneGridInfo.SearchURL;
|
||||
if (!string.IsNullOrEmpty(tmp))
|
||||
fm.AddOpenSimExtraFeature("search-server-url", tmp);
|
||||
if (!string.IsNullOrEmpty(SceneGridInfo.SearchURL))
|
||||
fm.AddOpenSimExtraFeature("search-server-url", SceneGridInfo.SearchURL);
|
||||
}
|
||||
|
||||
if (!fm.TryGetOpenSimExtraFeature("destination-guide-url", out osdtmp))
|
||||
if (!fm.OpenSimExtraFeatureContains("destination-guide-url"))
|
||||
{
|
||||
tmp = SceneGridInfo.DestinationGuideURL;
|
||||
if (!string.IsNullOrEmpty(tmp))
|
||||
fm.AddOpenSimExtraFeature("destination-guide-url", tmp);
|
||||
if (!string.IsNullOrEmpty(SceneGridInfo.DestinationGuideURL))
|
||||
fm.AddOpenSimExtraFeature("destination-guide-url", SceneGridInfo.DestinationGuideURL);
|
||||
}
|
||||
|
||||
if (!fm.TryGetOpenSimExtraFeature("currency-base-uri", out osdtmp))
|
||||
if (!fm.OpenSimExtraFeatureContains("currency-base-uri"))
|
||||
{
|
||||
tmp = SceneGridInfo.EconomyURL;
|
||||
if (!string.IsNullOrEmpty(tmp))
|
||||
fm.AddOpenSimExtraFeature("currency-base-uri", tmp);
|
||||
if (!string.IsNullOrEmpty(SceneGridInfo.EconomyURL))
|
||||
fm.AddOpenSimExtraFeature("currency-base-uri", SceneGridInfo.EconomyURL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public int Width { get { return m_terrainData.SizeX; } } // X dimension
|
||||
// Unfortunately, for historical reasons, in this module 'Width' is X and 'Height' is Y
|
||||
public int Height { get { return m_terrainData.SizeY; } } // Y dimension
|
||||
public int Altitude { get { return m_terrainData.SizeZ; } } // Y dimension
|
||||
public int Altitude { get { return 0; } } // Y dimension
|
||||
|
||||
|
||||
// Default, not-often-used builder
|
||||
|
||||
@@ -1292,7 +1292,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
{
|
||||
_ = UUID.TryParse(id, out UUID keyID);
|
||||
m_AsyncCommands.SensorRepeatPlugin.SenseOnce(m_host.LocalId, m_item.ItemID, name, keyID, type, range, arc, m_host);
|
||||
}
|
||||
}
|
||||
|
||||
public void llSensorRepeat(string name, string id, int type, double range, double arc, double rate)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user