diff options
author | Teravus Ovares | 2008-04-27 22:15:38 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-04-27 22:15:38 +0000 |
commit | 54563d8dea86ca1e022f3aafa791908e8bcc4912 (patch) | |
tree | 2eab339160a5f89cb637c6554e6d56be594d2180 /OpenSim/Region | |
parent | * Single Attachments now work from inventory. You can attach from inventory ... (diff) | |
download | opensim-SC-54563d8dea86ca1e022f3aafa791908e8bcc4912.zip opensim-SC-54563d8dea86ca1e022f3aafa791908e8bcc4912.tar.gz opensim-SC-54563d8dea86ca1e022f3aafa791908e8bcc4912.tar.bz2 opensim-SC-54563d8dea86ca1e022f3aafa791908e8bcc4912.tar.xz |
* 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!
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Application/OpenSimMain.cs | 51 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/InnerScene.cs | 3 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs | 55 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 1 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneEvents.cs | 12 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneManager.cs | 15 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs | 10 |
7 files changed, 130 insertions, 17 deletions
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index 2094578..b322f6d 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs | |||
@@ -212,7 +212,7 @@ namespace OpenSim | |||
212 | if (config != null) | 212 | if (config != null) |
213 | { | 213 | { |
214 | config.Set("accounts_authenticate", false); | 214 | config.Set("accounts_authenticate", false); |
215 | config.Set("welcome_message", "Welcome to OpenSim"); | 215 | config.Set("welcome_message", "Welcome to Krynn"); |
216 | config.Set("inventory_plugin", "OpenSim.Data.SQLite.dll"); | 216 | config.Set("inventory_plugin", "OpenSim.Data.SQLite.dll"); |
217 | config.Set("inventory_source", ""); | 217 | config.Set("inventory_source", ""); |
218 | config.Set("userDatabase_plugin", "OpenSim.Data.SQLite.dll"); | 218 | config.Set("userDatabase_plugin", "OpenSim.Data.SQLite.dll"); |
@@ -978,18 +978,63 @@ namespace OpenSim | |||
978 | CreateRegion(new RegionInfo(cmdparams[0], "Regions/" + cmdparams[1],false), true); | 978 | CreateRegion(new RegionInfo(cmdparams[0], "Regions/" + cmdparams[1],false), true); |
979 | break; | 979 | break; |
980 | case "remove-region": | 980 | case "remove-region": |
981 | |||
981 | string regName = CombineParams(cmdparams, 0); | 982 | string regName = CombineParams(cmdparams, 0); |
982 | 983 | ||
984 | Console.WriteLine("Trying to kill: " + regName); | ||
983 | Scene killScene; | 985 | Scene killScene; |
984 | if (m_sceneManager.TryGetScene(regName, out killScene)) | 986 | |
987 | /* if (m_sceneManager.TryGetScene(regName, out killScene)) | ||
985 | { | 988 | { |
989 | Console.WriteLine("Returned object ID: ", killScene.RegionInfo.RegionID.ToString()); | ||
990 | Console.WriteLine("Returned object Name: ", killScene.RegionInfo.RegionName); | ||
991 | |||
992 | |||
993 | if (killScene == null) | ||
994 | { | ||
995 | Console.WriteLine("Returned object is null!"); | ||
996 | } | ||
997 | |||
986 | if (m_sceneManager.CurrentScene.RegionInfo.RegionID == killScene.RegionInfo.RegionID) | 998 | if (m_sceneManager.CurrentScene.RegionInfo.RegionID == killScene.RegionInfo.RegionID) |
987 | { | 999 | { |
988 | m_sceneManager.TrySetCurrentScene(".."); | 1000 | m_sceneManager.TrySetCurrentScene(".."); |
989 | } | 1001 | } |
1002 | |||
990 | m_regionData.Remove(killScene.RegionInfo); | 1003 | m_regionData.Remove(killScene.RegionInfo); |
991 | m_sceneManager.CloseScene(killScene); | 1004 | m_sceneManager.CloseScene(killScene); |
1005 | |||
1006 | |||
1007 | }*/ | ||
1008 | |||
1009 | |||
1010 | /// note from John R Sohn aka XenReborn (irc.freenode.net) | ||
1011 | /// the trygetscene function does not work | ||
1012 | /// when debugging it i noticed it did indeed find the region by name | ||
1013 | /// but the OUT parameter "scene" return an empty object | ||
1014 | /// hence the reason it threw an exception | ||
1015 | /// when the server code in this block tried to kill it | ||
1016 | /// i know its not supposed to work that way... but it seems.. | ||
1017 | /// that it is.. given a flaw in the langauge or concurrency error.. | ||
1018 | /// i have no idea, but for some reason, performing the search here | ||
1019 | /// locally does work, as does dynamically killing the region | ||
1020 | /// however on server restart, the region returns, i dunno if this was | ||
1021 | /// intentional or not.... i suggest creating a seperate function | ||
1022 | /// which will permanently remove all data relating to the region | ||
1023 | /// as an administrative option... maybe something like "Purge Region" | ||
1024 | /// | ||
1025 | /// i made editations with debug console output in above commented code.. | ||
1026 | /// and the trygetscene(string,out scene) function to show whats happening. | ||
1027 | |||
1028 | for (int x = 0; x < m_sceneManager.Scenes.Count; x++) | ||
1029 | { | ||
1030 | if (m_sceneManager.Scenes[x].RegionInfo.RegionName.CompareTo(regName) == 0) | ||
1031 | { | ||
1032 | killScene = m_sceneManager.Scenes[x]; | ||
1033 | m_regionData.Remove(killScene.RegionInfo); | ||
1034 | m_sceneManager.CloseScene(killScene); | ||
1035 | } | ||
992 | } | 1036 | } |
1037 | |||
993 | break; | 1038 | break; |
994 | 1039 | ||
995 | case "exit": | 1040 | case "exit": |
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index 104ae48..d00f601 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs | |||
@@ -324,8 +324,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
324 | // Calls attach with a Zero position | 324 | // Calls attach with a Zero position |
325 | AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, LLVector3.Zero); | 325 | AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, LLVector3.Zero); |
326 | } | 326 | } |
327 | public void RezSingleAttachment(IClientAPI remoteClient, LLUUID itemID, uint AttachmentPt, | 327 | public void RezSingleAttachment(IClientAPI remoteClient, LLUUID itemID, uint AttachmentPt,uint ItemFlags, uint NextOwnerMask) |
328 | uint ItemFlags, uint NextOwnerMask) | ||
329 | { | 328 | { |
330 | SceneObjectGroup objatt = m_parentScene.RezObject(remoteClient, itemID, LLVector3.Zero, LLVector3.Zero, LLUUID.Zero, (byte)1, true, | 329 | SceneObjectGroup objatt = m_parentScene.RezObject(remoteClient, itemID, LLVector3.Zero, LLVector3.Zero, LLUUID.Zero, (byte)1, true, |
331 | (uint)(PermissionMask.Copy | PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer), | 330 | (uint)(PermissionMask.Copy | PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer), |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index 5e0b8ba..71b2716 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs | |||
@@ -151,22 +151,57 @@ namespace OpenSim.Region.Environment.Scenes | |||
151 | if (ent is SceneObjectGroup) | 151 | if (ent is SceneObjectGroup) |
152 | { | 152 | { |
153 | SceneObjectGroup obj = ent as SceneObjectGroup; | 153 | SceneObjectGroup obj = ent as SceneObjectGroup; |
154 | if (obj != null) | ||
155 | { | ||
156 | // Is this prim part of the group | ||
157 | if (obj.HasChildPrim(localID)) | ||
158 | { | ||
159 | // Currently only grab/touch for the single prim | ||
160 | // the client handles rez correctly | ||
161 | obj.ObjectGrabHandler(localID, offsetPos, remoteClient); | ||
162 | |||
163 | SceneObjectPart part = obj.GetChildPart(localID); | ||
164 | |||
165 | // If the touched prim handles touches, deliver it | ||
166 | // If not, deliver to root prim | ||
167 | if ((part.ObjectFlags & (uint)LLObject.ObjectFlags.Touch) != 0) | ||
168 | EventManager.TriggerObjectGrab(part.LocalId, part.OffsetPosition, remoteClient); | ||
169 | else | ||
170 | EventManager.TriggerObjectGrab(obj.RootPart.LocalId, part.OffsetPosition, remoteClient); | ||
171 | |||
172 | return; | ||
173 | } | ||
174 | } | ||
175 | } | ||
176 | } | ||
177 | } | ||
178 | |||
179 | public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient) | ||
180 | { | ||
181 | |||
182 | List<EntityBase> EntitieList = GetEntities(); | ||
183 | |||
184 | foreach (EntityBase ent in EntitieList) | ||
185 | { | ||
186 | if (ent is SceneObjectGroup) | ||
187 | { | ||
188 | SceneObjectGroup obj = ent as SceneObjectGroup; | ||
154 | 189 | ||
155 | // Is this prim part of the group | 190 | // Is this prim part of the group |
156 | if (obj.HasChildPrim(localID)) | 191 | if (obj.HasChildPrim(localID)) |
157 | { | 192 | { |
158 | // Currently only grab/touch for the single prim | 193 | SceneObjectPart part=obj.GetChildPart(localID); |
159 | // the client handles rez correctly | 194 | if (part != null) |
160 | obj.ObjectGrabHandler(localID, offsetPos, remoteClient); | ||
161 | |||
162 | // trigger event, one for each prim part in the group | ||
163 | // so that a touch to a non-root prim in a group will still | ||
164 | // trigger a touch_start for a script in the root prim | ||
165 | foreach (SceneObjectPart part in obj.Children.Values) | ||
166 | { | 195 | { |
167 | EventManager.TriggerObjectGrab(part.LocalId, part.OffsetPosition, remoteClient); | 196 | // If the touched prim handles touches, deliver it |
197 | // If not, deliver to root prim | ||
198 | if ((part.ObjectFlags & (uint)LLObject.ObjectFlags.Touch) != 0) | ||
199 | EventManager.TriggerObjectDeGrab(part.LocalId, remoteClient); | ||
200 | else | ||
201 | EventManager.TriggerObjectDeGrab(obj.RootPart.LocalId, remoteClient); | ||
202 | |||
203 | return; | ||
168 | } | 204 | } |
169 | |||
170 | return; | 205 | return; |
171 | } | 206 | } |
172 | } | 207 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index f94aec7..a517e69 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -1617,6 +1617,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1617 | client.OnMoveTaskItem += MoveTaskInventoryItem; | 1617 | client.OnMoveTaskItem += MoveTaskInventoryItem; |
1618 | 1618 | ||
1619 | client.OnGrabObject += ProcessObjectGrab; | 1619 | client.OnGrabObject += ProcessObjectGrab; |
1620 | client.OnDeGrabObject += ProcessObjectDeGrab; | ||
1620 | client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; | 1621 | client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; |
1621 | client.OnParcelBuy += ProcessParcelBuy; | 1622 | client.OnParcelBuy += ProcessParcelBuy; |
1622 | client.OnAvatarPickerRequest += ProcessAvatarPickerRequest; | 1623 | client.OnAvatarPickerRequest += ProcessAvatarPickerRequest; |
diff --git a/OpenSim/Region/Environment/Scenes/SceneEvents.cs b/OpenSim/Region/Environment/Scenes/SceneEvents.cs index 74554c3..769817e 100644 --- a/OpenSim/Region/Environment/Scenes/SceneEvents.cs +++ b/OpenSim/Region/Environment/Scenes/SceneEvents.cs | |||
@@ -83,10 +83,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
83 | public event OnShutdownDelegate OnShutdown; | 83 | public event OnShutdownDelegate OnShutdown; |
84 | 84 | ||
85 | public delegate void ObjectGrabDelegate(uint localID, LLVector3 offsetPos, IClientAPI remoteClient); | 85 | public delegate void ObjectGrabDelegate(uint localID, LLVector3 offsetPos, IClientAPI remoteClient); |
86 | public delegate void ObjectDeGrabDelegate(uint localID, IClientAPI remoteClient); | ||
86 | 87 | ||
87 | public delegate void OnPermissionErrorDelegate(LLUUID user, string reason); | 88 | public delegate void OnPermissionErrorDelegate(LLUUID user, string reason); |
88 | 89 | ||
89 | public event ObjectGrabDelegate OnObjectGrab; | 90 | public event ObjectGrabDelegate OnObjectGrab; |
91 | public event ObjectDeGrabDelegate OnObjectDeGrab; | ||
90 | 92 | ||
91 | public event OnPermissionErrorDelegate OnPermissionError; | 93 | public event OnPermissionErrorDelegate OnPermissionError; |
92 | 94 | ||
@@ -247,6 +249,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
247 | private OnParcelPrimCountAddDelegate handlerParcelPrimCountAdd = null; //OnParcelPrimCountAdd; | 249 | private OnParcelPrimCountAddDelegate handlerParcelPrimCountAdd = null; //OnParcelPrimCountAdd; |
248 | private OnShutdownDelegate handlerShutdown = null; //OnShutdown; | 250 | private OnShutdownDelegate handlerShutdown = null; //OnShutdown; |
249 | private ObjectGrabDelegate handlerObjectGrab = null; //OnObjectGrab; | 251 | private ObjectGrabDelegate handlerObjectGrab = null; //OnObjectGrab; |
252 | private ObjectDeGrabDelegate handlerObjectDeGrab = null; //OnObjectDeGrab; | ||
250 | private NewRezScript handlerRezScript = null; //OnRezScript; | 253 | private NewRezScript handlerRezScript = null; //OnRezScript; |
251 | private RemoveScript handlerRemoveScript = null; //OnRemoveScript; | 254 | private RemoveScript handlerRemoveScript = null; //OnRemoveScript; |
252 | private SceneGroupMoved handlerSceneGroupMove = null; //OnSceneGroupMove; | 255 | private SceneGroupMoved handlerSceneGroupMove = null; //OnSceneGroupMove; |
@@ -386,6 +389,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
386 | } | 389 | } |
387 | } | 390 | } |
388 | 391 | ||
392 | public void TriggerObjectDeGrab(uint localID, IClientAPI remoteClient) | ||
393 | { | ||
394 | handlerObjectDeGrab = OnObjectDeGrab; | ||
395 | if (handlerObjectDeGrab != null) | ||
396 | { | ||
397 | handlerObjectDeGrab(localID, remoteClient); | ||
398 | } | ||
399 | } | ||
400 | |||
389 | public void TriggerRezScript(uint localID, LLUUID itemID, string script) | 401 | public void TriggerRezScript(uint localID, LLUUID itemID, string script) |
390 | { | 402 | { |
391 | handlerRezScript = OnRezScript; | 403 | handlerRezScript = OnRezScript; |
diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs index 2dfea2a..4ded1a7 100644 --- a/OpenSim/Region/Environment/Scenes/SceneManager.cs +++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs | |||
@@ -268,15 +268,26 @@ namespace OpenSim.Region.Environment.Scenes | |||
268 | 268 | ||
269 | public bool TryGetScene(string regionName, out Scene scene) | 269 | public bool TryGetScene(string regionName, out Scene scene) |
270 | { | 270 | { |
271 | scene = null; | ||
272 | |||
271 | foreach (Scene mscene in m_localScenes) | 273 | foreach (Scene mscene in m_localScenes) |
272 | { | 274 | { |
273 | if (String.Compare(mscene.RegionInfo.RegionName, regionName, true) == 0) | 275 | Console.Write("Region tested: " + mscene.RegionInfo.RegionName+" With ID: "+mscene.RegionInfo.RegionID.ToString()); |
276 | |||
277 | |||
278 | bool b = String.Compare(mscene.RegionInfo.RegionName.Trim(), regionName.Trim(), true) == 0; | ||
279 | |||
280 | Console.WriteLine(" <==> Result: " + b.ToString()); | ||
281 | |||
282 | if (b) | ||
274 | { | 283 | { |
284 | |||
285 | Console.WriteLine("FOUND assigning region to out parameter"); | ||
275 | scene = mscene; | 286 | scene = mscene; |
276 | return true; | 287 | return true; |
277 | } | 288 | } |
278 | } | 289 | } |
279 | scene = null; | 290 | |
280 | return false; | 291 | return false; |
281 | } | 292 | } |
282 | 293 | ||
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs index ce9f445..cbc94e2 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs | |||
@@ -67,6 +67,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
67 | { | 67 | { |
68 | myScriptEngine.Log.Info("[" + myScriptEngine.ScriptEngineName + "]: Hooking up to server events"); | 68 | myScriptEngine.Log.Info("[" + myScriptEngine.ScriptEngineName + "]: Hooking up to server events"); |
69 | myScriptEngine.World.EventManager.OnObjectGrab += touch_start; | 69 | myScriptEngine.World.EventManager.OnObjectGrab += touch_start; |
70 | myScriptEngine.World.EventManager.OnObjectDeGrab += touch_end; | ||
70 | myScriptEngine.World.EventManager.OnRezScript += OnRezScript; | 71 | myScriptEngine.World.EventManager.OnRezScript += OnRezScript; |
71 | myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript; | 72 | myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript; |
72 | myScriptEngine.World.EventManager.OnScriptChangedEvent += changed; | 73 | myScriptEngine.World.EventManager.OnScriptChangedEvent += changed; |
@@ -117,6 +118,15 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
117 | myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "touch_start", detstruct, new object[] { (int)1 }); | 118 | myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "touch_start", detstruct, new object[] { (int)1 }); |
118 | } | 119 | } |
119 | 120 | ||
121 | public void touch_end(uint localID, IClientAPI remoteClient) | ||
122 | { | ||
123 | // Add to queue for all scripts in ObjectID object | ||
124 | EventQueueManager.Queue_llDetectParams_Struct detstruct = new EventQueueManager.Queue_llDetectParams_Struct(); | ||
125 | detstruct._key = new LSL_Types.key[1]; | ||
126 | detstruct._key[0] = new LSL_Types.key(remoteClient.AgentId.ToString()); | ||
127 | myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "touch_end", detstruct, new object[] { (int)1 }); | ||
128 | } | ||
129 | |||
120 | public void OnRezScript(uint localID, LLUUID itemID, string script) | 130 | public void OnRezScript(uint localID, LLUUID itemID, string script) |
121 | { | 131 | { |
122 | Console.WriteLine("OnRezScript localID: " + localID + " LLUID: " + itemID.ToString() + " Size: " + | 132 | Console.WriteLine("OnRezScript localID: " + localID + " LLUID: " + itemID.ToString() + " Size: " + |