Full API convergence. Api is back in LSL_Api.cs and OSSL_Api.cs.

The binaries are still different, but that is only a small step away now.
The OSSLPrim has been removed. This commit will breal all scripts
using Prim.Scale(), etc, syntax. It was not secure and will have to
be brought back in another form.
0.6.0-stable
Melanie Thielker 2008-09-26 02:51:00 +00:00
parent 33add28b51
commit c21a8b9969
19 changed files with 8397 additions and 9977 deletions

View File

@ -1,43 +0,0 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using OpenMetaverse;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.ScriptEngine.Common
{
/// <summary>
/// This is the end of a chain of inherited builtin command implementations. This module will be instanced by script engines.
/// </summary>
public class BuilIn_Commands : OSSL_BuilIn_Commands
{
public BuilIn_Commands(ScriptEngineBase.ScriptEngine scriptEngine, SceneObjectPart host, uint localID,
UUID itemID) : base(scriptEngine, host, localID, itemID)
{
}
}
}

View File

@ -27,6 +27,7 @@
using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase; using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase;
using OpenSim.Region.ScriptEngine.Shared; using OpenSim.Region.ScriptEngine.Shared;
using OpenSim.Region.ScriptEngine.Interfaces;
namespace OpenSim.Region.ScriptEngine.Common namespace OpenSim.Region.ScriptEngine.Common
{ {
@ -36,6 +37,6 @@ namespace OpenSim.Region.ScriptEngine.Common
int StartParam { get; set; } int StartParam { get; set; }
ExecutorBase Exec { get; } ExecutorBase Exec { get; }
string Source { get; set; } string Source { get; set; }
void Start(BuilIn_Commands BuiltIn_Commands); void InitApi(string api, IScriptApi LSL_Functions);
} }
} }

View File

@ -1,262 +0,0 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* 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 Nini.Config;
using OpenMetaverse;
using OpenMetaverse.Packets;
using OpenSim.Framework;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Region.Environment;
using OpenSim.Region.Interfaces;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney;
using OpenSim.Region.Environment.Modules.World.Land;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Physics.Manager;
using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase;
using OpenSim.Region.ScriptEngine.Shared;
using OpenSim.Region.ScriptEngine.Shared.Api;
using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list;
using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
namespace OpenSim.Region.ScriptEngine.Common
{
/// <summary>
/// Contains all LSL ll-functions. This class will be in Default AppDomain.
/// </summary>
public class LSL_BuiltIn_Commands : LSL_Api_Base, LSL_BuiltIn_Commands_Interface
{
// private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
internal ScriptEngineBase.ScriptEngine m_ScriptEngineDirect;
public LSL_BuiltIn_Commands(ScriptEngineBase.ScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID)
{
m_ScriptEngineDirect = ScriptEngine;
m_ScriptEngine = ScriptEngine;
m_host = host;
m_localID = localID;
m_itemID = itemID;
AsyncCommands = new AsyncCommandManager(m_ScriptEngine);
//m_log.Info(ScriptEngineName, "LSL_BaseClass.Start() called. Hosted by [" + m_host.Name + ":" + m_host.UUID + "@" + m_host.AbsolutePosition + "]");
IConfigSource config = new IniConfigSource(Application.iniFilePath);
if (config.Configs["LL-Functions"] == null)
config.AddConfig("LL-Functions");
m_ScriptDelayFactor = config.Configs["LL-Functions"].GetFloat("ScriptDelayFactor", 1.0f);
m_ScriptDistanceFactor = config.Configs["LL-Functions"].GetFloat("ScriptDistanceLimitFactor", 1.0f);
}
private string m_state = "default";
protected void ScriptSleep(int delay)
{
delay = (int)((float)delay * m_ScriptDelayFactor);
if (delay == 0)
return;
System.Threading.Thread.Sleep(delay);
}
// Object never expires
public override Object InitializeLifetimeService()
{
ILease lease = (ILease)base.InitializeLifetimeService();
if (lease.CurrentState == LeaseState.Initial)
{
lease.InitialLeaseTime = TimeSpan.Zero;
}
return lease;
}
public string State
{
get { return m_state; }
set {
// Set it if it changed
if (m_state != value)
{
try
{
m_ScriptEngineDirect.m_EventManager.state_exit(m_localID);
}
catch (AppDomainUnloadedException)
{
Console.WriteLine("[SCRIPT]: state change called when script was unloaded. Nothing to worry about, but noting the occurance");
}
m_state = value;
try
{
int eventFlags = m_ScriptEngineDirect.m_ScriptManager.GetStateEventFlags(m_localID, m_itemID);
m_host.SetScriptEvents(m_itemID, eventFlags);
m_ScriptEngineDirect.m_EventManager.state_entry(m_localID);
}
catch (AppDomainUnloadedException)
{
Console.WriteLine("[SCRIPT]: state change called when script was unloaded. Nothing to worry about, but noting the occurance");
}
}
}
}
// Extension commands use this:
public ICommander GetCommander(string name)
{
return World.GetCommander(name);
}
public LSL_Integer llGetScriptState(string name)
{
UUID item;
ScriptManager sm;
IScript script = null;
m_host.AddScriptLPS(1);
// These functions are supposed to be robust,
// so get the state one step at a time.
if ((item = ScriptByName(name)) != UUID.Zero)
{
if ((sm = m_ScriptEngineDirect.m_ScriptManager) != null)
{
if ((script = sm.GetScript(m_localID, item)) != null)
{
return script.Exec.Running?1:0;
}
}
}
// Required by SL
if (script == null)
ShoutError("llGetScriptState: script "+name+" not found");
// If we didn't find it, then it's safe to
// assume it is not running.
return 0;
}
public void llResetOtherScript(string name)
{
UUID item;
ScriptManager sm;
IScript script = null;
m_host.AddScriptLPS(8000);
// These functions are supposed to be robust,
// so get the state one step at a time.
if ((item = ScriptByName(name)) != UUID.Zero)
if ((sm = m_ScriptEngineDirect.m_ScriptManager) != null)
sm.ResetScript(m_localID, item);
// Required by SL
if (script == null)
ShoutError("llResetOtherScript: script "+name+" not found");
// If we didn't find it, then it's safe to
// assume it is not running.
}
public void llResetScript()
{
m_host.AddScriptLPS(800);
m_ScriptEngineDirect.m_ScriptManager.ResetScript(m_localID, m_itemID);
}
public void llSetScriptState(string name, int run)
{
UUID item;
ScriptManager sm;
IScript script = null;
m_host.AddScriptLPS(1);
// These functions are supposed to be robust,
// so get the state one step at a time.
if ((item = ScriptByName(name)) != UUID.Zero)
{
if ((sm = m_ScriptEngineDirect.m_ScriptManager) != null)
{
if (sm.Scripts.ContainsKey(m_localID))
{
if ((script = sm.GetScript(m_localID, item)) != null)
{
script.Exec.Running = (run==0) ? false : true;
}
}
}
}
// Required by SL
if (script == null)
ShoutError("llSetScriptState: script "+name+" not found");
// If we didn't find it, then it's safe to
// assume it is not running.
}
internal UUID ScriptByName(string name)
{
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
{
if (item.Type == 10 && item.Name == name)
return item.ItemID;
}
return UUID.Zero;
}
internal void ShoutError(string msg)
{
llShout(ScriptBaseClass.DEBUG_CHANNEL, msg);
}
}
}

View File

