mirror of
https://github.com/opensim/opensim.git
synced 2026-08-06 09:16:28 +08:00
Moved script engine os* commands to OSSL_BuilIn_Commands.cs and OSSL_BuilIn_Commands_Interface.cs where they belong.
This commit is contained in:
@@ -25,10 +25,22 @@
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Remoting.Lifetime;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using Axiom.Math;
|
||||
using libsecondlife;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Region.Environment.Interfaces;
|
||||
using OpenSim.Region.Environment.Scenes;
|
||||
using OpenSim.Region.ScriptEngine.Common;
|
||||
using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase;
|
||||
using OpenSim.Region.Environment;
|
||||
using OpenSim.Region.Environment.Modules.LandManagement;
|
||||
//using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL;
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.Common
|
||||
{
|
||||
@@ -242,5 +254,289 @@ namespace OpenSim.Region.ScriptEngine.Common
|
||||
// public double Z;
|
||||
// public double R;
|
||||
//}
|
||||
|
||||
|
||||
//
|
||||
// OpenSim functions
|
||||
//
|
||||
|
||||
public int osTerrainSetHeight(int x, int y, double val)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
if (x > 255 || x < 0 || y > 255 || y < 0)
|
||||
LSLError("osTerrainSetHeight: Coordinate out of bounds");
|
||||
|
||||
if (World.PermissionsMngr.CanTerraform(m_host.OwnerID, new LLVector3(x, y, 0)))
|
||||
{
|
||||
World.Heightmap[x, y] = val;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public double osTerrainGetHeight(int x, int y)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
if (x > 255 || x < 0 || y > 255 || y < 0)
|
||||
LSLError("osTerrainGetHeight: Coordinate out of bounds");
|
||||
|
||||
return World.Heightmap[x, y];
|
||||
}
|
||||
|
||||
public int osRegionRestart(double seconds)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
if (World.PermissionsMngr.CanRestartSim(m_host.OwnerID))
|
||||
{
|
||||
World.Restart((float)seconds);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void osRegionNotice(string msg)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
World.SendGeneralAlert(msg);
|
||||
}
|
||||
|
||||
public void osSetRot(LLUUID target, Quaternion rotation)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
if (World.Entities.ContainsKey(target))
|
||||
{
|
||||
World.Entities[target].Rotation = rotation;
|
||||
}
|
||||
else
|
||||
{
|
||||
LSLError("osSetRot: Invalid target");
|
||||
}
|
||||
}
|
||||
|
||||
public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams,
|
||||
int timer)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
if (dynamicID == String.Empty)
|
||||
{
|
||||
IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>();
|
||||
LLUUID createdTexture =
|
||||
textureManager.AddDynamicTextureURL(World.RegionInfo.RegionID, m_host.UUID, contentType, url,
|
||||
extraParams, timer);
|
||||
return createdTexture.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
//TODO update existing dynamic textures
|
||||
}
|
||||
|
||||
return LLUUID.Zero.ToString();
|
||||
}
|
||||
|
||||
public string osSetDynamicTextureURLBlend(string dynamicID, string contentType, string url, string extraParams,
|
||||
int timer, int alpha)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
if (dynamicID == String.Empty)
|
||||
{
|
||||
IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>();
|
||||
LLUUID createdTexture =
|
||||
textureManager.AddDynamicTextureURL(World.RegionInfo.RegionID, m_host.UUID, contentType, url,
|
||||
extraParams, timer, true, (byte) alpha );
|
||||
return createdTexture.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
//TODO update existing dynamic textures
|
||||
}
|
||||
|
||||
return LLUUID.Zero.ToString();
|
||||
}
|
||||
|
||||
public string osSetDynamicTextureData(string dynamicID, string contentType, string data, string extraParams,
|
||||
int timer)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
if (dynamicID == String.Empty)
|
||||
{
|
||||
IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>();
|
||||
if (textureManager != null)
|
||||
{
|
||||
LLUUID createdTexture =
|
||||
textureManager.AddDynamicTextureData(World.RegionInfo.RegionID, m_host.UUID, contentType, data,
|
||||
extraParams, timer);
|
||||
return createdTexture.ToString();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//TODO update existing dynamic textures
|
||||
}
|
||||
|
||||
return LLUUID.Zero.ToString();
|
||||
}
|
||||
|
||||
public string osSetDynamicTextureDataBlend(string dynamicID, string contentType, string data, string extraParams,
|
||||
int timer, int alpha)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
if (dynamicID == String.Empty)
|
||||
{
|
||||
IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>();
|
||||
if (textureManager != null)
|
||||
{
|
||||
LLUUID createdTexture =
|
||||
textureManager.AddDynamicTextureData(World.RegionInfo.RegionID, m_host.UUID, contentType, data,
|
||||
extraParams, timer, true, (byte) alpha);
|
||||
return createdTexture.ToString();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//TODO update existing dynamic textures
|
||||
}
|
||||
|
||||
return LLUUID.Zero.ToString();
|
||||
}
|
||||
|
||||
public bool osConsoleCommand(string command)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
Nini.Config.IConfigSource config = new Nini.Config.IniConfigSource(Application.iniFilePath);
|
||||
if (config.Configs["LL-Functions"] == null)
|
||||
config.AddConfig("LL-Functions");
|
||||
|
||||
if (config.Configs["LL-Functions"].GetBoolean("AllowosConsoleCommand", false))
|
||||
{
|
||||
if (World.PermissionsMngr.CanRunConsoleCommand(m_host.OwnerID))
|
||||
{
|
||||
OpenSim.Framework.Console.MainConsole.Instance.RunCommand(command);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public void osSetPrimFloatOnWater(int floatYN)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
if (m_host.ParentGroup != null)
|
||||
{
|
||||
if (m_host.ParentGroup.RootPart != null)
|
||||
{
|
||||
m_host.ParentGroup.RootPart.SetFloatOnWater(floatYN);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Adam's super super custom animation functions
|
||||
public void osAvatarPlayAnimation(string avatar, string animation)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
if (World.Entities.ContainsKey(avatar) && World.Entities[avatar] is ScenePresence)
|
||||
{
|
||||
ScenePresence target = (ScenePresence)World.Entities[avatar];
|
||||
target.AddAnimation(avatar, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public void osAvatarStopAnimation(string avatar, string animation)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
if (World.Entities.ContainsKey(avatar) && World.Entities[avatar] is ScenePresence)
|
||||
{
|
||||
ScenePresence target = (ScenePresence)World.Entities[avatar];
|
||||
target.RemoveAnimation(animation);
|
||||
}
|
||||
}
|
||||
|
||||
//Texture draw functions
|
||||
public string osMovePen(string drawList, int x, int y)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
drawList += "MoveTo " + x + "," + y + ";";
|
||||
return drawList;
|
||||
}
|
||||
|
||||
public string osDrawLine(string drawList, int startX, int startY, int endX, int endY)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
drawList += "MoveTo "+ startX+","+ startY +"; LineTo "+endX +","+endY +"; ";
|
||||
return drawList;
|
||||
}
|
||||
|
||||
public string osDrawLine(string drawList, int endX, int endY)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
drawList += "LineTo " + endX + "," + endY + "; ";
|
||||
return drawList;
|
||||
}
|
||||
|
||||
public string osDrawText(string drawList, string text)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
drawList += "Text " + text + "; ";
|
||||
return drawList;
|
||||
}
|
||||
|
||||
public string osDrawEllipse(string drawList, int width, int height)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
drawList += "Ellipse " + width + "," + height + "; ";
|
||||
return drawList;
|
||||
}
|
||||
|
||||
public string osDrawRectangle(string drawList, int width, int height)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
drawList += "Rectangle " + width + "," + height + "; ";
|
||||
return drawList;
|
||||
}
|
||||
|
||||
public string osDrawFilledRectangle(string drawList, int width, int height)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
drawList += "FillRectangle " + width + "," + height + "; ";
|
||||
return drawList;
|
||||
}
|
||||
|
||||
public string osSetFontSize(string drawList, int fontSize)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
drawList += "FontSize "+ fontSize +"; ";
|
||||
return drawList;
|
||||
}
|
||||
|
||||
public string osSetPenSize(string drawList, int penSize)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
drawList += "PenSize " + penSize + "; ";
|
||||
return drawList;
|
||||
}
|
||||
|
||||
public string osSetPenColour(string drawList, string colour)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
drawList += "PenColour " + colour + "; ";
|
||||
return drawList;
|
||||
}
|
||||
|
||||
public string osDrawImage(string drawList, int width, int height, string imageUrl)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
drawList +="Image " +width + "," + height+ ","+ imageUrl +"; " ;
|
||||
return drawList;
|
||||
}
|
||||
|
||||
public void osSetStateEvents(int events)
|
||||
{
|
||||
m_host.setScriptEvents(m_itemID, events);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user