Merge remote-tracking branch 'upstream/master' into develop

This commit is contained in:
Mike Dickson 2023-03-27 13:09:51 -04:00
commit 89d5d6f713
23 changed files with 320 additions and 191 deletions

63
.github/workflows/msbuildnet6.yml vendored Normal file
View file

@ -0,0 +1,63 @@
name: .msbuildnet6
on:
push:
branches: [ "dotnet6" ]
paths:
- '**.cs'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: dotnet6
- name: shortsha
id: vars
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: preBuild
run: bash ${GITHUB_WORKSPACE}/runprebuild.sh
- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'
- name: Build
id: build
run: dotnet build --configuration Release OpenSim.sln
- name: release
if: success()
run: zip -r LastDotNetBuild.zip bin ThirdPartyLicenses README.md CONTRIBUTORS.txt LICENSE.txt
- uses: softprops/action-gh-release@v1
if: success()
with:
tag_name: r${{ steps.vars.outputs.sha_short }}
name: LastDotNetAutoBuild
files: LastDotNetBuild.zip
- name: report push to irc
if: github.event_name == 'push'
uses: rectalogic/notify-irc@v1
with:
channel: "#opensim-dev"
server: "irc.libera.chat"
nickname: osgithub
message: |
${{ github.actor }} pushed to ${{ github.repository }}
${{ join(github.event.commits.*.message, '\n') }}
dotnet compile: ${{ steps.build.conclusion }}
- name: manual report to irc
if: github.event_name == 'workflow_dispatch'
uses: rectalogic/notify-irc@v1
with:
channel: "#opensim-dev"
server: "irc.libera.chat"
nickname: osgithub
message: |
${{ github.repository }}
dotnet compile: ${{ steps.build.conclusion }}

View file

@ -355,7 +355,7 @@ namespace OpenSim.Data.PGSQL
""ClickAction"" = :ClickAction, ""Material"" = :Material, ""CollisionSound"" = :CollisionSound, ""CollisionSoundVolume"" = :CollisionSoundVolume, ""PassTouches"" = :PassTouches,
""LinkNumber"" = :LinkNumber, ""MediaURL"" = :MediaURL, ""DynAttrs"" = :DynAttrs, ""Vehicle"" = :Vehicle,
""PhysInertia"" = :PhysInertia, ""standtargetx"" =:standtargetx, ""standtargety"" =:standtargety, ""standtargetz"" =:standtargetz,
""sitactrange"" =:sitactrange, ""pseudocrc"" = :pseudocrc
""sitactrange"" =:sitactrange, ""pseudocrc"" = :pseudocrc, ""sopanims"" = :sopanims
WHERE ""UUID"" = :UUID ;
@ -371,7 +371,7 @@ namespace OpenSim.Data.PGSQL
""ForceMouselook"", ""ScriptAccessPin"", ""AllowedDrop"", ""DieAtEdge"", ""SalePrice"", ""SaleType"", ""ColorR"", ""ColorG"", ""ColorB"", ""ColorA"",
""ParticleSystem"", ""ClickAction"", ""Material"", ""CollisionSound"", ""CollisionSoundVolume"", ""PassTouches"", ""LinkNumber"", ""MediaURL"", ""DynAttrs"",
""PhysicsShapeType"", ""Density"", ""GravityModifier"", ""Friction"", ""Restitution"", ""PassCollisions"", ""RotationAxisLocks"", ""RezzerID"" , ""Vehicle"", ""PhysInertia"",
""standtargetx"", ""standtargety"", ""standtargetz"", ""sitactrange"", ""pseudocrc""
""standtargetx"", ""standtargety"", ""standtargetz"", ""sitactrange"", ""pseudocrc"", ""sopanims""
) Select
:UUID, :CreationDate, :Name, :Text, :Description, :SitName, :TouchName, :ObjectFlags, :OwnerMask, :NextOwnerMask, :GroupMask,
:EveryoneMask, :BaseMask, :PositionX, :PositionY, :PositionZ, :GroupPositionX, :GroupPositionY, :GroupPositionZ, :VelocityX,
@ -383,7 +383,7 @@ namespace OpenSim.Data.PGSQL
:ForceMouselook, :ScriptAccessPin, :AllowedDrop, :DieAtEdge, :SalePrice, :SaleType, :ColorR, :ColorG, :ColorB, :ColorA,
:ParticleSystem, :ClickAction, :Material, :CollisionSound, :CollisionSoundVolume, :PassTouches, :LinkNumber, :MediaURL, :DynAttrs,
:PhysicsShapeType, :Density, :GravityModifier, :Friction, :Restitution, :PassCollisions, :RotationAxisLocks, :RezzerID, :Vehicle, :PhysInertia,
:standtargetx, :standtargety, :standtargetz,:sitactrange, :pseudocrc
:standtargetx, :standtargety, :standtargetz,:sitactrange, :pseudocrc, :sopanims
where not EXISTS (SELECT ""UUID"" FROM prims WHERE ""UUID"" = :UUID);
";
@ -1393,6 +1393,19 @@ namespace OpenSim.Data.PGSQL
if(pseudocrc != 0)
prim.PseudoCRC = pseudocrc;
if (!(primRow["sopanims"] is DBNull))
{
byte[] data = (byte[])primRow["sopanims"];
if (data.Length > 0)
prim.DeSerializeAnimations(data);
else
prim.Animations = null;
}
else
{
prim.Animations = null;
}
return prim;
}
@ -1852,6 +1865,11 @@ namespace OpenSim.Data.PGSQL
parameters.Add(_Database.CreateParameter("pseudocrc", prim.PseudoCRC));
if (prim.Animations != null)
parameters.Add(_Database.CreateParameter("sopanims", prim.SerializeAnimations()));
else
parameters.Add(_Database.CreateParameter("sopanims", null));
return parameters.ToArray();
}