@ -1,391 +0,0 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using OpenSim.Region.Environment.Interfaces;
using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list;
using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
namespace OpenSim.Region.ScriptEngine.Common
{
public interface LSL_BuiltIn_Commands_Interface
{
// Interface used for loading and executing scripts
string State { get; set; }
ICommander GetCommander(string name);
LSL_Integer llAbs(int i);
LSL_Float llAcos(double val);
void llAddToLandBanList(string avatar, double hours);
void llAddToLandPassList(string avatar, double hours);
void llAdjustSoundVolume(double volume);
void llAllowInventoryDrop(int add);
LSL_Float llAngleBetween(LSL_Rotation a, LSL_Rotation b);
void llApplyImpulse(LSL_Vector force, int local);
void llApplyRotationalImpulse(LSL_Vector force, int local);
LSL_Float llAsin(double val);
LSL_Float llAtan2(double x, double y);
void llAttachToAvatar(int attachment);
LSL_Key llAvatarOnSitTarget();
LSL_Rotation llAxes2Rot(LSL_Vector fwd, LSL_Vector left, LSL_Vector up);
LSL_Rotation llAxisAngle2Rot(LSL_Vector axis, double angle);
LSL_Integer llBase64ToInteger(string str);
LSL_String llBase64ToString(string str);
void llBreakAllLinks();
void llBreakLink(int linknum);
LSL_Integer llCeil(double f);
void llClearCameraParams();
void llCloseRemoteDataChannel(string channel);
LSL_Float llCloud(LSL_Vector offset);
void llCollisionFilter(string name, string id, int accept);
void llCollisionSound(string impact_sound, double impact_volume);
void llCollisionSprite(string impact_sprite);
LSL_Float llCos(double f);
void llCreateLink(string target, int parent);
LSL_List llCSV2List(string src);
LSL_List llDeleteSubList(LSL_List src, int start, int end);
LSL_String llDeleteSubString(string src, int start, int end);
void llDetachFromAvatar();
LSL_Vector llDetectedGrab(int number);
LSL_Integer llDetectedGroup(int number);
LSL_Key llDetectedKey(int number);
LSL_Integer llDetectedLinkNumber(int number);
LSL_String llDetectedName(int number);
LSL_Key llDetectedOwner(int number);
LSL_Vector llDetectedPos(int number);
LSL_Rotation llDetectedRot(int number);
LSL_Integer llDetectedType(int number);
LSL_Vector llDetectedTouchBinormal(int index);
LSL_Integer llDetectedTouchFace(int index);
LSL_Vector llDetectedTouchNormal(int index);
LSL_Vector llDetectedTouchPos(int index);
LSL_Vector llDetectedTouchST(int index);
LSL_Vector llDetectedTouchUV(int index);
LSL_Vector llDetectedVel(int number);
void llDialog(string avatar, string message, LSL_List buttons, int chat_channel);
void llDie();
LSL_String llDumpList2String(LSL_List src, string seperator);
LSL_Integer llEdgeOfWorld(LSL_Vector pos, LSL_Vector dir);
void llEjectFromLand(string pest);
void llEmail(string address, string subject, string message);
LSL_String llEscapeURL(string url);
LSL_Rotation llEuler2Rot(LSL_Vector v);
LSL_Float llFabs(double f);
LSL_Integer llFloor(double f);
void llForceMouselook(int mouselook);
LSL_Float llFrand(double mag);
LSL_Vector llGetAccel();
LSL_Integer llGetAgentInfo(string id);
LSL_Vector llGetAgentSize(string id);
LSL_Float llGetAlpha(int face);
LSL_Float llGetAndResetTime();
LSL_String llGetAnimation(string id);
LSL_List llGetAnimationList(string id);
LSL_Integer llGetAttached();
LSL_List llGetBoundingBox(string obj);
LSL_Vector llGetCameraPos();
LSL_Rotation llGetCameraRot();
LSL_Vector llGetCenterOfMass();
LSL_Vector llGetColor(int face);
LSL_String llGetCreator();
LSL_String llGetDate();
LSL_Float llGetEnergy();
LSL_Vector llGetForce();
LSL_Integer llGetFreeMemory();
LSL_Vector llGetGeometricCenter();
LSL_Float llGetGMTclock();
LSL_Key llGetInventoryCreator(string item);
LSL_Key llGetInventoryKey(string name);
LSL_String llGetInventoryName(int type, int number);
LSL_Integer llGetInventoryNumber(int type);
LSL_Integer llGetInventoryPermMask(string item, int mask);
LSL_Integer llGetInventoryType(string name);
LSL_Key llGetKey();
LSL_Key llGetLandOwnerAt(LSL_Vector pos);
LSL_Key llGetLinkKey(int linknum);
LSL_String llGetLinkName(int linknum);
LSL_Integer llGetLinkNumber();
LSL_Integer llGetListEntryType(LSL_List src, int index);
LSL_Integer llGetListLength(LSL_List src);
LSL_Vector llGetLocalPos();
LSL_Rotation llGetLocalRot();
LSL_Float llGetMass();
void llGetNextEmail(string address, string subject);
LSL_String llGetNotecardLine(string name, int line);
LSL_Key llGetNumberOfNotecardLines(string name);
LSL_Integer llGetNumberOfPrims();
LSL_Integer llGetNumberOfSides();
LSL_String llGetObjectDesc();
LSL_List llGetObjectDetails(string id, LSL_List args);
LSL_Float llGetObjectMass(string id);
LSL_String llGetObjectName();
LSL_Integer llGetObjectPermMask(int mask);
LSL_Integer llGetObjectPrimCount(string object_id);
LSL_Vector llGetOmega();
LSL_Key llGetOwner();
LSL_Key llGetOwnerKey(string id);
LSL_List llGetParcelDetails(LSL_Vector pos, LSL_List param);
LSL_Integer llGetParcelFlags(LSL_Vector pos);
LSL_Integer llGetParcelMaxPrims(LSL_Vector pos, int sim_wide);
LSL_Integer llGetParcelPrimCount(LSL_Vector pos, int category, int sim_wide);
LSL_List llGetParcelPrimOwners(LSL_Vector pos);
LSL_Integer llGetPermissions();
LSL_Key llGetPermissionsKey();
LSL_Vector llGetPos();
LSL_List llGetPrimitiveParams(LSL_List rules);
LSL_Integer llGetRegionAgentCount();
LSL_Vector llGetRegionCorner();
LSL_Integer llGetRegionFlags();
LSL_Float llGetRegionFPS();
LSL_String llGetRegionName();
LSL_Float llGetRegionTimeDilation();
LSL_Vector llGetRootPosition();
LSL_Rotation llGetRootRotation();
LSL_Rotation llGetRot();
LSL_Vector llGetScale();
LSL_String llGetScriptName();
LSL_Integer llGetScriptState(string name);
LSL_String llGetSimulatorHostname();
LSL_Integer llGetStartParameter();
LSL_Integer llGetStatus(int status);
LSL_String llGetSubString(string src, int start, int end);
LSL_Vector llGetSunDirection();
LSL_String llGetTexture(int face);
LSL_Vector llGetTextureOffset(int face);
LSL_Float llGetTextureRot(int side);
LSL_Vector llGetTextureScale(int side);
LSL_Float llGetTime();
LSL_Float llGetTimeOfDay();
LSL_String llGetTimestamp();
LSL_Vector llGetTorque();
LSL_Integer llGetUnixTime();
LSL_Vector llGetVel();
LSL_Float llGetWallclock();
void llGiveInventory(string destination, string inventory);
void llGiveInventoryList(string destination, string category, LSL_List inventory);
LSL_Integer llGiveMoney(string destination, int amount);
void llGodLikeRezObject(string inventory, LSL_Vector pos);
LSL_Float llGround(LSL_Vector offset);
LSL_Vector llGroundContour(LSL_Vector offset);
LSL_Vector llGroundNormal(LSL_Vector offset);
void llGroundRepel(double height, int water, double tau);
LSL_Vector llGroundSlope(LSL_Vector offset);
LSL_String llHTTPRequest(string url, LSL_List parameters, string body);
LSL_String llInsertString(string dst, int position, string src);
void llInstantMessage(string user, string message);
LSL_String llIntegerToBase64(int number);
LSL_String llKey2Name(string id);
LSL_String llList2CSV(LSL_List src);
LSL_Float llList2Float(LSL_List src, int index);
LSL_Integer llList2Integer(LSL_List src, int index);
LSL_Key llList2Key(LSL_List src, int index);
LSL_List llList2List(LSL_List src, int start, int end);
LSL_List llList2ListStrided(LSL_List src, int start, int end, int stride);
LSL_Rotation llList2Rot(LSL_List src, int index);
LSL_String llList2String(LSL_List src, int index);
LSL_Vector llList2Vector(LSL_List src, int index);
LSL_Integer llListen(int channelID, string name, string ID, string msg);
void llListenControl(int number, int active);
void llListenRemove(int number);
LSL_Integer llListFindList(LSL_List src, LSL_List test);
LSL_List llListInsertList(LSL_List dest, LSL_List src, int start);
LSL_List llListRandomize(LSL_List src, int stride);
LSL_List llListReplaceList(LSL_List dest, LSL_List src, int start, int end);
LSL_List llListSort(LSL_List src, int stride, int ascending);
LSL_Float llListStatistics(int operation, LSL_List src);
void llLoadURL(string avatar_id, string message, string url);
LSL_Float llLog(double val);
LSL_Float llLog10(double val);
void llLookAt(LSL_Vector target, double strength, double damping);
void llLoopSound(string sound, double volume);
void llLoopSoundMaster(string sound, double volume);
void llLoopSoundSlave(string sound, double volume);
void llMakeExplosion();
void llMakeFire();
void llMakeFountain();
void llMakeSmoke();
void llMapDestination(string simname, LSL_Vector pos, LSL_Vector look_at);
LSL_String llMD5String(string src, int nonce);
void llMessageLinked(int linknum, int num, string str, string id);
void llMinEventDelay(double delay);
void llModifyLand(int action, int brush);
LSL_Integer llModPow(int a, int b, int c);
void llMoveToTarget(LSL_Vector target, double tau);
void llOffsetTexture(double u, double v, int face);
void llOpenRemoteDataChannel();
LSL_Integer llOverMyLand(string id);
void llOwnerSay(string msg);
void llParcelMediaCommandList(LSL_List commandList);
LSL_List llParcelMediaQuery(LSL_List aList);
LSL_List llParseString2List(string str, LSL_List separators, LSL_List spacers);
LSL_List llParseStringKeepNulls(string src, LSL_List seperators, LSL_List spacers);
void llParticleSystem(LSL_List rules);
void llPassCollisions(int pass);
void llPassTouches(int pass);
void llPlaySound(string sound, double volume);
void llPlaySoundSlave(string sound, double volume);
void llPointAt();
LSL_Float llPow(double fbase, double fexponent);
void llPreloadSound(string sound);
void llPushObject(string target, LSL_Vector impulse, LSL_Vector ang_impulse, int local);
void llRefreshPrimURL();
void llRegionSay(int channelID, string text);
void llReleaseCamera(string avatar);
void llReleaseControls();
void llRemoteDataReply(string channel, string message_id, string sdata, int idata);
void llRemoteDataSetRegion();
void llRemoteLoadScript();
void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param);
void llRemoveFromLandBanList(string avatar);
void llRemoveFromLandPassList(string avatar);
void llRemoveInventory(string item);
void llRemoveVehicleFlags(int flags);
LSL_Key llRequestAgentData(string id, int data);
LSL_Key llRequestInventoryData(string name);
void llRequestPermissions(string agent, int perm);
LSL_Key llRequestSimulatorData(string simulator, int data);
void llResetLandBanList();
void llResetLandPassList();
void llResetOtherScript(string name);
void llResetScript();
void llResetTime();
void llRezAtRoot(string inventory, LSL_Vector position, LSL_Vector velocity, LSL_Rotation rot, int param);
void llRezObject(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param);
LSL_Float llRot2Angle(LSL_Rotation rot);
LSL_Vector llRot2Axis(LSL_Rotation rot);
LSL_Vector llRot2Euler(LSL_Rotation r);
LSL_Vector llRot2Fwd(LSL_Rotation r);
LSL_Vector llRot2Left(LSL_Rotation r);
LSL_Vector llRot2Up(LSL_Rotation r);
void llRotateTexture(double rotation, int face);
LSL_Rotation llRotBetween(LSL_Vector start, LSL_Vector end);
void llRotLookAt(LSL_Rotation target, double strength, double damping);
LSL_Integer llRotTarget(LSL_Rotation rot, double error);
void llRotTargetRemove(int number);
LSL_Integer llRound(double f);
LSL_Integer llSameGroup(string agent);
void llSay(int channelID, string text);
void llScaleTexture(double u, double v, int face);
LSL_Integer llScriptDanger(LSL_Vector pos);
LSL_Key llSendRemoteData(string channel, string dest, int idata, string sdata);
void llSensor(string name, string id, int type, double range, double arc);
void llSensorRemove();
void llSensorRepeat(string name, string id, int type, double range, double arc, double rate);
void llSetAlpha(double alpha, int face);
void llSetBuoyancy(double buoyancy);
void llSetCameraAtOffset(LSL_Vector offset);
void llSetCameraEyeOffset(LSL_Vector offset);
void llSetCameraParams(LSL_List rules);
void llSetClickAction(int action);
void llSetColor(LSL_Vector color, int face);
void llSetDamage(double damage);
void llSetForce(LSL_Vector force, int local);
void llSetForceAndTorque(LSL_Vector force, LSL_Vector torque, int local);
void llSetHoverHeight(double height, int water, double tau);
void llSetInventoryPermMask(string item, int mask, int value);
void llSetLinkAlpha(int linknumber, double alpha, int face);
void llSetLinkColor(int linknumber, LSL_Vector color, int face);
void llSetLinkPrimitiveParams(int linknumber, LSL_List rules);
void llSetLinkTexture(int linknumber, string texture, int face);
void llSetLocalRot(LSL_Rotation rot);
void llSetObjectDesc(string desc);
void llSetObjectName(string name);
void llSetObjectPermMask(int mask, int value);
void llSetParcelMusicURL(string url);
void llSetPayPrice(int price, LSL_List quick_pay_buttons);
void llSetPos(LSL_Vector pos);
void llSetPrimitiveParams(LSL_List rules);
void llSetPrimURL();
void llSetRemoteScriptAccessPin(int pin);
void llSetRot(LSL_Rotation rot);
void llSetScale(LSL_Vector scale);
void llSetScriptState(string name, int run);
void llSetSitText(string text);
void llSetSoundQueueing(int queue);
void llSetSoundRadius(double radius);
void llSetStatus(int status, int value);
void llSetText(string text, LSL_Vector color, double alpha);
void llSetTexture(string texture, int face);
void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate);
void llSetTimerEvent(double sec);
void llSetTorque(LSL_Vector torque, int local);
void llSetTouchText(string text);
void llSetVehicleFlags(int flags);
void llSetVehicleFloatParam(int param, float value);
void llSetVehicleRotationParam(int param, LSL_Rotation rot);
void llSetVehicleType(int type);
void llSetVehicleVectorParam(int param, LSL_Vector vec);
void llShout(int channelID, string text);
LSL_Float llSin(double f);
void llSitTarget(LSL_Vector offset, LSL_Rotation rot);
void llSleep(double sec);
void llSound();
void llSoundPreload();
LSL_Float llSqrt(double f);
void llStartAnimation(string anim);
void llStopAnimation(string anim);
void llStopHover();
void llStopLookAt();
void llStopMoveToTarget();
void llStopPointAt();
void llStopSound();
LSL_Integer llStringLength(string str);
LSL_String llStringToBase64(string str);
LSL_String llStringTrim(string src, int type);
LSL_Integer llSubStringIndex(string source, string pattern);
void llTakeCamera(string avatar);
void llTakeControls(int controls, int accept, int pass_on);
LSL_Float llTan(double f);
LSL_Integer llTarget(LSL_Vector position, double range);
void llTargetOmega(LSL_Vector axis, double spinrate, double gain);
void llTargetRemove(int number);
void llTeleportAgentHome(string agent);
void llTextBox(string avatar, string message, int chat_channel);
LSL_String llToLower(string source);
LSL_String llToUpper(string source);
void llTriggerSound(string sound, double volume);
void llTriggerSoundLimited(string sound, double volume, LSL_Vector top_north_east, LSL_Vector bottom_south_west);
LSL_String llUnescapeURL(string url);
void llUnSit(string id);
LSL_Float llVecDist(LSL_Vector a, LSL_Vector b);
LSL_Float llVecMag(LSL_Vector v);
LSL_Vector llVecNorm(LSL_Vector v);
void llVolumeDetect(int detect);
LSL_Float llWater(LSL_Vector offset);
void llWhisper(int channelID, string text);
LSL_Vector llWind(LSL_Vector offset);
void llXorBase64Strings();
LSL_String llXorBase64StringsCorrect(string str1, string str2);
}
}

