* Patch from XenReborn to make remove-region work properly without needing to do a change-region first. Careful though. I still suggest you do a change-region first.

* Patch from Melanie to implement touch_end.
* Thanks XenReborn!.  Thanks Melanie!
0.6.0-stable
Teravus Ovares 2008-04-27 22:15:38 +00:00
parent 911e63765c
commit 54563d8dea
8 changed files with 131 additions and 17 deletions

View File

@ -52,6 +52,7 @@ Patches
* A_Biondi * A_Biondi
* lulurun * lulurun
* Melanie Thielker * Melanie Thielker
* John R Sohn(XenReborn)
LSL Devs LSL Devs

View File

@ -212,7 +212,7 @@ namespace OpenSim
if (config != null) if (config != null)
{ {
config.Set("accounts_authenticate", false); config.Set("accounts_authenticate", false);
config.Set("welcome_message", "Welcome to OpenSim"); config.Set("welcome_message", "Welcome to Krynn");
config.Set("inventory_plugin", "OpenSim.Data.SQLite.dll"); config.Set("inventory_plugin", "OpenSim.Data.SQLite.dll");
config.Set("inventory_source", ""); config.Set("inventory_source", "");
config.Set("userDatabase_plugin", "OpenSim.Data.SQLite.dll"); config.Set("userDatabase_plugin", "OpenSim.Data.SQLite.dll");
@ -978,18 +978,63 @@ namespace OpenSim
CreateRegion(new RegionInfo(cmdparams[0], "Regions/" + cmdparams[1],false), true); CreateRegion(new RegionInfo(cmdparams[0], "Regions/" + cmdparams[1],false), true);
break; break;
case "remove-region": case "remove-region":
string regName = CombineParams(cmdparams, 0); string regName = CombineParams(cmdparams, 0);
Console.WriteLine("Trying to kill: " + regName);
Scene killScene; Scene killScene;
if (m_sceneManager.TryGetScene(regName, out killScene))
/* if (m_sceneManager.TryGetScene(regName, out killScene))
{ {
Console.WriteLine("Returned object ID: ", killScene.RegionInfo.RegionID.ToString());
Console.WriteLine("Returned object Name: ", killScene.RegionInfo.RegionName);
if (killScene == null)
{
Console.WriteLine("Returned object is null!");
}
if (m_sceneManager.CurrentScene.RegionInfo.RegionID == killScene.RegionInfo.RegionID) if (m_sceneManager.CurrentScene.RegionInfo.RegionID == killScene.RegionInfo.RegionID)
{ {
m_sceneManager.TrySetCurrentScene(".."); m_sceneManager.TrySetCurrentScene("..");
} }
m_regionData.Remove(killScene.RegionInfo); m_regionData.Remove(killScene.RegionInfo);
m_sceneManager.CloseScene(killScene); m_sceneManager.CloseScene(killScene);
}*/
/// note from John R Sohn aka XenReborn (irc.freenode.net)
/// the trygetscene function does not work
/// when debugging it i noticed it did indeed find the region by name
/// but the OUT parameter "scene" return an empty object
/// hence the reason it threw an exception
/// when the server code in this block tried to kill it
/// i know its not supposed to work that way... but it seems..
/// that it is.. given a flaw in the langauge or concurrency error..
/// i have no idea, but for some reason, performing the search here
/// locally does work, as does dynamically killing the region
/// however on server restart, the region returns, i dunno if this was
/// intentional or not.... i suggest creating a seperate function
/// which will permanently remove all data relating to the region
/// as an administrative option... maybe something like "Purge Region"
///
/// i made editations with debug console output in above commented code..
/// and the trygetscene(string,out scene) function to show whats happening.
for (int x = 0; x < m_sceneManager.Scenes.Count; x++)
{
if (m_sceneManager.Scenes[x].RegionInfo.RegionName.CompareTo(regName) == 0)
{
killScene = m_sceneManager.Scenes[x];
m_regionData.Remove(killScene.RegionInfo);
m_sceneManager.CloseScene(killScene);
}
} }
break; break;
case "exit": case "exit":

View File

@ -324,8 +324,7 @@ namespace OpenSim.Region.Environment.Scenes
// Calls attach with a Zero position // Calls attach with a Zero position
AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, LLVector3.Zero); AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, LLVector3.Zero);
} }
public void RezSingleAttachment(IClientAPI remoteClient, LLUUID itemID, uint AttachmentPt, public void RezSingleAttachment(IClientAPI remoteClient, LLUUID itemID, uint AttachmentPt,uint ItemFlags, uint NextOwnerMask)
uint ItemFlags, uint NextOwnerMask)
{ {
SceneObjectGroup objatt = m_parentScene.RezObject(remoteClient, itemID, LLVector3.Zero, LLVector3.Zero, LLUUID.Zero, (byte)1, true, SceneObjectGroup objatt = m_parentScene.RezObject(remoteClient, itemID, LLVector3.Zero, LLVector3.Zero, LLUUID.Zero, (byte)1, true,
(uint)(PermissionMask.Copy | PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer), (uint)(PermissionMask.Copy | PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer),

View File

@ -146,6 +146,41 @@ namespace OpenSim.Region.Environment.Scenes
List<EntityBase> EntitieList = GetEntities(); List<EntityBase> EntitieList = GetEntities();
foreach (EntityBase ent in EntitieList)
{
if (ent is SceneObjectGroup)
{
SceneObjectGroup obj = ent as SceneObjectGroup;
if (obj != null)
{
// Is this prim part of the group
if (obj.HasChildPrim(localID))
{
// Currently only grab/touch for the single prim
// the client handles rez correctly
obj.ObjectGrabHandler(localID, offsetPos, remoteClient);
SceneObjectPart part = obj.GetChildPart(localID);
// If the touched prim handles touches, deliver it
// If not, deliver to root prim
if ((part.ObjectFlags & (uint)LLObject.ObjectFlags.Touch) != 0)
EventManager.TriggerObjectGrab(part.LocalId, part.OffsetPosition, remoteClient);
else
EventManager.TriggerObjectGrab(obj.RootPart.LocalId, part.OffsetPosition, remoteClient);
return;
}
}
}
}
}
public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient)
{
List<EntityBase> EntitieList = GetEntities();
foreach (EntityBase ent in EntitieList) foreach (EntityBase ent in EntitieList)
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
@ -155,18 +190,18 @@ namespace OpenSim.Region.Environment.Scenes
// Is this prim part of the group // Is this prim part of the group
if (obj.HasChildPrim(localID)) if (obj.HasChildPrim(localID))
{ {
// Currently only grab/touch for the single prim SceneObjectPart part=obj.GetChildPart(localID);
// the client handles rez correctly if (part != null)
obj.ObjectGrabHandler(localID, offsetPos, remoteClient);
// trigger event, one for each prim part in the group
// so that a touch to a non-root prim in a group will still
// trigger a touch_start for a script in the root prim
foreach (SceneObjectPart part in obj.Children.Values)
{ {
EventManager.TriggerObjectGrab(part.LocalId, part.OffsetPosition, remoteClient); // If the touched prim handles touches, deliver it
} // If not, deliver to root prim
if ((part.ObjectFlags & (uint)LLObject.ObjectFlags.Touch) != 0)
EventManager.TriggerObjectDeGrab(part.LocalId, remoteClient);
else
EventManager.TriggerObjectDeGrab(obj.RootPart.LocalId, remoteClient);
return;
}
return; return;
} }
} }

View File

@ -1617,6 +1617,7 @@ namespace OpenSim.Region.Environment.Scenes
client.OnMoveTaskItem += MoveTaskInventoryItem; client.OnMoveTaskItem += MoveTaskInventoryItem;
client.OnGrabObject += ProcessObjectGrab; client.OnGrabObject += ProcessObjectGrab;
client.OnDeGrabObject += ProcessObjectDeGrab;
client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; client.OnMoneyTransferRequest += ProcessMoneyTransferRequest;
client.OnParcelBuy += ProcessParcelBuy; client.OnParcelBuy += ProcessParcelBuy;
client.OnAvatarPickerRequest += ProcessAvatarPickerRequest; client.OnAvatarPickerRequest += ProcessAvatarPickerRequest;

View File

@ -83,10 +83,12 @@ namespace OpenSim.Region.Environment.Scenes
public event OnShutdownDelegate OnShutdown; public event OnShutdownDelegate OnShutdown;
public delegate void ObjectGrabDelegate(uint localID, LLVector3 offsetPos, IClientAPI remoteClient); public delegate void ObjectGrabDelegate(uint localID, LLVector3 offsetPos, IClientAPI remoteClient);
public delegate void ObjectDeGrabDelegate(uint localID, IClientAPI remoteClient);
public delegate void OnPermissionErrorDelegate(LLUUID user, string reason); public delegate void OnPermissionErrorDelegate(LLUUID user, string reason);
public event ObjectGrabDelegate OnObjectGrab; public event ObjectGrabDelegate OnObjectGrab;
public event ObjectDeGrabDelegate OnObjectDeGrab;
public event OnPermissionErrorDelegate OnPermissionError; public event OnPermissionErrorDelegate OnPermissionError;
@ -247,6 +249,7 @@ namespace OpenSim.Region.Environment.Scenes
private OnParcelPrimCountAddDelegate handlerParcelPrimCountAdd = null; //OnParcelPrimCountAdd; private OnParcelPrimCountAddDelegate handlerParcelPrimCountAdd = null; //OnParcelPrimCountAdd;
private OnShutdownDelegate handlerShutdown = null; //OnShutdown; private OnShutdownDelegate handlerShutdown = null; //OnShutdown;
private ObjectGrabDelegate handlerObjectGrab = null; //OnObjectGrab; private ObjectGrabDelegate handlerObjectGrab = null; //OnObjectGrab;
private ObjectDeGrabDelegate handlerObjectDeGrab = null; //OnObjectDeGrab;
private NewRezScript handlerRezScript = null; //OnRezScript; private NewRezScript handlerRezScript = null; //OnRezScript;
private RemoveScript handlerRemoveScript = null; //OnRemoveScript; private RemoveScript handlerRemoveScript = null; //OnRemoveScript;
private SceneGroupMoved handlerSceneGroupMove = null; //OnSceneGroupMove; private SceneGroupMoved handlerSceneGroupMove = null; //OnSceneGroupMove;
@ -386,6 +389,15 @@ namespace OpenSim.Region.Environment.Scenes
} }
} }
public void TriggerObjectDeGrab(uint localID, IClientAPI remoteClient)
{
handlerObjectDeGrab = OnObjectDeGrab;
if (handlerObjectDeGrab != null)
{
handlerObjectDeGrab(localID, remoteClient);
}
}
public void TriggerRezScript(uint localID, LLUUID itemID, string script) public void TriggerRezScript(uint localID, LLUUID itemID, string script)
{ {
handlerRezScript = OnRezScript; handlerRezScript = OnRezScript;

View File

@ -268,15 +268,26 @@ namespace OpenSim.Region.Environment.Scenes
public bool TryGetScene(string regionName, out Scene scene) public bool TryGetScene(string regionName, out Scene scene)
{ {
scene = null;
foreach (Scene mscene in m_localScenes) foreach (Scene mscene in m_localScenes)
{ {
if (String.Compare(mscene.RegionInfo.RegionName, regionName, true) == 0) Console.Write("Region tested: " + mscene.RegionInfo.RegionName+" With ID: "+mscene.RegionInfo.RegionID.ToString());
bool b = String.Compare(mscene.RegionInfo.RegionName.Trim(), regionName.Trim(), true) == 0;
Console.WriteLine(" <==> Result: " + b.ToString());
if (b)
{ {
Console.WriteLine("FOUND assigning region to out parameter");
scene = mscene; scene = mscene;
return true; return true;
} }
} }
scene = null;
return false; return false;
} }

View File

@ -67,6 +67,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
{ {
myScriptEngine.Log.Info("[" + myScriptEngine.ScriptEngineName + "]: Hooking up to server events"); myScriptEngine.Log.Info("[" + myScriptEngine.ScriptEngineName + "]: Hooking up to server events");
myScriptEngine.World.EventManager.OnObjectGrab += touch_start; myScriptEngine.World.EventManager.OnObjectGrab += touch_start;
myScriptEngine.World.EventManager.OnObjectDeGrab += touch_end;
myScriptEngine.World.EventManager.OnRezScript += OnRezScript; myScriptEngine.World.EventManager.OnRezScript += OnRezScript;
myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript; myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript;
myScriptEngine.World.EventManager.OnScriptChangedEvent += changed; myScriptEngine.World.EventManager.OnScriptChangedEvent += changed;
@ -117,6 +118,15 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "touch_start", detstruct, new object[] { (int)1 }); myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "touch_start", detstruct, new object[] { (int)1 });
} }
public void touch_end(uint localID, IClientAPI remoteClient)
{
// Add to queue for all scripts in ObjectID object
EventQueueManager.Queue_llDetectParams_Struct detstruct = new EventQueueManager.Queue_llDetectParams_Struct();
detstruct._key = new LSL_Types.key[1];
detstruct._key[0] = new LSL_Types.key(remoteClient.AgentId.ToString());
myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "touch_end", detstruct, new object[] { (int)1 });
}
public void OnRezScript(uint localID, LLUUID itemID, string script) public void OnRezScript(uint localID, LLUUID itemID, string script)
{ {
Console.WriteLine("OnRezScript localID: " + localID + " LLUID: " + itemID.ToString() + " Size: " + Console.WriteLine("OnRezScript localID: " + localID + " LLUID: " + itemID.ToString() + " Size: " +