Merge branch 'master' of ssh://diva@opensimulator.org/var/git/opensim

soprefactor
Diva Canto 2010-06-11 12:48:06 -07:00
commit 556e91d33c
8 changed files with 70 additions and 34 deletions

View File

@ -54,13 +54,13 @@ using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
namespace OpenSim.Region.ScriptEngine.Shared.Api namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
[Serializable] [Serializable]
public class CM_Api : MarshalByRefObject, ICM_Api, IScriptApi public class LS_Api : MarshalByRefObject, ILS_Api, IScriptApi
{ {
internal IScriptEngine m_ScriptEngine; internal IScriptEngine 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;
internal bool m_CMFunctionsEnabled = false; internal bool m_LSFunctionsEnabled = false;
internal IScriptModuleComms m_comms = null; internal IScriptModuleComms m_comms = null;
public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID)
@ -70,12 +70,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_localID = localID; m_localID = localID;
m_itemID = itemID; m_itemID = itemID;
if (m_ScriptEngine.Config.GetBoolean("AllowCareminsterFunctions", false)) if (m_ScriptEngine.Config.GetBoolean("AllowLightShareFunctions", false))
m_CMFunctionsEnabled = true; m_LSFunctionsEnabled = true;
m_comms = m_ScriptEngine.World.RequestModuleInterface<IScriptModuleComms>(); m_comms = m_ScriptEngine.World.RequestModuleInterface<IScriptModuleComms>();
if (m_comms == null) if (m_comms == null)
m_CMFunctionsEnabled = false; m_LSFunctionsEnabled = false;
} }
public override Object InitializeLifetimeService() public override Object InitializeLifetimeService()
@ -100,7 +100,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
//Dumps an error message on the debug console. //Dumps an error message on the debug console.
// //
internal void CMShoutError(string message) internal void LSShoutError(string message)
{ {
if (message.Length > 1023) if (message.Length > 1023)
message = message.Substring(0, 1023); message = message.Substring(0, 1023);
@ -116,11 +116,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// Get the current Windlight scene /// Get the current Windlight scene
/// </summary> /// </summary>
/// <returns>List of windlight parameters</returns> /// <returns>List of windlight parameters</returns>
public LSL_List cmGetWindlightScene(LSL_List rules) public LSL_List lsGetWindlightScene(LSL_List rules)
{ {
if (!m_CMFunctionsEnabled) if (!m_LSFunctionsEnabled)
{ {
CMShoutError("Careminster functions are not enabled."); LSShoutError("LightShare functions are not enabled.");
return new LSL_List(); return new LSL_List();
} }
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
@ -440,16 +440,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// </summary> /// </summary>
/// <param name="rules"></param> /// <param name="rules"></param>
/// <returns>success: true or false</returns> /// <returns>success: true or false</returns>
public int cmSetWindlightScene(LSL_List rules) public int lsSetWindlightScene(LSL_List rules)
{ {
if (!m_CMFunctionsEnabled) if (!m_LSFunctionsEnabled)
{ {
CMShoutError("Careminster functions are not enabled."); LSShoutError("LightShare functions are not enabled.");
return 0; return 0;
} }
if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200)
{ {
CMShoutError("cmSetWindlightScene can only be used by estate managers or owners."); LSShoutError("lsSetWindlightScene can only be used by estate managers or owners.");
return 0; return 0;
} }
int success = 0; int success = 0;
@ -462,7 +462,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
} }
else else
{ {
CMShoutError("Windlight module is disabled"); LSShoutError("Windlight module is disabled");
return 0; return 0;
} }
return success; return success;
@ -472,16 +472,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// </summary> /// </summary>
/// <param name="rules"></param> /// <param name="rules"></param>
/// <returns>success: true or false</returns> /// <returns>success: true or false</returns>
public int cmSetWindlightSceneTargeted(LSL_List rules, LSL_Key target) public int lsSetWindlightSceneTargeted(LSL_List rules, LSL_Key target)
{ {
if (!m_CMFunctionsEnabled) if (!m_LSFunctionsEnabled)
{ {
CMShoutError("Careminster functions are not enabled."); LSShoutError("LightShare functions are not enabled.");
return 0; return 0;
} }
if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200)
{ {
CMShoutError("cmSetWindlightSceneTargeted can only be used by estate managers or owners."); LSShoutError("lsSetWindlightSceneTargeted can only be used by estate managers or owners.");
return 0; return 0;
} }
int success = 0; int success = 0;
@ -494,7 +494,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
} }
else else
{ {
CMShoutError("Windlight module is disabled"); LSShoutError("Windlight module is disabled");
return 0; return 0;
} }
return success; return success;

View File

@ -2202,5 +2202,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_LSL_Api.SetPrimitiveParamsEx(prim, rules); m_LSL_Api.SetPrimitiveParamsEx(prim, rules);
} }
/// <summary>
/// Like osGetAgents but returns enough info for a radar
/// </summary>
/// <returns>Strided list of the UUID, position and name of each avatar in the region</returns>
public LSL_List osGetAvatarList()
{
CheckThreatLevel(ThreatLevel.None, "osGetAvatarList");
LSL_List result = new LSL_List();
World.ForEachScenePresence(delegate (ScenePresence avatar)
{
if (avatar != null && avatar.UUID != m_host.OwnerID)
{
if (avatar.IsChildAgent == false)
{
if (avatar.PhysicsActor != null && avatar.PhysicsActor.Position != null)
{
result.Add(avatar.UUID);
result.Add(avatar.PhysicsActor.Position);
result.Add(avatar.Name);
}
}
}
});
return result;
}
} }
} }

