diff options
author | Teravus Ovares | 2008-05-05 00:03:30 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-05-05 00:03:30 +0000 |
commit | 1130c3067cb1d54c5a96ace2bc3f2519cf3916c1 (patch) | |
tree | 7d714dc93a76a1cdcdd65035558039633db87a1e /OpenSim/Region/ScriptEngine | |
parent | * Implemented DIE_AT_EDGE and Temporary objects don't save to the database. (diff) | |
download | opensim-SC-1130c3067cb1d54c5a96ace2bc3f2519cf3916c1.zip opensim-SC-1130c3067cb1d54c5a96ace2bc3f2519cf3916c1.tar.gz opensim-SC-1130c3067cb1d54c5a96ace2bc3f2519cf3916c1.tar.bz2 opensim-SC-1130c3067cb1d54c5a96ace2bc3f2519cf3916c1.tar.xz |
* A bit of spice from here, a pinch of salt from there, some brains that attracts zombies.. a recipe for llRezObject
* Original patch by YZh Thanks YZH!!!!
* object_rez event patch by Melanie, Thanks Melanie!!!
* Some fixups, some missing things(velocity,rotation)
* script delay
* Recoil
* Standard error messages
* Standard silent failures
* Easter egg management
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
3 files changed, 57 insertions, 5 deletions
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() |