View File

@ -1,817 +0,0 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections;
using OpenMetaverse;
using Nini.Config;
using OpenSim.Framework.Console;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase;
using TPFlags = OpenSim.Framework.Constants.TeleportFlags;
//using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL;
using OpenSim.Region.ScriptEngine.Shared;
namespace OpenSim.Region.ScriptEngine.Common
{
public class OSSL_BuilIn_Commands : LSL_BuiltIn_Commands, OSSL_BuilIn_Commands_Interface
{
internal ScriptEngineBase.ScriptEngine m_ScriptEngineDirect;
public OSSL_BuilIn_Commands(ScriptEngineBase.ScriptEngine scriptEngine, SceneObjectPart host, uint localID,
UUID itemID)
: base(scriptEngine, host, localID, itemID)
{
m_ScriptEngineDirect = scriptEngine;
Prim = new OSSLPrim(this);
}
public OSSLPrim Prim;
[Serializable]
public class OSSLPrim
{
internal OSSL_BuilIn_Commands OSSL;
public OSSLPrim(OSSL_BuilIn_Commands bc)
{
OSSL = bc;
Position = new OSSLPrim_Position(this);
Rotation = new OSSLPrim_Rotation(this);
}
public OSSLPrim_Position Position;
public OSSLPrim_Rotation Rotation;
//public LSL_Types.Vector3 Position
//{
// get { return OSSL.llGetPos(); }
// set { OSSL.llSetPos(value); }
//}
//public LSL_Types.Quaternion Rotation
//{
// get { return OSSL.llGetRot(); }
// set { OSSL.llSetRot(value); }
//}
private TextStruct _text;
public TextStruct Text
{
get { return _text; }
set
{
_text = value;
OSSL.llSetText(_text.Text, _text.color, _text.alpha);
}
}
[Serializable]
public struct TextStruct
{
public string Text;
public LSL_Types.Vector3 color;
public double alpha;
}
}
[Serializable]
public class OSSLPrim_Position
{
private OSSLPrim prim;
private LSL_Types.Vector3 Position;
public OSSLPrim_Position(OSSLPrim _prim)
{
prim = _prim;
}
private void Load()
{
Position = prim.OSSL.llGetPos();
}
private void Save()
{
if (Position.x > 255)
Position.x = 255;
if (Position.x < 0)
Position.x = 0;
if (Position.y > 255)
Position.y = 255;
if (Position.y < 0)
Position.y = 0;
if (Position.z > 768)
Position.z = 768;
if (Position.z < 0)
Position.z = 0;
prim.OSSL.llSetPos(Position);
}
public double x
{
get
{
Load();
return Position.x;
}
set
{
Load();
Position.x = value;
Save();
}
}
public double y
{
get
{
Load();
return Position.y;
}
set
{
Load();
Position.y = value;
Save();
}
}
public double z
{
get
{
Load();
return Position.z;
}
set
{
Load();
Position.z = value;
Save();
}
}
}
[Serializable]
public class OSSLPrim_Rotation
{
private OSSLPrim prim;
private LSL_Types.Quaternion Rotation;
public OSSLPrim_Rotation(OSSLPrim _prim)
{
prim = _prim;
}
private void Load()
{
Rotation = prim.OSSL.llGetRot();
}
private void Save()
{
prim.OSSL.llSetRot(Rotation);
}
public double x
{
get
{
Load();
return Rotation.x;
}
set
{
Load();
Rotation.x = value;
Save();
}
}
public double y
{
get
{
Load();
return Rotation.y;
}
set
{
Load();
Rotation.y = value;
Save();
}
}
public double z
{
get
{
Load();
return Rotation.z;
}
set
{
Load();
Rotation.z = value;
Save();
}
}
public double s
{
get
{
Load();
return Rotation.s;
}
set
{
Load();
Rotation.s = value;
Save();
}
}
}
//public struct OSSLPrim_Rotation
//{
// public double X;
// public double Y;
// 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.ExternalChecks.ExternalChecksCanTerraformLand(m_host.OwnerID, new Vector3(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.ExternalChecks.ExternalChecksCanIssueEstateCommand(m_host.OwnerID, false))
{
World.Restart((float)seconds);
return 1;
}
else
{
return 0;
}
}
public void osRegionNotice(string msg)
{
m_host.AddScriptLPS(1);
World.SendGeneralAlert(msg);
}
public void osSetRot(UUID 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>();
UUID createdTexture =
textureManager.AddDynamicTextureURL(World.RegionInfo.RegionID, m_host.UUID, contentType, url,
extraParams, timer);
return createdTexture.ToString();
}
else
{
//TODO update existing dynamic textures
}
return UUID.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>();
UUID 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 UUID.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)
{
if (extraParams == String.Empty)
{
extraParams = "256";
}
UUID createdTexture =
textureManager.AddDynamicTextureData(World.RegionInfo.RegionID, m_host.UUID, contentType, data,
extraParams, timer);
return createdTexture.ToString();
}
}
else
{
//TODO update existing dynamic textures
}
return UUID.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)
{
if (extraParams == String.Empty)
{
extraParams = "256";
}
UUID 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 UUID.Zero.ToString();
}
public bool osConsoleCommand(string command)
{
m_host.AddScriptLPS(1);
IConfigSource config = new IniConfigSource(Application.iniFilePath);
if (config.Configs["LL-Functions"] == null)
config.AddConfig("LL-Functions");
if (config.Configs["LL-Functions"].GetBoolean("AllowosConsoleCommand", false))
{
if (World.ExternalChecks.ExternalChecksCanRunConsoleCommand(m_host.OwnerID))
{
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);
}
}
}
// Teleport functions
public void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat)
{
m_host.AddScriptLPS(1);
UUID agentId = new UUID();
if (UUID.TryParse(agent, out agentId))
{
ScenePresence presence = World.GetScenePresence(agentId);
if (presence != null)
{
// agent must be over owners land to avoid abuse
if (m_host.OwnerID == World.GetLandOwner(presence.AbsolutePosition.X, presence.AbsolutePosition.Y))
{
World.RequestTeleportLocation(presence.ControllingClient, regionName,
new Vector3((float)position.x, (float)position.y, (float)position.z),
new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation);
// ScriptSleep(5000);
}
}
}
}
public void osTeleportAgent(string agent, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat)
{
osTeleportAgent(agent, World.RegionInfo.RegionName, position, lookat);
}
// 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);
}
}
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);
}
public void osOpenRemoteDataChannel(string channel)
{
m_host.AddScriptLPS(1);
IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
if (xmlrpcMod.IsEnabled())
{
UUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_localID, m_itemID, new UUID(channel));
object[] resobj = new object[] { new LSL_Types.LSLInteger(1), new LSL_Types.LSLString(channelID.ToString()), new LSL_Types.LSLString(UUID.Zero.ToString()), new LSL_Types.LSLString(String.Empty), new LSL_Types.LSLInteger(0), new LSL_Types.LSLString(String.Empty) };
m_ScriptEngineDirect.m_EventQueueManager.AddToScriptQueue(m_localID, m_itemID, "remote_data", new DetectParams[0], resobj);
}
}
public void osSetParcelMediaURL(string url)
{
m_host.AddScriptLPS(1);
UUID landowner = World.GetLandOwner(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
if (landowner == UUID.Zero)
{
return;
}
if (landowner != m_host.ObjectOwner)
{
return;
}
World.SetLandMediaURL(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y, url);
}
public string osGetScriptEngineName()
{
m_host.AddScriptLPS(1);
int scriptEngineNameIndex = 0;
if (!String.IsNullOrEmpty(m_ScriptEngineDirect.ScriptEngineName))
{
// parse off the "ScriptEngine."
scriptEngineNameIndex = m_ScriptEngineDirect.ScriptEngineName.IndexOf(".", scriptEngineNameIndex);
scriptEngineNameIndex++; // get past delimiter
int scriptEngineNameLength = m_ScriptEngineDirect.ScriptEngineName.Length - scriptEngineNameIndex;
// create char array then a string that is only the script engine name
Char[] scriptEngineNameCharArray = m_ScriptEngineDirect.ScriptEngineName.ToCharArray(scriptEngineNameIndex, scriptEngineNameLength);
String scriptEngineName = new String(scriptEngineNameCharArray);
return scriptEngineName;
}
else
{
return String.Empty;
}
}
//for testing purposes only
public void osSetParcelMediaTime(double time)
{
World.ParcelMediaSetTime((float)time);
}
public Hashtable osParseJSON(string JSON)
{
m_host.AddScriptLPS(1);
// see http://www.json.org/ for more details on JSON
string currentKey=null;
Stack objectStack = new Stack(); // objects in JSON can be nested so we need to keep a track of this
Hashtable jsondata = new Hashtable(); // the hashtable to be returned
try
{
// iterate through the serialised stream of tokens and store at the right depth in the hashtable
// the top level hashtable may contain more nested hashtables within it each containing an objects representation
for (int i=0;i<JSON.Length; i++)
{
// Console.WriteLine(""+JSON[i]);
switch (JSON[i])
{
case '{':
// create hashtable and add it to the stack or array if we are populating one, we can have a lot of nested objects in JSON
Hashtable currentObject = new Hashtable();
if (objectStack.Count==0) // the stack should only be empty for the first outer object
{
objectStack.Push(jsondata);
}
else if (objectStack.Peek().ToString()=="System.Collections.ArrayList")
{
// add it to the parent array
((ArrayList)objectStack.Peek()).Add(currentObject);
objectStack.Push(currentObject);
}
else
{
// add it to the parent hashtable
((Hashtable)objectStack.Peek()).Add(currentKey,currentObject);
objectStack.Push(currentObject);
}
// clear the key
currentKey=null;
break;
case '}':
// pop the hashtable off the stack
objectStack.Pop();
break;
case '"':// string boundary
string tokenValue="";
i++; // move to next char
// just loop through until the next quote mark storing the string
while (JSON[i]!='"')
{
tokenValue+=JSON[i++];
}
// ok we've got a string, if we've got an array on the top of the stack then we store it
if (objectStack.Peek().ToString()=="System.Collections.ArrayList")
{
((ArrayList)objectStack.Peek()).Add(tokenValue);
}
else if (currentKey==null) // no key stored and its not an array this must be a key so store it
{
currentKey = tokenValue;
}
else
{
// we have a key so lets store this value
((Hashtable)objectStack.Peek()).Add(currentKey,tokenValue);
// now lets clear the key, we're done with it and moving on
currentKey=null;
}
break;
case ':':// key : value separator
// just ignore
break;
case ' ':// spaces
// just ignore
break;
case '[': // array start
ArrayList currentArray = new ArrayList();
if (objectStack.Peek().ToString()=="System.Collections.ArrayList")
{
((ArrayList)objectStack.Peek()).Add(currentArray);
}
else
{
((Hashtable)objectStack.Peek()).Add(currentKey,currentArray);
// clear the key
currentKey=null;
}
objectStack.Push(currentArray);
break;
case ',':// seperator
// just ignore
break;
case ']'://Array end
// pop the array off the stack
objectStack.Pop();
break;
case 't': // we've found a character start not in quotes, it must be a boolean true
if (objectStack.Peek().ToString()=="System.Collections.ArrayList")
{
((ArrayList)objectStack.Peek()).Add(true);
}
else
{
((Hashtable)objectStack.Peek()).Add(currentKey,true);
}
//advance the counter to the letter 'e'
i = i+3;
break;
case 'f': // we've found a character start not in quotes, it must be a boolean false
if (objectStack.Peek().ToString()=="System.Collections.ArrayList")
{
((ArrayList)objectStack.Peek()).Add(false);
}
else
{
((Hashtable)objectStack.Peek()).Add(currentKey,false);
}
//advance the counter to the letter 'e'
i = i+4;
break;
default:
// ok here we're catching all numeric types int,double,long we might want to spit these up mr accurately
// but for now we'll just do them as strings
string numberValue="";
// just loop through until the next known marker quote mark storing the string
while (JSON[i] != '"' && JSON[i] != ',' && JSON[i] != ']' && JSON[i] != '}' && JSON[i] != ' ')
{
numberValue+=""+JSON[i++];
}
i--; // we want to process this caracter that marked the end of this string in the main loop
// ok we've got a string, if we've got an array on the top of the stack then we store it
if (objectStack.Peek().ToString()=="System.Collections.ArrayList")
{
((ArrayList)objectStack.Peek()).Add(numberValue);
}
else
{
// we have a key so lets store this value
((Hashtable)objectStack.Peek()).Add(currentKey,numberValue);
// now lets clear the key, we're done with it and moving on
currentKey=null;
}
break;
}
}
}
catch(Exception)
{
LSLError("osParseJSON: The JSON string is not valid " + JSON);
}
return jsondata;
}
internal void LSLError(string msg)
{
throw new Exception("LSL Runtime Error: " + msg);
}
}
}

