mirror of
https://github.com/opensim/opensim.git
synced 2026-05-15 19:35:41 +08:00
Merge branch 'master' into careminster
Conflicts: .gitignore OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs prebuild.xml runprebuild.bat
This commit is contained in:
@@ -6766,6 +6766,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
ps.BurstRate = 0.1f;
|
||||
ps.PartMaxAge = 10.0f;
|
||||
ps.BurstPartCount = 1;
|
||||
ps.BlendFuncSource = ScriptBaseClass.PSYS_PART_BF_SOURCE_ALPHA;
|
||||
ps.BlendFuncDest = ScriptBaseClass.PSYS_PART_BF_ONE_MINUS_SOURCE_ALPHA;
|
||||
ps.PartStartGlow = 0.0f;
|
||||
ps.PartEndGlow = 0.0f;
|
||||
|
||||
return ps;
|
||||
}
|
||||
|
||||
@@ -6800,6 +6805,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
LSL_Vector tempv = new LSL_Vector();
|
||||
|
||||
float tempf = 0;
|
||||
int tmpi = 0;
|
||||
|
||||
for (int i = 0; i < rules.Length; i += 2)
|
||||
{
|
||||
@@ -6858,7 +6864,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
break;
|
||||
|
||||
case (int)ScriptBaseClass.PSYS_SRC_PATTERN:
|
||||
int tmpi = (int)rules.GetLSLIntegerItem(i + 1);
|
||||
tmpi = (int)rules.GetLSLIntegerItem(i + 1);
|
||||
prules.Pattern = (Primitive.ParticleSystem.SourcePattern)tmpi;
|
||||
break;
|
||||
|
||||
@@ -6878,6 +6884,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
prules.PartFlags &= 0xFFFFFFFD; // Make sure new angle format is off.
|
||||
break;
|
||||
|
||||
case (int)ScriptBaseClass.PSYS_PART_BLEND_FUNC_SOURCE:
|
||||
tmpi = (int)rules.GetLSLIntegerItem(i + 1);
|
||||
prules.BlendFuncSource = (byte)tmpi;
|
||||
break;
|
||||
|
||||
case (int)ScriptBaseClass.PSYS_PART_BLEND_FUNC_DEST:
|
||||
tmpi = (int)rules.GetLSLIntegerItem(i + 1);
|
||||
prules.BlendFuncDest = (byte)tmpi;
|
||||
break;
|
||||
|
||||
case (int)ScriptBaseClass.PSYS_PART_START_GLOW:
|
||||
tempf = (float)rules.GetLSLFloatItem(i + 1);
|
||||
prules.PartStartGlow = (float)tempf;
|
||||
break;
|
||||
|
||||
case (int)ScriptBaseClass.PSYS_PART_END_GLOW:
|
||||
tempf = (float)rules.GetLSLFloatItem(i + 1);
|
||||
prules.PartEndGlow = (float)tempf;
|
||||
break;
|
||||
|
||||
case (int)ScriptBaseClass.PSYS_SRC_TEXTURE:
|
||||
prules.Texture = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, rules.GetLSLStringItem(i + 1));
|
||||
break;
|
||||
|
||||
@@ -368,7 +368,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||
|
||||
Vector3 ZeroVector = new Vector3(0, 0, 0);
|
||||
|
||||
bool nameSearch = (ts.name != null && ts.name != "");
|
||||
bool nameSearch = !string.IsNullOrEmpty(ts.name);
|
||||
|
||||
foreach (EntityBase ent in Entities)
|
||||
{
|
||||
@@ -608,7 +608,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||
return sensedEntities;
|
||||
senseEntity(sp);
|
||||
}
|
||||
else if (ts.name != null && ts.name != "")
|
||||
else if (!string.IsNullOrEmpty(ts.name))
|
||||
{
|
||||
ScenePresence sp;
|
||||
// Try lookup by name will return if/when found
|
||||
|
||||
@@ -618,7 +618,7 @@ namespace SecondLife
|
||||
// error log.
|
||||
if (results.Errors.Count > 0)
|
||||
{
|
||||
if (!retried && (results.Errors[0].FileName == null || results.Errors[0].FileName == String.Empty) &&
|
||||
if (!retried && string.IsNullOrEmpty(results.Errors[0].FileName) &&
|
||||
results.Errors[0].Line == 0)
|
||||
{
|
||||
// System.Console.WriteLine("retrying failed compilation");
|
||||
|
||||
@@ -0,0 +1,247 @@
|
||||
/*
|
||||
* 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 OpenSimulator 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.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
using NUnit.Framework;
|
||||
using OpenSim.Region.ScriptEngine.Shared.CodeTools;
|
||||
using OpenSim.Tests.Common;
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
||||
{
|
||||
public class LSL_EventTests : OpenSimTestCase
|
||||
{
|
||||
CSCodeGenerator m_cg = new CSCodeGenerator();
|
||||
|
||||
[Test]
|
||||
public void TestBadEvent()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// TestHelpers.EnableLogging();
|
||||
|
||||
TestCompile("default { bad() {} }", true);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestMovingEndEvent()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// TestHelpers.EnableLogging();
|
||||
|
||||
TestVoidArgEvent("moving_end");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestMovingStartEvent()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// TestHelpers.EnableLogging();
|
||||
|
||||
TestVoidArgEvent("moving_start");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestNoSensorEvent()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// TestHelpers.EnableLogging();
|
||||
|
||||
TestVoidArgEvent("no_sensor");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestNotAtRotTargetEvent()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// TestHelpers.EnableLogging();
|
||||
|
||||
TestVoidArgEvent("not_at_rot_target");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestNotAtTargetEvent()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// TestHelpers.EnableLogging();
|
||||
|
||||
TestVoidArgEvent("not_at_target");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestStateEntryEvent()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// TestHelpers.EnableLogging();
|
||||
|
||||
TestVoidArgEvent("state_entry");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestStateExitEvent()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// TestHelpers.EnableLogging();
|
||||
|
||||
TestVoidArgEvent("state_exit");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestTimerEvent()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// TestHelpers.EnableLogging();
|
||||
|
||||
TestVoidArgEvent("timer");
|
||||
}
|
||||
|
||||
private void TestVoidArgEvent(string eventName)
|
||||
{
|
||||
TestCompile("default { " + eventName + "() {} }", false);
|
||||
TestCompile("default { " + eventName + "(integer n) {} }", true);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestChangedEvent()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// TestHelpers.EnableLogging();
|
||||
|
||||
TestIntArgEvent("changed");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCollisionEvent()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// TestHelpers.EnableLogging();
|
||||
|
||||
TestIntArgEvent("collision");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCollisionStartEvent()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// TestHelpers.EnableLogging();
|
||||
|
||||
TestIntArgEvent("collision_start");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCollisionEndEvent()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// TestHelpers.EnableLogging();
|
||||
|
||||
TestIntArgEvent("collision_end");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestOnRezEvent()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// TestHelpers.EnableLogging();
|
||||
|
||||
TestIntArgEvent("on_rez");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRunTimePermissionsEvent()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// TestHelpers.EnableLogging();
|
||||
|
||||
TestIntArgEvent("run_time_permissions");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSensorEvent()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// TestHelpers.EnableLogging();
|
||||
|
||||
TestIntArgEvent("sensor");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestTouchEvent()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// TestHelpers.EnableLogging();
|
||||
|
||||
TestIntArgEvent("touch");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestTouchStartEvent()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// TestHelpers.EnableLogging();
|
||||
|
||||
TestIntArgEvent("touch_start");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestTouchEndEvent()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// TestHelpers.EnableLogging();
|
||||
|
||||
TestIntArgEvent("touch_end");
|
||||
}
|
||||
|
||||
private void TestIntArgEvent(string eventName)
|
||||
{
|
||||
TestCompile("default { " + eventName + "(integer n) {} }", false);
|
||||
TestCompile("default { " + eventName + "{{}} }", true);
|
||||
TestCompile("default { " + eventName + "(string s) {{}} }", true);
|
||||
TestCompile("default { " + eventName + "(integer n, integer o) {{}} }", true);
|
||||
}
|
||||
|
||||
private void TestCompile(string script, bool expectException)
|
||||
{
|
||||
bool gotException = false;
|
||||
Exception ge = null;
|
||||
|
||||
try
|
||||
{
|
||||
m_cg.Convert(script);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
gotException = true;
|
||||
ge = e;
|
||||
}
|
||||
|
||||
Assert.That(
|
||||
gotException,
|
||||
Is.EqualTo(expectException),
|
||||
"Failed on {0}, exception {1}", script, ge != null ? ge.ToString() : "n/a");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user