From b848df2a3ad7e4503904fc39e4a63e40a8ab0118 Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Wed, 9 Mar 2011 17:16:03 -0800 Subject: [PATCH] In LSL_Api.cs, no special checking of if ScriptEngineToSceneConnectorModule exist anymore -- async model is no longer used and we get rid of the old code. --- .../SymmetricSync/RegionSyncModule.cs | 2 +- .../Framework/Scenes/Scene.Inventory.cs | 2 + OpenSim/Region/Framework/Scenes/Scene.cs | 1 + .../Shared/Api/Implementation/LSL_Api.cs | 130 ++++++------------ 4 files changed, 44 insertions(+), 91 deletions(-) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs index 81c71ea2a2..854986508a 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -1200,7 +1200,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule primCount += sog.Parts.Length; } - m_log.WarnFormat("SyncStatus -- Object count: {0}, Prim Count {1} ", sogList.Count, primCount); + m_log.WarnFormat("SyncStateReport -- Object count: {0}, Prim Count {1} ", sogList.Count, primCount); } private void SyncDebug(Object[] args) diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 8aa7c363af..e73c381545 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -333,11 +333,13 @@ namespace OpenSim.Region.Framework.Scenes ArrayList errors = new ArrayList(); //In the old async model, this function is supposed to be executed only on a remote script engine, not an authorative Scene + /* if (RegionSyncModule==null && !IsSyncedScriptEngine()) { m_log.Warn("This is not the script engine. Should not have received OnUpdateScript event."); return errors; } + * */ SceneObjectPart part = GetSceneObjectPart(primID); SceneObjectGroup group = part.ParentGroup; if (isScriptRunning) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index c43bfd6349..59c7a0bc1c 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -508,6 +508,7 @@ namespace OpenSim.Region.Framework.Scenes //Only Auth. Scene should trigger scritp rez by remote script engine. return IsSyncedServer(); } + /////////////////////////////////////////////////////////////////////////////////////////////// //RA: Physics Engine diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index aaab3ba431..7253a7fed9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -1353,7 +1353,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api SetScale(m_host, scale); } - //REGION SYNC TOUCHED -- set via sync'ing with remote Scene protected void SetScale(SceneObjectPart part, LSL_Vector scale) { // TODO: this needs to trigger a persistance save as well @@ -1383,21 +1382,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (scale.z > World.m_maxNonphys) scale.z = World.m_maxNonphys; - if (World.ScriptEngineToSceneConnectorModule==null) - { - //If Script engine is local to Scene (REGION SYNC mode=server, and XEngine enabled=true, and no remote Script Engine connected) - Vector3 tmp = part.Scale; - tmp.X = (float)scale.x; - tmp.Y = (float)scale.y; - tmp.Z = (float)scale.z; - part.Scale = tmp; - part.SendFullUpdateToAllClients(); - } - else - { - //set via sync'ing with remote Scene - World.ScriptEngineToSceneConnectorModule.SendSetPrimProperties(part.ParentGroup.LocX, part.ParentGroup.LocY, part.UUID, "scale", scale); - } + Vector3 tmp = part.Scale; + tmp.X = (float)scale.x; + tmp.Y = (float)scale.y; + tmp.Z = (float)scale.z; + part.Scale = tmp; + part.SendFullUpdateToAllClients(); } public LSL_Vector llGetScale() @@ -1416,7 +1406,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; } - //REGION SYNC TOUCHED -- set via sync'ing with remote Scene public void llSetColor(LSL_Vector color, int face) { m_host.AddScriptLPS(1); @@ -1424,22 +1413,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (face == ScriptBaseClass.ALL_SIDES) face = SceneObjectPart.ALL_SIDES; - // REGION SYNC - if (World.ScriptEngineToSceneConnectorModule == null) - { - m_host.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face); - } - else - { - object[] valParams = new object[2]; - //valParams[0] = (object)color.x; - //valParams[1] = (object)color.y; - //valParams[2] = (object)color.z; - Vector3 vcolor = new Vector3((float)color.x, (float)color.y, (float)color.z); - valParams[0] = (object)vcolor; - valParams[1] = (object)face; - World.ScriptEngineToSceneConnectorModule.SendSetPrimProperties(m_host.ParentGroup.LocX, m_host.ParentGroup.LocY, m_host.UUID, "color", (object)valParams); - } + m_host.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face); } public void SetTexGen(SceneObjectPart part, int face,int style) @@ -2766,7 +2740,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ScriptSleep(100); } - //REGION SYNC TOUCHED -- set via sync'ing with remote Scene public void llRezAtRoot(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param) { m_host.AddScriptLPS(1); @@ -2778,39 +2751,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (dist > m_ScriptDistanceFactor * 10.0f) return; - if (World.ScriptEngineToSceneConnectorModule == null) + TaskInventoryDictionary partInventory = (TaskInventoryDictionary)m_host.TaskInventory.Clone(); + + foreach (KeyValuePair inv in partInventory) { - //if Scene co-locates with Script Engine - - TaskInventoryDictionary partInventory = (TaskInventoryDictionary)m_host.TaskInventory.Clone(); - - foreach (KeyValuePair inv in partInventory) + if (inv.Value.Name == inventory) { - if (inv.Value.Name == inventory) + // make sure we're an object. + if (inv.Value.InvType != (int)InventoryType.Object) { - // make sure we're an object. - if (inv.Value.InvType != (int)InventoryType.Object) - { - llSay(0, "Unable to create requested object. Object is missing from database."); - return; - } + llSay(0, "Unable to create requested object. Object is missing from database."); + return; + } - Vector3 llpos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z); - Vector3 llvel = new Vector3((float)vel.x, (float)vel.y, (float)vel.z); + Vector3 llpos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z); + Vector3 llvel = new Vector3((float)vel.x, (float)vel.y, (float)vel.z); - // need the magnitude later - float velmag = (float)Util.GetMagnitude(llvel); + // need the magnitude later + float velmag = (float)Util.GetMagnitude(llvel); - SceneObjectGroup new_group = World.RezObject(m_host, inv.Value, llpos, Rot2Quaternion(rot), llvel, param); + SceneObjectGroup new_group = World.RezObject(m_host, inv.Value, llpos, Rot2Quaternion(rot), llvel, param); - // If either of these are null, then there was an unknown error. - if (new_group == null) - continue; - if (new_group.RootPart == null) - continue; + // If either of these are null, then there was an unknown error. + if (new_group == null) + continue; + if (new_group.RootPart == null) + continue; - // objects rezzed with this method are die_at_edge by default. - new_group.RootPart.SetDieAtEdge(true); + // objects rezzed with this method are die_at_edge by default. + new_group.RootPart.SetDieAtEdge(true); new_group.ResumeScripts(); @@ -2818,45 +2787,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api "object_rez", new Object[] { new LSL_String( new_group.RootPart.UUID.ToString()) }, - new DetectParams[0])); + new DetectParams[0])); - float groupmass = new_group.GetMass(); + float groupmass = new_group.GetMass(); - if (new_group.RootPart.PhysActor != null && new_group.RootPart.PhysActor.IsPhysical && llvel != Vector3.Zero) - { - //Recoil. - llApplyImpulse(new LSL_Vector(llvel.X * groupmass, llvel.Y * groupmass, llvel.Z * groupmass), 0); - } - // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay) - ScriptSleep((int)((groupmass * velmag) / 10)); - ScriptSleep(100); - return; + if (new_group.RootPart.PhysActor != null && new_group.RootPart.PhysActor.IsPhysical && llvel != Vector3.Zero) + { + //Recoil. + llApplyImpulse(new LSL_Vector(llvel.X * groupmass, llvel.Y * groupmass, llvel.Z * groupmass), 0); } + // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay) + ScriptSleep((int)((groupmass * velmag) / 10)); + ScriptSleep(100); + return; } - - llSay(0, "Could not find object " + inventory); } - else - { - //Scene does not co-locate with Script Engine - Vector3 llpos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z); - Vector3 llvel = new Vector3((float)vel.x, (float)vel.y, (float)vel.z); - Quaternion llrot = Rot2Quaternion(rot); - object[] valParams = new object[5]; - valParams[0] = (object)inventory; - valParams[1] = (object)llpos; - valParams[2] = (object)llpos; - valParams[3] = (object)llrot; - valParams[4] = (object)param; - //we borrow the implementation SendSetPrimProperties to send the message to Scene - World.ScriptEngineToSceneConnectorModule.SendSetPrimProperties(m_host.ParentGroup.LocX, m_host.ParentGroup.LocY, m_host.UUID, "object_rez", (object)valParams); - // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay) - //ScriptSleep((int)((groupmass * velmag) / 10)); - ScriptSleep(100); - } + llSay(0, "Could not find object " + inventory); } + public void llRezObject(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param) { llRezAtRoot(inventory, pos, vel, rot, param);