View File

@ -1,78 +0,0 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using OpenSim.Region.ScriptEngine.Shared;
namespace OpenSim.Region.ScriptEngine.Common
{
public interface OSSL_BuilIn_Commands_Interface
{
//OpenSim functions
string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer);
string osSetDynamicTextureURLBlend(string dynamicID, string contentType, string url, string extraParams,
int timer, int alpha);
string osSetDynamicTextureData(string dynamicID, string contentType, string data, string extraParams, int timer);
string osSetDynamicTextureDataBlend(string dynamicID, string contentType, string data, string extraParams,
int timer, int alpha);
double osTerrainGetHeight(int x, int y);
int osTerrainSetHeight(int x, int y, double val);
int osRegionRestart(double seconds);
void osRegionNotice(string msg);
bool osConsoleCommand(string Command);
void osSetParcelMediaURL(string url);
void osSetPrimFloatOnWater(int floatYN);
// Teleport commands
void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat);
void osTeleportAgent(string agent, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat);
// Animation commands
void osAvatarPlayAnimation(string avatar, string animation);
void osAvatarStopAnimation(string avatar, string animation);
//texture draw functions
string osMovePen(string drawList, int x, int y);
string osDrawLine(string drawList, int startX, int startY, int endX, int endY);
string osDrawLine(string drawList, int endX, int endY);
string osDrawText(string drawList, string text);
string osDrawEllipse(string drawList, int width, int height);
string osDrawRectangle(string drawList, int width, int height);
string osDrawFilledRectangle(string drawList, int width, int height);
string osSetFontSize(string drawList, int fontSize);
string osSetPenSize(string drawList, int penSize);
string osSetPenColour(string drawList, string colour);
string osDrawImage(string drawList, int width, int height, string imageUrl);
void osSetStateEvents(int events);
void osOpenRemoteDataChannel(string channel);
System.Collections.Hashtable osParseJSON(string JSON);
string osGetScriptEngineName();
void osSetParcelMediaTime(double time);
}
}

