diff options
Diffstat (limited to '')
6 files changed, 133 insertions, 6 deletions
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index fda5286..b7d9fe8 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt | |||
@@ -54,6 +54,7 @@ Patches | |||
54 | * Melanie Thielker | 54 | * Melanie Thielker |
55 | * John R Sohn(XenReborn) | 55 | * John R Sohn(XenReborn) |
56 | * Xantor | 56 | * Xantor |
57 | * YZh | ||
57 | 58 | ||
58 | 59 | ||
59 | LSL Devs | 60 | LSL Devs |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 1c7e98e..ee52a66 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |||
@@ -1353,7 +1353,69 @@ namespace OpenSim.Region.Environment.Scenes | |||
1353 | } | 1353 | } |
1354 | return null; | 1354 | return null; |
1355 | } | 1355 | } |
1356 | 1356 | ||
1357 | public virtual SceneObjectGroup RezObject(TaskInventoryItem item, LLVector3 pos, LLQuaternion rot, LLVector3 vel, int param) | ||
1358 | { | ||
1359 | // Rez object | ||
1360 | if (item != null) | ||
1361 | { | ||
1362 | LLUUID ownerID = item.OwnerID; | ||
1363 | |||
1364 | if (!PermissionsMngr.CanRezObject(ownerID, pos)) | ||
1365 | { | ||
1366 | return null; | ||
1367 | } | ||
1368 | |||
1369 | AssetBase rezAsset = AssetCache.GetAsset(item.AssetID, false); | ||
1370 | |||
1371 | if (rezAsset != null) | ||
1372 | { | ||
1373 | string xmlData = Helpers.FieldToUTF8String(rezAsset.Data); | ||
1374 | SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, xmlData); | ||
1375 | group.ResetIDs(); | ||
1376 | AddEntity(group); | ||
1377 | |||
1378 | // we set it's position in world. | ||
1379 | group.AbsolutePosition = pos; | ||
1380 | |||
1381 | SceneObjectPart rootPart = group.GetChildPart(group.UUID); | ||
1382 | |||
1383 | // Since renaming the item in the inventory does not affect the name stored | ||
1384 | // in the serialization, transfer the correct name from the inventory to the | ||
1385 | // object itself before we rez. | ||
1386 | rootPart.Name = item.Name; | ||
1387 | rootPart.Description = item.Description; | ||
1388 | |||
1389 | List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values); | ||
1390 | foreach (SceneObjectPart part in partList) | ||
1391 | { | ||
1392 | if (part.OwnerID != item.OwnerID) | ||
1393 | { | ||
1394 | part.LastOwnerID = part.OwnerID; | ||
1395 | part.OwnerID = item.OwnerID; | ||
1396 | part.EveryoneMask = item.EveryoneMask; | ||
1397 | part.BaseMask = item.BaseMask; | ||
1398 | part.OwnerMask = item.OwnerMask; | ||
1399 | part.NextOwnerMask = item.NextOwnerMask; | ||
1400 | part.ChangeInventoryOwner(item.OwnerID); | ||
1401 | } | ||
1402 | } | ||
1403 | rootPart.TrimPermissions(); | ||
1404 | if (group.RootPart.Shape.PCode == (byte)PCode.Prim) | ||
1405 | { | ||
1406 | group.ClearPartAttachmentData(); | ||
1407 | } | ||
1408 | group.UpdateGroupRotation(rot); | ||
1409 | group.ApplyPhysics(m_physicalPrim); | ||
1410 | group.Velocity = vel; | ||
1411 | group.StartScripts(); | ||
1412 | rootPart.ScheduleFullUpdate(); | ||
1413 | return rootPart.ParentGroup; | ||
1414 | } | ||
1415 | |||
1416 | } | ||
1417 | return null; | ||
1418 | } | ||
1357 | 1419 | ||
1358 | } | 1420 | } |
1359 | } | 1421 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 5d39790..9ed5990 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -2526,5 +2526,17 @@ namespace OpenSim.Region.Environment.Scenes | |||
2526 | } | 2526 | } |
2527 | } | 2527 | } |
2528 | } | 2528 | } |
2529 | public float GetMass() | ||
2530 | { | ||
2531 | float retmass = 0f; | ||
2532 | lock (m_parts) | ||
2533 | { | ||
2534 | foreach (SceneObjectPart part in m_parts.Values) | ||
2535 | { | ||
2536 | retmass += part.GetMass(); | ||
2537 | } | ||
2538 | } | ||
2539 | return retmass; | ||
2540 | } | ||
2529 | } | 2541 | } |
2530 | } | 2542 | } |
diff --git a/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs b/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs index f7cd697..49ddd3f 100644 --- a/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs +++ b/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs | |||
@@ -697,9 +697,9 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
697 | m_LSL_Functions.llMakeFire(); | 697 | m_LSL_Functions.llMakeFire(); |
698 | } | 698 | } |
699 | 699 | ||
700 | public void llRezObject(string inventory, vector pos, rotation rot, int param) | 700 | public void llRezObject(string inventory, vector pos, vector vel, rotation rot, int param) |
701 | { | 701 | { |
702 | m_LSL_Functions.llRezObject(inventory, pos, rot, param); | 702 | m_LSL_Functions.llRezObject(inventory, pos, vel, rot, param); |
703 | } | 703 | } |
704 | 704 | ||
705 | public void llLookAt(vector target, double strength, double damping) | 705 | public void llLookAt(vector target, double strength, double damping) |
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index f0108f8..ca94dd7 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | |||
@@ -1839,10 +1839,62 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
1839 | NotImplemented("llMakeFire"); | 1839 | NotImplemented("llMakeFire"); |
1840 | } | 1840 | } |
1841 | 1841 | ||
1842 | public void llRezObject(string inventory, LSL_Types.Vector3 pos, LSL_Types.Quaternion rot, int param) | 1842 | public void llRezObject(string inventory, LSL_Types.Vector3 pos, LSL_Types.Vector3 vel, LSL_Types.Quaternion rot, int param) |
1843 | { | 1843 | { |
1844 | m_host.AddScriptLPS(1); | 1844 | m_host.AddScriptLPS(1); |
1845 | NotImplemented("llRezObject"); | 1845 | //NotImplemented("llRezObject"); |
1846 | bool found = false; | ||
1847 | |||
1848 | // Instead of using return;, I'm using continue; because in our TaskInventory implementation | ||
1849 | // it's possible to have two items with the same task inventory name. | ||
1850 | // this is an easter egg of sorts. | ||
1851 | |||
1852 | foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory) | ||
1853 | { | ||
1854 | if (inv.Value.Name == inventory) | ||
1855 | { | ||
1856 | // make sure we're an object. | ||
1857 | if (inv.Value.InvType != (int)InventoryType.Object) | ||
1858 | { | ||
1859 | llSay(0, "Unable to create requested object. Object is missing from database."); | ||
1860 | continue; | ||
1861 | } | ||
1862 | |||
1863 | LLVector3 llpos = new LLVector3((float)pos.x, (float)pos.y, (float)pos.z); | ||
1864 | |||
1865 | // test if we're further away then 10m | ||
1866 | if (Util.GetDistanceTo(llpos, m_host.AbsolutePosition) > 10) | ||
1867 | return; // wiki says, if it's further away then 10m, silently fail. | ||
1868 | |||
1869 | LLVector3 llvel = new LLVector3((float)vel.x, (float)vel.y, (float)vel.z); | ||
1870 | |||
1871 | // need the magnitude later | ||
1872 | float velmag = (float)Util.GetMagnitude(llvel); | ||
1873 | |||
1874 | SceneObjectGroup new_group = World.RezObject(inv.Value, llpos, new LLQuaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s), llvel, param); | ||
1875 | |||
1876 | // If either of these are null, then there was an unknown error. | ||
1877 | if (new_group == null) | ||
1878 | continue; | ||
1879 | if (new_group.RootPart == null) | ||
1880 | continue; | ||
1881 | |||
1882 | // objects rezzed with this method are die_at_edge by default. | ||
1883 | new_group.RootPart.SetDieAtEdge(true); | ||
1884 | |||
1885 | m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(m_localID, m_itemID, "object_rez", EventQueueManager.llDetectNull, new Object[] { new LSL_Types.LSLString(new_group.RootPart.UUID.ToString()) }); | ||
1886 | float groupmass = new_group.GetMass(); | ||
1887 | |||
1888 | //Recoil. | ||
1889 | llApplyImpulse(new LSL_Types.Vector3(llvel.X * groupmass, llvel.Y * groupmass, llvel.Z * groupmass), 0); | ||
1890 | found = true; | ||
1891 | //script delay | ||
1892 | System.Threading.Thread.Sleep((int)((groupmass * velmag) / 10)); | ||
1893 | break; | ||
1894 | } | ||
1895 | } | ||
1896 | if (!found) | ||
1897 | llSay(0, "Could not find object " + inventory); | ||
1846 | } | 1898 | } |
1847 | 1899 | ||
1848 | public void llLookAt(LSL_Types.Vector3 target, double strength, double damping) | 1900 | public void llLookAt(LSL_Types.Vector3 target, double strength, double damping) |
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs index 6742ed5..115e4e8 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs | |||
@@ -190,7 +190,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
190 | //wiki: (deprecated) | 190 | //wiki: (deprecated) |
191 | void llMakeFire(); | 191 | void llMakeFire(); |
192 | //wiki: llRezObject(string inventory, vector pos, vector rel, rotation rot, integer param) | 192 | //wiki: llRezObject(string inventory, vector pos, vector rel, rotation rot, integer param) |
193 | void llRezObject(string inventory, LSL_Types.Vector3 pos, LSL_Types.Quaternion rot, int param); | 193 | void llRezObject(string inventory, LSL_Types.Vector3 pos, LSL_Types.Vector3 vel, LSL_Types.Quaternion rot, int param); |
194 | //wiki: llLookAt(vector target, double strength, double damping) | 194 | //wiki: llLookAt(vector target, double strength, double damping) |
195 | void llLookAt(LSL_Types.Vector3 target, double strength, double damping); | 195 | void llLookAt(LSL_Types.Vector3 target, double strength, double damping); |
196 | //wiki: llStopLookAt() | 196 | //wiki: llStopLookAt() |