diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | 56 |
1 files changed, 54 insertions, 2 deletions
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) |