View file

@ -1254,4 +1254,10 @@ COMMIT;
:VERSION 51 #----- parcel environment store
BEGIN;
ALTER TABLE `land` ADD COLUMN `environment` varchar default NULL;
COMMIT;
COMMIT;
:VERSION 52 ##----- sop animations and materials
BEGIN;
ALTER TABLE `prims` ADD COLUMN `sopanims` bytea NULL;
ALTER TABLE `primshapes` ADD COLUMN `MatOvrd` bytea NULL;
COMMIT;

View file

@ -399,3 +399,10 @@ COMMIT;
BEGIN;
ALTER TABLE `land` ADD COLUMN `environment` TEXT default NULL;
COMMIT;
:VERSION 40 #----- sop animations and materials
BEGIN;
ALTER TABLE `prims` ADD COLUMN `sopanims` blob default NULL;
ALTER TABLE `primshapes` ADD COLUMN `MatOvrd` blob default NULL;
COMMIT;

View file

@ -1249,6 +1249,7 @@ namespace OpenSim.Data.SQLite
createCol(prims, "sitactrange", typeof(float));
createCol(prims, "pseudocrc", typeof(int));
createCol(prims, "sopanims", typeof(byte[]));
// Add in contraints
prims.PrimaryKey = new DataColumn[] { prims.Columns["UUID"] };
@ -1796,6 +1797,19 @@ namespace OpenSim.Data.SQLite
if(pseudocrc != 0)
prim.PseudoCRC = pseudocrc;
if (!(row["sopanims"] is DBNull))
{
byte[] data = (byte[])row["sopanims"];
if (data.Length > 0)
prim.DeSerializeAnimations(data);
else
prim.Animations = null;
}
else
{
prim.Animations = null;
}
return prim;
}
@ -2184,6 +2198,7 @@ namespace OpenSim.Data.SQLite
row["PhysInertia"] = String.Empty;
row["pseudocrc"] = prim.PseudoCRC;
row["sopanims"] = prim.SerializeAnimations();
}
/// <summary>

View file

@ -132,6 +132,7 @@ namespace OpenSim.Framework
/// <summary>
/// Whether to obscure parcel media URL
/// Now to obscure parcel MOAP
/// </summary>
[XmlIgnore]
public bool ObscureMedia

View file

@ -59,5 +59,6 @@ namespace OpenSim.Framework
public bool SeeAVs;
public bool AnyAVSounds;
public bool GroupAVSounds;
public bool ObscureMOAP;
}
}

View file

