Anonymous | Login | Signup for a new account | 2021-02-26 19:30 PST | ![]() |
Main | My View | View Issues | Change Log | Roadmap | Summary | My Account |
View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | |||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | |||||
0007510 | opensim | [REGION] Script Functions | public | 2015-03-22 00:26 | 2015-04-07 23:23 | |||||
Reporter | Magnuz | |||||||||
Assigned To | ||||||||||
Priority | normal | Severity | minor | Reproducibility | always | |||||
Status | patch included | Resolution | open | |||||||
Platform | Intel Core i7 | Operating System | Ubuntu | Operating System Version | 12.04 | |||||
Product Version | master (dev code) | |||||||||
Target Version | Fixed in Version | |||||||||
Summary | 0007510: Constants scattered in LSL_Api | |||||||||
Description | There are quite a few constants scattered throughout the LSL_Api. According to Robert Adams it would be better if at least some of them were parameterized. This is a first crack at that, starting with the 63 sleep constants, since they were the easiest to inventory. If there is any interest in continued work on this, I need pointers on documentation, directives or preferrably examples on naming, placing and use of parameters for e.g. limits and clipping. Added: 69 constants used for limits and clamping have also been parameterized and added to config. | |||||||||
Tags | No tags attached. | |||||||||
Git Revision or version number | 0.8.2 | |||||||||
Run Mode | Grid (1 Region per Sim) | |||||||||
Physics Engine | BulletSim | |||||||||
Script Engine | ||||||||||
Environment | Mono / Linux32 | |||||||||
Mono Version | 2.10 | |||||||||
Viewer | Firestorm 4.4.2 for OS X | |||||||||
Attached Files | ![]() From 8d33607badde40a640a580ff8d65afcaae76289e Mon Sep 17 00:00:00 2001 From: Magnuz Binder <magnuz@magnuz-se.com> Date: Sun, 22 Mar 2015 13:40:30 +0100 Subject: [PATCH] Parameterize sleeps in LSL functions. --- .../Shared/Api/Implementation/LSL_Api.cs | 187 +++++++++++++------- 1 file changed, 123 insertions(+), 64 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 054b8e3..e8485b6 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -120,6 +120,64 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected IUrlModule m_UrlModule = null; protected Dictionary<UUID, UserInfoCacheEntry> m_userInfoCache = new Dictionary<UUID, UserInfoCacheEntry>(); protected int EMAIL_PAUSE_TIME = 20; // documented delay value for smtp. + protected int m_sleepMsOnSetTexture = 200; + protected int m_sleepMsOnSetLinkTexture = 200; + protected int m_sleepMsOnScaleTexture = 200; + protected int m_sleepMsOnOffsetTexture = 200; + protected int m_sleepMsOnRotateTexture = 200; + protected int m_sleepMsOnSetPos = 200; + protected int m_sleepMsOnSetRot = 200; + protected int m_sleepMsOnSetLocalRot = 200; + protected int m_sleepMsOnPreloadSound = 1000; + protected int m_sleepMsOnMakeExplosion = 100; + protected int m_sleepMsOnMakeFountain = 100; + protected int m_sleepMsOnMakeSmoke = 100; + protected int m_sleepMsOnMakeFire = 100; + protected int m_sleepMsOnRezAtRoot = 100; + protected int m_sleepMsOnInstantMessage = 2000; + protected int m_sleepMsOnEmail = 20000; + protected int m_sleepMsOnCreateLink = 1000; + protected int m_sleepMsOnGiveInventory = 3000; + protected int m_sleepMsOnRequestAgentData = 100; + protected int m_sleepMsOnRequestInventoryData = 1000; + protected int m_sleepMsOnSetDamage = 5000; + protected int m_sleepMsOnTextBox = 1000; + protected int m_sleepMsOnAdjustSoundVolume = 100; + protected int m_sleepMsOnEjectFromLand = 5000; + protected int m_sleepMsOnAddToLandPassList = 100; + protected int m_sleepMsOnDialog = 1000; + protected int m_sleepMsOnRemoteLoadScript = 3000; + protected int m_sleepMsOnRemoteLoadScriptPin = 3000; + protected int m_sleepMsOnOpenRemoteDataChannel = 1000; + protected int m_sleepMsOnSendRemoteData = 3000; + protected int m_sleepMsOnRemoteDataReply = 3000; + protected int m_sleepMsOnCloseRemoteDataChannel = 1000; + protected int m_sleepMsOnSetPrimitiveParams = 200; + protected int m_sleepMsOnSetLinkPrimitiveParams = 200; + protected int m_sleepMsOnXorBase64Strings = 300; + protected int m_sleepMsOnSetParcelMusicURL = 2000; + protected int m_sleepMsOnGetPrimMediaParams = 1000; + protected int m_sleepMsOnGetLinkMedia = 1000; + protected int m_sleepMsOnSetPrimMediaParams = 1000; + protected int m_sleepMsOnSetLinkMedia = 1000; + protected int m_sleepMsOnClearPrimMedia = 1000; + protected int m_sleepMsOnClearLinkMedia = 1000; + protected int m_sleepMsOnRequestSimulatorData = 1000; + protected int m_sleepMsOnLoadURL = 10000; + protected int m_sleepMsOnParcelMediaCommandList = 2000; + protected int m_sleepMsOnParcelMediaQuery = 2000; + protected int m_sleepMsOnModPow = 1000; + protected int m_sleepMsOnSetPrimURL = 2000; + protected int m_sleepMsOnRefreshPrimURL = 20000; + protected int m_sleepMsOnMapDestination = 1000; + protected int m_sleepMsOnAddToLandBanList = 100; + protected int m_sleepMsOnRemoveFromLandPassList = 100; + protected int m_sleepMsOnRemoveFromLandBanList = 100; + protected int m_sleepMsOnResetLandBanList = 100; + protected int m_sleepMsOnResetLandPassList = 100; + protected int m_sleepMsOnGetParcelPrimOwners = 2000; + protected int m_sleepMsOnGetNumberOfNotecardLines = 100; + protected int m_sleepMsOnGetNotecardLine = 100; protected string m_internalObjectHost = "lsl.opensim.local"; protected bool m_restrictEmail = false; protected ISoundModule m_SoundModule = null; @@ -210,6 +268,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_internalObjectHost = smtpConfig.GetString("internal_object_host", m_internalObjectHost); } } + m_sleepMsOnEmail = EMAIL_PAUSE_TIME * 1000; } public override Object InitializeLifetimeService() @@ -1958,7 +2017,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); SetTexture(m_host, texture, face); - ScriptSleep(200); + ScriptSleep(m_sleepMsOnSetTexture); } public void llSetLinkTexture(int linknumber, string texture, int face) @@ -1970,7 +2029,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api foreach (SceneObjectPart part in parts) SetTexture(part, texture, face); - ScriptSleep(200); + ScriptSleep(m_sleepMsOnSetLinkTexture); } protected void SetTexture(SceneObjectPart part, string texture, int face) @@ -2014,7 +2073,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); ScaleTexture(m_host, u, v, face); - ScriptSleep(200); + ScriptSleep(m_sleepMsOnScaleTexture); } protected void ScaleTexture(SceneObjectPart part, double u, double v, int face) @@ -2050,7 +2109,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); OffsetTexture(m_host, u, v, face); - ScriptSleep(200); + ScriptSleep(m_sleepMsOnOffsetTexture); } protected void OffsetTexture(SceneObjectPart part, double u, double v, int face) @@ -2086,7 +2145,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); RotateTexture(m_host, rotation, face); - ScriptSleep(200); + ScriptSleep(m_sleepMsOnRotateTexture); } protected void RotateTexture(SceneObjectPart part, double rotation, int face) @@ -2161,7 +2220,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api SetPos(m_host, pos, true); - ScriptSleep(200); + ScriptSleep(m_sleepMsOnSetPos); } /// <summary> @@ -2344,14 +2403,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - ScriptSleep(200); + ScriptSleep(m_sleepMsOnSetRot); } public void llSetLocalRot(LSL_Rotation rot) { m_host.AddScriptLPS(1); SetRot(m_host, rot); - ScriptSleep(200); + ScriptSleep(m_sleepMsOnSetLocalRot); } protected void SetRot(SceneObjectPart part, Quaternion rot) @@ -2713,7 +2772,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); if (m_SoundModule != null) m_SoundModule.PreloadSound(m_host.UUID, ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound), 0); - ScriptSleep(1000); + ScriptSleep(m_sleepMsOnPreloadSound); } /// <summary> @@ -2986,28 +3045,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); Deprecated("llMakeExplosion", "Use llParticleSystem instead"); - ScriptSleep(100); + ScriptSleep(m_sleepMsOnMakeExplosion); } public void llMakeFountain(int particles, double scale, double vel, double lifetime, double arc, int bounce, string texture, LSL_Vector offset, double bounce_offset) { m_host.AddScriptLPS(1); Deprecated("llMakeFountain", "Use llParticleSystem instead"); - ScriptSleep(100); + ScriptSleep(m_sleepMsOnMakeFountain); } public void llMakeSmoke(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset) { m_host.AddScriptLPS(1); Deprecated("llMakeSmoke", "Use llParticleSystem instead"); - ScriptSleep(100); + ScriptSleep(m_sleepMsOnMakeSmoke); } public void llMakeFire(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset) { m_host.AddScriptLPS(1); Deprecated("llMakeFire", "Use llParticleSystem instead"); - ScriptSleep(100); + ScriptSleep(m_sleepMsOnMakeFire); } public void llRezAtRoot(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param) @@ -3078,7 +3137,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api }, null, "LSL_Api.llRezAtRoot"); //ScriptSleep((int)((groupmass * velmag) / 10)); - ScriptSleep(100); + ScriptSleep(m_sleepMsOnRezAtRoot); } public void llRezObject(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param) @@ -3385,7 +3444,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_TransferModule.SendInstantMessage(msg, delegate(bool success) {}); } - ScriptSleep(2000); + ScriptSleep(m_sleepMsOnInstantMessage); } public void llEmail(string address, string subject, string message) @@ -3423,7 +3482,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } emailModule.SendEmail(m_host.UUID, address, subject, message); - ScriptSleep(EMAIL_PAUSE_TIME * 1000); + ScriptSleep(m_sleepMsOnEmail); } public void llGetNextEmail(string address, string subject) @@ -3882,7 +3941,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (client != null) parentPrim.SendPropertiesToClient(client); - ScriptSleep(1000); + ScriptSleep(m_sleepMsOnCreateLink); } public void llBreakLink(int linknum) @@ -4198,7 +4257,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_TransferModule.SendInstantMessage(msg, delegate(bool success) {}); } - ScriptSleep(3000); + ScriptSleep(m_sleepMsOnGiveInventory); } } @@ -4368,7 +4427,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api AsyncCommands. DataserverPlugin.DataserverReply(rq.ToString(), reply); - ScriptSleep(100); + ScriptSleep(m_sleepMsOnRequestAgentData); return tid.ToString(); } @@ -4401,12 +4460,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api reply); }); - ScriptSleep(1000); + ScriptSleep(m_sleepMsOnRequestInventoryData); return tid.ToString(); } } - ScriptSleep(1000); + ScriptSleep(m_sleepMsOnRequestInventoryData); return String.Empty; } @@ -4433,7 +4492,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - ScriptSleep(5000); + ScriptSleep(m_sleepMsOnSetDamage); } public void llTeleportAgent(string agent, string destination, LSL_Vector targetPos, LSL_Vector targetLookAt) @@ -4549,7 +4608,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api else { dm.SendTextBoxToUser(av, message, chatChannel, m_host.Name, m_host.UUID, m_host.OwnerID); - ScriptSleep(1000); + ScriptSleep(m_sleepMsOnTextBox); } } @@ -6035,7 +6094,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); m_host.AdjustSoundGain(volume); - ScriptSleep(100); + ScriptSleep(m_sleepMsOnAdjustSoundVolume); } public void llSetSoundRadius(double radius) @@ -6141,7 +6200,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } } - ScriptSleep(5000); + ScriptSleep(m_sleepMsOnEjectFromLand); } public LSL_Integer llOverMyLand(string id) @@ -7116,7 +7175,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api World.EventManager.TriggerLandObjectUpdated((uint)land.LandData.LocalID, land); } } - ScriptSleep(100); + ScriptSleep(m_sleepMsOnAddToLandPassList); } public void llSetTouchText(string text) @@ -7254,7 +7313,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api av, m_host.Name, m_host.UUID, m_host.OwnerID, message, new UUID("00000000-0000-2222-3333-100000001000"), chat_channel, buts); - ScriptSleep(1000); + ScriptSleep(m_sleepMsOnDialog); } public void llVolumeDetect(int detect) @@ -7269,7 +7328,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); Deprecated("llRemoteLoadScript", "Use llRemoteLoadScriptPin instead"); - ScriptSleep(3000); + ScriptSleep(m_sleepMsOnRemoteLoadScript); } public void llSetRemoteScriptAccessPin(int pin) @@ -7310,7 +7369,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api World.RezScriptFromPrim(item.ItemID, m_host, destId, pin, running, start_param); // this will cause the delay even if the script pin or permissions were wrong - seems ok - ScriptSleep(3000); + ScriptSleep(m_sleepMsOnRemoteLoadScriptPin); } public void llOpenRemoteDataChannel() @@ -7341,14 +7400,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams("remote_data", resobj, new DetectParams[0])); } - ScriptSleep(1000); + ScriptSleep(m_sleepMsOnOpenRemoteDataChannel); } public LSL_String llSendRemoteData(string channel, string dest, int idata, string sdata) { m_host.AddScriptLPS(1); IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); - ScriptSleep(3000); + ScriptSleep(m_sleepMsOnSendRemoteData); if (xmlrpcMod == null) return ""; return (xmlrpcMod.SendRemoteData(m_host.LocalId, m_item.ItemID, channel, dest, idata, sdata)).ToString(); @@ -7360,7 +7419,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); if (xmlrpcMod != null) xmlrpcMod.RemoteDataReply(channel, message_id, sdata, idata); - ScriptSleep(3000); + ScriptSleep(m_sleepMsOnRemoteDataReply); } public void llCloseRemoteDataChannel(string channel) @@ -7376,7 +7435,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); if (xmlrpcMod != null) xmlrpcMod.CloseXMLRPCChannel((UUID)channel); - ScriptSleep(1000); + ScriptSleep(m_sleepMsOnCloseRemoteDataChannel); } public LSL_String llMD5String(string src, int nonce) @@ -7764,7 +7823,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api SetLinkPrimParams(ScriptBaseClass.LINK_THIS, rules, "llSetPrimitiveParams"); - ScriptSleep(200); + ScriptSleep(m_sleepMsOnSetPrimitiveParams); } public void llSetLinkPrimitiveParams(int linknumber, LSL_List rules) @@ -7773,7 +7832,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api SetLinkPrimParams(linknumber, rules, "llSetLinkPrimitiveParams"); - ScriptSleep(200); + ScriptSleep(m_sleepMsOnSetLinkPrimitiveParams); } public void llSetLinkPrimitiveParamsFast(int linknumber, LSL_List rules) @@ -9386,7 +9445,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); Deprecated("llXorBase64Strings", "Use llXorBase64 instead"); - ScriptSleep(300); + ScriptSleep(m_sleepMsOnXorBase64Strings); return String.Empty; } @@ -9434,7 +9493,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api land.SetMusicUrl(url); - ScriptSleep(2000); + ScriptSleep(m_sleepMsOnSetParcelMusicURL); } public LSL_String llGetParcelMusicURL() @@ -10213,14 +10272,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_List llGetPrimMediaParams(int face, LSL_List rules) { m_host.AddScriptLPS(1); - ScriptSleep(1000); + ScriptSleep(m_sleepMsOnGetPrimMediaParams); return GetPrimMediaParams(m_host, face, rules); } public LSL_List llGetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules) { m_host.AddScriptLPS(1); - ScriptSleep(1000); + ScriptSleep(m_sleepMsOnGetLinkMedia); if (link == ScriptBaseClass.LINK_ROOT) return GetPrimMediaParams(m_host.ParentGroup.RootPart, face, rules); else if (link == ScriptBaseClass.LINK_THIS) @@ -10340,14 +10399,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Integer llSetPrimMediaParams(LSL_Integer face, LSL_List rules) { m_host.AddScriptLPS(1); - ScriptSleep(1000); + ScriptSleep(m_sleepMsOnSetPrimMediaParams); return SetPrimMediaParams(m_host, face, rules); } public LSL_Integer llSetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules) { m_host.AddScriptLPS(1); - ScriptSleep(1000); + ScriptSleep(m_sleepMsOnSetLinkMedia); if (link == ScriptBaseClass.LINK_ROOT) return SetPrimMediaParams(m_host.ParentGroup.RootPart, face, rules); else if (link == ScriptBaseClass.LINK_THIS) @@ -10466,14 +10525,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Integer llClearPrimMedia(LSL_Integer face) { m_host.AddScriptLPS(1); - ScriptSleep(1000); + ScriptSleep(m_sleepMsOnClearPrimMedia); return ClearPrimMedia(m_host, face); } public LSL_Integer llClearLinkMedia(LSL_Integer link, LSL_Integer face) { m_host.AddScriptLPS(1); - ScriptSleep(1000); + ScriptSleep(m_sleepMsOnClearLinkMedia); if (link == ScriptBaseClass.LINK_ROOT) return ClearPrimMedia(m_host.ParentGroup.RootPart, face); else if (link == ScriptBaseClass.LINK_THIS) @@ -11160,7 +11219,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case ScriptBaseClass.DATA_SIM_POS: if (info == null) { - ScriptSleep(1000); + ScriptSleep(m_sleepMsOnRequestSimulatorData); return UUID.Zero.ToString(); } @@ -11207,7 +11266,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case ScriptBaseClass.DATA_SIM_RATING: if (info == null) { - ScriptSleep(1000); + ScriptSleep(m_sleepMsOnRequestSimulatorData); return UUID.Zero.ToString(); } int access = info.Maturity; @@ -11226,7 +11285,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api reply = "OpenSim"; break; default: - ScriptSleep(1000); + ScriptSleep(m_sleepMsOnRequestSimulatorData); return UUID.Zero.ToString(); // Raise no event } UUID rq = UUID.Random(); @@ -11237,7 +11296,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api AsyncCommands. DataserverPlugin.DataserverReply(rq.ToString(), reply); - ScriptSleep(1000); + ScriptSleep(m_sleepMsOnRequestSimulatorData); return tid.ToString(); } catch(Exception) @@ -11382,7 +11441,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api dm.SendUrlToUser( new UUID(avatar_id), m_host.Name, m_host.UUID, m_host.OwnerID, false, message, url); - ScriptSleep(10000); + ScriptSleep(m_sleepMsOnLoadURL); } public void llParcelMediaCommandList(LSL_List commandList) @@ -11625,7 +11684,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api time); } } - ScriptSleep(2000); + ScriptSleep(m_sleepMsOnParcelMediaCommandList); } public LSL_List llParcelMediaQuery(LSL_List aList) @@ -11665,7 +11724,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - ScriptSleep(2000); + ScriptSleep(m_sleepMsOnParcelMediaQuery); return list; } @@ -11674,7 +11733,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); Int64 tmp = 0; Math.DivRem(Convert.ToInt64(Math.Pow(a, b)), c, out tmp); - ScriptSleep(1000); + ScriptSleep(m_sleepMsOnModPow); return Convert.ToInt32(tmp); } @@ -11757,14 +11816,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); Deprecated("llSetPrimURL", "Use llSetPrimMediaParams instead"); - ScriptSleep(2000); + ScriptSleep(m_sleepMsOnSetPrimURL); } public void llRefreshPrimURL() { m_host.AddScriptLPS(1); Deprecated("llRefreshPrimURL"); - ScriptSleep(20000); + ScriptSleep(m_sleepMsOnRefreshPrimURL); } public LSL_String llEscapeURL(string url) @@ -11805,7 +11864,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api avatar.ControllingClient.SendScriptTeleportRequest(m_host.Name, simname, pos, lookAt); } - ScriptSleep(1000); + ScriptSleep(m_sleepMsOnMapDestination); } public void llAddToLandBanList(string avatar, double hours) @@ -11846,7 +11905,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api World.EventManager.TriggerLandObjectUpdated((uint)land.LandData.LocalID, land); } } - ScriptSleep(100); + ScriptSleep(m_sleepMsOnAddToLandBanList); } public void llRemoveFromLandPassList(string avatar) @@ -11873,7 +11932,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } } - ScriptSleep(100); + ScriptSleep(m_sleepMsOnRemoveFromLandPassList); } public void llRemoveFromLandBanList(string avatar) @@ -11900,7 +11959,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } } - ScriptSleep(100); + ScriptSleep(m_sleepMsOnRemoveFromLandBanList); } public void llSetCameraParams(LSL_List rules) @@ -12283,7 +12342,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } } - ScriptSleep(100); + ScriptSleep(m_sleepMsOnResetLandBanList); } public void llResetLandPassList() @@ -12300,7 +12359,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } } - ScriptSleep(100); + ScriptSleep(m_sleepMsOnResetLandPassList); } public LSL_Integer llGetParcelPrimCount(LSL_Vector pos, int category, int sim_wide) @@ -12358,7 +12417,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ret.Add(new LSL_Integer(detectedParams.Value)); } } - ScriptSleep(2000); + ScriptSleep(m_sleepMsOnGetParcelPrimOwners); return ret; } @@ -12831,7 +12890,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { AsyncCommands.DataserverPlugin.DataserverReply(reqIdentifier, NotecardCache.GetLines(assetID).ToString()); - ScriptSleep(100); + ScriptSleep(m_sleepMsOnGetNumberOfNotecardLines); return tid.ToString(); } @@ -12847,7 +12906,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api AsyncCommands.DataserverPlugin.DataserverReply(reqIdentifier, NotecardCache.GetLines(id).ToString()); }); - ScriptSleep(100); + ScriptSleep(m_sleepMsOnGetNumberOfNotecardLines); return tid.ToString(); } @@ -12883,7 +12942,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api AsyncCommands.DataserverPlugin.DataserverReply( reqIdentifier, NotecardCache.GetLine(assetID, line, m_notecardLineReadCharsMax)); - ScriptSleep(100); + ScriptSleep(m_sleepMsOnGetNotecardLine); return tid.ToString(); } @@ -12902,7 +12961,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api reqIdentifier, NotecardCache.GetLine(assetID, line, m_notecardLineReadCharsMax)); }); - ScriptSleep(100); + ScriptSleep(m_sleepMsOnGetNotecardLine); return tid.ToString(); } -- 1.7.9.5 ![]() From 127682ade2f167717f9f0a0c1e270b9b1aa40a84 Mon Sep 17 00:00:00 2001 From: Magnuz Binder <magnuz@magnuz-se.com> Date: Sun, 22 Mar 2015 19:47:51 +0100 Subject: [PATCH] Add LSL function sleep parameters to config. --- .../Shared/Api/Implementation/LSL_Api.cs | 59 +++++++++++++++++++ bin/OpenSimDefaults.ini | 61 ++++++++++++++++++++ 2 files changed, 120 insertions(+) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index d2ed1f7..5e81403 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -257,6 +257,65 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (lslConfig != null) { m_restrictEmail = lslConfig.GetBoolean("RestrictEmail", m_restrictEmail); + + m_sleepMsOnSetTexture = lslConfig.GetInt("sleepMsOnSetTexture", m_sleepMsOnSetTexture); + m_sleepMsOnSetLinkTexture = lslConfig.GetInt("sleepMsOnSetLinkTexture", m_sleepMsOnSetLinkTexture); + m_sleepMsOnScaleTexture = lslConfig.GetInt("sleepMsOnScaleTexture", m_sleepMsOnScaleTexture); + m_sleepMsOnOffsetTexture = lslConfig.GetInt("sleepMsOnOffsetTexture", m_sleepMsOnOffsetTexture); + m_sleepMsOnRotateTexture = lslConfig.GetInt("sleepMsOnRotateTexture", m_sleepMsOnRotateTexture); + m_sleepMsOnSetPos = lslConfig.GetInt("sleepMsOnSetPos", m_sleepMsOnSetPos); + m_sleepMsOnSetRot = lslConfig.GetInt("sleepMsOnSetRot", m_sleepMsOnSetRot); + m_sleepMsOnSetLocalRot = lslConfig.GetInt("sleepMsOnSetLocalRot", m_sleepMsOnSetLocalRot); + m_sleepMsOnPreloadSound = lslConfig.GetInt("sleepMsOnPreloadSound", m_sleepMsOnPreloadSound); + m_sleepMsOnMakeExplosion = lslConfig.GetInt("sleepMsOnMakeExplosion", m_sleepMsOnMakeExplosion); + m_sleepMsOnMakeFountain = lslConfig.GetInt("sleepMsOnMakeFountain", m_sleepMsOnMakeFountain); + m_sleepMsOnMakeSmoke = lslConfig.GetInt("sleepMsOnMakeSmoke", m_sleepMsOnMakeSmoke); + m_sleepMsOnMakeFire = lslConfig.GetInt("sleepMsOnMakeFire", m_sleepMsOnMakeFire); + m_sleepMsOnRezAtRoot = lslConfig.GetInt("sleepMsOnRezAtRoot", m_sleepMsOnRezAtRoot); + m_sleepMsOnInstantMessage = lslConfig.GetInt("sleepMsOnInstantMessage", m_sleepMsOnInstantMessage); + m_sleepMsOnEmail = lslConfig.GetInt("sleepMsOnEmail", m_sleepMsOnEmail); + m_sleepMsOnCreateLink = lslConfig.GetInt("sleepMsOnCreateLink", m_sleepMsOnCreateLink); + m_sleepMsOnGiveInventory = lslConfig.GetInt("sleepMsOnGiveInventory", m_sleepMsOnGiveInventory); + m_sleepMsOnRequestAgentData = lslConfig.GetInt("sleepMsOnRequestAgentData", m_sleepMsOnRequestAgentData); + m_sleepMsOnRequestInventoryData = lslConfig.GetInt("sleepMsOnRequestInventoryData", m_sleepMsOnRequestInventoryData); + m_sleepMsOnSetDamage = lslConfig.GetInt("sleepMsOnSetDamage", m_sleepMsOnSetDamage); + m_sleepMsOnTextBox = lslConfig.GetInt("sleepMsOnTextBox", m_sleepMsOnTextBox); + m_sleepMsOnAdjustSoundVolume = lslConfig.GetInt("sleepMsOnAdjustSoundVolume", m_sleepMsOnAdjustSoundVolume); + m_sleepMsOnEjectFromLand = lslConfig.GetInt("sleepMsOnEjectFromLand", m_sleepMsOnEjectFromLand); + m_sleepMsOnAddToLandPassList = lslConfig.GetInt("sleepMsOnAddToLandPassList", m_sleepMsOnAddToLandPassList); + m_sleepMsOnDialog = lslConfig.GetInt("sleepMsOnDialog", m_sleepMsOnDialog); + m_sleepMsOnRemoteLoadScript = lslConfig.GetInt("sleepMsOnRemoteLoadScript", m_sleepMsOnRemoteLoadScript); + m_sleepMsOnRemoteLoadScriptPin = lslConfig.GetInt("sleepMsOnRemoteLoadScriptPin", m_sleepMsOnRemoteLoadScriptPin); + m_sleepMsOnOpenRemoteDataChannel = lslConfig.GetInt("sleepMsOnOpenRemoteDataChannel", m_sleepMsOnOpenRemoteDataChannel); + m_sleepMsOnSendRemoteData = lslConfig.GetInt("sleepMsOnSendRemoteData", m_sleepMsOnSendRemoteData); + m_sleepMsOnRemoteDataReply = lslConfig.GetInt("sleepMsOnRemoteDataReply", m_sleepMsOnRemoteDataReply); + m_sleepMsOnCloseRemoteDataChannel = lslConfig.GetInt("sleepMsOnCloseRemoteDataChannel", m_sleepMsOnCloseRemoteDataChannel); + m_sleepMsOnSetPrimitiveParams = lslConfig.GetInt("sleepMsOnSetPrimitiveParams", m_sleepMsOnSetPrimitiveParams); + m_sleepMsOnSetLinkPrimitiveParams = lslConfig.GetInt("sleepMsOnSetLinkPrimitiveParams", m_sleepMsOnSetLinkPrimitiveParams); + m_sleepMsOnXorBase64Strings = lslConfig.GetInt("sleepMsOnXorBase64Strings", m_sleepMsOnXorBase64Strings); + m_sleepMsOnSetParcelMusicURL = lslConfig.GetInt("sleepMsOnSetParcelMusicURL", m_sleepMsOnSetParcelMusicURL); + m_sleepMsOnGetPrimMediaParams = lslConfig.GetInt("sleepMsOnGetPrimMediaParams", m_sleepMsOnGetPrimMediaParams); + m_sleepMsOnGetLinkMedia = lslConfig.GetInt("sleepMsOnGetLinkMedia", m_sleepMsOnGetLinkMedia); + m_sleepMsOnSetPrimMediaParams = lslConfig.GetInt("sleepMsOnSetPrimMediaParams", m_sleepMsOnSetPrimMediaParams); + m_sleepMsOnSetLinkMedia = lslConfig.GetInt("sleepMsOnSetLinkMedia", m_sleepMsOnSetLinkMedia); + m_sleepMsOnClearPrimMedia = lslConfig.GetInt("sleepMsOnClearPrimMedia", m_sleepMsOnClearPrimMedia); + m_sleepMsOnClearLinkMedia = lslConfig.GetInt("sleepMsOnClearLinkMedia", m_sleepMsOnClearLinkMedia); + m_sleepMsOnRequestSimulatorData = lslConfig.GetInt("sleepMsOnRequestSimulatorData", m_sleepMsOnRequestSimulatorData); + m_sleepMsOnLoadURL = lslConfig.GetInt("sleepMsOnLoadURL", m_sleepMsOnLoadURL); + m_sleepMsOnParcelMediaCommandList = lslConfig.GetInt("sleepMsOnParcelMediaCommandList", m_sleepMsOnParcelMediaCommandList); + m_sleepMsOnParcelMediaQuery = lslConfig.GetInt("sleepMsOnParcelMediaQuery", m_sleepMsOnParcelMediaQuery); + m_sleepMsOnModPow = lslConfig.GetInt("sleepMsOnModPow", m_sleepMsOnModPow); + m_sleepMsOnSetPrimURL = lslConfig.GetInt("sleepMsOnSetPrimURL", m_sleepMsOnSetPrimURL); + m_sleepMsOnRefreshPrimURL = lslConfig.GetInt("sleepMsOnRefreshPrimURL", m_sleepMsOnRefreshPrimURL); + m_sleepMsOnMapDestination = lslConfig.GetInt("sleepMsOnMapDestination", m_sleepMsOnMapDestination); + m_sleepMsOnAddToLandBanList = lslConfig.GetInt("sleepMsOnAddToLandBanList", m_sleepMsOnAddToLandBanList); + m_sleepMsOnRemoveFromLandPassList = lslConfig.GetInt("sleepMsOnRemoveFromLandPassList", m_sleepMsOnRemoveFromLandPassList); + m_sleepMsOnRemoveFromLandBanList = lslConfig.GetInt("sleepMsOnRemoveFromLandBanList", m_sleepMsOnRemoveFromLandBanList); + m_sleepMsOnResetLandBanList = lslConfig.GetInt("sleepMsOnResetLandBanList", m_sleepMsOnResetLandBanList); + m_sleepMsOnResetLandPassList = lslConfig.GetInt("sleepMsOnResetLandPassList", m_sleepMsOnResetLandPassList); + m_sleepMsOnGetParcelPrimOwners = lslConfig.GetInt("sleepMsOnGetParcelPrimOwners", m_sleepMsOnGetParcelPrimOwners); + m_sleepMsOnGetNumberOfNotecardLines = lslConfig.GetInt("sleepMsOnGetNumberOfNotecardLines", m_sleepMsOnGetNumberOfNotecardLines); + m_sleepMsOnGetNotecardLine = lslConfig.GetInt("sleepMsOnGetNotecardLine", m_sleepMsOnGetNotecardLine); } IConfig smtpConfig = seConfigSource.Configs["SMTP"]; diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index af37ccc..93412fc 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -1397,6 +1397,67 @@ ; Maximum number of external urls that scripts can set up in this simulator (e.g. via llRequestURL()) max_external_urls_per_simulator = 100 + ; Sleeps in milliseconds for various LL-Functions. + ; The function names are the parameter names with "ll" substituting "sleepMsOn". + sleepMsOnSetTexture = 200 + sleepMsOnSetLinkTexture = 200 + sleepMsOnScaleTexture = 200 + sleepMsOnOffsetTexture = 200 + sleepMsOnRotateTexture = 200 + sleepMsOnSetPos = 200 + sleepMsOnSetRot = 200 + sleepMsOnSetLocalRot = 200 + sleepMsOnPreloadSound = 1000 + sleepMsOnMakeExplosion = 100 + sleepMsOnMakeFountain = 100 + sleepMsOnMakeSmoke = 100 + sleepMsOnMakeFire = 100 + sleepMsOnRezAtRoot = 100 + sleepMsOnInstantMessage = 2000 + sleepMsOnEmail = 20000 + sleepMsOnCreateLink = 1000 + sleepMsOnGiveInventory = 3000 + sleepMsOnRequestAgentData = 100 + sleepMsOnRequestInventoryData = 1000 + sleepMsOnSetDamage = 5000 + sleepMsOnTextBox = 1000 + sleepMsOnAdjustSoundVolume = 100 + sleepMsOnEjectFromLand = 5000 + sleepMsOnAddToLandPassList = 100 + sleepMsOnDialog = 1000 + sleepMsOnRemoteLoadScript = 3000 + sleepMsOnRemoteLoadScriptPin = 3000 + sleepMsOnOpenRemoteDataChannel = 1000 + sleepMsOnSendRemoteData = 3000 + sleepMsOnRemoteDataReply = 3000 + sleepMsOnCloseRemoteDataChannel = 1000 + sleepMsOnSetPrimitiveParams = 200 + sleepMsOnSetLinkPrimitiveParams = 200 + sleepMsOnXorBase64Strings = 300 + sleepMsOnSetParcelMusicURL = 2000 + sleepMsOnGetPrimMediaParams = 1000 + sleepMsOnGetLinkMedia = 1000 + sleepMsOnSetPrimMediaParams = 1000 + sleepMsOnSetLinkMedia = 1000 + sleepMsOnClearPrimMedia = 1000 + sleepMsOnClearLinkMedia = 1000 + sleepMsOnRequestSimulatorData = 1000 + sleepMsOnLoadURL = 10000 + sleepMsOnParcelMediaCommandList = 2000 + sleepMsOnParcelMediaQuery = 2000 + sleepMsOnModPow = 1000 + sleepMsOnSetPrimURL = 2000 + sleepMsOnRefreshPrimURL = 20000 + sleepMsOnMapDestination = 1000 + sleepMsOnAddToLandBanList = 100 + sleepMsOnRemoveFromLandPassList = 100 + sleepMsOnRemoveFromLandBanList = 100 + sleepMsOnResetLandBanList = 100 + sleepMsOnResetLandPassList = 100 + sleepMsOnGetParcelPrimOwners = 2000 + sleepMsOnGetNumberOfNotecardLines = 100 + sleepMsOnGetNotecardLine = 100 + [DataSnapshot] ; The following set of configs pertains to search. -- 1.7.9.5 ![]() From bfcd8ed7afd8d1642cdf311d04210934933a9a15 Mon Sep 17 00:00:00 2001 From: Magnuz Binder <magnuz@magnuz-se.com> Date: Mon, 23 Mar 2015 22:07:22 +0100 Subject: [PATCH 2/2] Parameterize constants in LSL_Api and make configurable. --- .../Shared/Api/Implementation/LSL_Api.cs | 491 +++++++++++++------- bin/OpenSimDefaults.ini | 205 +++++++- 2 files changed, 519 insertions(+), 177 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 5e81403..6deca4a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -135,7 +135,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected int m_sleepMsOnMakeFire = 100; protected int m_sleepMsOnRezAtRoot = 100; protected int m_sleepMsOnInstantMessage = 2000; - protected int m_sleepMsOnEmail = 20000; protected int m_sleepMsOnCreateLink = 1000; protected int m_sleepMsOnGiveInventory = 3000; protected int m_sleepMsOnRequestAgentData = 100; @@ -182,6 +181,75 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected bool m_restrictEmail = false; protected ISoundModule m_SoundModule = null; + protected int m_minGodLevelForNoTeleportAgent = 200; + protected int m_minGodLevelForNoTeleportAgentGlobalCoords = 200; + protected double m_maxDiffForSetRegionPos = 0.1; + protected int m_maxHeadersInHTTPRequest = 8; + protected double m_maxDoubleDiff = 0.000001; + protected double m_minOrthoVectorInRotBetween = 0.0001; + protected float m_maxFloatDiff = 0.0000001f; + protected int m_maxTextLengthInWhisper = 1023; + protected int m_maxTextLengthInSay = 1023; + protected int m_maxTextLengthInShout = 1023; + protected int m_maxTextLengthInRegionSay = 1023; + protected int m_maxTextLengthInRegionSayTo = 1023; + protected double m_maxOutsideInSetRegionPos = 10; + protected float m_maxDistanceInSetPosAdjust = 10.0f; + protected float m_maxForceInApplyImpulse = 20000.0f; + protected float m_maxDistanceInRezAtRoot = 10.0f; + protected int m_maxTextLenghInInstantMessage = 1023; + protected int m_maxTextLengthInSetText = 254; + protected int m_minTextLengthInTextBox = 1; + protected int m_maxTextLengthInTextBox = 512; + protected int m_maxResultsInGetAgentList = 100; + protected float m_minParticleScale = 0.03125f; + protected float m_maxParticleScale = 4.0f; + protected int m_minButtonsInDialog = 1; + protected int m_maxButtonsInDialog = 12; + protected int m_minTextLengthInButton = 1; + protected int m_maxTextLengthInButton = 24; + protected float m_minPrimCut = 0.0f; + protected float m_maxPrimCut = 1.0f; + protected float m_minPrimCutDiff = 0.02f; + protected float m_minPrimHollow = 0.0f; + protected float m_maxPrimHollowSqr = 0.7f; + protected float m_maxPrimHollow = 0.99f; + protected float m_minPrimTwist = -1.0f; + protected float m_maxPrimTwist = 1.0f; + protected float m_minPrimTaperSimple = 0.0f; + protected float m_maxPrimTaperSimple = 2.0f; + protected float m_minPrimTopshear = -0.5f; + protected float m_maxPrimTopshear = 0.5f; + protected float m_minPrimDimple = 0.0f; + protected float m_maxPrimDimple = 1.0f; + protected float m_minPrimDimpleDiff = 0.02f; + protected float m_minPrimHolesizeX = 0.01f; + protected float m_minPrimHolesizeY = 0.01f; + protected float m_maxPrimHolesizeX = 1.0f; + protected float m_maxPrimHolesizeY = 0.5f; + protected float m_minPrimProfilecut = 0.0f; + protected float m_maxPrimProfilecut = 1.0f; + protected float m_minPrimProfilecutDiff = 0.02f; + protected float m_minPrimTaperComplex = -1.0f; + protected float m_maxPrimTaperComplex = 1.0f; + protected float m_minPrimRevolutions = 1.0f; + protected float m_maxPrimRevolutions = 4.0f; + protected float m_minPrimRadiusoffset = 0.0f; + protected float m_maxPrimRadiusoffset = 1.0f; + protected float m_minPrimSkew = -0.95f; + protected float m_maxPrimSkew = 0.95f; + protected int m_minPrimMaterialIdx = 0; + protected int m_maxPrimMaterialIdx = 7; + protected int m_maxPrimFaceIdx = 21; + protected int m_maxTextLengthInBase64ToInteger = 8; + protected int m_maxTextLengthInError = 1023; + protected double m_maxDInAvatarIntersection = 1.5; + protected int m_maxCountInCastRay = 16; + protected int m_maxPhysCountInCastRay = 20; + protected double m_minSDistInRot2Axis = 0.001; + protected int m_minButtonsInSetPayPrice = 4; + protected int m_maxButtonsInSetPayPrice = 4; + //An array of HTTP/1.1 headers that are not allowed to be used //as custom headers by llHTTPRequest. private string[] HttpStandardHeaders = @@ -273,7 +341,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_sleepMsOnMakeFire = lslConfig.GetInt("sleepMsOnMakeFire", m_sleepMsOnMakeFire); m_sleepMsOnRezAtRoot = lslConfig.GetInt("sleepMsOnRezAtRoot", m_sleepMsOnRezAtRoot); m_sleepMsOnInstantMessage = lslConfig.GetInt("sleepMsOnInstantMessage", m_sleepMsOnInstantMessage); - m_sleepMsOnEmail = lslConfig.GetInt("sleepMsOnEmail", m_sleepMsOnEmail); m_sleepMsOnCreateLink = lslConfig.GetInt("sleepMsOnCreateLink", m_sleepMsOnCreateLink); m_sleepMsOnGiveInventory = lslConfig.GetInt("sleepMsOnGiveInventory", m_sleepMsOnGiveInventory); m_sleepMsOnRequestAgentData = lslConfig.GetInt("sleepMsOnRequestAgentData", m_sleepMsOnRequestAgentData); @@ -326,8 +393,80 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_internalObjectHost = smtpConfig.GetString("internal_object_host", m_internalObjectHost); } + + IConfig xengineConfig = seConfigSource.Configs["XEngine"]; + if (xengineConfig != null) + { + m_minGodLevelForNoTeleportAgent = xengineConfig.GetInt("minGodLevelForNoTeleportAgent", m_minGodLevelForNoTeleportAgent); + m_minGodLevelForNoTeleportAgentGlobalCoords = xengineConfig.GetInt("minGodLevelForNoTeleportAgentGlobalCoords", m_minGodLevelForNoTeleportAgentGlobalCoords); + m_maxDiffForSetRegionPos = xengineConfig.GetDouble("maxDiffForSetRegionPos", m_maxDiffForSetRegionPos); + m_maxHeadersInHTTPRequest = xengineConfig.GetInt("maxHeadersInHTTPRequest", m_maxHeadersInHTTPRequest); + m_maxDoubleDiff = xengineConfig.GetDouble("maxDoubleDiff", m_maxDoubleDiff); + m_minOrthoVectorInRotBetween = xengineConfig.GetDouble("minOrthoVectorInRotBetween", m_minOrthoVectorInRotBetween); + m_maxFloatDiff = xengineConfig.GetFloat("maxFloatDiff", m_maxFloatDiff); + m_maxTextLengthInWhisper = xengineConfig.GetInt("maxTextLengthInWhisper", m_maxTextLengthInWhisper); + m_maxTextLengthInSay = xengineConfig.GetInt("maxTextLengthInSay", m_maxTextLengthInSay); + m_maxTextLengthInShout = xengineConfig.GetInt("maxTextLengthInShout", m_maxTextLengthInShout); + m_maxTextLengthInRegionSay = xengineConfig.GetInt("maxTextLengthInRegionSay", m_maxTextLengthInRegionSay); + m_maxTextLengthInRegionSayTo = xengineConfig.GetInt("maxTextLengthInRegionSayTo", m_maxTextLengthInRegionSayTo); + m_maxOutsideInSetRegionPos = xengineConfig.GetDouble("maxOutsideInSetRegionPos", m_maxOutsideInSetRegionPos); + m_maxDistanceInSetPosAdjust = xengineConfig.GetFloat("maxDistanceInSetPosAdjust", m_maxDistanceInSetPosAdjust); + m_maxForceInApplyImpulse = xengineConfig.GetFloat("maxForceInApplyImpulse", m_maxForceInApplyImpulse); + m_maxDistanceInRezAtRoot = xengineConfig.GetFloat("maxDistanceInRezAtRoot", m_maxDistanceInRezAtRoot); + m_maxTextLenghInInstantMessage = xengineConfig.GetInt("maxTextLenghInInstantMessage", m_maxTextLenghInInstantMessage); + m_maxTextLengthInSetText = xengineConfig.GetInt("maxTextLengthInSetText", m_maxTextLengthInSetText); + m_minTextLengthInTextBox = xengineConfig.GetInt("minTextLengthInTextBox", m_minTextLengthInTextBox); + m_maxTextLengthInTextBox = xengineConfig.GetInt("maxTextLengthInTextBox", m_maxTextLengthInTextBox); + m_maxResultsInGetAgentList = xengineConfig.GetInt("maxResultsInGetAgentList", m_maxResultsInGetAgentList); + m_minParticleScale = xengineConfig.GetFloat("minParticleScale", m_minParticleScale); + m_maxParticleScale = xengineConfig.GetFloat("maxParticleScale", m_maxParticleScale); + m_minButtonsInDialog = xengineConfig.GetInt("minButtonsInDialog", m_minButtonsInDialog); + m_maxButtonsInDialog = xengineConfig.GetInt("maxButtonsInDialog", m_maxButtonsInDialog); + m_minTextLengthInButton = xengineConfig.GetInt("minTextLengthInButton", m_minTextLengthInButton); + m_maxTextLengthInButton = xengineConfig.GetInt("maxTextLengthInButton", m_maxTextLengthInButton); + m_minPrimCut = xengineConfig.GetFloat("minPrimCut", m_minPrimCut); + m_maxPrimCut = xengineConfig.GetFloat("maxPrimCut", m_maxPrimCut); + m_minPrimCutDiff = xengineConfig.GetFloat("minPrimCutDiff", m_minPrimCutDiff); + m_minPrimHollow = xengineConfig.GetFloat("minPrimHollow", m_minPrimHollow); + m_maxPrimHollowSqr = xengineConfig.GetFloat("maxPrimHollowSqr", m_maxPrimHollowSqr); + m_maxPrimHollow = xengineConfig.GetFloat("maxPrimHollow", m_maxPrimHollow); + m_minPrimTwist = xengineConfig.GetFloat("minPrimTwist", m_minPrimTwist); + m_maxPrimTwist = xengineConfig.GetFloat("maxPrimTwist", m_maxPrimTwist); + m_minPrimTaperSimple = xengineConfig.GetFloat("minPrimTaperSimple", m_minPrimTaperSimple); + m_maxPrimTaperSimple = xengineConfig.GetFloat("maxPrimTaperSimple", m_maxPrimTaperSimple); + m_minPrimTopshear = xengineConfig.GetFloat("minPrimTopshear", m_minPrimTopshear); + m_maxPrimTopshear = xengineConfig.GetFloat("maxPrimTopshear", m_maxPrimTopshear); + m_minPrimDimple = xengineConfig.GetFloat("minPrimDimple", m_minPrimDimple); + m_maxPrimDimple = xengineConfig.GetFloat("maxPrimDimple", m_maxPrimDimple); + m_minPrimDimpleDiff = xengineConfig.GetFloat("minPrimDimpleDiff", m_minPrimDimpleDiff); + m_minPrimHolesizeX = xengineConfig.GetFloat("minPrimHolesizeX", m_minPrimHolesizeX); + m_minPrimHolesizeY = xengineConfig.GetFloat("minPrimHolesizeY", m_minPrimHolesizeY); + m_maxPrimHolesizeX = xengineConfig.GetFloat("maxPrimHolesizeX", m_maxPrimHolesizeX); + m_maxPrimHolesizeY = xengineConfig.GetFloat("maxPrimHolesizeY", m_maxPrimHolesizeY); + m_minPrimProfilecut = xengineConfig.GetFloat("minPrimProfilecut", m_minPrimProfilecut); + m_maxPrimProfilecut = xengineConfig.GetFloat("maxPrimProfilecut", m_maxPrimProfilecut); + m_minPrimProfilecutDiff = xengineConfig.GetFloat("minPrimProfilecutDiff", m_minPrimProfilecutDiff); + m_minPrimTaperComplex = xengineConfig.GetFloat("minPrimTaperComplex", m_minPrimTaperComplex); + m_maxPrimTaperComplex = xengineConfig.GetFloat("maxPrimTaperComplex", m_maxPrimTaperComplex); + m_minPrimRevolutions = xengineConfig.GetFloat("minPrimRevolutions", m_minPrimRevolutions); + m_maxPrimRevolutions = xengineConfig.GetFloat("maxPrimRevolutions", m_maxPrimRevolutions); + m_minPrimRadiusoffset = xengineConfig.GetFloat("minPrimRadiusoffset", m_minPrimRadiusoffset); + m_maxPrimRadiusoffset = xengineConfig.GetFloat("maxPrimRadiusoffset", m_maxPrimRadiusoffset); + m_minPrimSkew = xengineConfig.GetFloat("minPrimSkew", m_minPrimSkew); + m_maxPrimSkew = xengineConfig.GetFloat("maxPrimSkew", m_maxPrimSkew); + m_minPrimMaterialIdx = xengineConfig.GetInt("minPrimMaterialIdx", m_minPrimMaterialIdx); + m_maxPrimMaterialIdx = xengineConfig.GetInt("maxPrimMaterialIdx", m_maxPrimMaterialIdx); + m_maxPrimFaceIdx = xengineConfig.GetInt("maxPrimFaceIdx", m_maxPrimFaceIdx); + m_maxTextLengthInBase64ToInteger = xengineConfig.GetInt("maxTextLengthInBase64ToInteger", m_maxTextLengthInBase64ToInteger); + m_maxTextLengthInError = xengineConfig.GetInt("maxTextLengthInError", m_maxTextLengthInError); + m_maxDInAvatarIntersection = xengineConfig.GetDouble("maxDInAvatarIntersection", m_maxDInAvatarIntersection); + m_maxCountInCastRay = xengineConfig.GetInt("maxCountInCastRay", m_maxCountInCastRay); + m_maxPhysCountInCastRay = xengineConfig.GetInt("maxPhysCountInCastRay", m_maxPhysCountInCastRay); + m_minSDistInRot2Axis = xengineConfig.GetDouble("minSDistInRot2Axis", m_minSDistInRot2Axis); + m_minButtonsInSetPayPrice = xengineConfig.GetInt("minButtonsInSetPayPrice", m_minButtonsInSetPayPrice); + m_maxButtonsInSetPayPrice = xengineConfig.GetInt("maxButtonsInSetPayPrice", m_maxButtonsInSetPayPrice); + } } - m_sleepMsOnEmail = EMAIL_PAUSE_TIME * 1000; } public override Object InitializeLifetimeService() @@ -742,7 +881,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (m == 0.0) return new LSL_Vector(); double x = Math.Atan2(-v.y, v.z); double sin = v.x / m; - if (sin < -0.999999 || sin > 0.999999) x = 0.0; // Force X rotation to 0 at the singularities. + if (sin < -1.0 + m_maxDoubleDiff || sin > 1.0 - m_maxDoubleDiff) x = 0.0; // Force X rotation to 0 at the singularities. double y = Math.Asin(sin); // Rotate X axis unit vector by r and unwind the X and Y rotations leaving only the Z rotation v = new LSL_Vector(1.0, 0.0, 0.0) * ((r * new LSL_Rotation(Math.Sin(-x / 2.0), 0.0, 0.0, Math.Cos(-x / 2.0))) * new LSL_Rotation(0.0, Math.Sin(-y / 2.0), 0.0, Math.Cos(-y / 2.0))); @@ -881,7 +1020,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m = r.x * r.x + r.y * r.y + r.z * r.z + r.s * r.s; // m is always greater than zero // if m is not equal to 1 then Rotation needs to be normalized - if (Math.Abs(1.0 - m) > 0.000001) // allow a little slop here for calculation precision + if (Math.Abs(1.0 - m) > m_maxDoubleDiff) // allow a little slop here for calculation precision { m = 1.0 / Math.Sqrt(m); r.x *= m; @@ -906,7 +1045,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m = r.x * r.x + r.y * r.y + r.z * r.z + r.s * r.s; // m is always greater than zero // if m is not equal to 1 then Rotation needs to be normalized - if (Math.Abs(1.0 - m) > 0.000001) // allow a little slop here for calculation precision + if (Math.Abs(1.0 - m) > m_maxDoubleDiff) // allow a little slop here for calculation precision { m = 1.0 / Math.Sqrt(m); r.x *= m; @@ -930,7 +1069,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m = r.x * r.x + r.y * r.y + r.z * r.z + r.s * r.s; // m is always greater than zero // if m is not equal to 1 then Rotation needs to be normalized - if (Math.Abs(1.0 - m) > 0.000001) // allow a little slop here for calculation precision + if (Math.Abs(1.0 - m) > m_maxDoubleDiff) // allow a little slop here for calculation precision { m = 1.0 / Math.Sqrt(m); r.x *= m; @@ -967,14 +1106,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // // Check for vectors 180 degrees apart. // A dot product of -1 would mean the angle between vectors is 180 degrees. - if (dotProduct < -0.9999999f) + if (dotProduct < m_maxFloatDiff - 1.0f) { // First assume X axis is orthogonal to the vectors. LSL_Vector orthoVector = new LSL_Vector(1.0f, 0.0f, 0.0f); orthoVector = orthoVector - a * (a.x / LSL_Vector.Dot(a, a)); // Check for near zero vector. A very small non-zero number here will create // a rotation in an undesired direction. - if (LSL_Vector.Mag(orthoVector) > 0.0001) + if (LSL_Vector.Mag(orthoVector) > m_minOrthoVectorInRotBetween) { rotBetween = new LSL_Rotation(orthoVector.x, orthoVector.y, orthoVector.z, 0.0f); } @@ -988,7 +1127,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } // Check for parallel vectors. // A dot product of 1 would mean the angle between vectors is 0 degrees. - else if (dotProduct > 0.9999999f) + else if (dotProduct > 1.0f - m_maxFloatDiff) { // Set zero rotation. rotBetween = new LSL_Rotation(0.0f, 0.0f, 0.0f, 1.0f); @@ -1025,8 +1164,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - if (text.Length > 1023) - text = text.Substring(0, 1023); + if (text.Length > m_maxTextLengthInWhisper) + text = text.Substring(0, m_maxTextLengthInWhisper); World.SimChat(Utils.StringToBytes(text), ChatTypeEnum.Whisper, channelID, m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID, false); @@ -1046,8 +1185,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } else { - if (text.Length > 1023) - text = text.Substring(0, 1023); + if (text.Length > m_maxTextLengthInSay) + text = text.Substring(0, m_maxTextLengthInSay); World.SimChat(Utils.StringToBytes(text), ChatTypeEnum.Say, channelID, m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID, false); @@ -1062,8 +1201,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - if (text.Length > 1023) - text = text.Substring(0, 1023); + if (text.Length > m_maxTextLengthInShout) + text = text.Substring(0, m_maxTextLengthInShout); World.SimChat(Utils.StringToBytes(text), ChatTypeEnum.Shout, channelID, m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID, true); @@ -1081,8 +1220,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; } - if (text.Length > 1023) - text = text.Substring(0, 1023); + if (text.Length > m_maxTextLengthInRegionSay) + text = text.Substring(0, m_maxTextLengthInRegionSay); m_host.AddScriptLPS(1); @@ -1096,8 +1235,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llRegionSayTo(string target, int channel, string msg) { - if (msg.Length > 1023) - msg = msg.Substring(0, 1023); + if (msg.Length > m_maxTextLengthInRegionSayTo) + msg = msg.Substring(0, m_maxTextLengthInRegionSayTo); m_host.AddScriptLPS(1); @@ -2307,10 +2446,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api IsPhysical() || m_host.ParentGroup.IsAttachment || // return FALSE if attachment ( - pos.x < -10.0 || // return FALSE if more than 10 meters into a west-adjacent region. - pos.x > (World.RegionInfo.RegionSizeX + 10) || // return FALSE if more than 10 meters into a east-adjacent region. - pos.y < -10.0 || // return FALSE if more than 10 meters into a south-adjacent region. - pos.y > (World.RegionInfo.RegionSizeY + 10) || // return FALSE if more than 10 meters into a north-adjacent region. + pos.x < -m_maxOutsideInSetRegionPos || // return FALSE if more than 10 meters into a west-adjacent region. + pos.x > (World.RegionInfo.RegionSizeX + m_maxOutsideInSetRegionPos) || // return FALSE if more than 10 meters into a east-adjacent region. + pos.y < -m_maxOutsideInSetRegionPos || // return FALSE if more than 10 meters into a south-adjacent region. + pos.y > (World.RegionInfo.RegionSizeY + m_maxOutsideInSetRegionPos) || // return FALSE if more than 10 meters into a north-adjacent region. pos.z > Constants.RegionHeight // return FALSE if altitude than 4096m ) ) @@ -2337,15 +2476,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api SetPos(m_host.ParentGroup.RootPart, pos, false); - return VecDist(pos, llGetRootPosition()) <= 0.1 ? 1 : 0; + return VecDist(pos, llGetRootPosition()) <= m_maxDiffForSetRegionPos ? 1 : 0; } // Capped movemment if distance > 10m (http://wiki.secondlife.com/wiki/LlSetPos) // note linked setpos is capped "differently" private LSL_Vector SetPosAdjust(LSL_Vector start, LSL_Vector end) { - if (llVecDist(start, end) > 10.0f * m_ScriptDistanceFactor) - return start + m_ScriptDistanceFactor * 10.0f * llVecNorm(end - start); + if (llVecDist(start, end) > m_maxDistanceInSetPosAdjust * m_ScriptDistanceFactor) + return start + m_ScriptDistanceFactor * m_maxDistanceInSetPosAdjust * llVecNorm(end - start); else return end; } @@ -2641,10 +2780,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); //No energy force yet Vector3 v = force; - if (v.Length() > 20000.0f) + if (v.Length() > m_maxForceInApplyImpulse) { v.Normalize(); - v = v * 20000.0f; + v = v * m_maxForceInApplyImpulse; } m_host.ApplyImpulse(v, local != 0); } @@ -3139,7 +3278,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api float dist = (float)llVecDist(llGetPos(), pos); - if (dist > m_ScriptDistanceFactor * 10.0f) + if (dist > m_ScriptDistanceFactor * m_maxDistanceInRezAtRoot) return; TaskInventoryItem item = m_host.Inventory.GetInventoryItem(inventory); @@ -3477,9 +3616,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api //{ // msg.fromAgentName = "(hippos)";// Added for posterity. This means that we can't figure out who sent it //} - // Cap the message length at 1024. - if (message != null && message.Length > 1024) - msg.message = message.Substring(0, 1024); + // Cap the message length at 1023. + if (message != null && message.Length > m_maxTextLenghInInstantMessage) + msg.message = message.Substring(0, m_maxTextLenghInInstantMessage); else msg.message = message; msg.dialog = (byte)19; // messgage from script ??? // dialog; @@ -3541,7 +3680,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } emailModule.SendEmail(m_host.UUID, address, subject, message); - ScriptSleep(m_sleepMsOnEmail); + ScriptSleep(EMAIL_PAUSE_TIME * 1000); } public void llGetNextEmail(string address, string subject) @@ -4339,16 +4478,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); Vector3 av3 = Util.Clip(color, 0.0f, 1.0f); - if (text.Length > 254) - text = text.Remove(254); + if (text.Length > m_maxTextLengthInSetText) + text = text.Remove(m_maxTextLengthInSetText); byte[] data; do { data = Util.UTF8.GetBytes(text); - if (data.Length > 254) + if (data.Length > m_maxTextLengthInSetText) text = text.Substring(0, text.Length - 1); - } while (data.Length > 254); + } while (data.Length > m_maxTextLengthInSetText); m_host.SetText(text, av3, Util.Clip((float)alpha, 0.0f, 1.0f)); //m_host.ParentGroup.HasGroupChanged = true; @@ -4565,7 +4704,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (presence != null && presence.PresenceType != PresenceType.Npc) { // agent must not be a god - if (presence.GodLevel >= 200) return; + if (presence.GodLevel >= m_minGodLevelForNoTeleportAgent) return; if (destination == String.Empty) destination = World.RegionInfo.RegionName; @@ -4599,7 +4738,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (presence != null && presence.PresenceType != PresenceType.Npc) { // agent must not be a god - if (presence.GodLevel >= 200) return; + if (presence.GodLevel >= m_minGodLevelForNoTeleportAgentGlobalCoords) return; // agent must be over the owners land if (m_host.OwnerID == World.LandChannel.GetLandObject(presence.AbsolutePosition).LandData.OwnerID) @@ -4660,9 +4799,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { Error("llTextBox", "Empty message"); } - else if (message.Length > 512) + else if (message.Length > m_maxTextLengthInTextBox) { - Error("llTextBox", "Message more than 512 characters"); + Error("llTextBox", "Message more than m_maxTextLengthInTextBox characters"); } else { @@ -5023,7 +5162,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api rot.Normalize(); double s = Math.Sqrt(1 - rot.s * rot.s); - if (s < 0.001) + if (s < m_minSDistInRot2Axis) { return new LSL_Vector(1, 0, 0); } @@ -6140,7 +6279,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } // Maximum of 100 results - if (result.Length > 99) + if (result.Length >= m_maxResultsInGetAgentList) { return; } @@ -6995,7 +7134,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api private float validParticleScale(float value) { - if (value > 4.0f) return 4.0f; + if (value > m_maxParticleScale) return m_maxParticleScale; return value; } @@ -7342,27 +7481,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api Error("llDialog", "First parameter must be a key"); return; } - if (buttons.Length < 1) + if (buttons.Length < m_minButtonsInDialog) { - Error("llDialog", "At least 1 button must be shown"); + Error("llDialog", "At least " + m_minButtonsInDialog.ToString() + " button must be shown"); return; } - if (buttons.Length > 12) + if (buttons.Length > m_maxButtonsInDialog) { - Error("llDialog", "No more than 12 buttons can be shown"); + Error("llDialog", "No more than " + m_maxButtonsInDialog.ToString() + " buttons can be shown"); return; } string[] buts = new string[buttons.Length]; for (int i = 0; i < buttons.Length; i++) { - if (buttons.Data[i].ToString() == String.Empty) + if (buttons.Data[i].ToString().Length < m_minTextLengthInButton) { Error("llDialog", "Button label cannot be blank"); return; } - if (buttons.Data[i].ToString().Length > 24) + if (buttons.Data[i].ToString().Length > m_maxTextLengthInButton) { - Error("llDialog", "Button label cannot be longer than 24 characters"); + Error("llDialog", "Button label cannot be longer than " + m_maxTextLengthInButton.ToString() + " characters"); return; } buts[i] = buttons.Data[i].ToString(); @@ -7524,36 +7663,36 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api shapeBlock.PathCurve = pathcurve; shapeBlock.ProfileCurve = (byte)holeshape; // Set the hole shape. shapeBlock.ProfileCurve += profileshape; // Add in the profile shape. - if (cut.x < 0f) + if (cut.x < m_minPrimCut) { - cut.x = 0f; + cut.x = m_minPrimCut; } - if (cut.x > 1f) + if (cut.x > m_maxPrimCut) { - cut.x = 1f; + cut.x = m_maxPrimCut; } - if (cut.y < 0f) + if (cut.y < m_minPrimCut) { - cut.y = 0f; + cut.y = m_minPrimCut; } - if (cut.y > 1f) + if (cut.y > m_maxPrimCut) { - cut.y = 1f; + cut.y = m_maxPrimCut; } - if (cut.y - cut.x < 0.02f) + if (cut.y - cut.x < m_minPrimCutDiff) { - cut.x = cut.y - 0.02f; - if (cut.x < 0.0f) + cut.x = cut.y - m_minPrimCutDiff; + if (cut.x < m_minPrimCut) { - cut.x = 0.0f; - cut.y = 0.02f; + cut.x = m_minPrimCut; + cut.y = m_minPrimCutDiff; } } shapeBlock.ProfileBegin = (ushort)(50000 * cut.x); shapeBlock.ProfileEnd = (ushort)(50000 * (1 - cut.y)); - if (hollow < 0f) + if (hollow < m_minPrimHollow) { - hollow = 0f; + hollow = m_minPrimHollow; } // If the prim is a Cylinder, Prism, Sphere, Torus or Ring (or not a // Box or Tube) and the hole shape is a square, hollow is limited to @@ -7563,35 +7702,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (profileshape != (byte)ProfileCurve.Square && holeshape == (int)ScriptBaseClass.PRIM_HOLE_SQUARE) { - if (hollow > 0.70f) + if (hollow > m_maxPrimHollowSqr) { - hollow = 0.70f; + hollow = m_maxPrimHollowSqr; } } // Otherwise, hollow is limited to 99%. else { - if (hollow > 0.99f) + if (hollow > m_maxPrimHollow) { - hollow = 0.99f; + hollow = m_maxPrimHollow; } } shapeBlock.ProfileHollow = (ushort)(50000 * hollow); - if (twist.x < -1.0f) + if (twist.x < m_minPrimTwist) { - twist.x = -1.0f; + twist.x = m_minPrimTwist; } - if (twist.x > 1.0f) + if (twist.x > m_maxPrimTwist) { - twist.x = 1.0f; + twist.x = m_maxPrimTwist; } - if (twist.y < -1.0f) + if (twist.y < m_minPrimTwist) { - twist.y = -1.0f; + twist.y = m_minPrimTwist; } - if (twist.y > 1.0f) + if (twist.y > m_maxPrimTwist) { - twist.y = 1.0f; + twist.y = m_maxPrimTwist; } // A fairly large precision error occurs for some calculations, // if a float or double is directly cast to a byte or sbyte @@ -7622,41 +7761,41 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist, profileshape, pathcurve); - if (taper_b.x < 0f) + if (taper_b.x < m_minPrimTaperSimple) { - taper_b.x = 0f; + taper_b.x = m_minPrimTaperSimple; } - if (taper_b.x > 2f) + if (taper_b.x > m_maxPrimTaperSimple) { - taper_b.x = 2f; + taper_b.x = m_maxPrimTaperSimple; } - if (taper_b.y < 0f) + if (taper_b.y < m_minPrimTaperSimple) { - taper_b.y = 0f; + taper_b.y = m_minPrimTaperSimple; } - if (taper_b.y > 2f) + if (taper_b.y > m_maxPrimTaperSimple) { - taper_b.y = 2f; + taper_b.y = m_maxPrimTaperSimple; } tempFloat = (float)(100.0d * (2.0d - taper_b.x)); shapeBlock.PathScaleX = (byte)tempFloat; tempFloat = (float)(100.0d * (2.0d - taper_b.y)); shapeBlock.PathScaleY = (byte)tempFloat; - if (topshear.x < -0.5f) + if (topshear.x < m_minPrimTopshear) { - topshear.x = -0.5f; + topshear.x = m_minPrimTopshear; } - if (topshear.x > 0.5f) + if (topshear.x > m_maxPrimTopshear) { - topshear.x = 0.5f; + topshear.x = m_maxPrimTopshear; } - if (topshear.y < -0.5f) + if (topshear.y < m_minPrimTopshear) { - topshear.y = -0.5f; + topshear.y = m_minPrimTopshear; } - if (topshear.y > 0.5f) + if (topshear.y > m_maxPrimTopshear) { - topshear.y = 0.5f; + topshear.y = m_maxPrimTopshear; } tempFloat = (float)(100.0d * topshear.x); shapeBlock.PathShearX = (byte)tempFloat; @@ -7681,29 +7820,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api shapeBlock.PathScaleX = 100; shapeBlock.PathScaleY = 100; - if (dimple.x < 0f) + if (dimple.x < m_minPrimDimple) { - dimple.x = 0f; + dimple.x = m_minPrimDimple; } - if (dimple.x > 1f) + if (dimple.x > m_maxPrimDimple) { - dimple.x = 1f; + dimple.x = m_maxPrimDimple; } - if (dimple.y < 0f) + if (dimple.y < m_minPrimDimple) { - dimple.y = 0f; + dimple.y = m_minPrimDimple; } - if (dimple.y > 1f) + if (dimple.y > m_maxPrimDimple) { - dimple.y = 1f; + dimple.y = m_maxPrimDimple; } - if (dimple.y - dimple.x < 0.02f) + if (dimple.y - dimple.x < m_minPrimDimpleDiff) { - dimple.x = dimple.y - 0.02f; - if (dimple.x < 0.0f) + dimple.x = dimple.y - m_minPrimDimpleDiff; + if (dimple.x < m_minPrimDimple) { - dimple.x = 0.0f; - dimple.y = 0.02f; + dimple.x = m_minPrimDimple; + dimple.y = m_minPrimDimpleDiff; } } shapeBlock.ProfileBegin = (ushort)(50000 * dimple.x); @@ -7725,121 +7864,121 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api shapeBlock.PathBegin = shapeBlock.ProfileBegin; shapeBlock.PathEnd = shapeBlock.ProfileEnd; - if (holesize.x < 0.01f) + if (holesize.x < m_minPrimHolesizeX) { - holesize.x = 0.01f; + holesize.x = m_minPrimHolesizeX; } - if (holesize.x > 1f) + if (holesize.x > m_maxPrimHolesizeX) { - holesize.x = 1f; + holesize.x = m_maxPrimHolesizeX; } - if (holesize.y < 0.01f) + if (holesize.y < m_minPrimHolesizeY) { - holesize.y = 0.01f; + holesize.y = m_minPrimHolesizeY; } - if (holesize.y > 0.5f) + if (holesize.y > m_maxPrimHolesizeY) { - holesize.y = 0.5f; + holesize.y = m_maxPrimHolesizeY; } tempFloat = (float)(100.0d * (2.0d - holesize.x)); shapeBlock.PathScaleX = (byte)tempFloat; tempFloat = (float)(100.0d * (2.0d - holesize.y)); shapeBlock.PathScaleY = (byte)tempFloat; - if (topshear.x < -0.5f) + if (topshear.x < m_minPrimTopshear) { - topshear.x = -0.5f; + topshear.x = m_minPrimTopshear; } - if (topshear.x > 0.5f) + if (topshear.x > m_maxPrimTopshear) { - topshear.x = 0.5f; + topshear.x = m_maxPrimTopshear; } - if (topshear.y < -0.5f) + if (topshear.y < m_minPrimTopshear) { - topshear.y = -0.5f; + topshear.y = m_minPrimTopshear; } - if (topshear.y > 0.5f) + if (topshear.y > m_maxPrimTopshear) { - topshear.y = 0.5f; + topshear.y = m_maxPrimTopshear; } tempFloat = (float)(100.0d * topshear.x); shapeBlock.PathShearX = (byte)tempFloat; tempFloat = (float)(100.0d * topshear.y); shapeBlock.PathShearY = (byte)tempFloat; - if (profilecut.x < 0f) + if (profilecut.x < m_minPrimProfilecut) { - profilecut.x = 0f; + profilecut.x = m_minPrimProfilecut; } - if (profilecut.x > 1f) + if (profilecut.x > m_maxPrimProfilecut) { - profilecut.x = 1f; + profilecut.x = m_maxPrimProfilecut; } - if (profilecut.y < 0f) + if (profilecut.y < m_minPrimProfilecut) { - profilecut.y = 0f; + profilecut.y = m_minPrimProfilecut; } - if (profilecut.y > 1f) + if (profilecut.y > m_maxPrimProfilecut) { - profilecut.y = 1f; + profilecut.y = m_maxPrimProfilecut; } - if (profilecut.y - profilecut.x < 0.05f) + if (profilecut.y - profilecut.x < m_minPrimProfilecutDiff) { - profilecut.x = profilecut.y - 0.05f; - if (profilecut.x < 0.0f) + profilecut.x = profilecut.y - m_minPrimProfilecutDiff; + if (profilecut.x < m_minPrimProfilecut) { - profilecut.x = 0.0f; - profilecut.y = 0.05f; + profilecut.x = m_minPrimProfilecut; + profilecut.y = m_minPrimProfilecutDiff; } } shapeBlock.ProfileBegin = (ushort)(50000 * profilecut.x); shapeBlock.ProfileEnd = (ushort)(50000 * (1 - profilecut.y)); - if (taper_a.x < -1f) + if (taper_a.x < m_minPrimTaperComplex) { - taper_a.x = -1f; + taper_a.x = m_minPrimTaperComplex; } - if (taper_a.x > 1f) + if (taper_a.x > m_maxPrimTaperComplex) { - taper_a.x = 1f; + taper_a.x = m_maxPrimTaperComplex; } - if (taper_a.y < -1f) + if (taper_a.y < m_minPrimTaperComplex) { - taper_a.y = -1f; + taper_a.y = m_minPrimTaperComplex; } - if (taper_a.y > 1f) + if (taper_a.y > m_maxPrimTaperComplex) { - taper_a.y = 1f; + taper_a.y = m_maxPrimTaperComplex; } tempFloat = (float)(100.0d * taper_a.x); shapeBlock.PathTaperX = (sbyte)tempFloat; tempFloat = (float)(100.0d * taper_a.y); shapeBlock.PathTaperY = (sbyte)tempFloat; - if (revolutions < 1f) + if (revolutions < m_minPrimRevolutions) { - revolutions = 1f; + revolutions = m_minPrimRevolutions; } - if (revolutions > 4f) + if (revolutions > m_maxPrimRevolutions) { - revolutions = 4f; + revolutions = m_maxPrimRevolutions; } tempFloat = 66.66667f * (revolutions - 1.0f); shapeBlock.PathRevolutions = (byte)tempFloat; // limits on radiusoffset depend on revolutions and hole size (how?) seems like the maximum range is 0 to 1 - if (radiusoffset < 0f) + if (radiusoffset < m_minPrimRadiusoffset) { - radiusoffset = 0f; + radiusoffset = m_minPrimRadiusoffset; } - if (radiusoffset > 1f) + if (radiusoffset > m_maxPrimRadiusoffset) { - radiusoffset = 1f; + radiusoffset = m_maxPrimRadiusoffset; } tempFloat = 100.0f * radiusoffset; shapeBlock.PathRadiusOffset = (sbyte)tempFloat; - if (skew < -0.95f) + if (skew < m_minPrimSkew) { - skew = -0.95f; + skew = m_minPrimSkew; } - if (skew > 0.95f) + if (skew > m_maxPrimSkew) { - skew = 0.95f; + skew = m_maxPrimSkew; } tempFloat = 100.0f * skew; shapeBlock.PathSkew = (sbyte)tempFloat; @@ -9106,7 +9245,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api Error(originFunc, string.Format("Error running rule #{0} -> PRIM_MATERIAL: arg #{1} - parameter 2 must be integer", rulesParsed, idx - idxStart - 1)); return null; } - if (mat < 0 || mat > 7) + if (mat < m_minPrimMaterialIdx || mat > m_maxPrimMaterialIdx) return null; part.Material = Convert.ToByte(mat); @@ -9823,7 +9962,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return null; int face = (int)rules.GetLSLIntegerItem(idx++); - if (face > 21) + if (face > m_maxPrimFaceIdx) break; res.Add(new LSL_String("")); @@ -9837,7 +9976,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return null; face = (int)rules.GetLSLIntegerItem(idx++); - if (face > 21) + if (face > m_maxPrimFaceIdx) break; res.Add(ScriptBaseClass.ZERO_VECTOR); @@ -9849,7 +9988,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return null; face = (int)rules.GetLSLIntegerItem(idx++); - if (face > 21) + if (face > m_maxPrimFaceIdx) break; res.Add(ScriptBaseClass.PRIM_SHINY_NONE); @@ -9861,7 +10000,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return null; face = (int)rules.GetLSLIntegerItem(idx++); - if (face > 21) + if (face > m_maxPrimFaceIdx) break; res.Add(ScriptBaseClass.FALSE); @@ -9882,7 +10021,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return null; face = (int)rules.GetLSLIntegerItem(idx++); - if (face > 21) + if (face > m_maxPrimFaceIdx) break; res.Add(ScriptBaseClass.PRIM_TEXGEN_DEFAULT); @@ -9899,7 +10038,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return null; face = (int)rules.GetLSLIntegerItem(idx++); - if (face > 21) + if (face > m_maxPrimFaceIdx) break; res.Add(new LSL_Float(0)); @@ -10827,7 +10966,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // Require a well-fromed base64 string - if (str.Length > 8) + if (str.Length > m_maxTextLengthInBase64ToInteger) return 0; // The loop is unrolled in the interests @@ -11817,9 +11956,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - if (quick_pay_buttons.Data.Length < 4) + if (quick_pay_buttons.Data.Length < m_minButtonsInSetPayPrice || quick_pay_buttons.Data.Length > m_maxButtonsInSetPayPrice) { - Error("llSetPayPrice", "List must have at least 4 elements"); + Error("llSetPayPrice", "List must have at least " + m_minButtonsInSetPayPrice.ToString() + " elements"); return; } m_host.ParentGroup.RootPart.PayPrice[0]=price; @@ -12288,7 +12427,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api //Maximum of 8 headers are allowed based on the //Second Life documentation for llHTTPRequest. - for (int count = 1; count <= 8; ++count) + for (int count = 1; count <= m_maxHeadersInHTTPRequest; ++count) { //Enough parameters remaining for (another) header? if (parameters.Data.Length - i < 2) @@ -12852,9 +12991,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api internal void Error(string command, string message) { string text = command + ": " + message; - if (text.Length > 1023) + if (text.Length > m_maxTextLengthInError) { - text = text.Substring(0, 1023); + text = text.Substring(0, m_maxTextLengthInError); } World.SimChat(Utils.StringToBytes(text), ChatTypeEnum.DebugChannel, ScriptBaseClass.DEBUG_CHANNEL, @@ -13138,7 +13277,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api double d = Math.Abs(Vector3.Mag(Vector3.Cross(ab, ac)) / Vector3.Distance(rayStart, rayEnd)); - if (d > 1.5) + if (d > m_maxDInAvatarIntersection) return; double d2 = Vector3.Dot(Vector3.Negate(ab), ac); @@ -13342,7 +13481,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // Not intersecting the plane, or in plane (same thing) // Ignoring this MAY cause the ground to not be detected // sometimes - if (Math.Abs(b) < 0.000001) + if (Math.Abs(b) < m_maxDoubleDiff) continue; double r = a / b; @@ -13418,8 +13557,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api rejectTypes = options.GetLSLIntegerItem(i + 1); } - if (count > 16) - count = 16; + if (count > m_maxCountInCastRay) + count = m_maxCountInCastRay; List<ContactResult> results = new List<ContactResult>(); @@ -13456,8 +13595,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // get some more contacts to sort ??? int physcount = 4 * count; - if (physcount > 20) - physcount = 20; + if (physcount > m_maxPhysCountInCastRay) + physcount = m_maxPhysCountInCastRay; object physresults; physresults = World.RayCastFiltered(rayStart, direction, dist, physcount, rayfilter); diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 93412fc..75a02cb 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -1414,7 +1414,6 @@ sleepMsOnMakeFire = 100 sleepMsOnRezAtRoot = 100 sleepMsOnInstantMessage = 2000 - sleepMsOnEmail = 20000 sleepMsOnCreateLink = 1000 sleepMsOnGiveInventory = 3000 sleepMsOnRequestAgentData = 100 @@ -1668,6 +1667,210 @@ ;; Path to script assemblies ; ScriptEnginesPath = "ScriptEngines" + ; Minimum god level not to be teleported by llTeleportAgent + minGodLevelForNoTeleportAgent = 200 + + ; Minimum god level not to be teleported by llTeleportAgentGlobalCoords + minGodLevelForNoTeleportAgentGlobalCoords = 200 + + ; Maximum distance in meters from target permitted in llSetRegionPos + maxDiffForSetRegionPos = 0.1 + + ; Maximum number of headers in llHTTPRequest + maxHeadersInHTTPRequest = 8 + + ; Maximum difference between doubles to count as equal + maxDoubleDiff = 0.000001 + + ; Minimum difference in ortho vector in llRotBetween + minOrthoVectorInRotBetween = 0.0001 + + ; Maximum difference between floats to count as equal + maxFloatDiff = 0.0000001 + + ; Maximum text length permitted in llWhisper + maxTextLengthInWhisper = 1023 + + ; Maximum text length permitted in llSay + maxTextLengthInSay = 1023 + + ; Maximum text length permitted in llShout + maxTextLengthInShout = 1023 + + ; Maximum text length permitted in llRegionSay + maxTextLengthInRegionSay = 1023 + + ; Maximum text length permitted in llRegionSayTo + maxTextLengthInRegionSayTo = 1023 + + ; Maximum distance in meters outside region permitted in llSetRegionPos + maxOutsideInSetRegionPos = 10 + + ; Maximum distance in meters per move in llSetPos and similar + maxDistanceInSetPosAdjust = 10.0 + + ; Maximum force possible in llApplyImpulse + maxForceInApplyImpulse = 20000.0 + + ; Maximum distance in meters from rezzer possible in llRezAtRoot + maxDistanceInRezAtRoot = 10.0 + + ; Maximum text length permitted in llInstantMessage + maxTextLenghInInstantMessage = 1023 + + ; Maximum text length permitted in llSetText + maxTextLengthInSetText = 254 + + ; Minimum legend text length permitted in llTextBox + minTextLengthInTextBox = 1 + + ; Maximum legend text length permitted in llTextBox + maxTextLengthInTextBox = 512 + + ; Maximum number of agents in result from llGetAgentList + maxResultsInGetAgentList = 100 + + ; Minimum particle scale in meters in llParticleSystem and similar + minParticleScale = 0.03125 + + ; Maximum particle scale in meters in llParticleSystem and similar + maxParticleScale = 4.0 + + ; Minimum number of buttons in llDialog + minButtonsInDialog = 1 + + ; Maximum number of buttons in llDialog + maxButtonsInDialog = 12 + + ; Minimum text length permitted in button names in llDialog + minTextLengthInButton = 1 + + ; Maximum text length permitted in button names in llDialog + maxTextLengthInButton = 24 + + ; Minimum value of prim cut parameters + minPrimCut = 0.0 + + ; Maximum value of prim cut parameters + maxPrimCut = 1.0 + + ; Minimum difference between lower and upper prim cut parameters + minPrimCutDiff = 0.02 + + ; Minimum value of prim hollow parameter + minPrimHollow = 0.0 + + ; Maximum value of prim hollow parameter for square hole in round prim + maxPrimHollowSqr = 0.7 + + ; Maximum value of prim hollow parameter + maxPrimHollow = 0.99 + + ; Minimum value of prim twist parameter + minPrimTwist = -1.0 + + ; Maximum value of prim twist parameter + maxPrimTwist = 1.0 + + ; Minimum value of prims box, cylinder and prism taper parameters + minPrimTaperSimple = 0.0 + + ; Maximum value of prims box, cylinder and prism taper parameters + maxPrimTaperSimple = 2.0 + + ; Minimum value of prim shear parameters + minPrimTopshear = -0.5 + + ; Maximum value of prim shear parameters + maxPrimTopshear = 0.5 + + ; Minimum value of prim dimple parameters + minPrimDimple = 0.0 + + ; Maximum value of prim dimple parameters + maxPrimDimple = 1.0 + + ; Minimum difference between lower and upper prim dimple parameters + minPrimDimpleDiff = 0.02 + + ; Minimum value of first (X) prim holesize parameter + minPrimHolesizeX = 0.01 + + ; Minimum value of second (Y) prim holesize parameter + minPrimHolesizeY = 0.01 + + ; Maximum value of first (X) prim holesize parameter + maxPrimHolesizeX = 1.0 + + ; Maximum value of second (Y) prim holesize parameter + maxPrimHolesizeY = 0.5 + + ; Minimum value of prim profilecut/advanced_cut parameters + minPrimProfilecut = 0.0 + + ; Maximum value of prim profilecut/advanced_cut parameters + maxPrimProfilecut = 1.0 + + ; Minimum difference between lower and upper prim profilecut/advanced_cut parameters + minPrimProfilecutDiff = 0.02 + + ; Minimum value of prims torus, tube and ring taper parameters + minPrimTaperComplex = -1.0 + + ; Maximum value of prims torus, tube and ring taper parameters + maxPrimTaperComplex = 1.0 + + ; Minimum value of prim revolutions parameter + minPrimRevolutions = 1.0 + + ; Maximum value of prim revolutions parameter + maxPrimRevolutions = 4.0 + + ; Minimum value of prim radiusoffset parameter + minPrimRadiusoffset = 0.0 + + ; Maximum value of prim radiusoffset parameter + maxPrimRadiusoffset = 1.0 + + ; Minimum value of prim skew parameters + minPrimSkew = -0.95 + + ; Maximum value of prim skew parameters + maxPrimSkew = 0.95 + + ; Minimum value of prim material index + minPrimMaterialIdx = 0 + + ; Maximum value of prim material index + maxPrimMaterialIdx = 7 + + ; Maximum value of prim face index + maxPrimFaceIdx = 21 + + ; Maximum text length permitted in llBase64ToInteger + maxTextLengthInBase64ToInteger = 8 + + ; Maximum text length permitted in error messages + maxTextLengthInError = 1023 + + ; Maximum value of parameter D in avatar intersection calculations + maxDInAvatarIntersection = 1.5 + + ; Maximum hit count in llCastRay + maxCountInCastRay = 16 + + ; Maximum physical hit count in llCastRay + maxPhysCountInCastRay = 20 + + ; Minimum difference to count as difference in llRot2Axis + minSDistInRot2Axis = 0.001 + + ; Minimum number of buttons in llSetPayPrice + minButtonsInSetPayPrice = 4 + + ; Maximum number of buttons in llSetPayPrice + maxButtonsInSetPayPrice = 4 + [Concierge] ; Enable concierge module -- 1.7.9.5 ![]() From 9c89565bcde739a601c882602b77efe8c4370e6c Mon Sep 17 00:00:00 2001 From: Magnuz Binder <magnuz@magnuz-se.com> Date: Tue, 24 Mar 2015 14:19:23 +0100 Subject: [PATCH] Use Util.Clamp in LSL_Api. --- .../Shared/Api/Implementation/LSL_Api.cs | 299 +++++--------------- 1 file changed, 71 insertions(+), 228 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 6deca4a..50a3434 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -183,17 +183,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected int m_minGodLevelForNoTeleportAgent = 200; protected int m_minGodLevelForNoTeleportAgentGlobalCoords = 200; - protected double m_maxDiffForSetRegionPos = 0.1; + protected double m_maxDiffForSetRegionPos = 0.1d; protected int m_maxHeadersInHTTPRequest = 8; - protected double m_maxDoubleDiff = 0.000001; - protected double m_minOrthoVectorInRotBetween = 0.0001; + protected double m_maxDoubleDiff = 0.000001d; + protected double m_minOrthoVectorInRotBetween = 0.0001d; protected float m_maxFloatDiff = 0.0000001f; protected int m_maxTextLengthInWhisper = 1023; protected int m_maxTextLengthInSay = 1023; protected int m_maxTextLengthInShout = 1023; protected int m_maxTextLengthInRegionSay = 1023; protected int m_maxTextLengthInRegionSayTo = 1023; - protected double m_maxOutsideInSetRegionPos = 10; + protected double m_maxOutsideInSetRegionPos = 10.0d; protected float m_maxDistanceInSetPosAdjust = 10.0f; protected float m_maxForceInApplyImpulse = 20000.0f; protected float m_maxDistanceInRezAtRoot = 10.0f; @@ -208,30 +208,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected int m_maxButtonsInDialog = 12; protected int m_minTextLengthInButton = 1; protected int m_maxTextLengthInButton = 24; - protected float m_minPrimCut = 0.0f; - protected float m_maxPrimCut = 1.0f; - protected float m_minPrimCutDiff = 0.02f; + protected double m_minPrimCut = 0.0d; + protected double m_maxPrimCut = 1.0d; + protected double m_minPrimCutDiff = 0.02d; protected float m_minPrimHollow = 0.0f; protected float m_maxPrimHollowSqr = 0.7f; protected float m_maxPrimHollow = 0.99f; - protected float m_minPrimTwist = -1.0f; - protected float m_maxPrimTwist = 1.0f; - protected float m_minPrimTaperSimple = 0.0f; - protected float m_maxPrimTaperSimple = 2.0f; - protected float m_minPrimTopshear = -0.5f; - protected float m_maxPrimTopshear = 0.5f; - protected float m_minPrimDimple = 0.0f; - protected float m_maxPrimDimple = 1.0f; - protected float m_minPrimDimpleDiff = 0.02f; - protected float m_minPrimHolesizeX = 0.01f; - protected float m_minPrimHolesizeY = 0.01f; - protected float m_maxPrimHolesizeX = 1.0f; - protected float m_maxPrimHolesizeY = 0.5f; - protected float m_minPrimProfilecut = 0.0f; - protected float m_maxPrimProfilecut = 1.0f; - protected float m_minPrimProfilecutDiff = 0.02f; - protected float m_minPrimTaperComplex = -1.0f; - protected float m_maxPrimTaperComplex = 1.0f; + protected double m_minPrimTwist = -1.0d; + protected double m_maxPrimTwist = 1.0d; + protected double m_minPrimTaperSimple = 0.0d; + protected double m_maxPrimTaperSimple = 2.0d; + protected double m_minPrimTopshear = -0.5d; + protected double m_maxPrimTopshear = 0.5d; + protected double m_minPrimDimple = 0.0d; + protected double m_maxPrimDimple = 1.0d; + protected double m_minPrimDimpleDiff = 0.02d; + protected double m_minPrimHolesizeX = 0.01d; + protected double m_minPrimHolesizeY = 0.01d; + protected double m_maxPrimHolesizeX = 1.0d; + protected double m_maxPrimHolesizeY = 0.5d; + protected double m_minPrimProfilecut = 0.0d; + protected double m_maxPrimProfilecut = 1.0d; + protected double m_minPrimProfilecutDiff = 0.02d; + protected double m_minPrimTaperComplex = -1.0d; + protected double m_maxPrimTaperComplex = 1.0d; protected float m_minPrimRevolutions = 1.0f; protected float m_maxPrimRevolutions = 4.0f; protected float m_minPrimRadiusoffset = 0.0f; @@ -243,10 +243,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected int m_maxPrimFaceIdx = 21; protected int m_maxTextLengthInBase64ToInteger = 8; protected int m_maxTextLengthInError = 1023; - protected double m_maxDInAvatarIntersection = 1.5; + protected double m_maxDInAvatarIntersection = 1.5d; protected int m_maxCountInCastRay = 16; protected int m_maxPhysCountInCastRay = 20; - protected double m_minSDistInRot2Axis = 0.001; + protected double m_minSDistInRot2Axis = 0.001d; protected int m_minButtonsInSetPayPrice = 4; protected int m_maxButtonsInSetPayPrice = 4; @@ -424,30 +424,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_maxButtonsInDialog = xengineConfig.GetInt("maxButtonsInDialog", m_maxButtonsInDialog); m_minTextLengthInButton = xengineConfig.GetInt("minTextLengthInButton", m_minTextLengthInButton); m_maxTextLengthInButton = xengineConfig.GetInt("maxTextLengthInButton", m_maxTextLengthInButton); - m_minPrimCut = xengineConfig.GetFloat("minPrimCut", m_minPrimCut); - m_maxPrimCut = xengineConfig.GetFloat("maxPrimCut", m_maxPrimCut); - m_minPrimCutDiff = xengineConfig.GetFloat("minPrimCutDiff", m_minPrimCutDiff); + m_minPrimCut = xengineConfig.GetDouble("minPrimCut", m_minPrimCut); + m_maxPrimCut = xengineConfig.GetDouble("maxPrimCut", m_maxPrimCut); + m_minPrimCutDiff = xengineConfig.GetDouble("minPrimCutDiff", m_minPrimCutDiff); m_minPrimHollow = xengineConfig.GetFloat("minPrimHollow", m_minPrimHollow); m_maxPrimHollowSqr = xengineConfig.GetFloat("maxPrimHollowSqr", m_maxPrimHollowSqr); m_maxPrimHollow = xengineConfig.GetFloat("maxPrimHollow", m_maxPrimHollow); - m_minPrimTwist = xengineConfig.GetFloat("minPrimTwist", m_minPrimTwist); - m_maxPrimTwist = xengineConfig.GetFloat("maxPrimTwist", m_maxPrimTwist); - m_minPrimTaperSimple = xengineConfig.GetFloat("minPrimTaperSimple", m_minPrimTaperSimple); - m_maxPrimTaperSimple = xengineConfig.GetFloat("maxPrimTaperSimple", m_maxPrimTaperSimple); - m_minPrimTopshear = xengineConfig.GetFloat("minPrimTopshear", m_minPrimTopshear); - m_maxPrimTopshear = xengineConfig.GetFloat("maxPrimTopshear", m_maxPrimTopshear); - m_minPrimDimple = xengineConfig.GetFloat("minPrimDimple", m_minPrimDimple); - m_maxPrimDimple = xengineConfig.GetFloat("maxPrimDimple", m_maxPrimDimple); - m_minPrimDimpleDiff = xengineConfig.GetFloat("minPrimDimpleDiff", m_minPrimDimpleDiff); - m_minPrimHolesizeX = xengineConfig.GetFloat("minPrimHolesizeX", m_minPrimHolesizeX); - m_minPrimHolesizeY = xengineConfig.GetFloat("minPrimHolesizeY", m_minPrimHolesizeY); - m_maxPrimHolesizeX = xengineConfig.GetFloat("maxPrimHolesizeX", m_maxPrimHolesizeX); - m_maxPrimHolesizeY = xengineConfig.GetFloat("maxPrimHolesizeY", m_maxPrimHolesizeY); - m_minPrimProfilecut = xengineConfig.GetFloat("minPrimProfilecut", m_minPrimProfilecut); - m_maxPrimProfilecut = xengineConfig.GetFloat("maxPrimProfilecut", m_maxPrimProfilecut); - m_minPrimProfilecutDiff = xengineConfig.GetFloat("minPrimProfilecutDiff", m_minPrimProfilecutDiff); - m_minPrimTaperComplex = xengineConfig.GetFloat("minPrimTaperComplex", m_minPrimTaperComplex); - m_maxPrimTaperComplex = xengineConfig.GetFloat("maxPrimTaperComplex", m_maxPrimTaperComplex); + m_minPrimTwist = xengineConfig.GetDouble("minPrimTwist", m_minPrimTwist); + m_maxPrimTwist = xengineConfig.GetDouble("maxPrimTwist", m_maxPrimTwist); + m_minPrimTaperSimple = xengineConfig.GetDouble("minPrimTaperSimple", m_minPrimTaperSimple); + m_maxPrimTaperSimple = xengineConfig.GetDouble("maxPrimTaperSimple", m_maxPrimTaperSimple); + m_minPrimTopshear = xengineConfig.GetDouble("minPrimTopshear", m_minPrimTopshear); + m_maxPrimTopshear = xengineConfig.GetDouble("maxPrimTopshear", m_maxPrimTopshear); + m_minPrimDimple = xengineConfig.GetDouble("minPrimDimple", m_minPrimDimple); + m_maxPrimDimple = xengineConfig.GetDouble("maxPrimDimple", m_maxPrimDimple); + m_minPrimDimpleDiff = xengineConfig.GetDouble("minPrimDimpleDiff", m_minPrimDimpleDiff); + m_minPrimHolesizeX = xengineConfig.GetDouble("minPrimHolesizeX", m_minPrimHolesizeX); + m_minPrimHolesizeY = xengineConfig.GetDouble("minPrimHolesizeY", m_minPrimHolesizeY); + m_maxPrimHolesizeX = xengineConfig.GetDouble("maxPrimHolesizeX", m_maxPrimHolesizeX); + m_maxPrimHolesizeY = xengineConfig.GetDouble("maxPrimHolesizeY", m_maxPrimHolesizeY); + m_minPrimProfilecut = xengineConfig.GetDouble("minPrimProfilecut", m_minPrimProfilecut); + m_maxPrimProfilecut = xengineConfig.GetDouble("maxPrimProfilecut", m_maxPrimProfilecut); + m_minPrimProfilecutDiff = xengineConfig.GetDouble("minPrimProfilecutDiff", m_minPrimProfilecutDiff); + m_minPrimTaperComplex = xengineConfig.GetDouble("minPrimTaperComplex", m_minPrimTaperComplex); + m_maxPrimTaperComplex = xengineConfig.GetDouble("maxPrimTaperComplex", m_maxPrimTaperComplex); m_minPrimRevolutions = xengineConfig.GetFloat("minPrimRevolutions", m_minPrimRevolutions); m_maxPrimRevolutions = xengineConfig.GetFloat("maxPrimRevolutions", m_maxPrimRevolutions); m_minPrimRadiusoffset = xengineConfig.GetFloat("minPrimRadiusoffset", m_minPrimRadiusoffset); @@ -7663,22 +7663,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api shapeBlock.PathCurve = pathcurve; shapeBlock.ProfileCurve = (byte)holeshape; // Set the hole shape. shapeBlock.ProfileCurve += profileshape; // Add in the profile shape. - if (cut.x < m_minPrimCut) - { - cut.x = m_minPrimCut; - } - if (cut.x > m_maxPrimCut) - { - cut.x = m_maxPrimCut; - } - if (cut.y < m_minPrimCut) - { - cut.y = m_minPrimCut; - } - if (cut.y > m_maxPrimCut) - { - cut.y = m_maxPrimCut; - } + cut.x = Util.Clamp<double>(cut.x, m_minPrimCut, m_maxPrimCut); + cut.y = Util.Clamp<double>(cut.y, m_minPrimCut, m_maxPrimCut); if (cut.y - cut.x < m_minPrimCutDiff) { cut.x = cut.y - m_minPrimCutDiff; @@ -7690,10 +7676,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } shapeBlock.ProfileBegin = (ushort)(50000 * cut.x); shapeBlock.ProfileEnd = (ushort)(50000 * (1 - cut.y)); - if (hollow < m_minPrimHollow) - { - hollow = m_minPrimHollow; - } // If the prim is a Cylinder, Prism, Sphere, Torus or Ring (or not a // Box or Tube) and the hole shape is a square, hollow is limited to // a max of 70%. The viewer performs its own check on this value but @@ -7702,36 +7684,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (profileshape != (byte)ProfileCurve.Square && holeshape == (int)ScriptBaseClass.PRIM_HOLE_SQUARE) { - if (hollow > m_maxPrimHollowSqr) - { - hollow = m_maxPrimHollowSqr; - } + hollow = Util.Clamp<float>(hollow, m_minPrimHollow, m_maxPrimHollowSqr); } // Otherwise, hollow is limited to 99%. else { - if (hollow > m_maxPrimHollow) - { - hollow = m_maxPrimHollow; - } + hollow = Util.Clamp<float>(hollow, m_minPrimHollow, m_maxPrimHollow); } shapeBlock.ProfileHollow = (ushort)(50000 * hollow); - if (twist.x < m_minPrimTwist) - { - twist.x = m_minPrimTwist; - } - if (twist.x > m_maxPrimTwist) - { - twist.x = m_maxPrimTwist; - } - if (twist.y < m_minPrimTwist) - { - twist.y = m_minPrimTwist; - } - if (twist.y > m_maxPrimTwist) - { - twist.y = m_maxPrimTwist; - } + twist.x = Util.Clamp<double>(twist.x, m_minPrimTwist, m_maxPrimTwist); + twist.y = Util.Clamp<double>(twist.y, m_minPrimTwist, m_maxPrimTwist); // A fairly large precision error occurs for some calculations, // if a float or double is directly cast to a byte or sbyte // variable, in both .Net and Mono. In .Net, coding @@ -7761,42 +7723,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist, profileshape, pathcurve); - if (taper_b.x < m_minPrimTaperSimple) - { - taper_b.x = m_minPrimTaperSimple; - } - if (taper_b.x > m_maxPrimTaperSimple) - { - taper_b.x = m_maxPrimTaperSimple; - } - if (taper_b.y < m_minPrimTaperSimple) - { - taper_b.y = m_minPrimTaperSimple; - } - if (taper_b.y > m_maxPrimTaperSimple) - { - taper_b.y = m_maxPrimTaperSimple; - } + taper_b.x = Util.Clamp<double>(taper_b.x, m_minPrimTaperSimple, m_maxPrimTaperSimple); + taper_b.y = Util.Clamp<double>(taper_b.y, m_minPrimTaperSimple, m_maxPrimTaperSimple); tempFloat = (float)(100.0d * (2.0d - taper_b.x)); shapeBlock.PathScaleX = (byte)tempFloat; tempFloat = (float)(100.0d * (2.0d - taper_b.y)); shapeBlock.PathScaleY = (byte)tempFloat; - if (topshear.x < m_minPrimTopshear) - { - topshear.x = m_minPrimTopshear; - } - if (topshear.x > m_maxPrimTopshear) - { - topshear.x = m_maxPrimTopshear; - } - if (topshear.y < m_minPrimTopshear) - { - topshear.y = m_minPrimTopshear; - } - if (topshear.y > m_maxPrimTopshear) - { - topshear.y = m_maxPrimTopshear; - } + topshear.x = Util.Clamp<double>(topshear.x, m_minPrimTopshear, m_maxPrimTopshear); + topshear.y = Util.Clamp<double>(topshear.y, m_minPrimTopshear, m_maxPrimTopshear); tempFloat = (float)(100.0d * topshear.x); shapeBlock.PathShearX = (byte)tempFloat; tempFloat = (float)(100.0d * topshear.y); @@ -7820,22 +7754,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api shapeBlock.PathScaleX = 100; shapeBlock.PathScaleY = 100; - if (dimple.x < m_minPrimDimple) - { - dimple.x = m_minPrimDimple; - } - if (dimple.x > m_maxPrimDimple) - { - dimple.x = m_maxPrimDimple; - } - if (dimple.y < m_minPrimDimple) - { - dimple.y = m_minPrimDimple; - } - if (dimple.y > m_maxPrimDimple) - { - dimple.y = m_maxPrimDimple; - } + dimple.x = Util.Clamp<double>(dimple.x, m_minPrimDimple, m_maxPrimDimple); + dimple.y = Util.Clamp<double>(dimple.y, m_minPrimDimple, m_maxPrimDimple); if (dimple.y - dimple.x < m_minPrimDimpleDiff) { dimple.x = dimple.y - m_minPrimDimpleDiff; @@ -7864,62 +7784,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api shapeBlock.PathBegin = shapeBlock.ProfileBegin; shapeBlock.PathEnd = shapeBlock.ProfileEnd; - if (holesize.x < m_minPrimHolesizeX) - { - holesize.x = m_minPrimHolesizeX; - } - if (holesize.x > m_maxPrimHolesizeX) - { - holesize.x = m_maxPrimHolesizeX; - } - if (holesize.y < m_minPrimHolesizeY) - { - holesize.y = m_minPrimHolesizeY; - } - if (holesize.y > m_maxPrimHolesizeY) - { - holesize.y = m_maxPrimHolesizeY; - } + holesize.x = Util.Clamp<double>(holesize.x, m_minPrimHolesizeX, m_maxPrimHolesizeX); + holesize.y = Util.Clamp<double>(holesize.y, m_minPrimHolesizeY, m_maxPrimHolesizeY); tempFloat = (float)(100.0d * (2.0d - holesize.x)); shapeBlock.PathScaleX = (byte)tempFloat; tempFloat = (float)(100.0d * (2.0d - holesize.y)); shapeBlock.PathScaleY = (byte)tempFloat; - if (topshear.x < m_minPrimTopshear) - { - topshear.x = m_minPrimTopshear; - } - if (topshear.x > m_maxPrimTopshear) - { - topshear.x = m_maxPrimTopshear; - } - if (topshear.y < m_minPrimTopshear) - { - topshear.y = m_minPrimTopshear; - } - if (topshear.y > m_maxPrimTopshear) - { - topshear.y = m_maxPrimTopshear; - } + topshear.x = Util.Clamp<double>(topshear.x, m_minPrimTopshear, m_maxPrimTopshear); + topshear.y = Util.Clamp<double>(topshear.y, m_minPrimTopshear, m_maxPrimTopshear); tempFloat = (float)(100.0d * topshear.x); shapeBlock.PathShearX = (byte)tempFloat; tempFloat = (float)(100.0d * topshear.y); shapeBlock.PathShearY = (byte)tempFloat; - if (profilecut.x < m_minPrimProfilecut) - { - profilecut.x = m_minPrimProfilecut; - } - if (profilecut.x > m_maxPrimProfilecut) - { - profilecut.x = m_maxPrimProfilecut; - } - if (profilecut.y < m_minPrimProfilecut) - { - profilecut.y = m_minPrimProfilecut; - } - if (profilecut.y > m_maxPrimProfilecut) - { - profilecut.y = m_maxPrimProfilecut; - } + profilecut.x = Util.Clamp<double>(profilecut.x, m_minPrimProfilecut, m_maxPrimProfilecut); + profilecut.y = Util.Clamp<double>(profilecut.y, m_minPrimProfilecut, m_maxPrimProfilecut); if (profilecut.y - profilecut.x < m_minPrimProfilecutDiff) { profilecut.x = profilecut.y - m_minPrimProfilecutDiff; @@ -7931,55 +7809,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } shapeBlock.ProfileBegin = (ushort)(50000 * profilecut.x); shapeBlock.ProfileEnd = (ushort)(50000 * (1 - profilecut.y)); - if (taper_a.x < m_minPrimTaperComplex) - { - taper_a.x = m_minPrimTaperComplex; - } - if (taper_a.x > m_maxPrimTaperComplex) - { - taper_a.x = m_maxPrimTaperComplex; - } - if (taper_a.y < m_minPrimTaperComplex) - { - taper_a.y = m_minPrimTaperComplex; - } - if (taper_a.y > m_maxPrimTaperComplex) - { - taper_a.y = m_maxPrimTaperComplex; - } + taper_a.x = Util.Clamp<double>(taper_a.x, m_minPrimTaperComplex, m_maxPrimTaperComplex); + taper_a.y = Util.Clamp<double>(taper_a.y, m_minPrimTaperComplex, m_maxPrimTaperComplex); tempFloat = (float)(100.0d * taper_a.x); shapeBlock.PathTaperX = (sbyte)tempFloat; tempFloat = (float)(100.0d * taper_a.y); shapeBlock.PathTaperY = (sbyte)tempFloat; - if (revolutions < m_minPrimRevolutions) - { - revolutions = m_minPrimRevolutions; - } - if (revolutions > m_maxPrimRevolutions) - { - revolutions = m_maxPrimRevolutions; - } + revolutions = Util.Clamp<float>(revolutions, m_minPrimRevolutions, m_maxPrimRevolutions); tempFloat = 66.66667f * (revolutions - 1.0f); shapeBlock.PathRevolutions = (byte)tempFloat; // limits on radiusoffset depend on revolutions and hole size (how?) seems like the maximum range is 0 to 1 - if (radiusoffset < m_minPrimRadiusoffset) - { - radiusoffset = m_minPrimRadiusoffset; - } - if (radiusoffset > m_maxPrimRadiusoffset) - { - radiusoffset = m_maxPrimRadiusoffset; - } + radiusoffset = Util.Clamp<float>(radiusoffset, m_minPrimRadiusoffset, m_maxPrimRadiusoffset); tempFloat = 100.0f * radiusoffset; shapeBlock.PathRadiusOffset = (sbyte)tempFloat; - if (skew < m_minPrimSkew) - { - skew = m_minPrimSkew; - } - if (skew > m_maxPrimSkew) - { - skew = m_maxPrimSkew; - } + skew = Util.Clamp<float>(skew, m_minPrimSkew, m_maxPrimSkew); tempFloat = 100.0f * skew; shapeBlock.PathSkew = (sbyte)tempFloat; -- 1.7.9.5 ![]() From a15493508195c673d49ce12cc91274c7857d922a Mon Sep 17 00:00:00 2001 From: Magnuz Binder <magnuz@magnuz-se.com> Date: Wed, 25 Mar 2015 19:03:32 +0100 Subject: [PATCH] Parameterize more constants in LSL_Api and make configurable. --- .../Shared/Api/Implementation/LSL_Api.cs | 90 ++++++++++++++++--- bin/OpenSimDefaults.ini | 93 ++++++++++++++++++++ 2 files changed, 169 insertions(+), 14 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 50a3434..0a1da49 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -250,6 +250,38 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected int m_minButtonsInSetPayPrice = 4; protected int m_maxButtonsInSetPayPrice = 4; + protected double m_soundGain = 20.0d; + protected float PUSH_ATTENUATION_DISTANCE = 17f; + protected float PUSH_ATTENUATION_SCALE = 5f; + protected UUID m_textureIdInDialog = new UUID("00000000-0000-2222-3333-100000001000"); + protected float m_avatarSizeZScaleSit = 0.375f; + protected float m_avatarSizeX1Sit = -0.3375f; + protected float m_avatarSizeY1Sit = -0.45f; + protected float m_avatarSizeZCoeff1Sit = -1.0f; + protected float m_avatarSizeZOffset1Sit = 0.0f; + protected float m_avatarSizeX2Sit = 0.3375f; + protected float m_avatarSizeY2Sit = 0.45f; + protected float m_avatarSizeZCoeff2Sit = 0.0f; + protected float m_avatarSizeZOffset2Sit = 0.0f; + protected float m_avatarSizeZScaleStand = 0.5f; + protected float m_avatarSizeX1Stand = -0.225f; + protected float m_avatarSizeY1Stand = -0.3f; + protected float m_avatarSizeZCoeff1Stand = -1.0f; + protected float m_avatarSizeZOffset1Stand = 0.0f; + protected float m_avatarSizeX2Stand = 0.225f; + protected float m_avatarSizeY2Stand = 0.3f; + protected float m_avatarSizeZCoeff2Stand = 1.0f; + protected float m_avatarSizeZOffset2Stand = 0.05f; + protected float m_avatarSizeX = 0.45f; + protected float m_avatarSizeY = 0.6f; + protected float m_avatarSizeZCoeff = 1.0f; + protected float m_avatarSizeX1 = -0.225f; + protected float m_avatarSizeY1 = -0.3f; + protected float m_avatarSizeZCoeff1 = -0.5f; + protected float m_avatarSizeX2 = 0.225f; + protected float m_avatarSizeY2 = 0.3f; + protected float m_avatarSizeZCoeff2 = 0.5f; + //An array of HTTP/1.1 headers that are not allowed to be used //as custom headers by llHTTPRequest. private string[] HttpStandardHeaders = @@ -465,6 +497,38 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_minSDistInRot2Axis = xengineConfig.GetDouble("minSDistInRot2Axis", m_minSDistInRot2Axis); m_minButtonsInSetPayPrice = xengineConfig.GetInt("minButtonsInSetPayPrice", m_minButtonsInSetPayPrice); m_maxButtonsInSetPayPrice = xengineConfig.GetInt("maxButtonsInSetPayPrice", m_maxButtonsInSetPayPrice); + + m_soundGain = xengineConfig.GetDouble("soundGain", m_soundGain); + PUSH_ATTENUATION_DISTANCE = xengineConfig.GetFloat("PUSH_ATTENUATION_DISTANCE", PUSH_ATTENUATION_DISTANCE); + PUSH_ATTENUATION_SCALE = xengineConfig.GetFloat("PUSH_ATTENUATION_SCALE", PUSH_ATTENUATION_SCALE); + m_textureIdInDialog = new UUID(xengineConfig.GetString("textureIdInDialog", m_textureIdInDialog.ToString())); + m_avatarSizeZScaleSit = xengineConfig.GetFloat("avatarSizeZScaleSit", m_avatarSizeZScaleSit); + m_avatarSizeX1Sit = xengineConfig.GetFloat("avatarSizeX1Sit", m_avatarSizeX1Sit); + m_avatarSizeY1Sit = xengineConfig.GetFloat("avatarSizeY1Sit", m_avatarSizeY1Sit); + m_avatarSizeZCoeff1Sit = xengineConfig.GetFloat("avatarSizeZCoeff1Sit", m_avatarSizeZCoeff1Sit); + m_avatarSizeZOffset1Sit = xengineConfig.GetFloat("avatarSizeZOffset1Sit", m_avatarSizeZOffset1Sit); + m_avatarSizeX2Sit = xengineConfig.GetFloat("avatarSizeX2Sit", m_avatarSizeX2Sit); + m_avatarSizeY2Sit = xengineConfig.GetFloat("avatarSizeY2Sit", m_avatarSizeY2Sit); + m_avatarSizeZCoeff2Sit = xengineConfig.GetFloat("avatarSizeZCoeff2Sit", m_avatarSizeZCoeff2Sit); + m_avatarSizeZOffset2Sit = xengineConfig.GetFloat("avatarSizeZOffset2Sit", m_avatarSizeZOffset2Sit); + m_avatarSizeZScaleStand = xengineConfig.GetFloat("avatarSizeZScaleStand", m_avatarSizeZScaleStand); + m_avatarSizeX1Stand = xengineConfig.GetFloat("avatarSizeX1Stand", m_avatarSizeX1Stand); + m_avatarSizeY1Stand = xengineConfig.GetFloat("avatarSizeY1Stand", m_avatarSizeY1Stand); + m_avatarSizeZCoeff1Stand = xengineConfig.GetFloat("avatarSizeZCoeff1Stand", m_avatarSizeZCoeff1Stand); + m_avatarSizeZOffset1Stand = xengineConfig.GetFloat("avatarSizeZOffset1Stand", m_avatarSizeZOffset1Stand); + m_avatarSizeX2Stand = xengineConfig.GetFloat("avatarSizeX2Stand", m_avatarSizeX2Stand); + m_avatarSizeY2Stand = xengineConfig.GetFloat("avatarSizeY2Stand", m_avatarSizeY2Stand); + m_avatarSizeZCoeff2Stand = xengineConfig.GetFloat("avatarSizeZCoeff2Stand", m_avatarSizeZCoeff2Stand); + m_avatarSizeZOffset2Stand = xengineConfig.GetFloat("avatarSizeZOffset2Stand", m_avatarSizeZOffset2Stand); + m_avatarSizeX = xengineConfig.GetFloat("avatarSizeX", m_avatarSizeX); + m_avatarSizeY = xengineConfig.GetFloat("avatarSizeY", m_avatarSizeY); + m_avatarSizeZCoeff = xengineConfig.GetFloat("avatarSizeZCoeff", m_avatarSizeZCoeff); + m_avatarSizeX1 = xengineConfig.GetFloat("avatarSizeX1", m_avatarSizeX1); + m_avatarSizeY1 = xengineConfig.GetFloat("avatarSizeY1", m_avatarSizeY1); + m_avatarSizeZCoeff1 = xengineConfig.GetFloat("avatarSizeZCoeff1", m_avatarSizeZCoeff1); + m_avatarSizeX2 = xengineConfig.GetFloat("avatarSizeX2", m_avatarSizeX2); + m_avatarSizeY2 = xengineConfig.GetFloat("avatarSizeY2", m_avatarSizeY2); + m_avatarSizeZCoeff2 = xengineConfig.GetFloat("avatarSizeZCoeff2", m_avatarSizeZCoeff2); } } } @@ -2909,7 +2973,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (m_SoundModule != null) { m_SoundModule.LoopSound(m_host.UUID, ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound), - volume, 20, false); + volume, m_soundGain, false); } } @@ -2919,7 +2983,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (m_SoundModule != null) { m_SoundModule.LoopSound(m_host.UUID, ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound), - volume, 20, true); + volume, m_soundGain, true); } } @@ -4997,8 +5061,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api float distance_term = distance * distance * distance; // Script Energy float pusher_mass = m_host.GetMass(); - float PUSH_ATTENUATION_DISTANCE = 17f; - float PUSH_ATTENUATION_SCALE = 5f; float distance_attenuation = 1f; if (distance > PUSH_ATTENUATION_DISTANCE) { @@ -7509,7 +7571,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api dm.SendDialogToUser( av, m_host.Name, m_host.UUID, m_host.OwnerID, - message, new UUID("00000000-0000-2222-3333-100000001000"), chat_channel, buts); + message, m_textureIdInDialog, chat_channel, buts); ScriptSleep(m_sleepMsOnDialog); } @@ -9650,16 +9712,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api == DefaultAvatarAnimations.AnimsUUID["SIT_GROUND_CONSTRAINED"]) { // This is for ground sitting avatars - float height = presence.Appearance.AvatarHeight / 2.66666667f; - lower = new LSL_Vector(-0.3375f, -0.45f, height * -1.0f); - upper = new LSL_Vector(0.3375f, 0.45f, 0.0f); + float height = presence.Appearance.AvatarHeight * m_avatarSizeZScaleSit; + lower = new LSL_Vector(m_avatarSizeX1Sit, m_avatarSizeY1Sit, height * m_avatarSizeZCoeff1Sit + m_avatarSizeZOffset1Sit); + upper = new LSL_Vector(m_avatarSizeX2Sit, m_avatarSizeY2Sit, height * m_avatarSizeZCoeff2Sit + m_avatarSizeZOffset2Sit); } else { // This is for standing/flying avatars - float height = presence.Appearance.AvatarHeight / 2.0f; - lower = new LSL_Vector(-0.225f, -0.3f, height * -1.0f); - upper = new LSL_Vector(0.225f, 0.3f, height + 0.05f); + float height = presence.Appearance.AvatarHeight * m_avatarSizeZScaleStand; + lower = new LSL_Vector(m_avatarSizeX1Stand, m_avatarSizeY1Stand, height * m_avatarSizeZCoeff1Stand + m_avatarSizeZOffset1Stand); + upper = new LSL_Vector(m_avatarSizeX2Stand, m_avatarSizeY2Stand, height * m_avatarSizeZCoeff2Stand + m_avatarSizeZOffset2Stand); } result.Add(lower); result.Add(upper); @@ -9742,7 +9804,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Vector GetAgentSize(ScenePresence sp) { - return new LSL_Vector(0.45, 0.6, sp.Appearance.AvatarHeight); + return new LSL_Vector(m_avatarSizeX, m_avatarSizeY, sp.Appearance.AvatarHeight * m_avatarSizeZCoeff); } /// <summary> @@ -13097,8 +13159,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api private bool InBoundingBox(ScenePresence avatar, Vector3 point) { float height = avatar.Appearance.AvatarHeight; - Vector3 b1 = avatar.AbsolutePosition + new Vector3(-0.22f, -0.22f, -height/2); - Vector3 b2 = avatar.AbsolutePosition + new Vector3(0.22f, 0.22f, height/2); + Vector3 b1 = avatar.AbsolutePosition + new Vector3(m_avatarSizeX1, m_avatarSizeY1, height * m_avatarSizeZCoeff1); + Vector3 b2 = avatar.AbsolutePosition + new Vector3(m_avatarSizeX2, m_avatarSizeY2, height * m_avatarSizeZCoeff2); if (point.X > b1.X && point.X < b2.X && point.Y > b1.Y && point.Y < b2.Y && diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 75a02cb..b74cd06 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -1871,6 +1871,99 @@ ; Maximum number of buttons in llSetPayPrice maxButtonsInSetPayPrice = 4 + ; Gain factor used in llPlaySound and similar + soundGain = 20.0 + + ; Distance in meters where attenuation is normalized in llPush + PUSH_ATTENUATION_DISTANCE = 17 + + ; Interval in meters deciding rate of attenuation decrease in llPush + PUSH_ATTENUATION_SCALE = 5 + + ; Texture ID in llDialog + textureIdInDialog = "00000000-0000-2222-3333-100000001000" + + ; Avatar height scaling for ground-sitting avatar in llGetBoundingBox + avatarSizeZScaleSit = 0.375 + + ; Bounding box lower X value in meters for ground-sitting avatar in llGetBoundingBox + avatarSizeX1Sit = -0.3375 + + ; Bounding box lower Y value in meters for ground-sitting avatar in llGetBoundingBox + avatarSizeY1Sit = -0.45 + + ; Bounding box lower Z coefficient for ground-sitting avatar in llGetBoundingBox + avatarSizeZCoeff1Sit = -1.0 + + ; Bounding box lower Z offset in meters for ground-sitting avatar in llGetBoundingBox + avatarSizeZOffset1Sit = 0.0 + + ; Bounding box upper X value in meters for ground-sitting avatar in llGetBoundingBox + avatarSizeX2Sit = 0.3375 + + ; Bounding box upper Y value in meters for ground-sitting avatar in llGetBoundingBox + avatarSizeY2Sit = 0.45 + + ; Bounding box upper Z coefficient for ground-sitting avatar in llGetBoundingBox + avatarSizeZCoeff2Sit = 0.0 + + ; Bounding box upper Z offset in meters for ground-sitting avatar in llGetBoundingBox + avatarSizeZOffset2Sit = 0.0 + + ; Avatar height scaling for standing avatar in llGetBoundingBox + avatarSizeZScaleStand = 0.5 + + ; Bounding box lower X value in meters for standing avatar in llGetBoundingBox + avatarSizeX1Stand = -0.225 + + ; Bounding box lower Y value in meters for standing avatar in llGetBoundingBox + avatarSizeY1Stand = -0.3 + + ; Bounding box lower Z coefficient for standing avatar in llGetBoundingBox + avatarSizeZCoeff1Stand = -1.0 + + ; Bounding box lower Z offset in meters for standing avatar in llGetBoundingBox + avatarSizeZOffset1Stand = 0.0 + + ; Bounding box upper X value in meters for standing avatar in llGetBoundingBox + avatarSizeX2Stand = 0.225 + + ; Bounding box upper Y value in meters for standing avatar in llGetBoundingBox + avatarSizeY2Stand = 0.3 + + ; Bounding box upper Z coefficient for standing avatar in llGetBoundingBox + avatarSizeZCoeff2Stand = 1.0 + + ; Bounding box upper Z offset in meters for standing avatar in llGetBoundingBox + avatarSizeZOffset2Stand = 0.05 + + ; Bounding box X size in meters for avatar in llGetAgentSize + avatarSizeX = 0.45; + + ; Bounding box Y size in meters for avatar in llGetAgentSize + avatarSizeY = 0.6; + + ; Bounding box Z coefficient for avatar in llGetAgentSize + avatarSizeZCoeff = 1.0; + + ; Bounding box lower X size in meters for avatars in llCastRay + avatarSizeX1 = -0.225 + + ; Bounding box lower Y size in meters for avatars in llCastRay + avatarSizeY1 = -0.3 + + ; Bounding box lower Z coefficient for avatars in llCastRay + avatarSizeZCoeff1 = -0.5 + + ; Bounding box upper X size in meters for avatars in llCastRay + avatarSizeX2 = 0.225 + + ; Bounding box upper Y size in meters for avatars in llCastRay + avatarSizeY2 = 0.3 + + ; Bounding box upper Z coefficient for avatars in llCastRay + avatarSizeZCoeff2 = 0.5 + [Concierge] ; Enable concierge module -- 1.7.9.5 | |||||||||
![]() |
|
(0027930) Magnuz (reporter) 2015-03-22 00:27 |
Patch parameterizes all sleep constants in LSL_Api. |
(0027937) Robert Adams (administrator) 2015-03-22 10:30 |
Patch applied to master on 20150322. |
(0027938) Magnuz (reporter) 2015-03-22 12:08 |
Second patch (0001-Add-LSL-function-sleep-parameters-to-config.patch) adds the sleep parameters to configuration and reads them from there. Please check so I understood Robert Adams' instructions in Mantis 7509 right since I'm still noob at this. |
(0027939) Magnuz (reporter) 2015-03-23 14:20 |
Third patch (0001-Parameterize-constants-in-LSL_Api-and-make-conf.patch) parameterizes and adds relevant constants in LSL_Api to configuration, reading them from there. |
(0027941) Magnuz (reporter) 2015-03-24 10:47 |
Fourth patch (0001-Use-Util.Clamp-in-LSL_Api.patch) replaces a bit awkward clamping with a more elegant clamping function, and fixes the type of several limit parameters. Parameters stored in vectors are doubles, while those stored in scalars are floats, something the previous clamping handled gracefully, but not the clamping function, hence the changing of many types. This patch hasn't really got with the constants to do, but depends on the previous patches and tidies up the code some (8 lines of comparisons are replaced by a 1 line function call). |
(0027942) Magnuz (reporter) 2015-03-25 11:17 |
Fifth patch (0001-Parameterize-more-constants-in-LSL_Api-and-make-conf.patch) parametrizes and adds more constants in LSL_Api to configuration, reading them from there. This is hopefully the last major part in parameterizing the constants in LSL_Api, even if some tidying up after it might be needed. |
(0027987) Magnuz (reporter) 2015-04-07 23:23 |
I discovered a malformed parameter value in OpenSimDefaults.ini (a trailing " ***" flag left by mistake) passed the test suite despite it prevented XEngine from running live. I updated the patch for it, but it might be an idea to add a regression test for it. |
![]() |
|||
Date Modified | Username | Field | Change |
2015-03-22 00:26 | Magnuz | New Issue | |
2015-03-22 00:26 | Magnuz | File Added: 0001-Parameterize-sleeps-in-LSL-functions.patch | |
2015-03-22 00:27 | Magnuz | Note Added: 0027930 | |
2015-03-22 00:27 | Magnuz | Status | new => patch included |
2015-03-22 05:14 | Magnuz | File Added: 0002-Parameterize-sleeps-in-LSL-functions.patch | |
2015-03-22 05:15 | Magnuz | File Deleted: 0001-Parameterize-sleeps-in-LSL-functions.patch | |
2015-03-22 05:48 | Magnuz | File Added: 0001-Parameterize-sleeps-in-LSL-functions.patch | |
2015-03-22 05:49 | Magnuz | File Deleted: 0002-Parameterize-sleeps-in-LSL-functions.patch | |
2015-03-22 10:30 | Robert Adams | Note Added: 0027937 | |
2015-03-22 12:02 | Magnuz | File Added: 0001-Add-LSL-function-sleep-parameters-to-config.patch | |
2015-03-22 12:08 | Magnuz | Note Added: 0027938 | |
2015-03-23 14:18 | Magnuz | File Added: 0001-Parameterize-constants-in-LSL_Api-and-make-conf.patch | |
2015-03-23 14:20 | Magnuz | Note Added: 0027939 | |
2015-03-23 14:24 | Magnuz | Summary | Sleep constants scattered in LSL_Api => Constants scattered in LSL_Api |
2015-03-23 14:24 | Magnuz | Description Updated | View Revisions |
2015-03-24 10:40 | Magnuz | File Added: 0001-Use-Util.Clamp-in-LSL_Api.patch | |
2015-03-24 10:47 | Magnuz | Note Added: 0027941 | |
2015-03-25 11:11 | Magnuz | File Added: 0001-Parameterize-more-constants-in-LSL_Api-and-make-conf.patch | |
2015-03-25 11:17 | Magnuz | Note Added: 0027942 | |
2015-04-06 15:08 | Magnuz | File Deleted: 0001-Parameterize-more-constants-in-LSL_Api-and-make-conf.patch | |
2015-04-06 15:08 | Magnuz | File Added: 0001-Parameterize-more-constants-in-LSL_Api-and-make-conf.patch | |
2015-04-07 23:23 | Magnuz | Note Added: 0027987 |
Copyright © 2000 - 2012 MantisBT Group |