View File

@ -31,6 +31,8 @@ using System.Threading;
using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase; using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase;
using OpenSim.Region.ScriptEngine.Shared; using OpenSim.Region.ScriptEngine.Shared;
using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces;
using OpenSim.Region.ScriptEngine.Interfaces;
using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
@ -42,7 +44,7 @@ using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
namespace OpenSim.Region.ScriptEngine.Common namespace OpenSim.Region.ScriptEngine.Common
{ {
public class ScriptBaseClass : MarshalByRefObject, LSL_BuiltIn_Commands_Interface, OSSL_BuilIn_Commands_Interface, IScript public class ScriptBaseClass : MarshalByRefObject, IScript
{ {
// //
// Included as base for any LSL-script that is compiled. // Included as base for any LSL-script that is compiled.
@ -71,6 +73,19 @@ namespace OpenSim.Region.ScriptEngine.Common
private Executor m_Exec; private Executor m_Exec;
private string m_state = "default";
public String State
{
get { return m_state; }
set { m_state = value; }
}
public void state(string newState)
{
m_LSL_Functions.state(newState);
}
ExecutorBase IScript.Exec ExecutorBase IScript.Exec
{ {
get get
@ -82,7 +97,8 @@ namespace OpenSim.Region.ScriptEngine.Common
} }
public BuilIn_Commands m_LSL_Functions; public ILSL_Api m_LSL_Functions;
public IOSSL_Api m_OSSL_Functions;
private string _Source = String.Empty; private string _Source = String.Empty;
public string Source public string Source
{ {
@ -104,20 +120,12 @@ namespace OpenSim.Region.ScriptEngine.Common
{ {
} }
public string State public void InitApi(string api, IScriptApi LSL_Functions)
{ {
get { return m_LSL_Functions.State; } if (api == "LSL")
set { m_LSL_Functions.State = value; } m_LSL_Functions = (ILSL_Api)LSL_Functions;
} if (api == "OSSL")
public void state(string state) m_OSSL_Functions = (IOSSL_Api)LSL_Functions;
{
State = state;
}
public void Start(BuilIn_Commands LSL_Functions)
{
m_LSL_Functions = LSL_Functions;
//m_log.Info(ScriptEngineName, "LSL_BaseClass.Start() called."); //m_log.Info(ScriptEngineName, "LSL_BaseClass.Start() called.");
@ -142,9 +150,9 @@ namespace OpenSim.Region.ScriptEngine.Common
public OSSL_BuilIn_Commands.OSSLPrim Prim { // public OSSL_BuilIn_Commands.OSSLPrim Prim {
get { return m_LSL_Functions.Prim; } // get { return m_LSL_Functions.Prim; }
} // }
// //
@ -153,10 +161,10 @@ namespace OpenSim.Region.ScriptEngine.Common
// They are only forwarders to LSL_BuiltIn_Commands.cs // They are only forwarders to LSL_BuiltIn_Commands.cs
// //
public ICommander GetCommander(string name) // public ICommander GetCommander(string name)
{ // {
return m_LSL_Functions.GetCommander(name); // return m_LSL_Functions.GetCommander(name);
} // }
public LSL_Integer llAbs(int i) public LSL_Integer llAbs(int i)
{ {
@ -1874,84 +1882,84 @@ namespace OpenSim.Region.ScriptEngine.Common
public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams,
int timer) int timer)
{ {
return m_LSL_Functions.osSetDynamicTextureURL(dynamicID, contentType, url, extraParams, timer); return m_OSSL_Functions.osSetDynamicTextureURL(dynamicID, contentType, url, extraParams, timer);
} }
public string osSetDynamicTextureData(string dynamicID, string contentType, string data, string extraParams, public string osSetDynamicTextureData(string dynamicID, string contentType, string data, string extraParams,
int timer) int timer)
{ {
return m_LSL_Functions.osSetDynamicTextureData(dynamicID, contentType, data, extraParams, timer); return m_OSSL_Functions.osSetDynamicTextureData(dynamicID, contentType, data, extraParams, timer);
} }
public string osSetDynamicTextureURLBlend(string dynamicID, string contentType, string url, string extraParams, public string osSetDynamicTextureURLBlend(string dynamicID, string contentType, string url, string extraParams,
int timer, int alpha) int timer, int alpha)
{ {
return m_LSL_Functions.osSetDynamicTextureURLBlend(dynamicID, contentType, url, extraParams, timer, alpha); return m_OSSL_Functions.osSetDynamicTextureURLBlend(dynamicID, contentType, url, extraParams, timer, alpha);
} }
public string osSetDynamicTextureDataBlend(string dynamicID, string contentType, string data, string extraParams, public string osSetDynamicTextureDataBlend(string dynamicID, string contentType, string data, string extraParams,
int timer, int alpha) int timer, int alpha)
{ {
return m_LSL_Functions.osSetDynamicTextureDataBlend(dynamicID, contentType, data, extraParams, timer, alpha); return m_OSSL_Functions.osSetDynamicTextureDataBlend(dynamicID, contentType, data, extraParams, timer, alpha);
} }
public double osTerrainGetHeight(int x, int y) public double osTerrainGetHeight(int x, int y)
{ {
return m_LSL_Functions.osTerrainGetHeight(x, y); return m_OSSL_Functions.osTerrainGetHeight(x, y);
} }
public int osTerrainSetHeight(int x, int y, double val) public int osTerrainSetHeight(int x, int y, double val)
{ {
return m_LSL_Functions.osTerrainSetHeight(x, y, val); return m_OSSL_Functions.osTerrainSetHeight(x, y, val);
} }
public int osRegionRestart(double seconds) public int osRegionRestart(double seconds)
{ {
return m_LSL_Functions.osRegionRestart(seconds); return m_OSSL_Functions.osRegionRestart(seconds);
} }
public void osRegionNotice(string msg) public void osRegionNotice(string msg)
{ {
m_LSL_Functions.osRegionNotice(msg); m_OSSL_Functions.osRegionNotice(msg);
} }
public bool osConsoleCommand(string Command) public bool osConsoleCommand(string Command)
{ {
return m_LSL_Functions.osConsoleCommand(Command); return m_OSSL_Functions.osConsoleCommand(Command);
} }
public void osSetParcelMediaURL(string url) public void osSetParcelMediaURL(string url)
{ {
m_LSL_Functions.osSetParcelMediaURL(url); m_OSSL_Functions.osSetParcelMediaURL(url);
} }
public void osSetPrimFloatOnWater(int floatYN) public void osSetPrimFloatOnWater(int floatYN)
{ {
m_LSL_Functions.osSetPrimFloatOnWater(floatYN); m_OSSL_Functions.osSetPrimFloatOnWater(floatYN);
} }
// Teleport Functions // Teleport Functions
public void osTeleportAgent(string agent, string regionName, LSL_Vector position, LSL_Vector lookat) public void osTeleportAgent(string agent, string regionName, LSL_Vector position, LSL_Vector lookat)
{ {
m_LSL_Functions.osTeleportAgent(agent, regionName, position, lookat); m_OSSL_Functions.osTeleportAgent(agent, regionName, position, lookat);
} }
public void osTeleportAgent(string agent, LSL_Vector position, LSL_Vector lookat) public void osTeleportAgent(string agent, LSL_Vector position, LSL_Vector lookat)
{ {
m_LSL_Functions.osTeleportAgent(agent, position, lookat); m_OSSL_Functions.osTeleportAgent(agent, position, lookat);
} }
// Animation Functions // Animation Functions
public void osAvatarPlayAnimation(string avatar, string animation) public void osAvatarPlayAnimation(string avatar, string animation)
{ {
m_LSL_Functions.osAvatarPlayAnimation(avatar, animation); m_OSSL_Functions.osAvatarPlayAnimation(avatar, animation);
} }
public void osAvatarStopAnimation(string avatar, string animation) public void osAvatarStopAnimation(string avatar, string animation)
{ {
m_LSL_Functions.osAvatarStopAnimation(avatar, animation); m_OSSL_Functions.osAvatarStopAnimation(avatar, animation);
} }
@ -1959,83 +1967,83 @@ namespace OpenSim.Region.ScriptEngine.Common
public string osMovePen(string drawList, int x, int y) public string osMovePen(string drawList, int x, int y)
{ {
return m_LSL_Functions.osMovePen(drawList, x, y); return m_OSSL_Functions.osMovePen(drawList, x, y);
} }
public string osDrawLine(string drawList, int startX, int startY, int endX, int endY) public string osDrawLine(string drawList, int startX, int startY, int endX, int endY)
{ {
return m_LSL_Functions.osDrawLine(drawList, startX, startY, endX, endY); return m_OSSL_Functions.osDrawLine(drawList, startX, startY, endX, endY);
} }
public string osDrawLine(string drawList, int endX, int endY) public string osDrawLine(string drawList, int endX, int endY)
{ {
return m_LSL_Functions.osDrawLine(drawList, endX, endY); return m_OSSL_Functions.osDrawLine(drawList, endX, endY);
} }
public string osDrawText(string drawList, string text) public string osDrawText(string drawList, string text)
{ {
return m_LSL_Functions.osDrawText(drawList, text); return m_OSSL_Functions.osDrawText(drawList, text);
} }
public string osDrawEllipse(string drawList, int width, int height) public string osDrawEllipse(string drawList, int width, int height)
{ {
return m_LSL_Functions.osDrawEllipse(drawList, width, height); return m_OSSL_Functions.osDrawEllipse(drawList, width, height);
} }
public string osDrawRectangle(string drawList, int width, int height) public string osDrawRectangle(string drawList, int width, int height)
{ {
return m_LSL_Functions.osDrawRectangle(drawList, width, height); return m_OSSL_Functions.osDrawRectangle(drawList, width, height);
} }
public string osDrawFilledRectangle(string drawList, int width, int height) public string osDrawFilledRectangle(string drawList, int width, int height)
{ {
return m_LSL_Functions.osDrawFilledRectangle(drawList, width, height); return m_OSSL_Functions.osDrawFilledRectangle(drawList, width, height);
} }
public string osSetFontSize(string drawList, int fontSize) public string osSetFontSize(string drawList, int fontSize)
{ {
return m_LSL_Functions.osSetFontSize(drawList, fontSize); return m_OSSL_Functions.osSetFontSize(drawList, fontSize);
} }
public string osSetPenSize(string drawList, int penSize) public string osSetPenSize(string drawList, int penSize)
{ {
return m_LSL_Functions.osSetPenSize(drawList, penSize); return m_OSSL_Functions.osSetPenSize(drawList, penSize);
} }
public string osSetPenColour(string drawList, string colour) public string osSetPenColour(string drawList, string colour)
{ {
return m_LSL_Functions.osSetPenColour(drawList, colour); return m_OSSL_Functions.osSetPenColour(drawList, colour);
} }
public string osDrawImage(string drawList, int width, int height, string imageUrl) public string osDrawImage(string drawList, int width, int height, string imageUrl)
{ {
return m_LSL_Functions.osDrawImage(drawList, width, height, imageUrl); return m_OSSL_Functions.osDrawImage(drawList, width, height, imageUrl);
} }
public void osSetStateEvents(int events) public void osSetStateEvents(int events)
{ {
m_LSL_Functions.osSetStateEvents(events); m_OSSL_Functions.osSetStateEvents(events);
} }
public void osOpenRemoteDataChannel(string channel) // public void osOpenRemoteDataChannel(string channel)
{ // {
m_LSL_Functions.osOpenRemoteDataChannel(channel); // m_OSSL_Functions.osOpenRemoteDataChannel(channel);
} // }
public string osGetScriptEngineName() public string osGetScriptEngineName()
{ {
return m_LSL_Functions.osGetScriptEngineName(); return m_OSSL_Functions.osGetScriptEngineName();
} }
public System.Collections.Hashtable osParseJSON(string JSON) public System.Collections.Hashtable osParseJSON(string JSON)
{ {
return m_LSL_Functions.osParseJSON(JSON); return m_OSSL_Functions.osParseJSON(JSON);
} }
//for testing purposes only //for testing purposes only
public void osSetParcelMediaTime(double time) public void osSetParcelMediaTime(double time)
{ {
m_LSL_Functions.osSetParcelMediaTime(time); m_OSSL_Functions.osSetParcelMediaTime(time);
} }
// LSL CONSTANTS // LSL CONSTANTS

View File

@ -66,6 +66,11 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
private bool m_enabled = false; private bool m_enabled = false;
private bool m_hookUpToServer = false; private bool m_hookUpToServer = false;
public IConfig Config
{
get { return ScriptConfigSource; }
}
/// <summary> /// <summary>
/// How many seconds between re-reading config-file. 0 = never. ScriptEngine will try to adjust to new config changes. /// How many seconds between re-reading config-file. 0 = never. ScriptEngine will try to adjust to new config changes.
/// </summary> /// </summary>
@ -120,6 +125,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
m_EventManager = new EventManager(this, HookUpToServer); m_EventManager = new EventManager(this, HookUpToServer);
// We need to start it // We need to start it
m_ScriptManager = newScriptManager; m_ScriptManager = newScriptManager;
m_ScriptManager.Setup();
m_AppDomainManager = new AppDomainManager(this); m_AppDomainManager = new AppDomainManager(this);
if (m_MaintenanceThread == null) if (m_MaintenanceThread == null)
m_MaintenanceThread = new MaintenanceThread(); m_MaintenanceThread = new MaintenanceThread();
@ -229,23 +235,88 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
public void SetState(UUID itemID, string state) public void SetState(UUID itemID, string state)
{ {
uint localID = m_ScriptManager.GetLocalID(itemID);
if (localID == 0)
return;
IScript Script = m_ScriptManager.GetScript(localID, itemID);
if (Script == null)
return;
string currentState = Script.State;
if (currentState != state)
{
try
{
m_EventManager.state_exit(localID);
}
catch (AppDomainUnloadedException)
{
Console.WriteLine("[SCRIPT]: state change called when script was unloaded. Nothing to worry about, but noting the occurance");
}
Script.State = state;
try
{
int eventFlags = m_ScriptManager.GetStateEventFlags(localID, itemID);
SceneObjectPart part = m_Scene.GetSceneObjectPart(itemID);
if (part != null)
part.SetScriptEvents(itemID, eventFlags);
m_EventManager.state_entry(localID);
}
catch (AppDomainUnloadedException)
{
Console.WriteLine("[SCRIPT]: state change called when script was unloaded. Nothing to worry about, but noting the occurance");
}
}
} }
public bool GetScriptState(UUID itemID) public bool GetScriptState(UUID itemID)
{ {
return true; uint localID = m_ScriptManager.GetLocalID(itemID);
if (localID == 0)
return false;
IScript script = m_ScriptManager.GetScript(localID, itemID);
if (script == null)
return false;
return script.Exec.Running?true:false;
} }
public void SetScriptState(UUID itemID, bool state) public void SetScriptState(UUID itemID, bool state)
{ {
uint localID = m_ScriptManager.GetLocalID(itemID);
if (localID == 0)
return;
IScript script = m_ScriptManager.GetScript(localID, itemID);
if (script == null)
return;
script.Exec.Running = state;
} }
public void ApiResetScript(UUID itemID) public void ApiResetScript(UUID itemID)
{ {
uint localID = m_ScriptManager.GetLocalID(itemID);
if (localID == 0)
return;
m_ScriptManager.ResetScript(localID, itemID);
} }
public void ResetScript(UUID itemID) public void ResetScript(UUID itemID)
{ {
uint localID = m_ScriptManager.GetLocalID(itemID);
if (localID == 0)
return;
m_ScriptManager.ResetScript(localID, itemID);
} }
} }
} }

View File

@ -120,12 +120,15 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
m_scriptEngine = scriptEngine; m_scriptEngine = scriptEngine;
} }
public abstract void Initialize(); public abstract void Initialize();
public void Setup()
{
ReadConfig();
Initialize();
}
public void Start() public void Start()
{ {
m_started = true; m_started = true;
ReadConfig();
Initialize();
AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve); AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
@ -225,6 +228,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
{ {
if (LUQueue.Count > 0) if (LUQueue.Count > 0)
{ {
m_scriptEngine.Log.InfoFormat("[{0}]: Loading script", m_scriptEngine.ScriptEngineName);
LUStruct item = LUQueue.Dequeue(); LUStruct item = LUQueue.Dequeue();
if (item.Action == LUType.Unload) if (item.Action == LUType.Unload)
@ -281,6 +285,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
ls.startParam = startParam; ls.startParam = startParam;
ls.postOnRez = postOnRez; ls.postOnRez = postOnRez;
LUQueue.Enqueue(ls); LUQueue.Enqueue(ls);
m_scriptEngine.Log.InfoFormat("[{0}]: Queued script for load", m_scriptEngine.ScriptEngineName);
} }
} }

View File

@ -132,10 +132,16 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
// this private copy will contain Read-Only FullitemID so that it can bring that on to the server whenever needed. // this private copy will contain Read-Only FullitemID so that it can bring that on to the server whenever needed.
BuilIn_Commands LSLB = new BuilIn_Commands(m_scriptEngine, m_host, localID, itemID); // OSSL_BuilIn_Commands LSLB = new OSSL_BuilIn_Commands(m_scriptEngine, m_host, localID, itemID);
LSL_Api LSL = new LSL_Api();
OSSL_Api OSSL = new OSSL_Api();
LSL.Initialize(m_scriptEngine, m_host, localID, itemID);
OSSL.Initialize(m_scriptEngine, m_host, localID, itemID);
// Start the script - giving it BuiltIns // Start the script - giving it BuiltIns
CompiledScript.Start(LSLB); CompiledScript.InitApi("LSL", LSL);
CompiledScript.InitApi("OSSL", OSSL);
// Fire the first start-event // Fire the first start-event
int eventFlags = m_scriptEngine.m_ScriptManager.GetStateEventFlags(localID, itemID); int eventFlags = m_scriptEngine.m_ScriptManager.GetStateEventFlags(localID, itemID);

View File

@ -63,5 +63,8 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
void SetState(UUID itemID, string newState); void SetState(UUID itemID, string newState);
void ApiResetScript(UUID itemID); void ApiResetScript(UUID itemID);
void ResetScript(UUID itemID); void ResetScript(UUID itemID);
IConfig Config { get; }
string ScriptEngineName { get; }
ILog Log { get; }
} }
} }