@ -153,7 +153,8 @@ namespace OpenSim.Framework
public float dome_offset = 0.96f;
public float dome_radius = 15000f;
public float droplet_radius = 800.0f;
public float ice_level = 0;
public float ice_level = 0f;
public float reflectionProbeAmbiance = 0f;
public float moisture_level = 0;
public float sky_bottom_radius = 6360;
@ -217,6 +218,8 @@ namespace OpenSim.Framework
sunlight_color = map["sunlight_color"];
reflectionProbeAmbiance = 0f;
ViewerEnvironment.convertFromAngles(this, map["sun_angle"], map["east_angle"]);
Name = name;
}
@ -282,6 +285,9 @@ namespace OpenSim.Framework
map["halo_id"] = halo_id;
map["ice_level"] = ice_level;
if (reflectionProbeAmbiance != 0f)
map["reflection_probe_ambiance"] = reflectionProbeAmbiance;
OSDMap lhaze = new OSDMap();
lhaze["ambient"] = ambient;
lhaze["blue_density"] = blue_density;
@ -369,7 +375,10 @@ namespace OpenSim.Framework
if (map.TryGetValue("halo_id", out otmp))
halo_id = otmp;
if (map.TryGetValue("ice_level", out otmp))
halo_id = otmp;
ice_level = otmp;
if (map.TryGetValue("reflection_probe_ambiance", out otmp))
reflectionProbeAmbiance = otmp;
if (map.TryGetValue("legacy_haze", out OSD tmp) && tmp is OSDMap)
{

View file

@ -6590,11 +6590,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
LLSDxmlEncode2.AddElem("MediaWidth", landData.MediaWidth, sb);
LLSDxmlEncode2.AddElem("MediaLoop", landData.MediaLoop, sb);
LLSDxmlEncode2.AddElem("MediaType", landData.MediaType, sb);
LLSDxmlEncode2.AddElem("ObscureMedia", landData.ObscureMedia, sb);
LLSDxmlEncode2.AddElem("ObscureMusic", landData.ObscureMusic, sb);
//LLSDxmlEncode2.AddElem("ObscureMedia", landData.ObscureMedia, sb);
LLSDxmlEncode2.AddElem("ObscureMedia", false, sb); //obsolete
//LLSDxmlEncode2.AddElem("ObscureMusic", landData.ObscureMusic, sb);
LLSDxmlEncode2.AddElem("ObscureMusic", false, sb); //obsolete
LLSDxmlEncode2.AddEndMapAndArray(sb);
LLSDxmlEncode2.AddArrayAndMap("ParcelExtendedFlags", sb); // obscure moap
LLSDxmlEncode2.AddElem("Flags", (uint)(landData.ObscureMedia ? 1 : (int)0), sb);
LLSDxmlEncode2.AddEndMapAndArray(sb);
LLSDxmlEncode2.AddArrayAndMap("AgeVerificationBlock", sb);
LLSDxmlEncode2.AddElem("RegionDenyAgeUnverified", (regionFlags & (uint)RegionFlags.DenyAgeUnverified) != 0, sb);

View file

@ -328,64 +328,63 @@ namespace OpenMetaverse
private void AsyncBeginReceive()
{
if (!IsRunningInbound)
return;
UDPPacketBuffer buf = GetNewUDPBuffer(new IPEndPoint(IPAddress.Any, 0)); // we need a fresh one here, for now at least
try
while(IsRunningInbound)
{
// kick off an async read
m_udpSocket.BeginReceiveFrom(
buf.Data,
0,
buf.Data.Length,
SocketFlags.None,
ref buf.RemoteEndPoint,
AsyncEndReceive,
buf);
}
catch (SocketException e)
{
if (e.SocketErrorCode == SocketError.ConnectionReset)
UDPPacketBuffer buf = GetNewUDPBuffer(new IPEndPoint(IPAddress.Any, 0)); // we need a fresh one here, for now at least
try
{
m_log.Warn("[UDPBASE]: SIO_UDP_CONNRESET was ignored, attempting to salvage the UDP listener on port " + m_udpPort);
bool salvaged = false;
while (!salvaged)
{
try
{
m_udpSocket.BeginReceiveFrom(
buf.Data,
0,
buf.Data.Length,
SocketFlags.None,
ref buf.RemoteEndPoint,
AsyncEndReceive,
buf);
salvaged = true;
}
catch (SocketException) { }
catch (ObjectDisposedException) { return; }
}
// kick off an async read
IAsyncResult iar = m_udpSocket.BeginReceiveFrom(
buf.Data,
0,
buf.Data.Length,
SocketFlags.None,
ref buf.RemoteEndPoint,
AsyncEndReceive,
buf);
m_log.Warn("[UDPBASE]: Salvaged the UDP listener on port " + m_udpPort);
if (!iar.CompletedSynchronously)
return;
}
catch (SocketException e)
{
if (e.SocketErrorCode == SocketError.ConnectionReset)
{
m_log.Warn("[UDPBASE]: SIO_UDP_CONNRESET was ignored, attempting to salvage the UDP listener on port " + m_udpPort);
{
try
{
IAsyncResult iar = m_udpSocket.BeginReceiveFrom(
buf.Data,
0,
buf.Data.Length,
SocketFlags.None,
ref buf.RemoteEndPoint,
AsyncEndReceive,
buf);
if (!iar.CompletedSynchronously)
return;
}
catch (SocketException) { }
catch (ObjectDisposedException) { return; }
}
m_log.Warn("[UDPBASE]: Salvaged the UDP listener on port " + m_udpPort);
}
}
catch (Exception e)
{
m_log.Error(
string.Format("[UDPBASE]: Error processing UDP begin receive {0}. Exception ", UdpReceives), e);
}
}
catch (Exception e)
{
m_log.Error(
string.Format("[UDPBASE]: Error processing UDP begin receive {0}. Exception ", UdpReceives), e);
}
}
private void AsyncEndReceive(IAsyncResult iar)
{
// Asynchronous receive operations will complete here through the call
// to AsyncBeginReceive
if (IsRunningInbound)
{
UdpReceives++;
bool sync = iar.CompletedSynchronously;
try
{
// get the buffer that was created in AsyncBeginReceive
@ -398,6 +397,8 @@ namespace OpenMetaverse
// buffer
buffer.DataLength = m_udpSocket.EndReceiveFrom(iar, ref buffer.RemoteEndPoint);
UdpReceives++;
// call the abstract method PacketReceived(), passing the buffer that
// has just been filled from the socket read.
PacketReceived(buffer);
@ -434,51 +435,12 @@ namespace OpenMetaverse
}
finally
{
AsyncBeginReceive();
if (IsRunningInbound && !sync)
AsyncBeginReceive();
}
}
}
/* not in use
public void AsyncBeginSend(UDPPacketBuffer buf)
{
// if (IsRunningOutbound)
// {
// This is strictly for debugging purposes to simulate dropped
// packets when testing throttles & retransmission code
// if (DropOutgoingPacket())
// return;
try
{
m_udpSocket.BeginSendTo(
buf.Data,
0,
buf.DataLength,
SocketFlags.None,
buf.RemoteEndPoint,
AsyncEndSend,
buf);
}
catch (SocketException) { }
catch (ObjectDisposedException) { }
// }
}
void AsyncEndSend(IAsyncResult result)
{
try
{
// UDPPacketBuffer buf = (UDPPacketBuffer)result.AsyncState;
m_udpSocket.EndSendTo(result);
UdpSends++;
}
catch (SocketException) { }
catch (ObjectDisposedException) { }
}
*/
public void SyncSend(UDPPacketBuffer buf)
{
if(buf.RemoteEndPoint == null)

View file

@ -1460,11 +1460,11 @@ namespace OpenSim.Region.CoreModules.World.Land
// now flags
// local sound
if ((currentParcel.LandData.Flags & (uint)ParcelFlags.SoundLocal) != 0)
if ((currentParcelLandData.Flags & (uint)ParcelFlags.SoundLocal) != 0)
curByte |= (byte)LandChannel.LAND_FLAG_LOCALSOUND;
// hide avatars
if (!currentParcel.LandData.SeeAVs)
if (!currentParcelLandData.SeeAVs)
curByte |= (byte)LandChannel.LAND_FLAG_HIDEAVATARS;
// border flags for current
@ -2089,8 +2089,12 @@ namespace OpenSim.Region.CoreModules.World.Land
land_update.MediaWidth = properties.MediaWidth;
land_update.MediaHeight = properties.MediaHeight;
land_update.MediaLoop = properties.MediaLoop;
land_update.ObscureMusic = properties.ObscureMusic;
land_update.ObscureMedia = properties.ObscureMedia;
//land_update.ObscureMusic = properties.ObscureMusic;
//land_update.ObscureMedia = properties.ObscureMedia;
land_update.ObscureMedia = false; // obsolete
if (args.TryGetValue("obscure_moap", out OSD omoap))
land_update.ObscureMOAP = omoap.AsBoolean();
if (args.ContainsKey("see_avs"))
{
@ -2811,7 +2815,8 @@ namespace OpenSim.Region.CoreModules.World.Land
cdl.AddRow("Media Width", ld.MediaWidth);
cdl.AddRow("Media Height", ld.MediaHeight);
cdl.AddRow("Media Loop", ld.MediaLoop);
cdl.AddRow("Obscure Media", ld.ObscureMedia);
cdl.AddRow("Obscure MOAP", ld.ObscureMedia);
cdl.AddRow("Parcel Category", ld.Category);

View file

@ -614,8 +614,10 @@ namespace OpenSim.Region.CoreModules.World.Land
newData.MediaWidth = args.MediaWidth;
newData.MediaHeight = args.MediaHeight;
newData.MediaLoop = args.MediaLoop;
newData.ObscureMusic = args.ObscureMusic;
newData.ObscureMedia = args.ObscureMedia;
//newData.ObscureMusic = args.ObscureMusic;
newData.ObscureMusic = false; // obsolete
//newData.ObscureMedia = args.ObscureMedia;
newData.ObscureMedia = args.ObscureMOAP; // obsolete, reuse for moap
allowedDelta |= (uint)(ParcelFlags.SoundLocal |
ParcelFlags.UrlWebPage |

View file

@ -175,7 +175,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
protected int m_sleepMsOnClearPrimMedia = 1000;
protected int m_sleepMsOnClearLinkMedia = 1000;
protected int m_sleepMsOnRequestSimulatorData = 1000;
protected int m_sleepMsOnLoadURL = 10000;
protected int m_sleepMsOnLoadURL = 1000;
protected int m_sleepMsOnParcelMediaCommandList = 2000;
protected int m_sleepMsOnParcelMediaQuery = 2000;
protected int m_sleepMsOnModPow = 1000;
@ -2276,7 +2276,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (!pbs.SculptEntry && (pbs.PathCurve == (byte)Extrusion.Straight || pbs.PathCurve == (byte)Extrusion.Flexible))
{
if(flexi)
{
{
pbs.PathCurve = (byte)Extrusion.Flexible;
if(!sog.IsPhantom)
{
@ -2477,7 +2477,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
Primitive.TextureEntry tex = part.Shape.Textures;
int nsides = GetNumberOfSides(part);
int nsides = GetNumberOfSides(part);
if (face >= 0 && face < nsides)
{
@ -2773,7 +2773,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
SceneObjectGroup grp = part.ParentGroup;
if (grp == null || grp.IsDeleted || grp.inTransit)
return;
LSL_Vector currentPos = GetPartLocalPos(part);
LSL_Vector toPos = GetSetPosTarget(part, targetPos, currentPos, adjust);
@ -3152,7 +3152,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if(soundID.IsZero())
return;
// send the sound, once, to all clients in range
// send the sound, once, to all clients in range
m_SoundModule.SendSound(m_host.UUID, soundID, volume, false, 0, false, false);
}
@ -3165,12 +3165,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
SceneObjectPart sop;
if (linknumber == ScriptBaseClass.LINK_THIS)
sop = m_host;
sop = m_host;
else if (linknumber < 0)
return;
else if (linknumber < 2)
sop = m_host.ParentGroup.RootPart;
else
else
sop = m_host.ParentGroup.GetLinkNumPart(linknumber);
if(sop == null)
@ -3180,7 +3180,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (soundID.IsZero())
return;
// send the sound, once, to all clients in range
// send the sound, once, to all clients in range
m_SoundModule.SendSound(sop.UUID, soundID, volume, false, 0, false, false);
}
@ -3978,7 +3978,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
message = (message.Length > 1024) ? message.Substring(0, 1024) : message,
binaryBucket = Util.StringToBytes256("{0}/{1}/{2}/{3}", m_regionName, (int)pos.X, (int)pos.Y, (int)pos.Z)
};
m_TransferModule?.SendInstantMessage(msg, delegate(bool success) {});
ScriptSleep(m_sleepMsOnInstantMessage);
}
@ -4722,7 +4722,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
public LSL_Key llObjectGetLinkKey(LSL_Key objectid, int linknum)
public LSL_Key llGetObjectLinkKey(LSL_Key objectid, int linknum)
{
if(!UUID.TryParse(objectid, out UUID oID))
return ScriptBaseClass.NULL_KEY;
@ -5770,7 +5770,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
if(key.IsZero())
return id;
SceneObjectPart obj = World.GetSceneObjectPart(key);
return (obj == null) ? id : obj.OwnerID.ToString();
}
@ -5933,7 +5933,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// a string, a key as string and a string that by coincidence
// is a string, so we're going to leave that up to the
// LSL_Vector constructor.
if(item is LSL_Vector)
if(item is LSL_Vector)
return (LSL_Vector) item;
if (item is LSL_String || item is string) // xengine sees string
@ -5958,7 +5958,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// a string, a key as string and a string that by coincidence
// is a string, so we're going to leave that up to the
// LSL_Rotation constructor.
if (item.GetType() == typeof(LSL_Rotation))
return (LSL_Rotation)item;
@ -6521,7 +6521,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// Remove as they are done
/// </summary>
static readonly UUID busyAnimation = new UUID("efcf670c-2d18-8128-973a-034ebc806b67");
public LSL_Integer llGetAgentInfo(LSL_Key id)
{
@ -7600,7 +7600,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
case ScriptBaseClass.PSYS_SRC_TEXTURE:
try
{
prules.Texture = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, rules.GetLSLStringItem(i + 1));
prules.Texture = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, rules.GetStrictStringItem(i + 1));
}
catch(InvalidCastException)
{
@ -8311,7 +8311,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llSHA256String(LSL_String input)
{
// Create a SHA256
// Create a SHA256
using (SHA256 sha256Hash = SHA256.Create())
{
// ComputeHash - returns byte array
@ -10157,7 +10157,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
try
{
primText = rules.GetLSLStringItem(idx++);
primText = rules.GetStrictStringItem(idx++);
}
catch(InvalidCastException)
{
@ -10192,7 +10192,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return new LSL_List();
try
{
string primName = rules.GetLSLStringItem(idx++);
string primName = rules.GetStrictStringItem(idx++);
part.Name = primName;
}
catch(InvalidCastException)
@ -10206,7 +10206,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return new LSL_List();
try
{
string primDesc = rules.GetLSLStringItem(idx++);
string primDesc = rules.GetStrictStringItem(idx++);
part.Description = primDesc;
}
catch(InvalidCastException)
@ -10378,7 +10378,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
Error(originFunc, string.Format("Error running rule #{0} -> PRIM_ALPHA_MODE: arg #{1} - must be 0 to 255", rulesParsed, idx - idxStart - 1));
return new LSL_List();
}
materialChanged |= SetMaterialAlphaMode(part, face, materialAlphaMode, materialMaskCutoff);
break;
@ -10442,7 +10442,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
Error(originFunc, string.Format("Error running rule #{0} -> PRIM_NORMAL: arg #{1} - must be float", rulesParsed, idx - idxStart - 1));
return new LSL_List();
}
float repeatX = (float)Util.Clamp(mnrepeat.x,-100.0, 100.0);
float repeatY = (float)Util.Clamp(mnrepeat.y,-100.0, 100.0);
float offsetX = (float)Util.Clamp(mnoffset.x, 0, 1.0);
@ -10544,7 +10544,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
Error(originFunc, string.Format("Error running rule #{0} -> PRIM_SPECULAR: arg #{1} - must be integer", rulesParsed, idx - idxStart - 1));
return new LSL_List();
}
float srepeatX = (float)Util.Clamp(msrepeat.x, -100.0, 100.0);
float srepeatY = (float)Util.Clamp(msrepeat.y, -100.0, 100.0);
float soffsetX = (float)Util.Clamp(msoffset.x, -1.0, 1.0);
@ -10686,8 +10686,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
if(m_materialsModule == null)
return false;
int nsides = part.GetNumberOfSides();
int nsides = part.GetNumberOfSides();
if(face == ScriptBaseClass.ALL_SIDES)
{
@ -10741,8 +10741,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
if(m_materialsModule == null)
return false;
int nsides = part.GetNumberOfSides();
int nsides = part.GetNumberOfSides();
if(face == ScriptBaseClass.ALL_SIDES)
{
@ -10806,8 +10806,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
if(m_materialsModule == null)
return false;
int nsides = part.GetNumberOfSides();
int nsides = part.GetNumberOfSides();
if(face == ScriptBaseClass.ALL_SIDES)
{
@ -12113,11 +12113,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
break;
case ScriptBaseClass.PRIM_MEDIA_CURRENT_URL:
me.CurrentURL = rules.GetLSLStringItem(i++);
me.CurrentURL = rules.GetStringItem(i++);
break;
case ScriptBaseClass.PRIM_MEDIA_HOME_URL:
me.HomeURL = rules.GetLSLStringItem(i++);
me.HomeURL = rules.GetStringItem(i++);
break;
case ScriptBaseClass.PRIM_MEDIA_AUTO_LOOP:
@ -12153,7 +12153,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
break;
case ScriptBaseClass.PRIM_MEDIA_WHITELIST:
string[] rawWhiteListUrls = rules.GetLSLStringItem(i++).ToString().Split(new char[] { ',' });
string[] rawWhiteListUrls = rules.GetStringItem(i++).Split(new char[] { ',' });
List<string> whiteListUrls = new List<string>();
Array.ForEach(
rawWhiteListUrls, delegate(string rawUrl) { whiteListUrls.Add(rawUrl.Trim()); });
@ -12896,7 +12896,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
try
{
if (m_regionName.Equals(simulator))
{
string lreply = String.Empty;
@ -14863,18 +14863,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ret.Add(new LSL_String(obj.Description));
break;
case ScriptBaseClass.OBJECT_POS:
Vector3 opos = obj.AbsolutePosition;
ret.Add(new LSL_Vector(opos.X, opos.Y, opos.Z));
ret.Add(new LSL_Vector(obj.AbsolutePosition));
break;
case ScriptBaseClass.OBJECT_ROT:
Quaternion rot = Quaternion.Identity;
Quaternion rot;
if (obj.ParentGroup.IsAttachment)
{
ScenePresence sp = World.GetScenePresence(obj.ParentGroup.AttachedAvatar);
if (sp != null)
rot = sp.GetWorldRotation();
rot = sp != null ? sp.GetWorldRotation() : Quaternion.Identity;
}
else
{
@ -14976,23 +14973,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
break;
case ScriptBaseClass.OBJECT_PHYSICS:
if (obj.ParentGroup.AttachmentPoint != 0)
{
ret.Add(new LSL_Integer(0)); // Always false if attached
}
else
{
ret.Add(new LSL_Integer(obj.ParentGroup.UsesPhysics ? 1 : 0));
}
break;
case ScriptBaseClass.OBJECT_PHANTOM:
if (obj.ParentGroup.AttachmentPoint != 0)
{
ret.Add(new LSL_Integer(0)); // Always false if attached
}
else
{
ret.Add(new LSL_Integer(obj.ParentGroup.IsPhantom ? 1 : 0));
}
break;
case ScriptBaseClass.OBJECT_TEMP_ON_REZ:
ret.Add(new LSL_Integer(obj.ParentGroup.IsTemporary ? 1 : 0));
@ -15033,29 +15022,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
break;
case ScriptBaseClass.OBJECT_TEMP_ATTACHED:
if (obj.ParentGroup.AttachmentPoint != 0 && obj.ParentGroup.FromItemID.IsZero())
{
ret.Add(new LSL_Integer(1));
}
else
{
ret.Add(new LSL_Integer(0));
}
break;
case ScriptBaseClass.OBJECT_ATTACHED_SLOTS_AVAILABLE:
ret.Add(new LSL_Integer(0));
break;
case ScriptBaseClass.OBJECT_CREATION_TIME:
DateTime date = Util.ToDateTime(m_host.ParentGroup.RootPart.CreationDate);
DateTime date = Util.ToDateTime(obj.ParentGroup.RootPart.CreationDate);
ret.Add(new LSL_String(date.ToString("yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture)));
break;
case ScriptBaseClass.OBJECT_SELECT_COUNT:
ret.Add(new LSL_Integer(0));
break;
case ScriptBaseClass.OBJECT_SIT_COUNT:
ret.Add(new LSL_Integer(m_host.ParentGroup.GetSittingAvatarsCount()));
ret.Add(new LSL_Integer(obj.ParentGroup.GetSittingAvatarsCount()));
break;
case ScriptBaseClass.OBJECT_ANIMATED_COUNT:
if(m_host.ParentGroup.RootPart.Shape.MeshFlagEntry)
if(obj.ParentGroup.RootPart.Shape.MeshFlagEntry)
ret.Add(new LSL_Integer(1));
else
ret.Add(new LSL_Integer(0));
@ -15067,31 +15052,37 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ret.Add(new LSL_Integer(1));
break;
case ScriptBaseClass.OBJECT_MATERIAL:
ret.Add(new LSL_Integer(m_host.Material));
ret.Add(new LSL_Integer(obj.Material));
break;
case ScriptBaseClass.OBJECT_MASS:
ret.Add(new LSL_Float(llGetMassMKS()));
break;
float mass;
if (obj.ParentGroup.IsAttachment)
{
ScenePresence attachedAvatar = World.GetScenePresence(obj.ParentGroup.AttachedAvatar);
mass = attachedAvatar is null ? 0 : attachedAvatar.GetMass();
}
else
mass = obj.ParentGroup.GetMass();
mass *= 100f;
ret.Add(new LSL_Float(mass)); break;
case ScriptBaseClass.OBJECT_TEXT:
ret.Add(new LSL_String(m_host.Text));
ret.Add(new LSL_String(obj.Text));
break;
case ScriptBaseClass.OBJECT_REZ_TIME:
ret.Add(new LSL_String(m_host.Rezzed.ToString("yyyy-MM-ddTHH:mm:ss.ffffffZ", CultureInfo.InvariantCulture)));
ret.Add(new LSL_String(obj.Rezzed.ToString("yyyy-MM-ddTHH:mm:ss.ffffffZ", CultureInfo.InvariantCulture)));
break;
case ScriptBaseClass.OBJECT_LINK_NUMBER:
ret.Add(new LSL_Integer(m_host.LinkNum));
ret.Add(new LSL_Integer(obj.LinkNum));
break;
case ScriptBaseClass.OBJECT_SCALE:
ret.Add(new LSL_Vector(m_host.Scale));
ret.Add(new LSL_Vector(obj.Scale));
break;
case ScriptBaseClass.OBJECT_TEXT_COLOR:
Color4 textColor = m_host.GetTextColor();
ret.Add(new LSL_Vector(textColor.R,
textColor.G,
textColor.B));
Color4 textColor = obj.GetTextColor();
ret.Add(new LSL_Vector(textColor.R, textColor.G, textColor.B));
break;
case ScriptBaseClass.OBJECT_TEXT_ALPHA:
ret.Add(new LSL_Float(m_host.GetTextColor().A));
ret.Add(new LSL_Float(obj.GetTextColor().A));
break;
default:
// Invalid or unhandled constant.
@ -17895,7 +17886,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return new LSL_List();
char first = ((string)json)[0];
if(first != '[' && first !='{')
if(first != '[' && first !='{')
{
// we already have a single element
LSL_List l = new LSL_List();
@ -17929,7 +17920,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LSL_List retl = new LSL_List();
if(elem == null)
retl.Add((LSL_String)ScriptBaseClass.JSON_NULL);
LitJson.JsonType elemType = elem.GetJsonType();
switch (elemType)
{
@ -18050,7 +18041,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return "\"Inf\"";
if(double.IsNaN(float_val))
return "\"NaN\"";
return ((LSL_Float)float_val).ToString();
}
if (o is LSL_Integer || o is int)
@ -18278,7 +18269,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
newData.SetJsonType(LitJson.JsonType.Array);
newData.Add(JsonBuildRestOfSpec(specifiers, level + 1, val));
return newData;
}
}
}
else
{

View file

@ -573,7 +573,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
idx++;
try
{
wl.normalMapTexture = new UUID(rules.GetLSLStringItem(idx).m_string);
wl.normalMapTexture = new UUID(rules.GetStrictStringItem(idx));
}
catch (ArgumentException)
{

View file

@ -1408,10 +1408,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
return "";
}
drawList += "FillPolygon " + x.GetLSLStringItem(0) + "," + y.GetLSLStringItem(0);
drawList += "FillPolygon " + x.GetStringItem(0) + "," + y.GetStringItem(0);
for (int i = 1; i < x.Length; i++)
{
drawList += "," + x.GetLSLStringItem(i) + "," + y.GetLSLStringItem(i);
drawList += "," + x.GetStringItem(i) + "," + y.GetStringItem(i);
}
drawList += "; ";
return drawList;
@ -1425,10 +1425,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
return "";
}
drawList += "Polygon " + x.GetLSLStringItem(0) + "," + y.GetLSLStringItem(0);
drawList += "Polygon " + x.GetStringItem(0) + "," + y.GetStringItem(0);
for (int i = 1; i < x.Length; i++)
{
drawList += "," + x.GetLSLStringItem(i) + "," + y.GetLSLStringItem(i);
drawList += "," + x.GetStringItem(i) + "," + y.GetStringItem(i);
}
drawList += "; ";
return drawList;
@ -1835,7 +1835,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
for (int idx = 0; idx < rules.Length;)
{
int code = rules.GetLSLIntegerItem(idx++);
string arg = rules.GetLSLStringItem(idx++);
string arg = rules.GetStringItem(idx++);
switch (code)
{
case ScriptBaseClass.PARCEL_DETAILS_NAME:
@ -2239,7 +2239,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
StringBuilder notecardData = new StringBuilder();
for (int i = 0; i < contents.Length; i++)
notecardData.Append((string)(contents.GetLSLStringItem(i) + "\n"));
notecardData.Append(contents.GetStringItem(i) + "\n");
SaveNotecard(notecardName, "Script generated notecard", notecardData.ToString(), false);
}

View file

@ -154,7 +154,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
LSL_Key llGetKey();
LSL_Key llGetLandOwnerAt(LSL_Vector pos);
LSL_Key llGetLinkKey(int linknum);
LSL_Key llObjectGetLinkKey(LSL_Key objectid, int linknum);
LSL_Key llGetObjectLinkKey(LSL_Key objectid, int linknum);
LSL_String llGetLinkName(int linknum);
LSL_Integer llGetLinkNumber();
LSL_Integer llGetLinkNumberOfSides(int link);

View file

@ -568,9 +568,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
return m_LSL_Functions.llGetLinkKey(linknum);
}
public LSL_Key llObjectGetLinkKey(LSL_Key objectid, int linknum)
public LSL_Key llGetObjectLinkKey(LSL_Key objectid, int linknum)
{
return m_LSL_Functions.llObjectGetLinkKey(objectid, linknum); ;
return m_LSL_Functions.llGetObjectLinkKey(objectid, linknum); ;
}
public LSL_String llGetLinkName(int linknum)

View file

@ -790,6 +790,49 @@ namespace OpenSim.Region.ScriptEngine.Shared
return new LSL_Types.LSLString(o.ToString());
}
public string GetStringItem(int itemIndex)
{
object o = Data[itemIndex];
if (o is LSL_Types.key)
return ((LSL_Types.key)o).value;
return o.ToString();
}
public LSL_Types.LSLString GetStrictLSLStringItem(int itemIndex)
{
object o = Data[itemIndex];
if (o is LSL_Types.LSLString)
return ((LSL_Types.LSLString)o);
if (o is string)
return new LSL_Types.LSLString((string)o);
if (o is LSL_Types.key)
return ((LSL_Types.key)o).value;
throw new InvalidCastException(string.Format(
"{0} expected but {1} given",
typeof(LSL_Types.LSLString).Name,
o != null ?
o.GetType().Name : "null"));
}
public string GetStrictStringItem(int itemIndex)
{
object o = Data[itemIndex];
if (o is LSL_Types.LSLString)
return ((LSL_Types.LSLString)o).m_string;
if (o is string)
return (string)o;
if (o is LSL_Types.key)
return ((LSL_Types.key)o).value;
throw new InvalidCastException(string.Format(
"{0} expected but {1} given",
typeof(LSL_Types.LSLString).Name,
o != null ?
o.GetType().Name : "null"));
}
public LSL_Types.LSLInteger GetLSLIntegerItem(int itemIndex)
{
object o = Data[itemIndex];

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1,4 +1,4 @@
b60b609e-502d-3344-e38d-7fd0718cf5ea
face0493-6022-3cf1-bdbe-1ae375f7f2da
<llsd><map><key>llsd-lsl-syntax-version</key><integer>2</integer>
<key>controls</key>
<map>
@ -4337,6 +4337,14 @@ b60b609e-502d-3344-e38d-7fd0718cf5ea
<map><key>args</key><map><key>type</key><string>list</string></map></map>
</array>
</map>
<key>llGetObjectLinkKey</key>
<map>
<key>return</key><string>key</string>
<key>arguments</key><array>
<map><key>objectid</key><map><key>type</key><string>key</string></map></map>
<map><key>linknum</key><map><key>type</key><string>integer</string></map></map>
</array>
</map>
<key>llGetObjectMass</key>
<map>
<key>return</key><string>float</string>
@ -5199,14 +5207,6 @@ b60b609e-502d-3344-e38d-7fd0718cf5ea
<map><key>name</key><map><key>type</key><string>string</string></map></map>
</array>
</map>
<key>llObjectGetLinkKey</key>
<map>
<key>return</key><string>key</string>
<key>arguments</key><array>
<map><key>objectid</key><map><key>type</key><string>key</string></map></map>
<map><key>linknum</key><map><key>type</key><string>integer</string></map></map>
</array>
</map>
<key>llOffsetTexture</key>
<map>
<key>arguments</key><array>