From 3151e302caa804222206dc85579bb4c2ed9181ac Mon Sep 17 00:00:00 2001 From: Charles Krinke Date: Sat, 8 Mar 2008 18:06:10 +0000 Subject: Thank you kindly, Ldviopeng for: Patch to implement the following LSL / OS functions llParcelPrimCount(60%) osSetParcelMediaURL --- OpenSim/Region/Environment/Scenes/Scene.cs | 16 ++++ .../Environment/Scenes/Scripting/IScriptHost.cs | 8 +- .../Common/BuiltIn_Commands_BaseClass.cs | 41 ++++++++++ .../ScriptEngine/Common/LSL_BuiltIn_Commands.cs | 89 +++++++++++++++++++++- .../Common/LSL_BuiltIn_Commands_Interface.cs | 3 +- 5 files changed, 151 insertions(+), 6 deletions(-) diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 2ede245..cc97988 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -2414,6 +2414,22 @@ namespace OpenSim.Region.Environment.Scenes } } + public void SetLandMediaURL(float x, float y, string url) + { + Land land = LandManager.getLandObject(x, y); + + if (land == null) + { + return; + } + + else + { + land.landData.mediaURL = url; + return; + } + } + #endregion #region Script Engine diff --git a/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs b/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs index b4e2a13..f385106 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs +++ b/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs @@ -34,13 +34,15 @@ namespace OpenSim.Region.Environment.Scenes.Scripting public interface IScriptHost { string Name { get; set; } - string SitName { get; set; } - string TouchName { get; set; } string Description { get; set; } + LLUUID UUID { get; } LLUUID ObjectOwner { get; } LLUUID ObjectCreator { get; } LLVector3 AbsolutePosition { get; } + + string SitName { get; set; } + string TouchName { get; set; } void SetText(string text, Vector3 color, double alpha); } -} \ No newline at end of file +} diff --git a/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs b/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs index c971707..922b301 100644 --- a/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs +++ b/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs @@ -1874,6 +1874,11 @@ namespace OpenSim.Region.ScriptEngine.Common return m_LSL_Functions.osConsoleCommand(Command); } + public void osSetParcelMediaURL(string url) + { + m_LSL_Functions.osSetParcelMediaURL(url); + } + public double llList2Float(LSL_Types.list src, int index) { return m_LSL_Functions.llList2Float(src, index); @@ -1882,6 +1887,7 @@ namespace OpenSim.Region.ScriptEngine.Common // LSL CONSTANTS public const int TRUE = 1; public const int FALSE = 0; + public const int STATUS_PHYSICS = 1; public const int STATUS_ROTATE_X = 2; public const int STATUS_ROTATE_Y = 4; @@ -1892,10 +1898,12 @@ namespace OpenSim.Region.ScriptEngine.Common public const int STATUS_DIE_AT_EDGE = 128; public const int STATUS_RETURN_AT_EDGE = 256; public const int STATUS_CAST_SHADOWS = 512; + public const int AGENT = 1; public const int ACTIVE = 2; public const int PASSIVE = 4; public const int SCRIPTED = 8; + public const int CONTROL_FWD = 1; public const int CONTROL_BACK = 2; public const int CONTROL_LEFT = 4; @@ -1906,6 +1914,8 @@ namespace OpenSim.Region.ScriptEngine.Common public const int CONTROL_ROT_RIGHT = 512; public const int CONTROL_LBUTTON = 268435456; public const int CONTROL_ML_LBUTTON = 1073741824; + + //Permissions public const int PERMISSION_DEBIT = 2; public const int PERMISSION_TAKE_CONTROLS = 4; public const int PERMISSION_REMAP_CONTROLS = 8; @@ -1916,6 +1926,7 @@ namespace OpenSim.Region.ScriptEngine.Common public const int PERMISSION_CHANGE_JOINTS = 256; public const int PERMISSION_CHANGE_PERMISSIONS = 512; public const int PERMISSION_TRACK_CAMERA = 1024; + public const int AGENT_FLYING = 1; public const int AGENT_ATTACHMENTS = 2; public const int AGENT_SCRIPTED = 4; @@ -1929,6 +1940,8 @@ namespace OpenSim.Region.ScriptEngine.Common public const int AGENT_CROUCHING = 1024; public const int AGENT_BUSY = 2048; public const int AGENT_ALWAYS_RUN = 4096; + + //Particle Systems public const int PSYS_PART_INTERP_COLOR_MASK = 1; public const int PSYS_PART_INTERP_SCALE_MASK = 2; public const int PSYS_PART_BOUNCE_MASK = 4; @@ -1966,6 +1979,7 @@ namespace OpenSim.Region.ScriptEngine.Common public const int PSYS_SRC_PATTERN_ANGLE = 4; public const int PSYS_SRC_PATTERN_ANGLE_CONE = 8; public const int PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY = 16; + public const int VEHICLE_TYPE_NONE = 0; public const int VEHICLE_TYPE_SLED = 1; public const int VEHICLE_TYPE_CAR = 2; @@ -2005,6 +2019,7 @@ namespace OpenSim.Region.ScriptEngine.Common public const int VEHICLE_FLAG_MOUSELOOK_STEER = 128; public const int VEHICLE_FLAG_MOUSELOOK_BANK = 256; public const int VEHICLE_FLAG_CAMERA_DECOUPLED = 512; + public const int INVENTORY_ALL = -1; public const int INVENTORY_NONE = -1; public const int INVENTORY_TEXTURE = 0; @@ -2017,6 +2032,7 @@ namespace OpenSim.Region.ScriptEngine.Common public const int INVENTORY_BODYPART = 13; public const int INVENTORY_ANIMATION = 20; public const int INVENTORY_GESTURE = 21; + public const int ATTACH_CHEST = 1; public const int ATTACH_HEAD = 2; public const int ATTACH_LSHOULDER = 3; @@ -2047,6 +2063,7 @@ namespace OpenSim.Region.ScriptEngine.Common public const int ATTACH_BELLY = 28; public const int ATTACH_RPEC = 29; public const int ATTACH_LPEC = 30; + public const int LAND_LEVEL = 0; public const int LAND_RAISE = 1; public const int LAND_LOWER = 2; @@ -2056,6 +2073,8 @@ namespace OpenSim.Region.ScriptEngine.Common public const int LAND_SMALL_BRUSH = 1; public const int LAND_MEDIUM_BRUSH = 2; public const int LAND_LARGE_BRUSH = 3; + + //Agent Dataserver public const int DATA_ONLINE = 1; public const int DATA_NAME = 2; public const int DATA_BORN = 3; @@ -2063,6 +2082,7 @@ namespace OpenSim.Region.ScriptEngine.Common public const int DATA_SIM_POS = 5; public const int DATA_SIM_STATUS = 6; public const int DATA_SIM_RATING = 7; + public const int ANIM_ON = 1; public const int LOOP = 2; public const int REVERSE = 4; @@ -2091,9 +2111,13 @@ namespace OpenSim.Region.ScriptEngine.Common public const int TYPE_KEY = 4; public const int TYPE_VECTOR = 5; public const int TYPE_ROTATION = 6; + + //XML RPC Remote Data Channel public const int REMOTE_DATA_CHANNEL = 1; public const int REMOTE_DATA_REQUEST = 2; public const int REMOTE_DATA_REPLY = 3; + + //llHTTPRequest public const int HTTP_METHOD = 0; public const int HTTP_MIMETYPE = 1; public const int HTTP_BODY_MAXLENGTH = 2; @@ -2117,6 +2141,7 @@ namespace OpenSim.Region.ScriptEngine.Common public const int PRIM_POINT_LIGHT = 23; // Huh? public const int PRIM_TEXGEN_DEFAULT = 0; public const int PRIM_TEXGEN_PLANAR = 1; + public const int PRIM_TYPE_BOX = 0; public const int PRIM_TYPE_CYLINDER = 1; public const int PRIM_TYPE_PRISM = 2; @@ -2125,10 +2150,12 @@ namespace OpenSim.Region.ScriptEngine.Common public const int PRIM_TYPE_TUBE = 5; public const int PRIM_TYPE_RING = 6; public const int PRIM_TYPE_SCULPT = 7; + public const int PRIM_HOLE_DEFAULT = 0; public const int PRIM_HOLE_CIRCLE = 16; public const int PRIM_HOLE_SQUARE = 32; public const int PRIM_HOLE_TRIANGLE = 48; + public const int PRIM_MATERIAL_STONE = 0; public const int PRIM_MATERIAL_METAL = 1; public const int PRIM_MATERIAL_GLASS = 2; @@ -2137,6 +2164,7 @@ namespace OpenSim.Region.ScriptEngine.Common public const int PRIM_MATERIAL_PLASTIC = 5; public const int PRIM_MATERIAL_RUBBER = 6; public const int PRIM_MATERIAL_LIGHT = 7; + public const int PRIM_SHINY_NONE = 0; public const int PRIM_SHINY_LOW = 1; public const int PRIM_SHINY_MEDIUM = 2; @@ -2170,11 +2198,13 @@ namespace OpenSim.Region.ScriptEngine.Common public const int MASK_GROUP = 2; public const int MASK_EVERYONE = 3; public const int MASK_NEXT = 4; + public const int PERM_TRANSFER = 8192; public const int PERM_MODIFY = 16384; public const int PERM_COPY = 32768; public const int PERM_MOVE = 524288; public const int PERM_ALL = 2147483647; + public const int PARCEL_MEDIA_COMMAND_STOP = 0; public const int PARCEL_MEDIA_COMMAND_PAUSE = 1; public const int PARCEL_MEDIA_COMMAND_PLAY = 2; @@ -2185,8 +2215,10 @@ namespace OpenSim.Region.ScriptEngine.Common public const int PARCEL_MEDIA_COMMAND_AGENT = 7; public const int PARCEL_MEDIA_COMMAND_UNLOAD = 8; public const int PARCEL_MEDIA_COMMAND_AUTO_ALIGN = 9; + public const int PAY_HIDE = -1; public const int PAY_DEFAULT = -2; + public const string NULL_KEY = "00000000-0000-0000-0000-000000000000"; public const string EOF = "\n\n\n"; public const double PI = 3.14159274f; @@ -2209,6 +2241,15 @@ namespace OpenSim.Region.ScriptEngine.Common public const int LIST_STAT_NUM_COUNT = 8; public const int LIST_STAT_GEOMETRIC_MEAN = 9; public const int LIST_STAT_HARMONIC_MEAN = 100; + + //ParcelPrim Categories + public const int PARCEL_COUNT_TOTAL = 0; + public const int PARCEL_COUNT_OWNER = 1; + public const int PARCEL_COUNT_GROUP = 2; + public const int PARCEL_COUNT_OTHER = 3; + public const int PARCEL_COUNT_SELECTED = 4; + public const int PARCEL_COUNT_TEMP = 5; + // Can not be public const? public vector ZERO_VECTOR = new vector(0.0, 0.0, 0.0); public rotation ZERO_ROTATION = new rotation(0.0, 0, 0.0, 1.0); diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index 7828834..7da47d4 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs @@ -1899,6 +1899,7 @@ namespace OpenSim.Region.ScriptEngine.Common public string llGetScriptName() { m_host.AddScriptLPS(1); + return String.Empty; } @@ -2942,7 +2943,8 @@ namespace OpenSim.Region.ScriptEngine.Common public int llGetScriptState(string name) { m_host.AddScriptLPS(1); - NotImplemented("llGetScriptState"); + + //NotImplemented("llGetScriptState"); return 0; } @@ -3096,6 +3098,24 @@ namespace OpenSim.Region.ScriptEngine.Common World.SetLandMusicURL(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y, url); } + public void osSetParcelMediaURL(string url) + { + m_host.AddScriptLPS(1); + LLUUID landowner = World.GetLandOwner(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); + + if(landowner.Equals(null)) + { + return; + } + + if(landowner != m_host.ObjectOwner) + { + return; + } + + World.SetLandMediaURL(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y, url); + } + public LSL_Types.Vector3 llGetRootPosition() { m_host.AddScriptLPS(1); @@ -3441,6 +3461,7 @@ namespace OpenSim.Region.ScriptEngine.Common int number = 0; int digit; + int baddigit = 0; m_host.AddScriptLPS(1); @@ -4004,7 +4025,65 @@ namespace OpenSim.Region.ScriptEngine.Common public int llGetParcelPrimCount(LSL_Types.Vector3 pos, int category, int sim_wide) { m_host.AddScriptLPS(1); - NotImplemented("llGetParcelPrimCount"); + + LandData land = World.GetLandData((float)pos.x, (float)pos.y); + + if(land == null) + { + return 0; + } + + else + { + if(sim_wide == 1) + { + if (category == 0) + { + return land.simwidePrims; + } + + else + { + //public int simwideArea = 0; + return 0; + } + } + + else + { + if(category == 0)//Total Prims + { + return 0;//land. + } + + else if(category == 1)//Owner Prims + { + return land.ownerPrims; + } + + else if(category == 2)//Group Prims + { + return land.groupPrims; + } + + else if(category == 3)//Other Prims + { + return land.otherPrims; + } + + else if(category == 4)//Selected + { + return land.selectedPrims; + } + + else if(category == 5)//Temp + { + return 0;//land. + } + } + } + + //NotImplemented("llGetParcelPrimCount"); return 0; } @@ -4035,19 +4114,25 @@ namespace OpenSim.Region.ScriptEngine.Common // Alondria: This currently just is utilizing the normal grid's 0.22 prims/m2 calculation // Which probably will be irrelevent in OpenSim.... LandData land = World.GetLandData((float)pos.x, (float)pos.y); + float bonusfactor = World.RegionInfo.EstateSettings.objectBonusFactor; + if (land == null) { return 0; } + if (sim_wide == 1) { decimal v = land.simwideArea * (decimal)(0.22) * (decimal)bonusfactor; + return (int)v; } + else { decimal v = land.area * (decimal)(0.22) * (decimal)bonusfactor; + return (int)v; } diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs index 42197a2..c1e178b 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs @@ -641,6 +641,7 @@ namespace OpenSim.Region.ScriptEngine.Common int osTerrainSetHeight(int x, int y, double val); int osRegionRestart(double seconds); void osRegionNotice(string msg); - bool osConsoleCommand(string Command); + bool osConsoleCommand(string Command); + void osSetParcelMediaURL(string url); } } -- cgit v1.1