View File

@ -38,6 +38,6 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
// Each API has an identifier, which is used to load the // Each API has an identifier, which is used to load the
// proper runtime assembly at load time. // proper runtime assembly at load time.
// //
void Initialize(IScriptEngine engine, SceneObjectPart part, uint localID, UUID item); void Initialize(IEventReceiver engine, SceneObjectPart part, uint localID, UUID item);
} }
} }

View File

@ -42,10 +42,6 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
/// </summary> /// </summary>
public interface IScriptEngine : IEventReceiver public interface IScriptEngine : IEventReceiver
{ {
IConfig Config { get; }
ILog Log { get; }
string ScriptEngineName { get; }
/// <summary> /// <summary>
/// Queue an event for execution /// Queue an event for execution
/// </summary> /// </summary>

View File

@ -100,7 +100,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
[Serializable] [Serializable]
public class OSSL_Api : MarshalByRefObject, IOSSL_Api, IScriptApi public class OSSL_Api : MarshalByRefObject, IOSSL_Api, IScriptApi
{ {
internal IScriptEngine m_ScriptEngine; internal IEventReceiver m_ScriptEngine;
internal SceneObjectPart m_host; internal SceneObjectPart m_host;
internal uint m_localID; internal uint m_localID;
internal UUID m_itemID; internal UUID m_itemID;
@ -110,7 +110,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
internal float m_ScriptDistanceFactor = 1.0f; internal float m_ScriptDistanceFactor = 1.0f;
internal Dictionary<string, List<UUID> > m_FunctionPerms = new Dictionary<string, List<UUID> >(); internal Dictionary<string, List<UUID> > m_FunctionPerms = new Dictionary<string, List<UUID> >();
public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) public void Initialize(IEventReceiver ScriptEngine, SceneObjectPart host, uint localID, UUID itemID)
{ {
m_ScriptEngine = ScriptEngine; m_ScriptEngine = ScriptEngine;
m_host = host; m_host = host;

View File

@ -25,6 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
using System.Collections; using System.Collections;
using OpenSim.Region.ScriptEngine.Interfaces;
namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
{ {
public interface IOSSL_Api public interface IOSSL_Api

View File

@ -443,6 +443,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
new DetectParams[0])); new DetectParams[0]));
PostEvent(new EventParams("state_entry", new Object[0], PostEvent(new EventParams("state_entry", new Object[0],
new DetectParams[0])); new DetectParams[0]));
throw new EventAbortException();
} }
public void PostEvent(EventParams data) public void PostEvent(EventParams data)
@ -733,6 +735,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
m_SaveState = true; m_SaveState = true;
PostEvent(new EventParams("state_entry", PostEvent(new EventParams("state_entry",
new Object[0], new DetectParams[0])); new Object[0], new DetectParams[0]));
throw new EventAbortException();
} }
} }

View File

@ -1960,6 +1960,7 @@
<Reference name="OpenSim.Framework.Console"/> <Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Region.ScriptEngine.Shared"/> <Reference name="OpenSim.Region.ScriptEngine.Shared"/>
<Reference name="OpenSim.Region.ScriptEngine.Shared.Api"/> <Reference name="OpenSim.Region.ScriptEngine.Shared.Api"/>
<Reference name="OpenSim.Region.ScriptEngine.Shared.Api.Runtime"/>
<Reference name="Nini.dll" /> <Reference name="Nini.dll" />
<Reference name="RAIL.dll"/> <Reference name="RAIL.dll"/>
<Reference name="OpenSim.Framework.Console"/> <Reference name="OpenSim.Framework.Console"/>