Merge branch 'master' of ssh://3dhosting.de/var/git/careminster
commit
95d533ce8a
|
@ -143,6 +143,8 @@ namespace OpenSim.Framework
|
||||||
public string RemotingAddress;
|
public string RemotingAddress;
|
||||||
public UUID ScopeID = UUID.Zero;
|
public UUID ScopeID = UUID.Zero;
|
||||||
|
|
||||||
|
private Dictionary<String, String> m_otherSettings = new Dictionary<string, string>();
|
||||||
|
|
||||||
|
|
||||||
// Apparently, we're applying the same estatesettings regardless of whether it's local or remote.
|
// Apparently, we're applying the same estatesettings regardless of whether it's local or remote.
|
||||||
|
|
||||||
|
@ -445,6 +447,18 @@ namespace OpenSim.Framework
|
||||||
m_internalEndPoint = tmpEPE;
|
m_internalEndPoint = tmpEPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string GetOtherSetting(string key)
|
||||||
|
{
|
||||||
|
string val;
|
||||||
|
m_otherSettings.TryGetValue(key, out val);
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetOtherSetting(string key, string value)
|
||||||
|
{
|
||||||
|
m_otherSettings[key] = value;
|
||||||
|
}
|
||||||
|
|
||||||
private void ReadNiniConfig(IConfigSource source, string name)
|
private void ReadNiniConfig(IConfigSource source, string name)
|
||||||
{
|
{
|
||||||
// bool creatingNew = false;
|
// bool creatingNew = false;
|
||||||
|
@ -473,30 +487,39 @@ namespace OpenSim.Framework
|
||||||
if (source.Configs[name] == null)
|
if (source.Configs[name] == null)
|
||||||
{
|
{
|
||||||
source.AddConfig(name);
|
source.AddConfig(name);
|
||||||
|
|
||||||
// creatingNew = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RegionName = name;
|
||||||
IConfig config = source.Configs[name];
|
IConfig config = source.Configs[name];
|
||||||
|
|
||||||
// UUID
|
// Track all of the keys in this config and remove as they are processed
|
||||||
//
|
// The remaining keys will be added to generic key-value storage for
|
||||||
string regionUUID = config.GetString("RegionUUID", string.Empty);
|
// whoever might need it
|
||||||
|
HashSet<String> allKeys = new HashSet<String>();
|
||||||
|
foreach (string s in config.GetKeys())
|
||||||
|
{
|
||||||
|
allKeys.Add(s.ToLower());
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegionUUID
|
||||||
|
//
|
||||||
|
allKeys.Remove(("RegionUUID").ToLower());
|
||||||
|
string regionUUID = config.GetString("RegionUUID", string.Empty);
|
||||||
if (regionUUID == String.Empty)
|
if (regionUUID == String.Empty)
|
||||||
{
|
{
|
||||||
UUID newID = UUID.Random();
|
UUID newID = UUID.Random();
|
||||||
|
|
||||||
regionUUID = MainConsole.Instance.CmdPrompt("Region UUID", newID.ToString());
|
regionUUID = MainConsole.Instance.CmdPrompt("RegionUUID", newID.ToString());
|
||||||
config.Set("RegionUUID", regionUUID);
|
config.Set("RegionUUID", regionUUID);
|
||||||
}
|
}
|
||||||
|
|
||||||
RegionID = new UUID(regionUUID);
|
RegionID = new UUID(regionUUID);
|
||||||
originRegionID = RegionID; // What IS this?!
|
originRegionID = RegionID; // What IS this?! (Needed for RegionCombinerModule?)
|
||||||
|
|
||||||
RegionName = name;
|
// Location
|
||||||
|
//
|
||||||
|
allKeys.Remove(("Location").ToLower());
|
||||||
string location = config.GetString("Location", String.Empty);
|
string location = config.GetString("Location", String.Empty);
|
||||||
|
|
||||||
if (location == String.Empty)
|
if (location == String.Empty)
|
||||||
{
|
{
|
||||||
location = MainConsole.Instance.CmdPrompt("Region Location", "1000,1000");
|
location = MainConsole.Instance.CmdPrompt("Region Location", "1000,1000");
|
||||||
|
@ -508,13 +531,10 @@ namespace OpenSim.Framework
|
||||||
m_regionLocX = Convert.ToUInt32(locationElements[0]);
|
m_regionLocX = Convert.ToUInt32(locationElements[0]);
|
||||||
m_regionLocY = Convert.ToUInt32(locationElements[1]);
|
m_regionLocY = Convert.ToUInt32(locationElements[1]);
|
||||||
|
|
||||||
|
// InternalAddress
|
||||||
// Datastore (is this implemented? Omitted from example!)
|
//
|
||||||
DataStore = config.GetString("Datastore", String.Empty);
|
|
||||||
|
|
||||||
// Internal IP
|
|
||||||
IPAddress address;
|
IPAddress address;
|
||||||
|
allKeys.Remove(("InternalAddress").ToLower());
|
||||||
if (config.Contains("InternalAddress"))
|
if (config.Contains("InternalAddress"))
|
||||||
{
|
{
|
||||||
address = IPAddress.Parse(config.GetString("InternalAddress", String.Empty));
|
address = IPAddress.Parse(config.GetString("InternalAddress", String.Empty));
|
||||||
|
@ -525,8 +545,10 @@ namespace OpenSim.Framework
|
||||||
config.Set("InternalAddress", address.ToString());
|
config.Set("InternalAddress", address.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// InternalPort
|
||||||
|
//
|
||||||
int port;
|
int port;
|
||||||
|
allKeys.Remove(("InternalPort").ToLower());
|
||||||
if (config.Contains("InternalPort"))
|
if (config.Contains("InternalPort"))
|
||||||
{
|
{
|
||||||
port = config.GetInt("InternalPort", 9000);
|
port = config.GetInt("InternalPort", 9000);
|
||||||
|
@ -536,9 +558,11 @@ namespace OpenSim.Framework
|
||||||
port = Convert.ToInt32(MainConsole.Instance.CmdPrompt("Internal port", "9000"));
|
port = Convert.ToInt32(MainConsole.Instance.CmdPrompt("Internal port", "9000"));
|
||||||
config.Set("InternalPort", port);
|
config.Set("InternalPort", port);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_internalEndPoint = new IPEndPoint(address, port);
|
m_internalEndPoint = new IPEndPoint(address, port);
|
||||||
|
|
||||||
|
// AllowAlternatePorts
|
||||||
|
//
|
||||||
|
allKeys.Remove(("AllowAlternatePorts").ToLower());
|
||||||
if (config.Contains("AllowAlternatePorts"))
|
if (config.Contains("AllowAlternatePorts"))
|
||||||
{
|
{
|
||||||
m_allow_alternate_ports = config.GetBoolean("AllowAlternatePorts", true);
|
m_allow_alternate_ports = config.GetBoolean("AllowAlternatePorts", true);
|
||||||
|
@ -550,10 +574,10 @@ namespace OpenSim.Framework
|
||||||
config.Set("AllowAlternatePorts", m_allow_alternate_ports.ToString());
|
config.Set("AllowAlternatePorts", m_allow_alternate_ports.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
// External IP
|
// ExternalHostName
|
||||||
//
|
//
|
||||||
|
allKeys.Remove(("ExternalHostName").ToLower());
|
||||||
string externalName;
|
string externalName;
|
||||||
|
|
||||||
if (config.Contains("ExternalHostName"))
|
if (config.Contains("ExternalHostName"))
|
||||||
{
|
{
|
||||||
externalName = config.GetString("ExternalHostName", "SYSTEMIP");
|
externalName = config.GetString("ExternalHostName", "SYSTEMIP");
|
||||||
|
@ -563,7 +587,6 @@ namespace OpenSim.Framework
|
||||||
externalName = MainConsole.Instance.CmdPrompt("External host name", "SYSTEMIP");
|
externalName = MainConsole.Instance.CmdPrompt("External host name", "SYSTEMIP");
|
||||||
config.Set("ExternalHostName", externalName);
|
config.Set("ExternalHostName", externalName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (externalName == "SYSTEMIP")
|
if (externalName == "SYSTEMIP")
|
||||||
{
|
{
|
||||||
m_externalHostName = Util.GetLocalHost().ToString();
|
m_externalHostName = Util.GetLocalHost().ToString();
|
||||||
|
@ -576,24 +599,32 @@ namespace OpenSim.Framework
|
||||||
m_externalHostName = externalName;
|
m_externalHostName = externalName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RegionType
|
||||||
m_regionType = config.GetString("RegionType", String.Empty);
|
m_regionType = config.GetString("RegionType", String.Empty);
|
||||||
|
allKeys.Remove(("RegionType").ToLower());
|
||||||
|
|
||||||
// Prim stuff
|
// Prim stuff
|
||||||
//
|
//
|
||||||
m_nonphysPrimMax = config.GetInt("NonphysicalPrimMax", 256);
|
m_nonphysPrimMax = config.GetInt("NonphysicalPrimMax", 256);
|
||||||
|
allKeys.Remove(("NonphysicalPrimMax").ToLower());
|
||||||
m_physPrimMax = config.GetInt("PhysicalPrimMax", 10);
|
m_physPrimMax = config.GetInt("PhysicalPrimMax", 10);
|
||||||
|
allKeys.Remove(("PhysicalPrimMax").ToLower());
|
||||||
m_clampPrimSize = config.GetBoolean("ClampPrimSize", false);
|
m_clampPrimSize = config.GetBoolean("ClampPrimSize", false);
|
||||||
|
allKeys.Remove(("ClampPrimSize").ToLower());
|
||||||
m_objectCapacity = config.GetInt("MaxPrims", 15000);
|
m_objectCapacity = config.GetInt("MaxPrims", 15000);
|
||||||
|
allKeys.Remove(("MaxPrims").ToLower());
|
||||||
m_agentCapacity = config.GetInt("MaxAgents", 100);
|
m_agentCapacity = config.GetInt("MaxAgents", 100);
|
||||||
|
allKeys.Remove(("MaxAgents").ToLower());
|
||||||
|
|
||||||
// Multi-tenancy
|
// Multi-tenancy
|
||||||
//
|
//
|
||||||
ScopeID = new UUID(config.GetString("ScopeID", UUID.Zero.ToString()));
|
ScopeID = new UUID(config.GetString("ScopeID", UUID.Zero.ToString()));
|
||||||
|
allKeys.Remove(("ScopeID").ToLower());
|
||||||
|
|
||||||
|
foreach (String s in allKeys)
|
||||||
|
{
|
||||||
|
m_otherSettings.Add(s, config.GetString(s));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WriteNiniConfig(IConfigSource source)
|
private void WriteNiniConfig(IConfigSource source)
|
||||||
|
|
|
@ -5417,7 +5417,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
presence.AbsolutePosition = presence.MoveToPositionTarget;
|
presence.AbsolutePosition = presence.MoveToPositionTarget;
|
||||||
presence.ResetMoveToTarget();
|
presence.ResetMoveToTarget();
|
||||||
|
|
||||||
if (presence.PhysicsActor.Flying)
|
if (presence.Flying)
|
||||||
{
|
{
|
||||||
// A horrible hack to stop the avatar dead in its tracks rather than having them overshoot
|
// A horrible hack to stop the avatar dead in its tracks rather than having them overshoot
|
||||||
// the target if flying.
|
// the target if flying.
|
||||||
|
@ -5425,16 +5425,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// least be able to set collision status once, rather than 5 times to give it enough
|
// least be able to set collision status once, rather than 5 times to give it enough
|
||||||
// weighting so that that PhysicsActor thinks it really is colliding.
|
// weighting so that that PhysicsActor thinks it really is colliding.
|
||||||
for (int i = 0; i < 5; i++)
|
for (int i = 0; i < 5; i++)
|
||||||
presence.PhysicsActor.IsColliding = true;
|
presence.IsColliding = true;
|
||||||
|
|
||||||
if (presence.LandAtTarget)
|
if (presence.LandAtTarget)
|
||||||
presence.PhysicsActor.Flying = false;
|
presence.Flying = false;
|
||||||
|
|
||||||
// Vector3 targetPos = presence.MoveToPositionTarget;
|
// Vector3 targetPos = presence.MoveToPositionTarget;
|
||||||
// float terrainHeight = (float)presence.Scene.Heightmap[(int)targetPos.X, (int)targetPos.Y];
|
// float terrainHeight = (float)presence.Scene.Heightmap[(int)targetPos.X, (int)targetPos.Y];
|
||||||
// if (targetPos.Z - terrainHeight < 0.2)
|
// if (targetPos.Z - terrainHeight < 0.2)
|
||||||
// {
|
// {
|
||||||
// presence.PhysicsActor.Flying = false;
|
// presence.Flying = false;
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -142,12 +142,27 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
get { return m_userFlags; }
|
get { return m_userFlags; }
|
||||||
}
|
}
|
||||||
private bool m_flyingOld; // add for fly velocity control
|
|
||||||
|
// Flying
|
||||||
|
public bool Flying
|
||||||
|
{
|
||||||
|
get { return PhysicsActor != null && PhysicsActor.Flying; }
|
||||||
|
set { PhysicsActor.Flying = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
// add for fly velocity control
|
||||||
|
private bool FlyingOld {get; set;}
|
||||||
public bool WasFlying
|
public bool WasFlying
|
||||||
{
|
{
|
||||||
get { return m_wasFlying; }
|
get; private set;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsColliding
|
||||||
|
{
|
||||||
|
get { return PhysicsActor != null && PhysicsActor.IsColliding; }
|
||||||
|
// We would expect setting IsColliding to be private but it's used by a hack in Scene
|
||||||
|
set { PhysicsActor.IsColliding = value; }
|
||||||
}
|
}
|
||||||
private bool m_wasFlying; // add for fly velocity control
|
|
||||||
|
|
||||||
// private int m_lastColCount = -1; //KF: Look for Collision chnages
|
// private int m_lastColCount = -1; //KF: Look for Collision chnages
|
||||||
// private int m_updateCount = 0; //KF: Update Anims for a while
|
// private int m_updateCount = 0; //KF: Update Anims for a while
|
||||||
|
@ -697,9 +712,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
set {
|
set {
|
||||||
if(value)
|
if(value)
|
||||||
{
|
{
|
||||||
if ((PhysicsActor != null) && PhysicsActor.Flying)
|
if (Flying)
|
||||||
m_AgentControlFlags |= AgentManager.ControlFlags.AGENT_CONTROL_FLY;
|
m_AgentControlFlags |= AgentManager.ControlFlags.AGENT_CONTROL_FLY;
|
||||||
else if ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0)
|
else
|
||||||
m_AgentControlFlags &= ~AgentManager.ControlFlags.AGENT_CONTROL_FLY;
|
m_AgentControlFlags &= ~AgentManager.ControlFlags.AGENT_CONTROL_FLY;
|
||||||
}
|
}
|
||||||
m_inTransit = value;
|
m_inTransit = value;
|
||||||
|
@ -925,11 +940,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
if (ForceFly)
|
if (ForceFly)
|
||||||
{
|
{
|
||||||
PhysicsActor.Flying = true;
|
Flying = true;
|
||||||
}
|
}
|
||||||
else if (FlyDisabled)
|
else if (FlyDisabled)
|
||||||
{
|
{
|
||||||
PhysicsActor.Flying = false;
|
Flying = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't send an animation pack here, since on a region crossing this will sometimes cause a flying
|
// Don't send an animation pack here, since on a region crossing this will sometimes cause a flying
|
||||||
|
@ -1054,11 +1069,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <param name="pos"></param>
|
/// <param name="pos"></param>
|
||||||
public void Teleport(Vector3 pos)
|
public void Teleport(Vector3 pos)
|
||||||
{
|
{
|
||||||
bool isFlying = false;
|
bool isFlying = Flying;
|
||||||
if (PhysicsActor != null)
|
|
||||||
isFlying = PhysicsActor.Flying;
|
|
||||||
|
|
||||||
m_log.DebugFormat("[SCENE PRESENCCE]: Local teleport, flying = {0}", isFlying);
|
|
||||||
RemoveFromPhysicalScene();
|
RemoveFromPhysicalScene();
|
||||||
Velocity = Vector3.Zero;
|
Velocity = Vector3.Zero;
|
||||||
CheckLandingPoint(ref pos);
|
CheckLandingPoint(ref pos);
|
||||||
|
@ -1070,10 +1081,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public void TeleportWithMomentum(Vector3 pos)
|
public void TeleportWithMomentum(Vector3 pos)
|
||||||
{
|
{
|
||||||
bool isFlying = false;
|
bool isFlying = Flying;
|
||||||
if (PhysicsActor != null)
|
|
||||||
isFlying = PhysicsActor.Flying;
|
|
||||||
|
|
||||||
RemoveFromPhysicalScene();
|
RemoveFromPhysicalScene();
|
||||||
CheckLandingPoint(ref pos);
|
CheckLandingPoint(ref pos);
|
||||||
AbsolutePosition = pos;
|
AbsolutePosition = pos;
|
||||||
|
@ -1208,8 +1216,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
AbsolutePosition = pos;
|
AbsolutePosition = pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool m_flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
|
bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
|
||||||
MakeRootAgent(AbsolutePosition, m_flying);
|
MakeRootAgent(AbsolutePosition, flying);
|
||||||
|
|
||||||
if ((m_callbackURI != null) && !m_callbackURI.Equals(""))
|
if ((m_callbackURI != null) && !m_callbackURI.Equals(""))
|
||||||
{
|
{
|
||||||
|
@ -1434,7 +1442,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
bool DCFlagKeyPressed = false;
|
bool DCFlagKeyPressed = false;
|
||||||
Vector3 agent_control_v3 = Vector3.Zero;
|
Vector3 agent_control_v3 = Vector3.Zero;
|
||||||
|
|
||||||
bool oldflying = PhysicsActor.Flying;
|
bool oldflying = Flying;
|
||||||
|
|
||||||
if (ForceFly)
|
if (ForceFly)
|
||||||
actor.Flying = true;
|
actor.Flying = true;
|
||||||
|
@ -1454,7 +1462,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
// use camera up angle when in mouselook and not flying or when holding the left mouse button down and not flying
|
// use camera up angle when in mouselook and not flying or when holding the left mouse button down and not flying
|
||||||
// this prevents 'jumping' in inappropriate situations.
|
// this prevents 'jumping' in inappropriate situations.
|
||||||
if ((m_mouseLook && !PhysicsActor.Flying) || (m_leftButtonDown && !PhysicsActor.Flying))
|
if (!Flying && (m_mouseLook || m_leftButtonDown))
|
||||||
dirVectors = GetWalkDirectionVectors();
|
dirVectors = GetWalkDirectionVectors();
|
||||||
else
|
else
|
||||||
dirVectors = Dir_Vectors;
|
dirVectors = Dir_Vectors;
|
||||||
|
@ -1541,7 +1549,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// with something with the down arrow pressed.
|
// with something with the down arrow pressed.
|
||||||
|
|
||||||
// Only do this if we're flying
|
// Only do this if we're flying
|
||||||
if (PhysicsActor != null && PhysicsActor.Flying && !ForceFly)
|
if (Flying && !ForceFly)
|
||||||
{
|
{
|
||||||
// Landing detection code
|
// Landing detection code
|
||||||
|
|
||||||
|
@ -1549,7 +1557,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
bool controlland = (((flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) ||
|
bool controlland = (((flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) ||
|
||||||
((flags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0));
|
((flags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0));
|
||||||
|
|
||||||
if (PhysicsActor.Flying && PhysicsActor.IsColliding && controlland)
|
if (Flying && IsColliding && controlland)
|
||||||
{
|
{
|
||||||
// nesting this check because LengthSquared() is expensive and we don't
|
// nesting this check because LengthSquared() is expensive and we don't
|
||||||
// want to do it every step when flying.
|
// want to do it every step when flying.
|
||||||
|
@ -1762,9 +1770,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Name, pos, terrainHeight, m_scene.RegionInfo.RegionName);
|
Name, pos, terrainHeight, m_scene.RegionInfo.RegionName);
|
||||||
|
|
||||||
if (noFly)
|
if (noFly)
|
||||||
PhysicsActor.Flying = false;
|
Flying = false;
|
||||||
else if (pos.Z > terrainHeight)
|
else if (pos.Z > terrainHeight)
|
||||||
PhysicsActor.Flying = true;
|
Flying = true;
|
||||||
|
|
||||||
LandAtTarget = landAtTarget;
|
LandAtTarget = landAtTarget;
|
||||||
MovingToTarget = true;
|
MovingToTarget = true;
|
||||||
|
@ -2330,42 +2338,42 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Vector3 direc = vec * Rotation;
|
Vector3 direc = vec * Rotation;
|
||||||
direc.Normalize();
|
direc.Normalize();
|
||||||
|
|
||||||
if (PhysicsActor.Flying != m_flyingOld) // add for fly velocity control
|
if (Flying != FlyingOld) // add for fly velocity control
|
||||||
{
|
{
|
||||||
m_flyingOld = PhysicsActor.Flying; // add for fly velocity control
|
FlyingOld = Flying; // add for fly velocity control
|
||||||
if (!PhysicsActor.Flying)
|
if (!Flying)
|
||||||
m_wasFlying = true; // add for fly velocity control
|
WasFlying = true; // add for fly velocity control
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PhysicsActor.IsColliding == true)
|
if (IsColliding)
|
||||||
m_wasFlying = false; // add for fly velocity control
|
WasFlying = false; // add for fly velocity control
|
||||||
|
|
||||||
if ((vec.Z == 0f) && !PhysicsActor.Flying)
|
if ((vec.Z == 0f) && !Flying)
|
||||||
direc.Z = 0f; // Prevent camera WASD up.
|
direc.Z = 0f; // Prevent camera WASD up.
|
||||||
|
|
||||||
direc *= 0.03f * 128f * SpeedModifier;
|
direc *= 0.03f * 128f * SpeedModifier;
|
||||||
|
|
||||||
if (PhysicsActor != null)
|
if (PhysicsActor != null)
|
||||||
{
|
{
|
||||||
if (PhysicsActor.Flying)
|
if (Flying)
|
||||||
{
|
{
|
||||||
direc *= 4.0f;
|
direc *= 4.0f;
|
||||||
//bool controlland = (((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) || ((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0));
|
//bool controlland = (((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) || ((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0));
|
||||||
//if (controlland)
|
//if (controlland)
|
||||||
// m_log.Info("[AGENT]: landCommand");
|
// m_log.Info("[AGENT]: landCommand");
|
||||||
//if (PhysicsActor.IsColliding)
|
//if (IsColliding)
|
||||||
// m_log.Info("[AGENT]: colliding");
|
// m_log.Info("[AGENT]: colliding");
|
||||||
//if (PhysicsActor.Flying && PhysicsActor.IsColliding && controlland)
|
//if (Flying && IsColliding && controlland)
|
||||||
//{
|
//{
|
||||||
// StopFlying();
|
// StopFlying();
|
||||||
// m_log.Info("[AGENT]: Stop Flying");
|
// m_log.Info("[AGENT]: Stop Flying");
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
if (Animator.Falling && m_wasFlying) // if falling from flying, disable motion add
|
if (Animator.Falling && WasFlying) // if falling from flying, disable motion add
|
||||||
{
|
{
|
||||||
direc *= 0.0f;
|
direc *= 0.0f;
|
||||||
}
|
}
|
||||||
else if (!PhysicsActor.Flying && PhysicsActor.IsColliding)
|
else if (!Flying && IsColliding)
|
||||||
{
|
{
|
||||||
if (direc.Z > 2.0f)
|
if (direc.Z > 2.0f)
|
||||||
{
|
{
|
||||||
|
@ -2835,7 +2843,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
if (m_requestedSitTargetUUID == UUID.Zero)
|
if (m_requestedSitTargetUUID == UUID.Zero)
|
||||||
{
|
{
|
||||||
bool isFlying = PhysicsActor.Flying;
|
bool isFlying = Flying;
|
||||||
RemoveFromPhysicalScene();
|
RemoveFromPhysicalScene();
|
||||||
|
|
||||||
Vector3 pos = AbsolutePosition;
|
Vector3 pos = AbsolutePosition;
|
||||||
|
@ -2862,7 +2870,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
if (m_requestedSitTargetUUID == UUID.Zero)
|
if (m_requestedSitTargetUUID == UUID.Zero)
|
||||||
{
|
{
|
||||||
bool isFlying = PhysicsActor.Flying;
|
bool isFlying = Flying;
|
||||||
RemoveFromPhysicalScene();
|
RemoveFromPhysicalScene();
|
||||||
|
|
||||||
Vector3 pos = AbsolutePosition;
|
Vector3 pos = AbsolutePosition;
|
||||||
|
@ -2912,7 +2920,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return m_scene.CrossAgentToNewRegion(this, PhysicsActor.Flying);
|
return m_scene.CrossAgentToNewRegion(this, Flying);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
@ -3188,7 +3196,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Appearance = new AvatarAppearance(cAgent.Appearance);
|
Appearance = new AvatarAppearance(cAgent.Appearance);
|
||||||
if (PhysicsActor != null)
|
if (PhysicsActor != null)
|
||||||
{
|
{
|
||||||
bool isFlying = PhysicsActor.Flying;
|
bool isFlying = Flying;
|
||||||
RemoveFromPhysicalScene();
|
RemoveFromPhysicalScene();
|
||||||
AddToPhysicalScene(isFlying);
|
AddToPhysicalScene(isFlying);
|
||||||
}
|
}
|
||||||
|
@ -3291,7 +3299,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
private void OutOfBoundsCall(Vector3 pos)
|
private void OutOfBoundsCall(Vector3 pos)
|
||||||
{
|
{
|
||||||
//bool flying = PhysicsActor.Flying;
|
//bool flying = Flying;
|
||||||
//RemoveFromPhysicalScene();
|
//RemoveFromPhysicalScene();
|
||||||
|
|
||||||
//AddToPhysicalScene(flying);
|
//AddToPhysicalScene(flying);
|
||||||
|
|
|
@ -61,7 +61,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
|
|
||||||
TestScene scene = SceneHelpers.SetupScene();
|
TestScene scene = SceneHelpers.SetupScene();
|
||||||
ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
|
ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
|
||||||
sp.PhysicsActor.Flying = true;
|
sp.Flying = true;
|
||||||
sp.PhysicsCollisionUpdate(new CollisionEventUpdate());
|
sp.PhysicsCollisionUpdate(new CollisionEventUpdate());
|
||||||
|
|
||||||
Assert.That(sp.Animator.CurrentMovementAnimation, Is.EqualTo("HOVER"));
|
Assert.That(sp.Animator.CurrentMovementAnimation, Is.EqualTo("HOVER"));
|
||||||
|
|
|
@ -79,7 +79,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
// Vector3 startPos = new Vector3(128, 128, 30);
|
// Vector3 startPos = new Vector3(128, 128, 30);
|
||||||
|
|
||||||
// For now, we'll make the scene presence fly to simplify this test, but this needs to change.
|
// For now, we'll make the scene presence fly to simplify this test, but this needs to change.
|
||||||
sp.PhysicsActor.Flying = true;
|
sp.Flying = true;
|
||||||
|
|
||||||
m_scene.Update();
|
m_scene.Update();
|
||||||
Assert.That(sp.AbsolutePosition, Is.EqualTo(startPos));
|
Assert.That(sp.AbsolutePosition, Is.EqualTo(startPos));
|
||||||
|
|
|
@ -175,7 +175,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
|
||||||
Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos));
|
Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos));
|
||||||
|
|
||||||
// For now, we'll make the scene presence fly to simplify this test, but this needs to change.
|
// For now, we'll make the scene presence fly to simplify this test, but this needs to change.
|
||||||
npc.PhysicsActor.Flying = true;
|
npc.Flying = true;
|
||||||
|
|
||||||
scene.Update();
|
scene.Update();
|
||||||
Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos));
|
Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos));
|
||||||
|
|
|
@ -5984,9 +5984,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
// note: this may need some tweaking when walking downhill. you "fall down" for a brief instant
|
// note: this may need some tweaking when walking downhill. you "fall down" for a brief instant
|
||||||
// and don't collide when walking downhill, which instantly registers as in-air, briefly. should
|
// and don't collide when walking downhill, which instantly registers as in-air, briefly. should
|
||||||
// there be some minimum non-collision threshold time before claiming the avatar is in-air?
|
// there be some minimum non-collision threshold time before claiming the avatar is in-air?
|
||||||
if ((flags & ScriptBaseClass.AGENT_WALKING) == 0 &&
|
if ((flags & ScriptBaseClass.AGENT_WALKING) == 0 && !agent.IsColliding )
|
||||||
agent.PhysicsActor != null &&
|
|
||||||
!agent.PhysicsActor.IsColliding)
|
|
||||||
{
|
{
|
||||||
flags |= ScriptBaseClass.AGENT_IN_AIR;
|
flags |= ScriptBaseClass.AGENT_IN_AIR;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1559,209 +1559,83 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
return m_ScriptEngine.World.GetSimulatorVersion();
|
return m_ScriptEngine.World.GetSimulatorVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Hashtable osdToHashtable(OSDMap map)
|
||||||
|
{
|
||||||
|
Hashtable result = new Hashtable();
|
||||||
|
foreach (KeyValuePair<string, OSD> item in map) {
|
||||||
|
result.Add(item.Key, osdToObject(item.Value));
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ArrayList osdToArray(OSDArray list)
|
||||||
|
{
|
||||||
|
ArrayList result = new ArrayList();
|
||||||
|
foreach ( OSD item in list ) {
|
||||||
|
result.Add(osdToObject(item));
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Object osdToObject(OSD decoded)
|
||||||
|
{
|
||||||
|
if ( decoded is OSDString ) {
|
||||||
|
return (string) decoded.AsString();
|
||||||
|
} else if ( decoded is OSDInteger ) {
|
||||||
|
return (int) decoded.AsInteger();
|
||||||
|
} else if ( decoded is OSDReal ) {
|
||||||
|
return (float) decoded.AsReal();
|
||||||
|
} else if ( decoded is OSDBoolean ) {
|
||||||
|
return (bool) decoded.AsBoolean();
|
||||||
|
} else if ( decoded is OSDMap ) {
|
||||||
|
return osdToHashtable((OSDMap) decoded);
|
||||||
|
} else if ( decoded is OSDArray ) {
|
||||||
|
return osdToArray((OSDArray) decoded);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object osParseJSONNew(string JSON)
|
||||||
|
{
|
||||||
|
CheckThreatLevel(ThreatLevel.None, "osParseJSON");
|
||||||
|
|
||||||
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
OSD decoded = OSDParser.DeserializeJson(JSON);
|
||||||
|
return osdToObject(decoded);
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
OSSLError("osParseJSONNew: Problems decoding JSON string " + JSON + " : " + e.Message) ;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Hashtable osParseJSON(string JSON)
|
public Hashtable osParseJSON(string JSON)
|
||||||
{
|
{
|
||||||
CheckThreatLevel(ThreatLevel.None, "osParseJSON");
|
CheckThreatLevel(ThreatLevel.None, "osParseJSON");
|
||||||
|
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
// see http://www.json.org/ for more details on JSON
|
Object decoded = osParseJSONNew(JSON);
|
||||||
|
|
||||||
string currentKey = null;
|
if ( decoded is Hashtable ) {
|
||||||
Stack objectStack = new Stack(); // objects in JSON can be nested so we need to keep a track of this
|
return (Hashtable) decoded;
|
||||||
Hashtable jsondata = new Hashtable(); // the hashtable to be returned
|
} else if ( decoded is ArrayList ) {
|
||||||
int i = 0;
|
ArrayList decoded_list = (ArrayList) decoded;
|
||||||
try
|
Hashtable fakearray = new Hashtable();
|
||||||
{
|
int i = 0;
|
||||||
|
for ( i = 0; i < decoded_list.Count ; i++ ) {
|
||||||
// iterate through the serialised stream of tokens and store at the right depth in the hashtable
|
fakearray.Add(i, decoded_list[i]);
|
||||||
// the top level hashtable may contain more nested hashtables within it each containing an objects representation
|
|
||||||
for (i = 0; i < JSON.Length; i++)
|
|
||||||
{
|
|
||||||
|
|
||||||
// m_log.Debug(""+JSON[i]);
|
|
||||||
switch (JSON[i])
|
|
||||||
{
|
|
||||||
case '{':
|
|
||||||
// create hashtable and add it to the stack or array if we are populating one, we can have a lot of nested objects in JSON
|
|
||||||
|
|
||||||
Hashtable currentObject = new Hashtable();
|
|
||||||
if (objectStack.Count == 0) // the stack should only be empty for the first outer object
|
|
||||||
{
|
|
||||||
|
|
||||||
objectStack.Push(jsondata);
|
|
||||||
}
|
|
||||||
else if (objectStack.Peek().ToString() == "System.Collections.ArrayList")
|
|
||||||
{
|
|
||||||
// add it to the parent array
|
|
||||||
((ArrayList)objectStack.Peek()).Add(currentObject);
|
|
||||||
objectStack.Push(currentObject);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// add it to the parent hashtable
|
|
||||||
((Hashtable)objectStack.Peek()).Add(currentKey,currentObject);
|
|
||||||
objectStack.Push(currentObject);
|
|
||||||
}
|
|
||||||
|
|
||||||
// clear the key
|
|
||||||
currentKey = null;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '}':
|
|
||||||
// pop the hashtable off the stack
|
|
||||||
objectStack.Pop();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '"':// string boundary
|
|
||||||
|
|
||||||
string tokenValue = "";
|
|
||||||
i++; // move to next char
|
|
||||||
|
|
||||||
// just loop through until the next quote mark storing the string, ignore quotes with pre-ceding \
|
|
||||||
while (JSON[i] != '"')
|
|
||||||
{
|
|
||||||
tokenValue += JSON[i];
|
|
||||||
|
|
||||||
// handle escaped double quotes \"
|
|
||||||
if (JSON[i] == '\\' && JSON[i+1] == '"')
|
|
||||||
{
|
|
||||||
tokenValue += JSON[i+1];
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// ok we've got a string, if we've got an array on the top of the stack then we store it
|
|
||||||
if (objectStack.Peek().ToString() == "System.Collections.ArrayList")
|
|
||||||
{
|
|
||||||
((ArrayList)objectStack.Peek()).Add(tokenValue);
|
|
||||||
}
|
|
||||||
else if (currentKey == null) // no key stored and its not an array this must be a key so store it
|
|
||||||
{
|
|
||||||
currentKey = tokenValue;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// we have a key so lets store this value
|
|
||||||
((Hashtable)objectStack.Peek()).Add(currentKey,tokenValue);
|
|
||||||
// now lets clear the key, we're done with it and moving on
|
|
||||||
currentKey = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ':':// key : value separator
|
|
||||||
// just ignore
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ' ':// spaces
|
|
||||||
// just ignore
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '[': // array start
|
|
||||||
ArrayList currentArray = new ArrayList();
|
|
||||||
|
|
||||||
if (objectStack.Peek().ToString() == "System.Collections.ArrayList")
|
|
||||||
{
|
|
||||||
((ArrayList)objectStack.Peek()).Add(currentArray);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
((Hashtable)objectStack.Peek()).Add(currentKey,currentArray);
|
|
||||||
// clear the key
|
|
||||||
currentKey = null;
|
|
||||||
}
|
|
||||||
objectStack.Push(currentArray);
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ',':// seperator
|
|
||||||
// just ignore
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ']'://Array end
|
|
||||||
// pop the array off the stack
|
|
||||||
objectStack.Pop();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 't': // we've found a character start not in quotes, it must be a boolean true
|
|
||||||
|
|
||||||
if (objectStack.Peek().ToString() == "System.Collections.ArrayList")
|
|
||||||
{
|
|
||||||
((ArrayList)objectStack.Peek()).Add(true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
((Hashtable)objectStack.Peek()).Add(currentKey,true);
|
|
||||||
currentKey = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
//advance the counter to the letter 'e'
|
|
||||||
i = i + 3;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'f': // we've found a character start not in quotes, it must be a boolean false
|
|
||||||
|
|
||||||
if (objectStack.Peek().ToString() == "System.Collections.ArrayList")
|
|
||||||
{
|
|
||||||
((ArrayList)objectStack.Peek()).Add(false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
((Hashtable)objectStack.Peek()).Add(currentKey,false);
|
|
||||||
currentKey = null;
|
|
||||||
}
|
|
||||||
//advance the counter to the letter 'e'
|
|
||||||
i = i + 4;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '\n':// carriage return
|
|
||||||
// just ignore
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '\r':// carriage return
|
|
||||||
// just ignore
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
// ok here we're catching all numeric types int,double,long we might want to spit these up mr accurately
|
|
||||||
// but for now we'll just do them as strings
|
|
||||||
|
|
||||||
string numberValue = "";
|
|
||||||
|
|
||||||
// just loop through until the next known marker quote mark storing the string
|
|
||||||
while (JSON[i] != '"' && JSON[i] != ',' && JSON[i] != ']' && JSON[i] != '}' && JSON[i] != ' ')
|
|
||||||
{
|
|
||||||
numberValue += "" + JSON[i++];
|
|
||||||
}
|
|
||||||
|
|
||||||
i--; // we want to process this caracter that marked the end of this string in the main loop
|
|
||||||
|
|
||||||
// ok we've got a string, if we've got an array on the top of the stack then we store it
|
|
||||||
if (objectStack.Peek().ToString() == "System.Collections.ArrayList")
|
|
||||||
{
|
|
||||||
((ArrayList)objectStack.Peek()).Add(numberValue);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// we have a key so lets store this value
|
|
||||||
((Hashtable)objectStack.Peek()).Add(currentKey,numberValue);
|
|
||||||
// now lets clear the key, we're done with it and moving on
|
|
||||||
currentKey = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return fakearray;
|
||||||
|
} else {
|
||||||
|
OSSLError("osParseJSON: unable to parse JSON string " + JSON);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
catch(Exception)
|
|
||||||
{
|
|
||||||
OSSLError("osParseJSON: The JSON string is not valid " + JSON) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
return jsondata;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using OpenSim.Region.ScriptEngine.Interfaces;
|
using OpenSim.Region.ScriptEngine.Interfaces;
|
||||||
|
|
||||||
|
@ -140,6 +141,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||||
|
|
||||||
string osGetScriptEngineName();
|
string osGetScriptEngineName();
|
||||||
string osGetSimulatorVersion();
|
string osGetSimulatorVersion();
|
||||||
|
Object osParseJSONNew(string JSON);
|
||||||
Hashtable osParseJSON(string JSON);
|
Hashtable osParseJSON(string JSON);
|
||||||
|
|
||||||
void osMessageObject(key objectUUID,string message);
|
void osMessageObject(key objectUUID,string message);
|
||||||
|
|
|
@ -397,6 +397,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||||
return m_OSSL_Functions.osParseJSON(JSON);
|
return m_OSSL_Functions.osParseJSON(JSON);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Object osParseJSONNew(string JSON)
|
||||||
|
{
|
||||||
|
return m_OSSL_Functions.osParseJSONNew(JSON);
|
||||||
|
}
|
||||||
|
|
||||||
public void osMessageObject(key objectUUID,string message)
|
public void osMessageObject(key objectUUID,string message)
|
||||||
{
|
{
|
||||||
m_OSSL_Functions.osMessageObject(objectUUID,message);
|
m_OSSL_Functions.osMessageObject(objectUUID,message);
|
||||||
|
|
Loading…
Reference in New Issue