View File

@ -38,11 +38,11 @@ using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
{ {
public interface ICM_Api public interface ILS_Api
{ {
// Windlight Functions // Windlight Functions
LSL_List cmGetWindlightScene(LSL_List rules); LSL_List lsGetWindlightScene(LSL_List rules);
int cmSetWindlightScene(LSL_List rules); int lsSetWindlightScene(LSL_List rules);
int cmSetWindlightSceneTargeted(LSL_List rules, key target); int lsSetWindlightSceneTargeted(LSL_List rules, key target);
} }
} }

View File

@ -176,6 +176,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
void osCauseDamage(string avatar, double damage); void osCauseDamage(string avatar, double damage);
LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules); LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules);
void osSetPrimitiveParams(LSL_Key prim, LSL_List rules); void osSetPrimitiveParams(LSL_Key prim, LSL_List rules);
LSL_List osGetAvatarList();
} }
} }

View File

@ -48,29 +48,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
{ {
public partial class ScriptBaseClass : MarshalByRefObject public partial class ScriptBaseClass : MarshalByRefObject
{ {
public ICM_Api m_CM_Functions; public ILS_Api m_LS_Functions;
public void ApiTypeCM(IScriptApi api) public void ApiTypeLS(IScriptApi api)
{ {
if (!(api is ICM_Api)) if (!(api is ILS_Api))
return; return;
m_CM_Functions = (ICM_Api)api; m_LS_Functions = (ILS_Api)api;
} }
public LSL_List cmGetWindlightScene(LSL_List rules) public LSL_List lsGetWindlightScene(LSL_List rules)
{ {
return m_CM_Functions.cmGetWindlightScene(rules); return m_LS_Functions.lsGetWindlightScene(rules);
} }
public int cmSetWindlightScene(LSL_List rules) public int lsSetWindlightScene(LSL_List rules)
{ {
return m_CM_Functions.cmSetWindlightScene(rules); return m_LS_Functions.lsSetWindlightScene(rules);
} }
public int cmSetWindlightSceneTargeted(LSL_List rules, key target) public int lsSetWindlightSceneTargeted(LSL_List rules, key target)
{ {
return m_CM_Functions.cmSetWindlightSceneTargeted(rules, target); return m_LS_Functions.lsSetWindlightSceneTargeted(rules, target);
} }
} }
} }

View File

@ -687,5 +687,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
{ {
m_OSSL_Functions.osSetPrimitiveParams(prim, rules); m_OSSL_Functions.osSetPrimitiveParams(prim, rules);
} }
public LSL_List osGetAvatarList()
{
return m_OSSL_Functions.osGetAvatarList();
}
} }
} }

View File

@ -18,10 +18,10 @@
</DeploymentInformation> </DeploymentInformation>
<Contents> <Contents>
<File name="./CM_Constants.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name="./CM_Constants.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name="./CM_Stub.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name="./Executor.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name="./Executor.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name="./LSL_Constants.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name="./LSL_Constants.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name="./LSL_Stub.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name="./LSL_Stub.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name="./LS_Stub.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name="./MOD_Stub.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name="./MOD_Stub.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name="./OSSL_Stub.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name="./OSSL_Stub.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name="./ScriptBase.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name="./ScriptBase.cs" subtype="Code" buildaction="Compile" dependson="" data="" />

View File

@ -935,6 +935,9 @@
; Allow the use of os* functions (some are dangerous) ; Allow the use of os* functions (some are dangerous)
AllowOSFunctions = false AllowOSFunctions = false
; Allow the user of LightShare functions
AllowLightShareFunctions = false
; Threat level to allow, one of None, VeryLow, Low, Moderate, High, VeryHigh, Severe ; Threat level to allow, one of None, VeryLow, Low, Moderate, High, VeryHigh, Severe
OSFunctionThreatLevel = VeryLow OSFunctionThreatLevel = VeryLow