public LSL_List modInvokeL(string fname, params object[] parms) { // m_log.DebugFormat( // "[MOD API]: Invoking dynamic function {0}, args '{1}' with {2} return type", // fname, // string.Join(",", Array.ConvertAll<object, string>(parms, o => o.ToString())), // ((MethodInfo)MethodBase.GetCurrentMethod()).ReturnType); Type returntype = m_comms.LookupReturnType(fname); if (returntype != typeof(object[])) { MODError(String.Format("return type mismatch for {0}", fname)); } object[] result = (object[])modInvoke(fname, parms); object[] llist = new object[result.Length]; for (int i = 0; i < result.Length; i++) { if (result[i] is string) { llist[i] = new LSL_String((string)result[i]); } else if (result[i] is int) { llist[i] = new LSL_Integer((int)result[i]); } else if (result[i] is float) { llist[i] = new LSL_Float((float)result[i]); } else if (result[i] is double) { llist[i] = new LSL_Float((double)result[i]); } else if (result[i] is UUID) { llist[i] = new LSL_Key(result[i].ToString()); } else if (result[i] is OpenMetaverse.Vector3) { OpenMetaverse.Vector3 vresult = (OpenMetaverse.Vector3)result[i]; llist[i] = new LSL_Vector(vresult.X, vresult.Y, vresult.Z); } else if (result[i] is OpenMetaverse.Quaternion) { OpenMetaverse.Quaternion qresult = (OpenMetaverse.Quaternion)result[i]; llist[i] = new LSL_Rotation(qresult.X, qresult.Y, qresult.Z, qresult.W); } else { MODError(String.Format("unknown list element {1} returned by {0}", fname, result[i].GetType().Name)); } } return(new LSL_List(llist)); }
public LSL_List modInvokeL(string fname, params object[] parms) { Type returntype = m_comms.LookupReturnType(fname); if (returntype != typeof(object[])) { MODError(String.Format("return type mismatch for {0}", fname)); } object[] result = (object[])modInvoke(fname, parms); object[] llist = new object[result.Length]; for (int i = 0; i < result.Length; i++) { if (result[i] is string) { llist[i] = new LSL_String((string)result[i]); } else if (result[i] is int) { llist[i] = new LSL_Integer((int)result[i]); } else if (result[i] is float) { llist[i] = new LSL_Float((float)result[i]); } else if (result[i] is UUID) { llist[i] = new LSL_Key(result[i].ToString()); } else if (result[i] is OpenMetaverse.Vector3) { OpenMetaverse.Vector3 vresult = (OpenMetaverse.Vector3)result[i]; llist[i] = new LSL_Vector(vresult.X, vresult.Y, vresult.Z); } else if (result[i] is OpenMetaverse.Quaternion) { OpenMetaverse.Quaternion qresult = (OpenMetaverse.Quaternion)result[i]; llist[i] = new LSL_Rotation(qresult.X, qresult.Y, qresult.Z, qresult.W); } else { MODError(String.Format("unknown list element {1} returned by {0}", fname, result[i].GetType().Name)); } } return(new LSL_List(llist)); }
public void osSetInertia(LSL_Float mass, vector centerOfMass, vector principalInertiaScaled, rotation rot) { m_OSSL_Functions.osSetInertia(mass, centerOfMass, principalInertiaScaled, rot); }
public void llSetVehicleFloatParam(int param, LSL_Float value) { m_LSL_Functions.llSetVehicleFloatParam(param, value); }
public void osSetWindParam(string plugin, string param, LSL_Float value) { m_OSSL_Functions.osSetWindParam(plugin, param, value); }
public LSL_Integer osApproxEquals(vector va, vector vb, LSL_Float margin) { return(m_OSSL_Functions.osApproxEquals(va, vb, margin)); }
public void osSetSpeed(string UUID, LSL_Float SpeedModifier) { CheckThreatLevel(ThreatLevel.Moderate, "osSetSpeed"); m_host.AddScriptLPS(1); ScenePresence avatar = World.GetScenePresence(new UUID(UUID)); if (avatar != null) avatar.SpeedModifier = (float)SpeedModifier; }
public string osDrawRotationTransform(string drawList, LSL_Float x) { return(m_OSSL_Functions.osDrawRotationTransform(drawList, x)); }
public LSL_Integer osReplaceRegionEnvironment(LSL_Integer transition, LSL_String daycycle, LSL_Float daylen, LSL_Float dayoffset, LSL_Float altitude1, LSL_Float altitude2, LSL_Float altitude3) { return(m_OSSL_Functions.osReplaceRegionEnvironment(transition, daycycle, daylen, dayoffset, altitude1, altitude2, altitude3)); }
public void osSetLinkSitActiveRange(LSL_Integer linkNumber, LSL_Float v) { m_OSSL_Functions.osSetLinkSitActiveRange(linkNumber, v); }
public void osSetSitActiveRange(LSL_Float v) { m_OSSL_Functions.osSetSitActiveRange(v); }
public LSL_Integer osIsNotValidNumber(LSL_Float v) { return(m_OSSL_Functions.osIsNotValidNumber(v)); }
public LSL_List modInvokeL(string fname, params object[] parms) { // m_log.DebugFormat( // "[MOD API]: Invoking dynamic function {0}, args '{1}' with {2} return type", // fname, // string.Join(",", Array.ConvertAll<object, string>(parms, o => o.ToString())), // ((MethodInfo)MethodBase.GetCurrentMethod()).ReturnType); Type returntype = m_comms.LookupReturnType(fname); if (returntype != typeof(object[])) MODError(String.Format("return type mismatch for {0}",fname)); object[] result = (object[])modInvoke(fname,parms); object[] llist = new object[result.Length]; for (int i = 0; i < result.Length; i++) { if (result[i] is string) { llist[i] = new LSL_String((string)result[i]); } else if (result[i] is int) { llist[i] = new LSL_Integer((int)result[i]); } else if (result[i] is float) { llist[i] = new LSL_Float((float)result[i]); } else if (result[i] is double) { llist[i] = new LSL_Float((double)result[i]); } else if (result[i] is UUID) { llist[i] = new LSL_Key(result[i].ToString()); } else if (result[i] is OpenMetaverse.Vector3) { OpenMetaverse.Vector3 vresult = (OpenMetaverse.Vector3)result[i]; llist[i] = new LSL_Vector(vresult.X, vresult.Y, vresult.Z); } else if (result[i] is OpenMetaverse.Quaternion) { OpenMetaverse.Quaternion qresult = (OpenMetaverse.Quaternion)result[i]; llist[i] = new LSL_Rotation(qresult.X, qresult.Y, qresult.Z, qresult.W); } else { MODError(String.Format("unknown list element {1} returned by {0}", fname, result[i].GetType().Name)); } } return new LSL_List(llist); }
public void osSetWindParam(string plugin, string param, LSL_Float value) { m_OSSL_Functions.osSetWindParam(plugin, param, value); }
public void osSetInertiaAsSphere(LSL_Float mass, LSL_Float radius, vector centerOfMass) { m_OSSL_Functions.osSetInertiaAsSphere(mass, radius, centerOfMass); }
public LSL_List llGetObjectDetails(string id, LSL_List args) { m_host.AddScriptLPS(1); LSL_List ret = new LSL_List(); UUID key = new UUID(); if (UUID.TryParse(id, out key)) { ScenePresence av = World.GetScenePresence(key); if (av != null) { foreach (object o in args.Data) { switch (int.Parse(o.ToString())) { case ScriptBaseClass.OBJECT_NAME: ret.Add(new LSL_String(av.Firstname + " " + av.Lastname)); break; case ScriptBaseClass.OBJECT_DESC: ret.Add(new LSL_String("")); break; case ScriptBaseClass.OBJECT_POS: ret.Add(new LSL_Vector((double)av.AbsolutePosition.X, (double)av.AbsolutePosition.Y, (double)av.AbsolutePosition.Z)); break; case ScriptBaseClass.OBJECT_ROT: ret.Add(new LSL_Rotation(av.GetWorldRotation())); break; case ScriptBaseClass.OBJECT_VELOCITY: ret.Add(new LSL_Vector(av.GetWorldVelocity())); break; case ScriptBaseClass.OBJECT_OWNER: ret.Add(new LSL_String(id)); break; case ScriptBaseClass.OBJECT_GROUP: ret.Add(new LSL_String(UUID.Zero.ToString())); break; case ScriptBaseClass.OBJECT_CREATOR: ret.Add(new LSL_String(UUID.Zero.ToString())); break; // For the following 8 see the Object version below case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT: ret.Add(new LSL_Integer(av.RunningScriptCount())); break; case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT: ret.Add(new LSL_Integer(av.ScriptCount())); break; case ScriptBaseClass.OBJECT_SCRIPT_MEMORY: ret.Add(new LSL_Integer(av.RunningScriptCount() * 16384)); break; case ScriptBaseClass.OBJECT_SCRIPT_TIME: ret.Add(new LSL_Float(av.ScriptExecutionTime() / 1000.0f)); break; case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE: ret.Add(new LSL_Integer(1)); break; case ScriptBaseClass.OBJECT_SERVER_COST: ret.Add(new LSL_Float(0)); break; case ScriptBaseClass.OBJECT_STREAMING_COST: ret.Add(new LSL_Float(0)); break; case ScriptBaseClass.OBJECT_PHYSICS_COST: ret.Add(new LSL_Float(0)); break; case ScriptBaseClass.OBJECT_CHARACTER_TIME: // Pathfinding ret.Add(new LSL_Float(0)); break; case ScriptBaseClass.OBJECT_ROOT: SceneObjectPart p = av.ParentPart; if (p != null) { ret.Add(new LSL_String(p.ParentGroup.RootPart.UUID.ToString())); } else { ret.Add(new LSL_String(id)); } break; case ScriptBaseClass.OBJECT_ATTACHED_POINT: ret.Add(new LSL_Integer(0)); break; case ScriptBaseClass.OBJECT_PATHFINDING_TYPE: // Pathfinding ret.Add(new LSL_Integer(ScriptBaseClass.OPT_AVATAR)); break; case ScriptBaseClass.OBJECT_PHYSICS: ret.Add(new LSL_Integer(0)); break; case ScriptBaseClass.OBJECT_PHANTOM: ret.Add(new LSL_Integer(0)); break; case ScriptBaseClass.OBJECT_TEMP_ON_REZ: ret.Add(new LSL_Integer(0)); break; case ScriptBaseClass.OBJECT_RENDER_WEIGHT: ret.Add(new LSL_Integer(-1)); break; case ScriptBaseClass.OBJECT_HOVER_HEIGHT: ret.Add(new LSL_Float(0)); break; case ScriptBaseClass.OBJECT_BODY_SHAPE_TYPE: LSL_Float shapeType; if (av.Appearance.VisualParams[(int)AvatarAppearance.VPElement.SHAPE_MALE] != 0) shapeType = new LSL_Float(1); else shapeType = new LSL_Float(0); ret.Add(shapeType); break; case ScriptBaseClass.OBJECT_LAST_OWNER_ID: ret.Add(new LSL_Key(ScriptBaseClass.NULL_KEY)); break; default: // Invalid or unhandled constant. ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL)); break; } } return ret; } SceneObjectPart obj = World.GetSceneObjectPart(key); if (obj != null) { foreach (object o in args.Data) { switch (int.Parse(o.ToString())) { case ScriptBaseClass.OBJECT_NAME: ret.Add(new LSL_String(obj.Name)); break; case ScriptBaseClass.OBJECT_DESC: ret.Add(new LSL_String(obj.Description)); break; case ScriptBaseClass.OBJECT_POS: ret.Add(new LSL_Vector(obj.AbsolutePosition.X, obj.AbsolutePosition.Y, obj.AbsolutePosition.Z)); break; case ScriptBaseClass.OBJECT_ROT: Quaternion rot = Quaternion.Identity; if (obj.ParentGroup.IsAttachment) { ScenePresence sp = World.GetScenePresence(obj.ParentGroup.AttachedAvatar); if (sp != null) rot = sp.GetWorldRotation(); } else { if (obj.ParentGroup.RootPart == obj) rot = obj.ParentGroup.GroupRotation; else rot = obj.GetWorldRotation(); } LSL_Rotation objrot = new LSL_Rotation(rot); ret.Add(objrot); break; case ScriptBaseClass.OBJECT_VELOCITY: Vector3 vel = Vector3.Zero; if (obj.ParentGroup.IsAttachment) { ScenePresence sp = World.GetScenePresence(obj.ParentGroup.AttachedAvatar); if (sp != null) vel = sp.GetWorldVelocity(); } else { vel = obj.Velocity; } ret.Add(vel); break; case ScriptBaseClass.OBJECT_OWNER: ret.Add(new LSL_String(obj.OwnerID.ToString())); break; case ScriptBaseClass.OBJECT_GROUP: ret.Add(new LSL_String(obj.GroupID.ToString())); break; case ScriptBaseClass.OBJECT_CREATOR: ret.Add(new LSL_String(obj.CreatorID.ToString())); break; case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT: ret.Add(new LSL_Integer(obj.ParentGroup.RunningScriptCount())); break; case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT: ret.Add(new LSL_Integer(obj.ParentGroup.ScriptCount())); break; case ScriptBaseClass.OBJECT_SCRIPT_MEMORY: // The value returned in SL for mono scripts is 65536 * number of active scripts // and 16384 * number of active scripts for LSO. since llGetFreememory // is coded to give the LSO value use it here ret.Add(new LSL_Integer(obj.ParentGroup.RunningScriptCount() * 16384)); break; case ScriptBaseClass.OBJECT_SCRIPT_TIME: // Average cpu time in seconds per simulator frame expended on all scripts in the object ret.Add(new LSL_Float(obj.ParentGroup.ScriptExecutionTime() / 1000.0f)); break; case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE: // according to the SL wiki A prim or linkset will have prim // equivalent of the number of prims in a linkset if it does not // contain a mesh anywhere in the link set or is not a normal prim // The value returned in SL for normal prims is prim count ret.Add(new LSL_Integer(obj.ParentGroup.PrimCount)); break; // The following 3 costs I have intentionaly coded to return zero. They are part of // "Land Impact" calculations. These calculations are probably not applicable // to OpenSim and are not yet complete in SL case ScriptBaseClass.OBJECT_SERVER_COST: // The linden calculation is here // http://wiki.secondlife.com/wiki/Mesh/Mesh_Server_Weight // The value returned in SL for normal prims looks like the prim count ret.Add(new LSL_Float(0)); break; case ScriptBaseClass.OBJECT_STREAMING_COST: // The linden calculation is here // http://wiki.secondlife.com/wiki/Mesh/Mesh_Streaming_Cost // The value returned in SL for normal prims looks like the prim count * 0.06 ret.Add(new LSL_Float(0)); break; case ScriptBaseClass.OBJECT_PHYSICS_COST: // The linden calculation is here // http://wiki.secondlife.com/wiki/Mesh/Mesh_physics // The value returned in SL for normal prims looks like the prim count ret.Add(new LSL_Float(0)); break; case ScriptBaseClass.OBJECT_CHARACTER_TIME: // Pathfinding ret.Add(new LSL_Float(0)); break; case ScriptBaseClass.OBJECT_ROOT: ret.Add(new LSL_String(obj.ParentGroup.RootPart.UUID.ToString())); break; case ScriptBaseClass.OBJECT_ATTACHED_POINT: ret.Add(new LSL_Integer(obj.ParentGroup.AttachmentPoint)); break; case ScriptBaseClass.OBJECT_PATHFINDING_TYPE: byte pcode = obj.Shape.PCode; if (obj.ParentGroup.AttachmentPoint != 0 || pcode == (byte)PCode.Grass || pcode == (byte)PCode.Tree || pcode == (byte)PCode.NewTree) { ret.Add(new LSL_Integer(ScriptBaseClass.OPT_OTHER)); } else { ret.Add(new LSL_Integer(ScriptBaseClass.OPT_LEGACY_LINKSET)); } break; case ScriptBaseClass.OBJECT_PHYSICS: if (obj.ParentGroup.AttachmentPoint != 0) { ret.Add(new LSL_Integer(0)); // Always false if attached } else { ret.Add(new LSL_Integer(obj.ParentGroup.UsesPhysics ? 1 : 0)); } break; case ScriptBaseClass.OBJECT_PHANTOM: if (obj.ParentGroup.AttachmentPoint != 0) { ret.Add(new LSL_Integer(0)); // Always false if attached } else { ret.Add(new LSL_Integer(obj.ParentGroup.IsPhantom ? 1 : 0)); } break; case ScriptBaseClass.OBJECT_TEMP_ON_REZ: ret.Add(new LSL_Integer(obj.ParentGroup.IsTemporary ? 1 : 0)); break; case ScriptBaseClass.OBJECT_RENDER_WEIGHT: ret.Add(new LSL_Integer(0)); break; case ScriptBaseClass.OBJECT_HOVER_HEIGHT: ret.Add(new LSL_Float(0)); break; case ScriptBaseClass.OBJECT_BODY_SHAPE_TYPE: ret.Add(new LSL_Float(-1)); break; case ScriptBaseClass.OBJECT_LAST_OWNER_ID: ret.Add(new LSL_Key(obj.ParentGroup.LastOwnerID.ToString())); break; default: // Invalid or unhandled constant. ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL)); break; } } return ret; } } return new LSL_List(); }
public void osSetSpeed(string UUID, LSL_Float SpeedModifier) { m_OSSL_Functions.osSetSpeed(UUID, SpeedModifier); }
public void osSetOwnerSpeed(LSL_Float SpeedModifier) { m_OSSL_Functions.osSetOwnerSpeed(SpeedModifier); }
public LSL_Float osGetHealRate(string avatar) { CheckThreatLevel(ThreatLevel.None, "osGetHealRate"); m_host.AddScriptLPS(1); LSL_Float rate = new LSL_Float(0); ScenePresence presence = World.GetScenePresence(new UUID(avatar)); if (presence != null) rate = presence.HealRate; return rate; }
public void osCauseDamage(key avatar, LSL_Float damage) { m_OSSL_Functions.osCauseDamage(avatar, damage); }
public LSL_Integer osApproxEquals(LSL_Float a, LSL_Float b, LSL_Float margin) { return(m_OSSL_Functions.osApproxEquals(a, b, margin)); }
public void osCauseHealing(key avatar, LSL_Float healing) { m_OSSL_Functions.osCauseHealing(avatar, healing); }
public LSL_Integer osApproxEquals(rotation ra, rotation rb, LSL_Float margin) { return(m_OSSL_Functions.osApproxEquals(ra, rb, margin)); }
public void osSetHealRate(key avatar, LSL_Float health) { m_OSSL_Functions.osSetHealRate(avatar, health); }
public void osSetSpeed(string UUID, LSL_Float SpeedModifier) { m_OSSL_Functions.osSetSpeed(UUID, SpeedModifier); }
public void osSetProjectionParams(LSL_Integer linknumber, LSL_Integer projection, LSL_Key texture, LSL_Float fov, LSL_Float focus, LSL_Float amb) { m_OSSL_Functions.osSetProjectionParams(linknumber, projection, texture, fov, focus, amb); }
public LSL_Float osRound(LSL_Float value, LSL_Integer digits) { return(m_OSSL_Functions.osRound(value, digits)); }
public void osAdjustSoundVolume(LSL_Integer linknum, LSL_Float volume) { m_OSSL_Functions.osAdjustSoundVolume(linknum, volume); }
//CFK 9/28: Most, but not all of the underlying plumbing between here and the physics modules is in //CFK 9/28: so these are not complete yet. public void llSetVehicleFloatParam(int param, LSL_Float value) { m_host.AddScriptLPS(1); if (!m_host.ParentGroup.IsDeleted) { m_host.ParentGroup.RootPart.SetVehicleFloatParam(param, (float)value); } }
public void osSetSoundRadius(LSL_Integer linknum, LSL_Float radius) { m_OSSL_Functions.osSetSoundRadius(linknum, radius); }
public void osSetInertiaAsBox(LSL_Float mass, vector boxSize, vector centerOfMass, rotation rot) { m_OSSL_Functions.osSetInertiaAsBox(mass, boxSize, centerOfMass, rot); }
public void osLoopSoundMaster(LSL_Integer linknum, LSL_String sound, LSL_Float volume) { m_OSSL_Functions.osLoopSoundMaster(linknum, sound, volume); }
public void osSetInertiaAsCylinder(LSL_Float mass, LSL_Float radius, LSL_Float lenght, vector centerOfMass, rotation lslrot) { m_OSSL_Functions.osSetInertiaAsCylinder(mass, radius, lenght, centerOfMass, lslrot); }
public void osPlaySoundSlave(LSL_Integer linknum, LSL_String sound, LSL_Float volume) { m_OSSL_Functions.osPlaySoundSlave(linknum, sound, volume); }
public string osDrawTranslationTransform(string drawList, LSL_Float x, LSL_Float y) { return(m_OSSL_Functions.osDrawTranslationTransform(drawList, x, y)); }
public void osTriggerSound(LSL_Integer linknum, LSL_String sound, LSL_Float volume) { m_OSSL_Functions.osTriggerSound(linknum, sound, volume); }
public void osSetWindParam(string plugin, string param, LSL_Float value) { CheckThreatLevel(ThreatLevel.VeryLow, "osSetWindParam"); m_host.AddScriptLPS(1); IWindModule module = World.RequestModuleInterface<IWindModule>(); if (module != null) { try { module.WindParamSet(plugin, param, (float)value); } catch (Exception) { } } }
public void osTriggerSoundLimited(LSL_Integer linknum, LSL_String sound, LSL_Float volume, vector top_north_east, vector bottom_south_west) { m_OSSL_Functions.osTriggerSoundLimited(linknum, sound, volume, top_north_east, bottom_south_west); }
public LSL_Float osGetHealth(string avatar) { CheckThreatLevel(ThreatLevel.None, "osGetHealth"); m_host.AddScriptLPS(1); LSL_Float health = new LSL_Float(-1); ScenePresence presence = World.GetScenePresence(new UUID(avatar)); if (presence != null) health = presence.Health; return health; }
public LSL_Integer osApproxEquals(LSL_Float a, LSL_Float b) { return(m_OSSL_Functions.osApproxEquals(a, b)); }
public LSL_List modInvokeL(string fname, params object[] parms) { Type returntype = m_comms.LookupReturnType(fname); if (returntype != typeof(object[])) MODError(String.Format("return type mismatch for {0}",fname)); object[] result = (object[])modInvoke(fname,parms); object[] llist = new object[result.Length]; for (int i = 0; i < result.Length; i++) { if (result[i] is string) { llist[i] = new LSL_String((string)result[i]); } else if (result[i] is int) { llist[i] = new LSL_Integer((int)result[i]); } else if (result[i] is float) { llist[i] = new LSL_Float((float)result[i]); } else if (result[i] is UUID) { llist[i] = new LSL_Key(result[i].ToString()); } else if (result[i] is OpenMetaverse.Vector3) { OpenMetaverse.Vector3 vresult = (OpenMetaverse.Vector3)result[i]; llist[i] = new LSL_Vector(vresult.X, vresult.Y, vresult.Z); } else if (result[i] is OpenMetaverse.Quaternion) { OpenMetaverse.Quaternion qresult = (OpenMetaverse.Quaternion)result[i]; llist[i] = new LSL_Rotation(qresult.X, qresult.Y, qresult.Z, qresult.W); } else { MODError(String.Format("unknown list element {1} returned by {0}", fname, result[i].GetType().Name)); } } return new LSL_List(llist); }
public void osSetWindParam(string plugin, string param, LSL_Float value) { m_host.AddScriptLPS(1); if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID)) { OSSLShoutError("osSetWindParam can only be used by estate managers or owner"); return; } IWindModule module = World.RequestModuleInterface<IWindModule>(); if (module != null) { try { module.WindParamSet(plugin, param, (float)value); } catch (Exception) { } } }