29 using System.Collections;
30 using System.Collections.Generic;
31 using System.Diagnostics;
33 using System.Drawing.Imaging;
34 using System.Runtime.Remoting.Lifetime;
36 using System.Threading;
37 using System.Text.RegularExpressions;
42 using OpenMetaverse.Assets;
43 using OpenMetaverse.StructuredData;
44 using OpenMetaverse.Packets;
45 using OpenMetaverse.Rendering;
47 using OpenSim.Framework;
49 using OpenSim.Region.CoreModules;
50 using OpenSim.Region.CoreModules.World.Land;
51 using OpenSim.Region.CoreModules.World.Terrain;
52 using OpenSim.Region.Framework.Interfaces;
53 using OpenSim.Region.Framework.Scenes;
54 using OpenSim.Region.Framework.Scenes.Serialization;
56 using OpenSim.Region.Framework.Scenes.Scripting;
57 using OpenSim.Region.PhysicsModules.SharedBase;
58 using OpenSim.Region.ScriptEngine.Shared;
59 using OpenSim.Region.ScriptEngine.Shared.Api.Plugins;
60 using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
61 using OpenSim.Region.ScriptEngine.Interfaces;
62 using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces;
63 using OpenSim.Services.Interfaces;
77 using System.Reflection;
97 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
99 public int LlRequestAgentDataCacheTimeoutMs {
get; set; }
113 protected bool throwErrorOnNotImplemented =
false;
115 protected float m_ScriptDelayFactor = 1.0f;
116 protected float m_ScriptDistanceFactor = 1.0f;
117 protected float m_MinTimerInterval = 0.5f;
118 protected float m_recoilScaleFactor = 0.0f;
120 protected DateTime m_timer = DateTime.Now;
121 protected bool m_waitingForScriptAnswer =
false;
122 protected bool m_automaticLinkPermission =
false;
124 protected int m_notecardLineReadCharsMax = 255;
125 protected int m_scriptConsoleChannel = 0;
126 protected bool m_scriptConsoleChannelEnabled =
false;
127 protected bool m_debuggerSafe =
false;
130 protected Dictionary<UUID, UserInfoCacheEntry> m_userInfoCache =
new Dictionary<UUID, UserInfoCacheEntry>();
131 protected int EMAIL_PAUSE_TIME = 20;
132 protected int m_sleepMsOnSetTexture = 200;
133 protected int m_sleepMsOnSetLinkTexture = 200;
134 protected int m_sleepMsOnScaleTexture = 200;
135 protected int m_sleepMsOnOffsetTexture = 200;
136 protected int m_sleepMsOnRotateTexture = 200;
137 protected int m_sleepMsOnSetPos = 200;
138 protected int m_sleepMsOnSetRot = 200;
139 protected int m_sleepMsOnSetLocalRot = 200;
140 protected int m_sleepMsOnPreloadSound = 1000;
141 protected int m_sleepMsOnMakeExplosion = 100;
142 protected int m_sleepMsOnMakeFountain = 100;
143 protected int m_sleepMsOnMakeSmoke = 100;
144 protected int m_sleepMsOnMakeFire = 100;
145 protected int m_sleepMsOnRezAtRoot = 100;
146 protected int m_sleepMsOnInstantMessage = 2000;
147 protected int m_sleepMsOnEmail = 20000;
148 protected int m_sleepMsOnCreateLink = 1000;
149 protected int m_sleepMsOnGiveInventory = 3000;
150 protected int m_sleepMsOnRequestAgentData = 100;
151 protected int m_sleepMsOnRequestInventoryData = 1000;
152 protected int m_sleepMsOnSetDamage = 5000;
153 protected int m_sleepMsOnTextBox = 1000;
154 protected int m_sleepMsOnAdjustSoundVolume = 100;
155 protected int m_sleepMsOnEjectFromLand = 5000;
156 protected int m_sleepMsOnAddToLandPassList = 100;
157 protected int m_sleepMsOnDialog = 1000;
158 protected int m_sleepMsOnRemoteLoadScript = 3000;
159 protected int m_sleepMsOnRemoteLoadScriptPin = 3000;
160 protected int m_sleepMsOnOpenRemoteDataChannel = 1000;
161 protected int m_sleepMsOnSendRemoteData = 3000;
162 protected int m_sleepMsOnRemoteDataReply = 3000;
163 protected int m_sleepMsOnCloseRemoteDataChannel = 1000;
164 protected int m_sleepMsOnSetPrimitiveParams = 200;
165 protected int m_sleepMsOnSetLinkPrimitiveParams = 200;
166 protected int m_sleepMsOnXorBase64Strings = 300;
167 protected int m_sleepMsOnSetParcelMusicURL = 2000;
168 protected int m_sleepMsOnGetPrimMediaParams = 1000;
169 protected int m_sleepMsOnGetLinkMedia = 1000;
170 protected int m_sleepMsOnSetPrimMediaParams = 1000;
171 protected int m_sleepMsOnSetLinkMedia = 1000;
172 protected int m_sleepMsOnClearPrimMedia = 1000;
173 protected int m_sleepMsOnClearLinkMedia = 1000;
174 protected int m_sleepMsOnRequestSimulatorData = 1000;
175 protected int m_sleepMsOnLoadURL = 10000;
176 protected int m_sleepMsOnParcelMediaCommandList = 2000;
177 protected int m_sleepMsOnParcelMediaQuery = 2000;
178 protected int m_sleepMsOnModPow = 1000;
179 protected int m_sleepMsOnSetPrimURL = 2000;
180 protected int m_sleepMsOnRefreshPrimURL = 20000;
181 protected int m_sleepMsOnMapDestination = 1000;
182 protected int m_sleepMsOnAddToLandBanList = 100;
183 protected int m_sleepMsOnRemoveFromLandPassList = 100;
184 protected int m_sleepMsOnRemoveFromLandBanList = 100;
185 protected int m_sleepMsOnResetLandBanList = 100;
186 protected int m_sleepMsOnResetLandPassList = 100;
187 protected int m_sleepMsOnGetParcelPrimOwners = 2000;
188 protected int m_sleepMsOnGetNumberOfNotecardLines = 100;
189 protected int m_sleepMsOnGetNotecardLine = 100;
190 protected string m_internalObjectHost =
"lsl.opensim.local";
191 protected bool m_restrictEmail =
false;
194 protected float m_avatarHeightCorrection = 0.2f;
195 protected bool m_useSimpleBoxesInGetBoundingBox =
false;
196 protected bool m_addStatsInGetBoundingBox =
false;
201 protected float m_lABB1StdX0 = -0.275f;
202 protected float m_lABB2StdX0 = 0.275f;
203 protected float m_lABB1StdY0 = -0.35f;
204 protected float m_lABB2StdY0 = 0.35f;
205 protected float m_lABB1StdZ0 = -0.1f;
206 protected float m_lABB1StdZ1 = -0.5f;
207 protected float m_lABB2StdZ0 = 0.1f;
208 protected float m_lABB2StdZ1 = 0.5f;
209 protected float m_lABB1GrsX0 = -0.3875f;
210 protected float m_lABB2GrsX0 = 0.3875f;
211 protected float m_lABB1GrsY0 = -0.5f;
212 protected float m_lABB2GrsY0 = 0.5f;
213 protected float m_lABB1GrsZ0 = -0.05f;
214 protected float m_lABB1GrsZ1 = -0.375f;
215 protected float m_lABB2GrsZ0 = 0.5f;
216 protected float m_lABB2GrsZ1 = 0.0f;
217 protected float m_lABB1SitX0 = -0.5875f;
218 protected float m_lABB2SitX0 = 0.1875f;
219 protected float m_lABB1SitY0 = -0.35f;
220 protected float m_lABB2SitY0 = 0.35f;
221 protected float m_lABB1SitZ0 = -0.35f;
222 protected float m_lABB1SitZ1 = -0.375f;
223 protected float m_lABB2SitZ0 = -0.25f;
224 protected float m_lABB2SitZ1 = 0.25f;
226 protected float m_primSafetyCoeffX = 2.414214f;
227 protected float m_primSafetyCoeffY = 2.414214f;
228 protected float m_primSafetyCoeffZ = 1.618034f;
229 protected bool m_useCastRayV3 =
false;
230 protected float m_floatToleranceInCastRay = 0.00001f;
231 protected float m_floatTolerance2InCastRay = 0.001f;
232 protected DetailLevel m_primLodInCastRay = DetailLevel.Medium;
233 protected DetailLevel m_sculptLodInCastRay = DetailLevel.Medium;
234 protected DetailLevel m_meshLodInCastRay = DetailLevel.Highest;
235 protected DetailLevel m_avatarLodInCastRay = DetailLevel.Medium;
236 protected int m_maxHitsInCastRay = 16;
237 protected int m_maxHitsPerPrimInCastRay = 16;
238 protected int m_maxHitsPerObjectInCastRay = 16;
239 protected bool m_detectExitsInCastRay =
false;
240 protected bool m_filterPartsInCastRay =
false;
241 protected bool m_doAttachmentsInCastRay =
false;
242 protected int m_msThrottleInCastRay = 200;
243 protected int m_msPerRegionInCastRay = 40;
244 protected int m_msPerAvatarInCastRay = 10;
245 protected int m_msMinInCastRay = 2;
246 protected int m_msMaxInCastRay = 40;
247 protected static List<CastRayCall> m_castRayCalls =
new List<CastRayCall>();
248 protected bool m_useMeshCacheInCastRay =
true;
249 protected static Dictionary<ulong, FacetedMesh> m_cachedMeshes =
new Dictionary<ulong, FacetedMesh>();
252 protected int m_SayShoutCount = 0;
253 DateTime m_lastSayShoutCheck;
255 private Dictionary<string, string> MovementAnimationsForLSL =
256 new Dictionary<string, string> {
257 {
"CROUCH",
"Crouching"},
258 {
"CROUCHWALK",
"CrouchWalking"},
259 {
"FALLDOWN",
"Falling Down"},
261 {
"FLYSLOW",
"FlyingSlow"},
262 {
"HOVER",
"Hovering"},
263 {
"HOVER_UP",
"Hovering Up"},
264 {
"HOVER_DOWN",
"Hovering Down"},
267 {
"PREJUMP",
"PreJumping"},
270 {
"SITGROUND",
"Sitting on Ground"},
271 {
"STAND",
"Standing"},
272 {
"STANDUP",
"Standing Up"},
273 {
"STRIDE",
"Striding"},
274 {
"SOFT_LAND",
"Soft Landing"},
275 {
"TURNLEFT",
"Turning Left"},
276 {
"TURNRIGHT",
"Turning Right"},
282 private string[] HttpStandardHeaders =
284 "Accept",
"Accept-Charset",
"Accept-Encoding",
"Accept-Language",
285 "Accept-Ranges",
"Age",
"Allow",
"Authorization",
"Cache-Control",
286 "Connection",
"Content-Encoding",
"Content-Language",
287 "Content-Length",
"Content-Location",
"Content-MD5",
288 "Content-Range",
"Content-Type",
"Date",
"ETag",
"Expect",
289 "Expires",
"From",
"Host",
"If-Match",
"If-Modified-Since",
290 "If-None-Match",
"If-Range",
"If-Unmodified-Since",
"Last-Modified",
291 "Location",
"Max-Forwards",
"Pragma",
"Proxy-Authenticate",
292 "Proxy-Authorization",
"Range",
"Referer",
"Retry-After",
"Server",
293 "TE",
"Trailer",
"Transfer-Encoding",
"Upgrade",
"User-Agent",
294 "Vary",
"Via",
"Warning",
"WWW-Authenticate"
300 m_lastSayShoutCheck = DateTime.UtcNow;
302 m_ScriptEngine = scriptEngine;
305 m_debuggerSafe = m_ScriptEngine.Config.GetBoolean(
"DebuggerSafe",
false);
311 m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<
IUrlModule>();
312 m_SoundModule = m_ScriptEngine.World.RequestModuleInterface<
ISoundModule>();
320 private void LoadConfig()
322 LlRequestAgentDataCacheTimeoutMs = 20000;
324 IConfig seConfig = m_ScriptEngine.Config;
326 if (seConfig != null)
328 m_ScriptDelayFactor =
329 seConfig.GetFloat(
"ScriptDelayFactor", m_ScriptDelayFactor);
330 m_ScriptDistanceFactor =
331 seConfig.GetFloat(
"ScriptDistanceLimitFactor", m_ScriptDistanceFactor);
333 seConfig.GetFloat(
"MinTimerInterval", m_MinTimerInterval);
334 m_automaticLinkPermission =
335 seConfig.GetBoolean(
"AutomaticLinkPermission", m_automaticLinkPermission);
336 m_notecardLineReadCharsMax =
337 seConfig.GetInt(
"NotecardLineReadCharsMax", m_notecardLineReadCharsMax);
342 m_recoilScaleFactor = m_ScriptEngine.Config.GetFloat(
"RecoilScaleFactor", m_recoilScaleFactor);
345 if (m_notecardLineReadCharsMax > 65535)
346 m_notecardLineReadCharsMax = 65535;
349 IConfigSource seConfigSource = m_ScriptEngine.ConfigSource;
351 if (seConfigSource != null)
353 IConfig lslConfig = seConfigSource.Configs[
"LL-Functions"];
354 if (lslConfig != null)
356 m_restrictEmail = lslConfig.GetBoolean(
"RestrictEmail", m_restrictEmail);
357 m_avatarHeightCorrection = lslConfig.GetFloat(
"AvatarHeightCorrection", m_avatarHeightCorrection);
358 m_useSimpleBoxesInGetBoundingBox = lslConfig.GetBoolean(
"UseSimpleBoxesInGetBoundingBox", m_useSimpleBoxesInGetBoundingBox);
359 m_addStatsInGetBoundingBox = lslConfig.GetBoolean(
"AddStatsInGetBoundingBox", m_addStatsInGetBoundingBox);
360 m_lABB1StdX0 = lslConfig.GetFloat(
"LowerAvatarBoundingBoxStandingXconst", m_lABB1StdX0);
361 m_lABB2StdX0 = lslConfig.GetFloat(
"UpperAvatarBoundingBoxStandingXconst", m_lABB2StdX0);
362 m_lABB1StdY0 = lslConfig.GetFloat(
"LowerAvatarBoundingBoxStandingYconst", m_lABB1StdY0);
363 m_lABB2StdY0 = lslConfig.GetFloat(
"UpperAvatarBoundingBoxStandingYconst", m_lABB2StdY0);
364 m_lABB1StdZ0 = lslConfig.GetFloat(
"LowerAvatarBoundingBoxStandingZconst", m_lABB1StdZ0);
365 m_lABB1StdZ1 = lslConfig.GetFloat(
"LowerAvatarBoundingBoxStandingZcoeff", m_lABB1StdZ1);
366 m_lABB2StdZ0 = lslConfig.GetFloat(
"UpperAvatarBoundingBoxStandingZconst", m_lABB2StdZ0);
367 m_lABB2StdZ1 = lslConfig.GetFloat(
"UpperAvatarBoundingBoxStandingZcoeff", m_lABB2StdZ1);
368 m_lABB1GrsX0 = lslConfig.GetFloat(
"LowerAvatarBoundingBoxGroundsittingXconst", m_lABB1GrsX0);
369 m_lABB2GrsX0 = lslConfig.GetFloat(
"UpperAvatarBoundingBoxGroundsittingXconst", m_lABB2GrsX0);
370 m_lABB1GrsY0 = lslConfig.GetFloat(
"LowerAvatarBoundingBoxGroundsittingYconst", m_lABB1GrsY0);
371 m_lABB2GrsY0 = lslConfig.GetFloat(
"UpperAvatarBoundingBoxGroundsittingYconst", m_lABB2GrsY0);
372 m_lABB1GrsZ0 = lslConfig.GetFloat(
"LowerAvatarBoundingBoxGroundsittingZconst", m_lABB1GrsZ0);
373 m_lABB1GrsZ1 = lslConfig.GetFloat(
"LowerAvatarBoundingBoxGroundsittingZcoeff", m_lABB1GrsZ1);
374 m_lABB2GrsZ0 = lslConfig.GetFloat(
"UpperAvatarBoundingBoxGroundsittingZconst", m_lABB2GrsZ0);
375 m_lABB2GrsZ1 = lslConfig.GetFloat(
"UpperAvatarBoundingBoxGroundsittingZcoeff", m_lABB2GrsZ1);
376 m_lABB1SitX0 = lslConfig.GetFloat(
"LowerAvatarBoundingBoxSittingXconst", m_lABB1SitX0);
377 m_lABB2SitX0 = lslConfig.GetFloat(
"UpperAvatarBoundingBoxSittingXconst", m_lABB2SitX0);
378 m_lABB1SitY0 = lslConfig.GetFloat(
"LowerAvatarBoundingBoxSittingYconst", m_lABB1SitY0);
379 m_lABB2SitY0 = lslConfig.GetFloat(
"UpperAvatarBoundingBoxSittingYconst", m_lABB2SitY0);
380 m_lABB1SitZ0 = lslConfig.GetFloat(
"LowerAvatarBoundingBoxSittingZconst", m_lABB1SitZ0);
381 m_lABB1SitZ1 = lslConfig.GetFloat(
"LowerAvatarBoundingBoxSittingZcoeff", m_lABB1SitZ1);
382 m_lABB2SitZ0 = lslConfig.GetFloat(
"UpperAvatarBoundingBoxSittingZconst", m_lABB2SitZ0);
383 m_lABB2SitZ1 = lslConfig.GetFloat(
"UpperAvatarBoundingBoxSittingZcoeff", m_lABB2SitZ1);
384 m_primSafetyCoeffX = lslConfig.GetFloat(
"PrimBoundingBoxSafetyCoefficientX", m_primSafetyCoeffX);
385 m_primSafetyCoeffY = lslConfig.GetFloat(
"PrimBoundingBoxSafetyCoefficientY", m_primSafetyCoeffY);
386 m_primSafetyCoeffZ = lslConfig.GetFloat(
"PrimBoundingBoxSafetyCoefficientZ", m_primSafetyCoeffZ);
387 m_useCastRayV3 = lslConfig.GetBoolean(
"UseLlCastRayV3", m_useCastRayV3);
388 m_floatToleranceInCastRay = lslConfig.GetFloat(
"FloatToleranceInLlCastRay", m_floatToleranceInCastRay);
389 m_floatTolerance2InCastRay = lslConfig.GetFloat(
"FloatTolerance2InLlCastRay", m_floatTolerance2InCastRay);
390 m_primLodInCastRay = (DetailLevel)lslConfig.GetInt(
"PrimDetailLevelInLlCastRay", (
int)m_primLodInCastRay);
391 m_sculptLodInCastRay = (DetailLevel)lslConfig.GetInt(
"SculptDetailLevelInLlCastRay", (
int)m_sculptLodInCastRay);
392 m_meshLodInCastRay = (DetailLevel)lslConfig.GetInt(
"MeshDetailLevelInLlCastRay", (
int)m_meshLodInCastRay);
393 m_avatarLodInCastRay = (DetailLevel)lslConfig.GetInt(
"AvatarDetailLevelInLlCastRay", (
int)m_avatarLodInCastRay);
394 m_maxHitsInCastRay = lslConfig.GetInt(
"MaxHitsInLlCastRay", m_maxHitsInCastRay);
395 m_maxHitsPerPrimInCastRay = lslConfig.GetInt(
"MaxHitsPerPrimInLlCastRay", m_maxHitsPerPrimInCastRay);
396 m_maxHitsPerObjectInCastRay = lslConfig.GetInt(
"MaxHitsPerObjectInLlCastRay", m_maxHitsPerObjectInCastRay);
397 m_detectExitsInCastRay = lslConfig.GetBoolean(
"DetectExitHitsInLlCastRay", m_detectExitsInCastRay);
398 m_filterPartsInCastRay = lslConfig.GetBoolean(
"FilterPartsInLlCastRay", m_filterPartsInCastRay);
399 m_doAttachmentsInCastRay = lslConfig.GetBoolean(
"DoAttachmentsInLlCastRay", m_doAttachmentsInCastRay);
400 m_msThrottleInCastRay = lslConfig.GetInt(
"ThrottleTimeInMsInLlCastRay", m_msThrottleInCastRay);
401 m_msPerRegionInCastRay = lslConfig.GetInt(
"AvailableTimeInMsPerRegionInLlCastRay", m_msPerRegionInCastRay);
402 m_msPerAvatarInCastRay = lslConfig.GetInt(
"AvailableTimeInMsPerAvatarInLlCastRay", m_msPerAvatarInCastRay);
403 m_msMinInCastRay = lslConfig.GetInt(
"RequiredAvailableTimeInMsInLlCastRay", m_msMinInCastRay);
404 m_msMaxInCastRay = lslConfig.GetInt(
"MaximumAvailableTimeInMsInLlCastRay", m_msMaxInCastRay);
405 m_useMeshCacheInCastRay = lslConfig.GetBoolean(
"UseMeshCacheInLlCastRay", m_useMeshCacheInCastRay);
408 IConfig smtpConfig = seConfigSource.Configs[
"SMTP"];
409 if (smtpConfig != null)
412 EMAIL_PAUSE_TIME = smtpConfig.GetInt(
"email_pause_time", EMAIL_PAUSE_TIME);
414 m_internalObjectHost = smtpConfig.GetString(
"internal_object_host", m_internalObjectHost);
417 m_sleepMsOnEmail = EMAIL_PAUSE_TIME * 1000;
422 ILease lease = (ILease)base.InitializeLifetimeService();
424 if (lease.CurrentState == LeaseState.Initial)
426 lease.InitialLeaseTime = TimeSpan.FromMinutes(0);
435 delay = (int)((
float)delay * m_ScriptDelayFactor);
442 protected virtual void Sleep(
int delay)
450 m_ScriptEngine.SleepScript(m_item.ItemID, delay);
460 get {
return m_ScriptEngine.World; }
463 [DebuggerNonUserCode]
466 m_ScriptEngine.SetState(m_item.ItemID, newState);
473 [DebuggerNonUserCode]
476 m_host.AddScriptLPS(1);
480 if (m_UrlModule != null)
481 m_UrlModule.ScriptRemoved(m_item.ItemID);
483 m_ScriptEngine.ApiResetScript(m_item.ItemID);
490 m_host.AddScriptLPS(1);
492 if ((item = GetScriptByName(name)) != UUID.Zero)
493 m_ScriptEngine.ResetScript(item);
495 Error(
"llResetOtherScript",
"Can't find script '" + name +
"'");
502 m_host.AddScriptLPS(1);
504 if ((item = GetScriptByName(name)) != UUID.Zero)
506 return m_ScriptEngine.GetScriptState(item) ?1:0;
509 Error(
"llGetScriptState",
"Can't find script '" + name +
"'");
521 m_host.AddScriptLPS(1);
526 if ((item = GetScriptByName(name)) != UUID.Zero)
528 m_ScriptEngine.SetScriptState(item, run == 0 ?
false :
true);
532 Error(
"llSetScriptState",
"Can't find script '" + name +
"'");
538 List<ScenePresence> ret =
new List<ScenePresence>();
539 if (m_host == null || m_host.ParentGroup == null || m_host.ParentGroup.IsDeleted)
544 List<ScenePresence> avs = m_host.ParentGroup.GetSittingAvatars();
547 case ScriptBaseClass.LINK_SET:
550 case ScriptBaseClass.LINK_ROOT:
553 case ScriptBaseClass.LINK_ALL_OTHERS:
556 case ScriptBaseClass.LINK_ALL_CHILDREN:
559 case ScriptBaseClass.LINK_THIS:
566 int partCount = m_host.ParentGroup.GetPartCount();
568 if (linkType <= partCount)
574 linkType = linkType - partCount;
575 if (linkType > avs.Count)
581 ret.Add(avs[linkType-1]);
620 int actualPrimCount = part.ParentGroup.PrimCount;
621 List<ScenePresence> sittingAvatars = part.ParentGroup.GetSittingAvatars();
622 int adjustedPrimCount = actualPrimCount + sittingAvatars.Count;
628 if (actualPrimCount == 1 && sittingAvatars.Count == 0)
637 if (sittingAvatars.Count > 0)
638 return part.ParentGroup.RootPart;
642 else if (linknum <= adjustedPrimCount)
644 if (linknum <= actualPrimCount)
646 return part.ParentGroup.GetLinkNumPart(linknum);
650 return sittingAvatars[linknum - actualPrimCount - 1];
661 return GetLinkParts(m_host, linkType);
666 List<SceneObjectPart> ret =
new List<SceneObjectPart>();
673 case ScriptBaseClass.LINK_SET:
674 return new List<SceneObjectPart>(part.ParentGroup.Parts);
676 case ScriptBaseClass.LINK_ROOT:
677 ret =
new List<SceneObjectPart>();
678 ret.Add(part.ParentGroup.RootPart);
681 case ScriptBaseClass.LINK_ALL_OTHERS:
682 ret =
new List<SceneObjectPart>(part.ParentGroup.Parts);
684 if (ret.Contains(part))
689 case ScriptBaseClass.LINK_ALL_CHILDREN:
690 ret =
new List<SceneObjectPart>(part.ParentGroup.Parts);
696 case ScriptBaseClass.LINK_THIS:
701 return new List<SceneObjectPart>();
705 return new List<SceneObjectPart>();
706 ret =
new List<SceneObjectPart>();
714 return GetLinkEntities(m_host, linkType);
719 List<ISceneEntity> ret;
723 case ScriptBaseClass.LINK_SET:
724 return new List<ISceneEntity>(part.ParentGroup.Parts);
726 case ScriptBaseClass.LINK_ROOT:
727 return new List<ISceneEntity>() { part.ParentGroup.RootPart };
729 case ScriptBaseClass.LINK_ALL_OTHERS:
730 ret =
new List<ISceneEntity>(part.ParentGroup.Parts);
732 if (ret.Contains(part))
737 case ScriptBaseClass.LINK_ALL_CHILDREN:
738 ret =
new List<ISceneEntity>(part.ParentGroup.Parts);
745 case ScriptBaseClass.LINK_THIS:
746 return new List<ISceneEntity>() { part };
750 return new List<ISceneEntity>();
754 return new List<ISceneEntity>();
756 return new List<ISceneEntity>() { target };
763 m_host.AddScriptLPS(1);
764 return (
double)Math.Sin(f);
769 m_host.AddScriptLPS(1);
770 return (
double)Math.Cos(f);
775 m_host.AddScriptLPS(1);
776 return (
double)Math.Tan(f);
781 m_host.AddScriptLPS(1);
782 return (
double)Math.Atan2(x, y);
787 m_host.AddScriptLPS(1);
788 return (
double)Math.Sqrt(f);
793 m_host.AddScriptLPS(1);
794 return (
double)Math.Pow(fbase, fexponent);
800 m_host.AddScriptLPS(1);
801 if (i == Int32.MinValue)
804 return (
int)Math.Abs(i);
809 m_host.AddScriptLPS(1);
810 return (
double)Math.Abs(f);
815 m_host.AddScriptLPS(1);
816 lock (Util.RandomClass)
818 return Util.RandomClass.NextDouble() * mag;
824 m_host.AddScriptLPS(1);
825 return (
int)Math.Floor(f);
830 m_host.AddScriptLPS(1);
831 return (
int)Math.Ceiling(f);
837 m_host.AddScriptLPS(1);
838 return (
int)Math.Round(f, MidpointRounding.AwayFromZero);
844 m_host.AddScriptLPS(1);
845 return LSL_Vector.Mag(v);
850 m_host.AddScriptLPS(1);
851 return LSL_Vector.Norm(v);
856 double dx = a.x - b.x;
857 double dy = a.y - b.y;
858 double dz = a.z - b.z;
859 return Math.Sqrt(dx * dx + dy * dy + dz * dz);
864 m_host.AddScriptLPS(1);
865 return VecDist(a, b);
874 m_host.AddScriptLPS(1);
877 double sqw = q1.s*q1.s;
878 double sqx = q1.x*q1.x;
879 double sqy = q1.z*q1.z;
880 double sqz = q1.y*q1.y;
881 double unit = sqx + sqy + sqz + sqw;
882 double test = q1.x*q1.z + q1.y*q1.s;
883 if (test > 0.4999*unit) {
884 eul.z = 2 * Math.Atan2(q1.x,q1.s);
889 if (test < -0.4999*unit) {
890 eul.z = -2 * Math.Atan2(q1.x,q1.s);
895 eul.z = Math.Atan2(2*q1.z*q1.s-2*q1.x*q1.y , sqx - sqy - sqz + sqw);
896 eul.y = Math.Asin(2*test/unit);
897 eul.x = Math.Atan2(2*q1.x*q1.s-2*q1.z*q1.y , -sqx + sqy - sqz + sqw);
948 m_host.AddScriptLPS(1);
954 double c1 = Math.Cos(v.x);
955 double c2 = Math.Cos(v.y);
956 double c1c2 = c1 * c2;
957 double s1 = Math.Sin(v.x);
958 double s2 = Math.Sin(v.y);
959 double s1s2 = s1 * s2;
960 double c1s2 = c1 * s2;
961 double s1c2 = s1 * c2;
962 double c3 = Math.Cos(v.z);
963 double s3 = Math.Sin(v.z);
965 x = s1c2 * c3 + c1s2 * s3;
966 y = c1s2 * c3 - s1c2 * s3;
967 z = s1s2 * c3 + c1c2 * s3;
968 s = c1c2 * c3 - s1s2 * s3;
975 m_host.AddScriptLPS(1);
977 double tr = fwd.x + left.y + up.z + 1.0;
981 s = 0.5 / Math.Sqrt(tr);
985 (fwd.y - left.x) * s,
990 double max = (left.y > up.z) ? left.y : up.z;
994 s = Math.Sqrt(fwd.x - (left.y + up.z) + 1.0);
999 (fwd.y + left.x) * s,
1001 (left.z - up.y) * s);
1003 else if (max == left.y)
1005 s = Math.Sqrt(left.y - (up.z + fwd.x) + 1.0);
1009 (fwd.y + left.x) * s,
1011 (left.z + up.y) * s,
1012 (up.x - fwd.z) * s);
1016 s = Math.Sqrt(up.z - (fwd.x + left.y) + 1.0);
1021 (left.z + up.y) * s,
1023 (fwd.y - left.x) * s);
1030 m_host.AddScriptLPS(1);
1034 m = r.x * r.x + r.y * r.y + r.z * r.z + r.s * r.s;
1037 if (Math.Abs(1.0 - m) > 0.000001)
1039 m = 1.0 / Math.Sqrt(m);
1047 x = r.x * r.x - r.y * r.y - r.z * r.z + r.s * r.s;
1048 y = 2 * (r.x * r.y + r.z * r.s);
1049 z = 2 * (r.x * r.z - r.y * r.s);
1055 m_host.AddScriptLPS(1);
1059 m = r.x * r.x + r.y * r.y + r.z * r.z + r.s * r.s;
1062 if (Math.Abs(1.0 - m) > 0.000001)
1064 m = 1.0 / Math.Sqrt(m);
1072 x = 2 * (r.x * r.y - r.z * r.s);
1073 y = -r.x * r.x + r.y * r.y - r.z * r.z + r.s * r.s;
1074 z = 2 * (r.x * r.s + r.y * r.z);
1080 m_host.AddScriptLPS(1);
1083 m = r.x * r.x + r.y * r.y + r.z * r.z + r.s * r.s;
1086 if (Math.Abs(1.0 - m) > 0.000001)
1088 m = 1.0 / Math.Sqrt(m);
1096 x = 2 * (r.x * r.z + r.y * r.s);
1097 y = 2 * (-r.x * r.s + r.y * r.z);
1098 z = -r.x * r.x - r.y * r.y + r.z * r.z + r.s * r.s;
1105 m_host.AddScriptLPS(1);
1133 LSL_Float vec_a_mag = LSL_Vector.Mag(vec_a);
1134 LSL_Float vec_b_mag = LSL_Vector.Mag(vec_b);
1135 if (vec_a_mag < 0.00001 ||
1136 vec_b_mag < 0.00001)
1142 vec_a = llVecNorm(vec_a);
1143 vec_b = llVecNorm(vec_b);
1150 if (cos_theta > 0.99999)
1156 else if (cos_theta < -0.99999)
1160 return new LSL_Rotation((
float)orthog_axis.x, (
float)orthog_axis.y, (
float)orthog_axis.z, 0.0);
1165 axis = llVecNorm(axis);
1166 double x, y, z, s, t;
1167 s = Math.Cos(theta);
1168 t = Math.Sin(theta);
1178 m_host.AddScriptLPS(1);
1180 if (text.Length > 1023)
1181 text = text.Substring(0, 1023);
1183 World.SimChat(Utils.StringToBytes(text),
1184 ChatTypeEnum.Whisper, channelID, m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID,
false);
1188 wComm.DeliverMessage(ChatTypeEnum.Whisper, channelID, m_host.Name, m_host.UUID, text);
1191 private void CheckSayShoutTime()
1193 DateTime now = DateTime.UtcNow;
1194 if ((now - m_lastSayShoutCheck).Ticks > 10000000)
1196 m_lastSayShoutCheck = now;
1197 m_SayShoutCount = 0;
1203 public void llSay(
int channelID,
string text)
1205 m_host.AddScriptLPS(1);
1209 CheckSayShoutTime();
1211 if (m_SayShoutCount >= 11)
1214 if (m_scriptConsoleChannelEnabled && (channelID == m_scriptConsoleChannel))
1216 Console.WriteLine(text);
1220 if (text.Length > 1023)
1221 text = text.Substring(0, 1023);
1223 World.SimChat(Utils.StringToBytes(text),
1224 ChatTypeEnum.Say, channelID, m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID,
false);
1228 wComm.DeliverMessage(ChatTypeEnum.Say, channelID, m_host.Name, m_host.UUID, text);
1234 m_host.AddScriptLPS(1);
1238 CheckSayShoutTime();
1240 if (m_SayShoutCount >= 11)
1243 if (text.Length > 1023)
1244 text = text.Substring(0, 1023);
1246 World.SimChat(Utils.StringToBytes(text),
1247 ChatTypeEnum.Shout, channelID, m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID,
true);
1251 wComm.DeliverMessage(ChatTypeEnum.Shout, channelID, m_host.Name, m_host.UUID, text);
1258 Error(
"llRegionSay",
"Cannot use on channel 0");
1262 if (text.Length > 1023)
1263 text = text.Substring(0, 1023);
1265 m_host.AddScriptLPS(1);
1270 World.SimChat(Utils.StringToBytes(text),
1271 ChatTypeEnum.Shout, channelID, m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID,
true);
1277 wComm.DeliverMessage(ChatTypeEnum.Region, channelID, m_host.Name, m_host.UUID, text);
1282 if (msg.Length > 1023)
1283 msg = msg.Substring(0, 1023);
1285 m_host.AddScriptLPS(1);
1291 UUID.TryParse(target, out TargetID);
1295 wComm.DeliverMessageTo(TargetID, channel, m_host.AbsolutePosition, m_host.Name, m_host.UUID, msg);
1300 m_host.AddScriptLPS(1);
1302 UUID.TryParse(ID, out keyID);
1305 return wComm.Listen(m_host.LocalId, m_item.ItemID, m_host.UUID, channelID, name, keyID, msg);
1312 m_host.AddScriptLPS(1);
1315 wComm.ListenControl(m_item.ItemID, number, active);
1320 m_host.AddScriptLPS(1);
1323 wComm.ListenRemove(m_item.ItemID, number);
1326 public void llSensor(
string name,
string id,
int type,
double range,
double arc)
1328 m_host.AddScriptLPS(1);
1329 UUID keyID = UUID.Zero;
1330 UUID.TryParse(id, out keyID);
1332 AsyncCommands.SensorRepeatPlugin.SenseOnce(m_host.LocalId, m_item.ItemID, name, keyID, type, range, arc, m_host);
1335 public void llSensorRepeat(
string name,
string id,
int type,
double range,
double arc,
double rate)
1337 m_host.AddScriptLPS(1);
1338 UUID keyID = UUID.Zero;
1339 UUID.TryParse(id, out keyID);
1341 AsyncCommands.SensorRepeatPlugin.SetSenseRepeatEvent(m_host.LocalId, m_item.ItemID, name, keyID, type, range, arc, rate, m_host);
1346 m_host.AddScriptLPS(1);
1347 AsyncCommands.SensorRepeatPlugin.UnSetSenseRepeaterEvents(m_host.LocalId, m_item.ItemID);
1353 UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, objecUUID);
1354 if (account != null)
1356 string avatarname = account.Name;
1363 string objectname = SOP.Name;
1368 World.Entities.TryGetValue(objecUUID, out SensedObject);
1370 if (SensedObject == null)
1375 GroupRecord gr = groups.GetGroupRecord(objecUUID);
1377 return gr.GroupName;
1379 return String.Empty;
1382 return SensedObject.Name;
1387 m_host.AddScriptLPS(1);
1388 DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number);
1389 if (detectedParams == null)
1390 return String.Empty;
1391 return detectedParams.Name;
1396 m_host.AddScriptLPS(1);
1397 DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number);
1398 if (detectedParams == null)
1399 return String.Empty;
1400 return detectedParams.Key.ToString();
1405 m_host.AddScriptLPS(1);
1406 DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number);
1407 if (detectedParams == null)
1408 return String.Empty;
1409 return detectedParams.Owner.ToString();
1414 m_host.AddScriptLPS(1);
1415 DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number);
1416 if (detectedParams == null)
1423 m_host.AddScriptLPS(1);
1424 DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number);
1425 if (detectedParams == null)
1427 return detectedParams.Position;
1432 m_host.AddScriptLPS(1);
1433 DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number);
1434 if (detectedParams == null)
1436 return detectedParams.Velocity;
1441 m_host.AddScriptLPS(1);
1442 DetectParams parms = m_ScriptEngine.GetDetectParams(m_item.ItemID, number);
1446 return parms.OffsetPos;
1451 m_host.AddScriptLPS(1);
1452 DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number);
1453 if (detectedParams == null)
1455 return detectedParams.Rotation;
1460 m_host.AddScriptLPS(1);
1461 DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number);
1462 if (detectedParams == null)
1464 if (m_host.GroupID == detectedParams.Group)
1471 m_host.AddScriptLPS(1);
1472 DetectParams parms = m_ScriptEngine.GetDetectParams(m_item.ItemID, number);
1484 m_host.AddScriptLPS(1);
1485 DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, index);
1486 if (detectedParams == null)
1488 return detectedParams.TouchBinormal;
1496 m_host.AddScriptLPS(1);
1497 DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, index);
1498 if (detectedParams == null)
1508 m_host.AddScriptLPS(1);
1509 DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, index);
1510 if (detectedParams == null)
1512 return detectedParams.TouchNormal;
1520 m_host.AddScriptLPS(1);
1521 DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, index);
1522 if (detectedParams == null)
1524 return detectedParams.TouchPos;
1532 m_host.AddScriptLPS(1);
1533 DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, index);
1534 if (detectedParams == null)
1536 return detectedParams.TouchST;
1544 m_host.AddScriptLPS(1);
1545 DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, index);
1546 if (detectedParams == null)
1548 return detectedParams.TouchUV;
1551 [DebuggerNonUserCode]
1554 m_host.AddScriptLPS(1);
1560 m_host.AddScriptLPS(1);
1561 Vector3 pos = m_host.GetWorldPosition() + (Vector3)offset;
1569 else if (pos.X >=
World.Heightmap.Width)
1570 pos.X = World.Heightmap.Width - 1;
1573 else if (pos.Y >=
World.Heightmap.Height)
1574 pos.Y = World.Heightmap.Height - 1;
1577 float baseheight = (float)
World.Heightmap[(
int)pos.X, (int)pos.Y];
1580 float xdiff = pos.X - (
float)((int)pos.X);
1581 float ydiff = pos.Y - (float)((
int)pos.Y);
1585 return (((vsn.x * xdiff) + (vsn.y * ydiff)) / (-1 * vsn.z)) + baseheight;
1590 m_host.AddScriptLPS(1);
1591 float cloudCover = 0f;
1595 Vector3 pos = m_host.GetWorldPosition();
1596 int x = (int)(pos.X + offset.x);
1597 int y = (int)(pos.Y + offset.y);
1599 cloudCover = module.CloudCover(x, y, 0);
1607 m_host.AddScriptLPS(1);
1612 Vector3 pos = m_host.GetWorldPosition();
1613 int x = (int)(pos.X + offset.x);
1614 int y = (int)(pos.Y + offset.y);
1616 Vector3 windSpeed = module.WindSpeed(x, y, 0);
1618 wind.x = windSpeed.X;
1619 wind.y = windSpeed.Y;
1626 if (m_host == null || m_host.ParentGroup == null || m_host.ParentGroup.IsDeleted)
1628 m_host.AddScriptLPS(1);
1630 int statusrotationaxis = 0;
1639 int maxprims = World.m_linksetPhysCapacity;
1640 bool checkShape = (maxprims > 0 && group.PrimCount > maxprims);
1662 if (m_host.ParentGroup.RootPart.PhysActor != null &&
1663 m_host.ParentGroup.RootPart.PhysActor.IsPhysical)
1666 m_host.ScriptSetPhysicsStatus(
true);
1670 m_host.ScriptSetPhysicsStatus(
false);
1676 m_host.ParentGroup.ScriptSetPhantomStatus(value != 0);
1681 m_host.AddFlag(PrimFlags.CastShadows);
1686 statusrotationaxis |= ScriptBaseClass.STATUS_ROTATE_X;
1691 statusrotationaxis |= ScriptBaseClass.STATUS_ROTATE_Y;
1696 statusrotationaxis |= ScriptBaseClass.STATUS_ROTATE_Z;
1700 m_host.BlockGrab = value != 0;
1708 m_host.SetDieAtEdge(
true);
1710 m_host.SetDieAtEdge(
false);
1716 m_host.SetReturnAtEdge(
true);
1718 m_host.SetReturnAtEdge(
false);
1724 m_host.SetStatusSandbox(
true);
1726 m_host.SetStatusSandbox(
false);
1729 if (statusrotationaxis != 0)
1731 m_host.SetAxisRotation(statusrotationaxis, value);
1735 private bool IsPhysical()
1737 return ((m_host.GetEffectiveObjectFlags() & (uint)
PrimFlags.Physics) == (uint)
PrimFlags.Physics);
1742 m_host.AddScriptLPS(1);
1746 case ScriptBaseClass.STATUS_PHYSICS:
1747 return IsPhysical() ? 1 : 0;
1749 case ScriptBaseClass.STATUS_PHANTOM:
1750 if ((m_host.GetEffectiveObjectFlags() & (uint)
PrimFlags.Phantom) == (uint)
PrimFlags.Phantom)
1756 case ScriptBaseClass.STATUS_CAST_SHADOWS:
1757 if ((m_host.GetEffectiveObjectFlags() & (uint)
PrimFlags.CastShadows) == (uint)
PrimFlags.CastShadows)
1763 case ScriptBaseClass.STATUS_BLOCK_GRAB:
1764 return m_host.BlockGrab ? 1 : 0;
1766 case ScriptBaseClass.STATUS_BLOCK_GRAB_OBJECT:
1767 return m_host.ParentGroup.BlockGrabOverride ? 1 : 0;
1769 case ScriptBaseClass.STATUS_DIE_AT_EDGE:
1770 if (m_host.GetDieAtEdge())
1775 case ScriptBaseClass.STATUS_RETURN_AT_EDGE:
1776 if (m_host.GetReturnAtEdge())
1781 case ScriptBaseClass.STATUS_ROTATE_X:
1788 case ScriptBaseClass.STATUS_ROTATE_Y:
1794 case ScriptBaseClass.STATUS_ROTATE_Z:
1800 case ScriptBaseClass.STATUS_SANDBOX:
1801 if (m_host.GetStatusSandbox())
1811 m_host.AddScriptLPS(1);
1812 SetScale(m_host, scale);
1825 scale.x = Math.Max(World.m_minPhys, Math.Min(World.m_maxPhys, scale.x));
1826 scale.y = Math.Max(World.m_minPhys, Math.Min(World.m_maxPhys, scale.y));
1827 scale.z = Math.Max(World.m_minPhys, Math.Min(World.m_maxPhys, scale.z));
1832 scale.x = Math.Max(World.m_minNonphys, Math.Min(World.m_maxNonphys, scale.x));
1833 scale.y = Math.Max(World.m_minNonphys, Math.Min(World.m_maxNonphys, scale.y));
1834 scale.z = Math.Max(World.m_minNonphys, Math.Min(World.m_maxNonphys, scale.z));
1837 Vector3 tmp = part.Scale;
1838 tmp.X = (float)scale.x;
1839 tmp.Y = (
float)scale.y;
1840 tmp.Z = (float)scale.z;
1847 m_host.AddScriptLPS(1);
1848 return new LSL_Vector(m_host.Scale.X, m_host.Scale.Y, m_host.Scale.Z);
1853 m_host.AddScriptLPS(1);
1854 m_host.ClickAction = (byte)action;
1855 m_host.ParentGroup.HasGroupChanged =
true;
1856 m_host.ScheduleFullUpdate();
1862 m_host.AddScriptLPS(1);
1864 SetColor(m_host, color, face);
1872 Primitive.TextureEntry tex = part.Shape.Textures;
1874 if (face >= 0 && face < GetNumberOfSides(part))
1876 texcolor = tex.CreateFace((uint)face).RGBA;
1877 texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f);
1878 texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f);
1879 texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f);
1880 tex.FaceTextures[face].RGBA = texcolor;
1881 part.UpdateTextureEntry(tex.GetBytes());
1886 for (uint i = 0; i < GetNumberOfSides(part); i++)
1888 if (tex.FaceTextures[i] != null)
1890 texcolor = tex.FaceTextures[i].RGBA;
1891 texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f);
1892 texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f);
1893 texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f);
1894 tex.FaceTextures[i].RGBA = texcolor;
1896 texcolor = tex.DefaultTexture.RGBA;
1897 texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f);
1898 texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f);
1899 texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f);
1900 tex.DefaultTexture.RGBA = texcolor;
1902 part.UpdateTextureEntry(tex.GetBytes());
1907 face = SceneObjectPart.ALL_SIDES;
1909 m_host.SetFaceColorAlpha(face, color, null);
1914 m_host.AddScriptLPS(1);
1916 if (m_UrlModule == null)
1920 m_UrlModule.HttpContentType(
new UUID(
id),
"text/plain");
1924 if (agent == null || agent.IsChildAgent)
1928 string userAgent = m_UrlModule.GetHttpHeader(
new UUID(
id),
"user-agent");
1929 if (userAgent.IndexOf(
"SecondLife") < 0)
1935 string logonFromIPAddress = agent.ControllingClient.RemoteEndPoint.Address.ToString();
1936 string requestFromIPAddress = m_UrlModule.GetHttpHeader(
new UUID(
id),
"remote_addr");
1938 if (requestFromIPAddress == null || requestFromIPAddress.Trim() ==
"")
1940 if (logonFromIPAddress == null || logonFromIPAddress.Trim() ==
"")
1944 if (!requestFromIPAddress.Trim().Equals(logonFromIPAddress.Trim()))
1949 case ScriptBaseClass.CONTENT_TYPE_HTML:
1950 m_UrlModule.HttpContentType(
new UUID(
id),
"text/html");
1952 case ScriptBaseClass.CONTENT_TYPE_XML:
1953 m_UrlModule.HttpContentType(
new UUID(
id),
"application/xml");
1955 case ScriptBaseClass.CONTENT_TYPE_XHTML:
1956 m_UrlModule.HttpContentType(
new UUID(
id),
"application/xhtml+xml");
1958 case ScriptBaseClass.CONTENT_TYPE_ATOM:
1959 m_UrlModule.HttpContentType(
new UUID(
id),
"application/atom+xml");
1961 case ScriptBaseClass.CONTENT_TYPE_JSON:
1962 m_UrlModule.HttpContentType(
new UUID(
id),
"application/json");
1964 case ScriptBaseClass.CONTENT_TYPE_LLSD:
1965 m_UrlModule.HttpContentType(
new UUID(
id),
"application/llsd+xml");
1967 case ScriptBaseClass.CONTENT_TYPE_FORM:
1968 m_UrlModule.HttpContentType(
new UUID(
id),
"application/x-www-form-urlencoded");
1970 case ScriptBaseClass.CONTENT_TYPE_RSS:
1971 m_UrlModule.HttpContentType(
new UUID(
id),
"application/rss+xml");
1974 m_UrlModule.HttpContentType(
new UUID(
id),
"text/plain");
1997 Primitive.TextureEntry tex = part.Shape.Textures;
1998 MappingType textype;
1999 textype = MappingType.Default;
2001 textype = MappingType.Planar;
2003 if (face >= 0 && face < GetNumberOfSides(part))
2005 tex.CreateFace((uint) face);
2006 tex.FaceTextures[face].TexMapType = textype;
2007 part.UpdateTextureEntry(tex.GetBytes());
2012 for (uint i = 0; i < GetNumberOfSides(part); i++)
2014 if (tex.FaceTextures[i] != null)
2016 tex.FaceTextures[i].TexMapType = textype;
2018 tex.DefaultTexture.TexMapType = textype;
2020 part.UpdateTextureEntry(tex.GetBytes());
2030 Primitive.TextureEntry tex = part.Shape.Textures;
2031 if (face >= 0 && face < GetNumberOfSides(part))
2033 tex.CreateFace((uint) face);
2034 tex.FaceTextures[face].Glow = glow;
2035 part.UpdateTextureEntry(tex.GetBytes());
2040 for (uint i = 0; i < GetNumberOfSides(part); i++)
2042 if (tex.FaceTextures[i] != null)
2044 tex.FaceTextures[i].Glow = glow;
2046 tex.DefaultTexture.Glow = glow;
2048 part.UpdateTextureEntry(tex.GetBytes());
2058 Shininess sval =
new Shininess();
2063 sval = Shininess.None;
2066 sval = Shininess.Low;
2069 sval = Shininess.Medium;
2072 sval = Shininess.High;
2075 sval = Shininess.None;
2079 Primitive.TextureEntry tex = part.Shape.Textures;
2080 if (face >= 0 && face < GetNumberOfSides(part))
2082 tex.CreateFace((uint) face);
2083 tex.FaceTextures[face].Shiny = sval;
2084 tex.FaceTextures[face].Bump = bump;
2085 part.UpdateTextureEntry(tex.GetBytes());
2090 for (uint i = 0; i < GetNumberOfSides(part); i++)
2092 if (tex.FaceTextures[i] != null)
2094 tex.FaceTextures[i].Shiny = sval;
2095 tex.FaceTextures[i].Bump = bump;
2097 tex.DefaultTexture.Shiny = sval;
2098 tex.DefaultTexture.Bump = bump;
2100 part.UpdateTextureEntry(tex.GetBytes());
2110 Primitive.TextureEntry tex = part.Shape.Textures;
2111 if (face >= 0 && face < GetNumberOfSides(part))
2113 tex.CreateFace((uint) face);
2114 tex.FaceTextures[face].Fullbright = bright;
2115 part.UpdateTextureEntry(tex.GetBytes());
2120 for (uint i = 0; i < GetNumberOfSides(part); i++)
2122 if (tex.FaceTextures[i] != null)
2124 tex.FaceTextures[i].Fullbright = bright;
2127 tex.DefaultTexture.Fullbright = bright;
2128 part.UpdateTextureEntry(tex.GetBytes());
2135 m_host.AddScriptLPS(1);
2137 return GetAlpha(m_host, face);
2142 Primitive.TextureEntry tex = part.Shape.Textures;
2147 for (i = 0 ; i < GetNumberOfSides(part); i++)
2148 sum += (
double)tex.GetFace((uint)i).RGBA.A;
2151 if (face >= 0 && face < GetNumberOfSides(part))
2153 return (
double)tex.GetFace((uint)face).RGBA.A;
2160 m_host.AddScriptLPS(1);
2162 SetAlpha(m_host, alpha, face);
2167 m_host.AddScriptLPS(1);
2169 List<SceneObjectPart> parts = GetLinkParts(linknumber);
2170 if (parts.Count > 0)
2175 SetAlpha(part, alpha, face);
2186 Primitive.TextureEntry tex = part.Shape.Textures;
2188 if (face >= 0 && face < GetNumberOfSides(part))
2190 texcolor = tex.CreateFace((uint)face).RGBA;
2191 texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
2192 tex.FaceTextures[face].RGBA = texcolor;
2193 part.UpdateTextureEntry(tex.GetBytes());
2198 for (
int i = 0; i < GetNumberOfSides(part); i++)
2200 if (tex.FaceTextures[i] != null)
2202 texcolor = tex.FaceTextures[i].RGBA;
2203 texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
2204 tex.FaceTextures[i].RGBA = texcolor;
2210 if (tex.DefaultTexture != null)
2212 texcolor = tex.DefaultTexture.RGBA;
2213 texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
2214 tex.DefaultTexture.RGBA = texcolor;
2217 part.UpdateTextureEntry(tex.GetBytes());
2243 part.Shape.FlexiEntry =
true;
2245 part.Shape.FlexiSoftness = softness;
2246 part.Shape.FlexiGravity = gravity;
2247 part.Shape.FlexiDrag = friction;
2248 part.Shape.FlexiWind = wind;
2249 part.Shape.FlexiTension = tension;
2250 part.Shape.FlexiForceX = (float)Force.x;
2252 part.Shape.FlexiForceZ = (float)Force.z;
2259 part.Shape.PathCurve = (byte)
Extrusion.Straight;
2262 part.ParentGroup.HasGroupChanged =
true;
2263 part.ScheduleFullUpdate();
2284 part.Shape.LightEntry =
true;
2285 part.Shape.LightColorR = Util.Clip((float)color.x, 0.0f, 1.0f);
2286 part.Shape.LightColorG = Util.Clip((float)color.y, 0.0f, 1.0f);
2287 part.Shape.LightColorB = Util.Clip((float)color.z, 0.0f, 1.0f);
2288 part.Shape.LightIntensity = Util.Clip((float)intensity, 0.0f, 1.0f);
2289 part.Shape.LightRadius = Util.Clip((float)radius, 0.1f, 20.0f);
2290 part.Shape.LightFalloff = Util.Clip((float)falloff, 0.01f, 2.0f);
2294 part.Shape.LightEntry =
false;
2297 part.ParentGroup.HasGroupChanged =
true;
2298 part.ScheduleFullUpdate();
2303 m_host.AddScriptLPS(1);
2304 return GetColor(m_host, face);
2309 Primitive.TextureEntry tex = part.Shape.Textures;
2312 int nsides = GetNumberOfSides(part);
2317 for (i = 0; i < nsides; i++)
2319 texcolor = tex.GetFace((uint)i).RGBA;
2320 rgb.x += texcolor.R;
2321 rgb.y += texcolor.G;
2322 rgb.z += texcolor.B;
2325 float invnsides = 1.0f / (float)nsides;
2333 if (face >= 0 && face < nsides)
2335 texcolor = tex.GetFace((uint)face).RGBA;
2350 m_host.AddScriptLPS(1);
2351 SetTexture(m_host, texture, face);
2352 ScriptSleep(m_sleepMsOnSetTexture);
2357 m_host.AddScriptLPS(1);
2359 List<SceneObjectPart> parts = GetLinkParts(linknumber);
2360 if (parts.Count > 0)
2365 SetTexture(part, texture, face);
2369 ScriptSleep(m_sleepMsOnSetLinkTexture);
2379 textureID = ScriptUtils.GetAssetIdFromItemName(m_host, texture, (int)AssetType.Texture);
2380 if (textureID ==
UUID.Zero)
2382 if (!
UUID.TryParse(texture, out textureID))
2386 Primitive.TextureEntry tex = part.Shape.Textures;
2388 if (face >= 0 && face < GetNumberOfSides(part))
2390 Primitive.TextureEntryFace texface = tex.CreateFace((uint)face);
2391 texface.TextureID = textureID;
2392 tex.FaceTextures[face] = texface;
2393 part.UpdateTextureEntry(tex.GetBytes());
2398 for (uint i = 0; i < GetNumberOfSides(part); i++)
2400 if (tex.FaceTextures[i] != null)
2402 tex.FaceTextures[i].TextureID = textureID;
2405 tex.DefaultTexture.TextureID = textureID;
2406 part.UpdateTextureEntry(tex.GetBytes());
2413 m_host.AddScriptLPS(1);
2415 ScaleTexture(m_host, u, v, face);
2416 ScriptSleep(m_sleepMsOnScaleTexture);
2424 Primitive.TextureEntry tex = part.Shape.Textures;
2425 if (face >= 0 && face < GetNumberOfSides(part))
2427 Primitive.TextureEntryFace texface = tex.CreateFace((uint)face);
2428 texface.RepeatU = (float)u;
2429 texface.RepeatV = (float)v;
2430 tex.FaceTextures[face] = texface;
2431 part.UpdateTextureEntry(tex.GetBytes());
2436 for (
int i = 0; i < GetNumberOfSides(part); i++)
2438 if (tex.FaceTextures[i] != null)
2440 tex.FaceTextures[i].RepeatU = (float)u;
2441 tex.FaceTextures[i].RepeatV = (float)v;
2444 tex.DefaultTexture.RepeatU = (float)u;
2445 tex.DefaultTexture.RepeatV = (float)v;
2446 part.UpdateTextureEntry(tex.GetBytes());
2453 m_host.AddScriptLPS(1);
2454 OffsetTexture(m_host, u, v, face);
2455 ScriptSleep(m_sleepMsOnOffsetTexture);
2463 Primitive.TextureEntry tex = part.Shape.Textures;
2464 if (face >= 0 && face < GetNumberOfSides(part))
2466 Primitive.TextureEntryFace texface = tex.CreateFace((uint)face);
2467 texface.OffsetU = (float)u;
2468 texface.OffsetV = (float)v;
2469 tex.FaceTextures[face] = texface;
2470 part.UpdateTextureEntry(tex.GetBytes());
2475 for (
int i = 0; i < GetNumberOfSides(part); i++)
2477 if (tex.FaceTextures[i] != null)
2479 tex.FaceTextures[i].OffsetU = (float)u;
2480 tex.FaceTextures[i].OffsetV = (float)v;
2483 tex.DefaultTexture.OffsetU = (float)u;
2484 tex.DefaultTexture.OffsetV = (float)v;
2485 part.UpdateTextureEntry(tex.GetBytes());
2492 m_host.AddScriptLPS(1);
2493 RotateTexture(m_host, rotation, face);
2494 ScriptSleep(m_sleepMsOnRotateTexture);
2502 Primitive.TextureEntry tex = part.Shape.Textures;
2503 if (face >= 0 && face < GetNumberOfSides(part))
2505 Primitive.TextureEntryFace texface = tex.CreateFace((uint)face);
2506 texface.Rotation = (float)rotation;
2507 tex.FaceTextures[face] = texface;
2508 part.UpdateTextureEntry(tex.GetBytes());
2513 for (
int i = 0; i < GetNumberOfSides(part); i++)
2515 if (tex.FaceTextures[i] != null)
2517 tex.FaceTextures[i].Rotation = (float)rotation;
2520 tex.DefaultTexture.Rotation = (float)rotation;
2521 part.UpdateTextureEntry(tex.GetBytes());
2528 m_host.AddScriptLPS(1);
2529 return GetTexture(m_host, face);
2534 Primitive.TextureEntry tex = part.Shape.Textures;
2540 if (face >= 0 && face < GetNumberOfSides(part))
2542 Primitive.TextureEntryFace texface;
2543 texface = tex.GetFace((uint)face);
2544 string texture = texface.TextureID.ToString();
2548 foreach (KeyValuePair<UUID, TaskInventoryItem> inv
in part.
TaskInventory)
2550 if (inv.Value.AssetID == texface.TextureID)
2552 texture = inv.Value.Name.ToString();
2562 return UUID.Zero.ToString();
2568 m_host.AddScriptLPS(1);
2570 SetPos(m_host, pos,
true);
2572 ScriptSleep(m_sleepMsOnSetPos);
2584 m_host.AddScriptLPS(1);
2591 if (pos.x < 0 || pos.x >
World.RegionInfo.RegionSizeX || pos.y < 0 || pos.y >
World.RegionInfo.RegionSizeY)
2598 m_host.ParentGroup.IsAttachment ||
2601 pos.x > (World.RegionInfo.RegionSizeX + 10) ||
2603 pos.y > (
World.RegionInfo.RegionSizeY + 10) ||
2604 pos.z > Constants.RegionHeight
2614 Vector3 objectPos = m_host.ParentGroup.RootPart.AbsolutePosition;
2615 LandData here = World.GetLandData(objectPos);
2616 LandData there = World.GetLandData(pos);
2620 bool sameParcel = here.GlobalID == there.GlobalID;
2622 if (!sameParcel && !
World.Permissions.CanRezObject(
2623 m_host.ParentGroup.PrimCount, m_host.ParentGroup.OwnerID, pos))
2628 SetPos(m_host.ParentGroup.RootPart, pos,
false);
2630 return VecDist(pos, llGetRootPosition()) <= 0.1 ? 1 : 0;
2637 if (llVecDist(start, end) > 10.0f * m_ScriptDistanceFactor)
2638 return start + m_ScriptDistanceFactor * 10.0f * llVecNorm(end - start);
2651 float ground = World.GetGroundHeight((float)targetPos.x, (
float)targetPos.y);
2652 bool disable_underground_movement = m_ScriptEngine.Config.GetBoolean(
"DisableUndergroundMovement",
true);
2656 if ((targetPos.z < ground) && disable_underground_movement && m_host.ParentGroup.AttachmentPoint == 0)
2657 targetPos.z = ground;
2660 return SetPosAdjust(fromPos, targetPos);
2676 LSL_Vector currentPos = GetPartLocalPos(part);
2677 LSL_Vector toPos = GetSetPosTarget(part, targetPos, currentPos, adjust);
2683 if (!
World.Permissions.CanObjectEntry(parent.
UUID,
false, (Vector3)toPos))
2685 parent.UpdateGroupPosition((Vector3)toPos);
2689 part.OffsetPosition = (Vector3)toPos;
2693 part.ScheduleTerseUpdate();
2699 m_host.AddScriptLPS(1);
2700 return m_host.GetWorldPosition();
2705 m_host.AddScriptLPS(1);
2706 return GetPartLocalPos(m_host);
2711 m_host.AddScriptLPS(1);
2717 pos = part.OffsetPosition;
2722 pos = part.AttachedPos;
2724 pos = part.AbsolutePosition;
2734 m_host.AddScriptLPS(1);
2737 if (m_host.ParentID == 0 || (m_host.ParentGroup != null && m_host == m_host.ParentGroup.RootPart))
2740 SetRot(m_host, rot);
2746 if (rootPart != null)
2752 ScriptSleep(m_sleepMsOnSetRot);
2757 m_host.AddScriptLPS(1);
2758 SetRot(m_host, rot);
2759 ScriptSleep(m_sleepMsOnSetLocalRot);
2767 bool isroot = (part == part.ParentGroup.RootPart);
2781 if (isroot && isphys)
2784 part.UpdateRotation(rot);
2788 if (isroot && pa != null)
2790 part.ParentGroup.ResetChildPrimPhysicsPositions();
2795 List<ScenePresence> sittingavas = part.ParentGroup.GetSittingAvatars();
2796 if (sittingavas.Count > 0)
2801 av.SendTerseUpdateToAllClients();
2814 if (m_host.LinkNum == 0 || m_host.LinkNum == 1)
2816 return llGetRootRotation();
2819 m_host.AddScriptLPS(1);
2820 Quaternion q = m_host.GetWorldRotation();
2822 if (m_host.ParentGroup != null && m_host.ParentGroup.AttachmentPoint != 0)
2824 ScenePresence avatar = World.GetScenePresence(m_host.ParentGroup.AttachedAvatar);
2827 if ((avatar.
AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0)
2828 q = avatar.CameraRotation * q;
2830 q = avatar.Rotation * q;
2844 ScenePresence avatar = World.GetScenePresence(part.ParentGroup.AttachedAvatar);
2847 if ((avatar.
AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0)
2853 q = part.ParentGroup.GroupRotation;
2856 q = part.ParentGroup.GroupRotation;
2861 q = part.GetWorldRotation();
2864 ScenePresence avatar = World.GetScenePresence(part.ParentGroup.AttachedAvatar);
2867 if ((avatar.
AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0)
2868 q = avatar.CameraRotation * q;
2870 q = avatar.Rotation * q;
2879 return GetPartLocalRot(m_host);
2884 m_host.AddScriptLPS(1);
2885 Quaternion rot = part.RotationOffset;
2891 m_host.AddScriptLPS(1);
2893 if (!m_host.ParentGroup.IsDeleted)
2896 force *= llGetRot();
2898 m_host.ParentGroup.RootPart.SetForce(force);
2906 m_host.AddScriptLPS(1);
2908 if (!m_host.ParentGroup.IsDeleted)
2910 force = m_host.ParentGroup.RootPart.GetForce();
2918 m_host.AddScriptLPS(1);
2919 m_host.SetVelocity(
new Vector3((
float)vel.x, (
float)vel.y, (
float)vel.z), local != 0);
2924 m_host.AddScriptLPS(1);
2925 m_host.SetAngularVelocity(
new Vector3((
float)avel.x, (
float)avel.y, (
float)avel.z), local != 0);
2929 m_host.AddScriptLPS(1);
2930 return m_host.ParentGroup.registerTargetWaypoint(position,
2936 m_host.AddScriptLPS(1);
2937 m_host.ParentGroup.unregisterTargetWaypoint(number);
2942 m_host.AddScriptLPS(1);
2943 return m_host.ParentGroup.registerRotTargetWaypoint(rot, (float)error);
2948 m_host.AddScriptLPS(1);
2949 m_host.ParentGroup.unregisterRotTargetWaypoint(number);
2954 m_host.AddScriptLPS(1);
2955 m_host.MoveToTarget(target, (float)tau);
2960 m_host.AddScriptLPS(1);
2961 m_host.StopMoveToTarget();
2966 m_host.AddScriptLPS(1);
2969 if (v.Length() > 20000.0f)
2974 m_host.ApplyImpulse(v, local != 0);
2980 m_host.AddScriptLPS(1);
2981 m_host.ParentGroup.RootPart.ApplyAngularImpulse(force, local != 0);
2986 m_host.AddScriptLPS(1);
2987 m_host.ParentGroup.RootPart.SetAngularImpulse(torque, local != 0);
2992 m_host.AddScriptLPS(1);
2994 return new LSL_Vector(m_host.ParentGroup.GetTorque());
2999 m_host.AddScriptLPS(1);
3000 llSetForce(force, local);
3001 llSetTorque(torque, local);
3007 m_host.AddScriptLPS(1);
3009 Vector3 vel = Vector3.Zero;
3011 if (m_host.ParentGroup.IsAttachment)
3013 ScenePresence avatar = m_host.ParentGroup.Scene.GetScenePresence(m_host.ParentGroup.AttachedAvatar);
3015 vel = avatar.GetWorldVelocity();
3019 vel = m_host.ParentGroup.RootPart.Velocity;
3027 m_host.AddScriptLPS(1);
3034 m_host.AddScriptLPS(1);
3035 Vector3 avel = m_host.AngularVelocity;
3036 return new LSL_Vector(avel.X, avel.Y, avel.Z);
3041 m_host.AddScriptLPS(1);
3042 return (
double)((DateTime.Now.TimeOfDay.TotalMilliseconds / 1000) % (3600 * 4));
3047 m_host.AddScriptLPS(1);
3048 return DateTime.Now.TimeOfDay.TotalSeconds;
3053 m_host.AddScriptLPS(1);
3054 TimeSpan ScriptTime = DateTime.Now - m_timer;
3055 return (
double)(ScriptTime.TotalMilliseconds / 1000);
3060 m_host.AddScriptLPS(1);
3061 m_timer = DateTime.Now;
3066 m_host.AddScriptLPS(1);
3067 TimeSpan ScriptTime = DateTime.Now - m_timer;
3068 m_timer = DateTime.Now;
3069 return (
double)(ScriptTime.TotalMilliseconds / 1000);
3072 public void llSound(
string sound,
double volume,
int queue,
int loop)
3074 m_host.AddScriptLPS(1);
3075 Deprecated(
"llSound",
"Use llPlaySound instead");
3082 m_host.AddScriptLPS(1);
3085 if (m_SoundModule != null)
3087 m_SoundModule.SendSound(
3089 ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound, AssetType.Sound),
3097 m_host.AddScriptLPS(1);
3098 if (m_SoundModule != null)
3100 m_SoundModule.LoopSound(m_host.UUID, ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound),
3101 volume, 20,
false,
false);
3107 m_host.AddScriptLPS(1);
3108 if (m_SoundModule != null)
3110 m_SoundModule.LoopSound(m_host.UUID, ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound),
3111 volume, 20,
true,
false);
3117 m_host.AddScriptLPS(1);
3118 if (m_SoundModule != null)
3120 m_SoundModule.LoopSound(m_host.UUID, ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound),
3121 volume, 20,
false,
true);
3127 m_host.AddScriptLPS(1);
3130 if (m_SoundModule != null)
3132 m_SoundModule.SendSound(m_host.UUID,
3133 ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound, AssetType.Sound), volume,
false, 0,
3140 m_host.AddScriptLPS(1);
3142 if (m_SoundModule != null)
3144 m_SoundModule.SendSound(m_host.UUID,
3145 ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound, AssetType.Sound), volume,
true, 0, 0,
3152 m_host.AddScriptLPS(1);
3154 if (m_SoundModule != null)
3155 m_SoundModule.StopSound(m_host.UUID);
3160 m_host.AddScriptLPS(1);
3161 if (m_SoundModule != null)
3162 m_SoundModule.PreloadSound(m_host.UUID, ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound), 0);
3163 ScriptSleep(m_sleepMsOnPreloadSound);
3174 m_host.AddScriptLPS(1);
3184 start = src.Length+start;
3188 end = src.Length+end;
3195 if (end < 0 || start >= src.Length)
3197 return String.Empty;
3203 if (end >= src.Length)
3210 return src.Substring(0,end+1);
3213 return src.Substring(start, (end+1) - start);
3230 if (end >= src.Length)
3237 if (start < src.Length)
3239 return src.Substring(start);
3243 return String.Empty;
3248 if (start < src.Length)
3250 return src.Substring(0,end+1) + src.Substring(start);
3254 return src.Substring(0,end+1);
3268 m_host.AddScriptLPS(1);
3277 start = src.Length+start;
3281 end = src.Length+end;
3288 if (end < 0 || start >= src.Length)
3299 if (end >= src.Length)
3304 return src.Remove(start,end-start+1);
3311 if (start < 0 || end >= src.Length)
3313 return String.Empty;
3318 if (start < src.Length)
3320 return src.Remove(start).Remove(0,end+1);
3324 return src.Remove(0,end+1);
3329 if (start < src.Length)
3331 return src.Remove(start);
3349 m_host.AddScriptLPS(1);
3358 index = dest.Length+index;
3370 if (index >= dest.Length)
3380 return dest.Substring(0,index)+src+dest.Substring(index);
3386 m_host.AddScriptLPS(1);
3387 return src.ToUpper();
3392 m_host.AddScriptLPS(1);
3393 return src.ToLower();
3398 Util.FireAndForget(x =>
3400 m_host.AddScriptLPS(1);
3402 if (m_item.PermsGranter ==
UUID.Zero)
3407 Error(
"llGiveMoney",
"No permissions to give money");
3413 if (!
UUID.TryParse(destination, out toID))
3415 Error(
"llGiveMoney",
"Bad key in llGiveMoney");
3423 NotImplemented(
"llGiveMoney");
3428 money.ObjectGiveMoney(
3430 m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount,UUID.Zero, out reason);
3431 }, null,
"LSL_Api.llGiveMoney");
3438 m_host.AddScriptLPS(1);
3439 Deprecated(
"llMakeExplosion",
"Use llParticleSystem instead");
3440 ScriptSleep(m_sleepMsOnMakeExplosion);
3443 public void llMakeFountain(
int particles,
double scale,
double vel,
double lifetime,
double arc,
int bounce,
string texture,
LSL_Vector offset,
double bounce_offset)
3445 m_host.AddScriptLPS(1);
3446 Deprecated(
"llMakeFountain",
"Use llParticleSystem instead");
3447 ScriptSleep(m_sleepMsOnMakeFountain);
3450 public void llMakeSmoke(
int particles,
double scale,
double vel,
double lifetime,
double arc,
string texture,
LSL_Vector offset)
3452 m_host.AddScriptLPS(1);
3453 Deprecated(
"llMakeSmoke",
"Use llParticleSystem instead");
3454 ScriptSleep(m_sleepMsOnMakeSmoke);
3457 public void llMakeFire(
int particles,
double scale,
double vel,
double lifetime,
double arc,
string texture,
LSL_Vector offset)
3459 m_host.AddScriptLPS(1);
3460 Deprecated(
"llMakeFire",
"Use llParticleSystem instead");
3461 ScriptSleep(m_sleepMsOnMakeFire);
3466 doObjectRez(inventory, pos, vel, rot, param,
true);
3471 m_host.AddScriptLPS(1);
3473 Util.FireAndForget(x =>
3475 if (Double.IsNaN(rot.x) || Double.IsNaN(rot.y) || Double.IsNaN(rot.z) || Double.IsNaN(rot.s))
3478 float dist = (float)llVecDist(llGetPos(), pos);
3480 if (dist > m_ScriptDistanceFactor * 10.0f)
3487 Error(
"llRezAtRoot",
"Can't find object '" + inventory +
"'");
3491 if (item.
InvType != (
int)InventoryType.Object)
3493 Error(
"llRezAtRoot",
"Can't create requested object; object is missing from database");
3497 List<SceneObjectGroup> new_groups = World.RezObject(m_host, item, pos, rot, vel, param, atRoot);
3500 if (new_groups == null)
3503 bool notAttachment = !m_host.ParentGroup.IsAttachment;
3508 group.RootPart.SetDieAtEdge(
true);
3510 group.ResumeScripts();
3512 m_ScriptEngine.PostObjectEvent(m_host.LocalId,
new EventParams(
3513 "object_rez",
new Object[] {
3520 float groupmass = group.GetMass();
3525 if (pa != null && pa.IsPhysical && (Vector3)vel != Vector3.Zero)
3527 Vector3 recoil = -vel * groupmass * m_recoilScaleFactor;
3528 if (recoil != Vector3.Zero)
3530 llApplyImpulse(recoil, 0);
3537 }, null,
"LSL_Api.llRezAtRoot");
3540 ScriptSleep(m_sleepMsOnRezAtRoot);
3545 doObjectRez(inventory, pos, vel, rot, param,
false);
3550 m_host.AddScriptLPS(1);
3564 left = llVecNorm(left);
3579 if (strength <= 0.0 || damping <= 0.0)
3592 sog.StartLookAt(rot, (float)strength, (
float)damping);
3598 m_host.AddScriptLPS(1);
3599 m_host.StopLookAt();
3604 if (sec != 0.0 && sec < m_MinTimerInterval)
3605 sec = m_MinTimerInterval;
3606 m_host.AddScriptLPS(1);
3608 AsyncCommands.TimerPlugin.SetTimerEvent(m_host.LocalId, m_item.ItemID, sec);
3614 m_host.AddScriptLPS(1);
3616 Sleep((
int)(sec * 1000));
3621 m_host.AddScriptLPS(1);
3623 if (m_host.ParentGroup.IsAttachment)
3625 ScenePresence attachedAvatar = World.GetScenePresence(m_host.ParentGroup.AttachedAvatar);
3627 if (attachedAvatar != null)
3629 return attachedAvatar.GetMass();
3641 return m_host.ParentGroup.GetMass();
3652 return 100f * llGetMass();
3657 m_host.AddScriptLPS(1);
3658 m_host.CollisionFilter.Clear();
3661 if (!
UUID.TryParse(
id, out objectID))
3662 objectID =
UUID.Zero;
3664 if (objectID ==
UUID.Zero && name ==
"")
3667 m_host.CollisionFilter.Add(accept,objectID.ToString() + name);
3672 if (m_item.PermsGranter !=
UUID.Zero)
3674 ScenePresence presence = World.GetScenePresence(m_item.PermsGranter);
3676 if (presence != null)
3680 presence.RegisterControlEventsToScript(controls, accept, pass_on, m_host.LocalId, m_item.ItemID);
3685 m_host.AddScriptLPS(1);
3690 m_host.AddScriptLPS(1);
3692 if (m_item.PermsGranter !=
UUID.Zero)
3694 ScenePresence presence = World.GetScenePresence(m_item.PermsGranter);
3696 if (presence != null)
3701 presence.UnRegisterControlEventsToScript(m_host.LocalId, m_item.ItemID);
3711 m_host.AddScriptLPS(1);
3712 if (m_UrlModule != null)
3713 m_UrlModule.ReleaseURL(url);
3726 ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
3730 if (attachmentsModule != null)
3731 return attachmentsModule.AttachObject(presence, grp, (uint)attachmentPoint,
false,
true,
true);
3744 Util.FireAndForget(DetachWrapper, m_host,
"LSL_Api.DetachFromAvatar");
3747 private void DetachWrapper(
object o)
3749 if (
World.AttachmentsModule != null)
3752 ScenePresence presence = World.GetScenePresence(host.OwnerID);
3753 World.AttachmentsModule.DetachSingleAttachmentToInv(presence, host.ParentGroup);
3759 m_host.AddScriptLPS(1);
3761 if (m_item.PermsGranter != m_host.OwnerID)
3765 AttachToAvatar(attachmentPoint);
3770 m_host.AddScriptLPS(1);
3772 if (m_host.ParentGroup.AttachmentPoint == 0)
3775 if (m_item.PermsGranter != m_host.OwnerID)
3784 m_host.AddScriptLPS(1);
3785 Deprecated(
"llTakeCamera",
"Use llSetCameraParams instead");
3790 m_host.AddScriptLPS(1);
3791 Deprecated(
"llReleaseCamera",
"Use llClearCameraParams instead");
3796 m_host.AddScriptLPS(1);
3798 return m_host.OwnerID.ToString();
3803 m_host.AddScriptLPS(1);
3805 if (!
UUID.TryParse(user, out result) || result == UUID.Zero)
3807 Error(
"llInstantMessage",
"An invalid key was passed to llInstantMessage");
3821 UUID friendTransactionID = UUID.Random();
3826 msg.fromAgentID =
new Guid(m_host.OwnerID.ToString());
3827 msg.toAgentID =
new Guid(user);
3828 msg.imSessionID =
new Guid(m_host.UUID.ToString());
3829 msg.timestamp = (uint)Util.UnixTimeSinceEpoch();
3830 msg.fromAgentName = m_host.Name;
3832 if (message != null && message.Length > 1024)
3833 msg.message = message.Substring(0, 1024);
3835 msg.message = message;
3836 msg.dialog = (byte)19;
3837 msg.fromGroup =
false;
3838 msg.offline = (byte)0;
3839 msg.ParentEstateID = World.RegionInfo.EstateSettings.EstateID;
3840 msg.Position =
new Vector3(m_host.AbsolutePosition);
3841 msg.RegionID = World.RegionInfo.RegionID.Guid;
3843 Vector3 pos = m_host.AbsolutePosition;
3845 = Util.StringToBytes256(
3847 World.RegionInfo.RegionName,
3848 (int)Math.Floor(pos.X),
3849 (int)Math.Floor(pos.Y),
3850 (int)Math.Floor(pos.Z));
3852 if (m_TransferModule != null)
3854 m_TransferModule.SendInstantMessage(msg, delegate(
bool success) {});
3857 ScriptSleep(m_sleepMsOnInstantMessage);
3860 public void llEmail(
string address,
string subject,
string message)
3862 m_host.AddScriptLPS(1);
3864 if (emailModule == null)
3866 Error(
"llEmail",
"Email module not configured");
3872 if (m_restrictEmail ==
true && address.Contains(m_internalObjectHost) ==
false)
3875 World.UserAccountService.GetUserAccount(
3876 World.RegionInfo.ScopeID,
3879 if (account == null)
3881 Error(
"llEmail",
"Can't find user account for '" + m_host.OwnerID.ToString() +
"'");
3887 Error(
"llEmail",
"User account has not registered an email address.");
3891 address = account.Email;
3894 emailModule.SendEmail(m_host.UUID, address, subject, message);
3895 ScriptSleep(m_sleepMsOnEmail);
3900 m_host.AddScriptLPS(1);
3902 if (emailModule == null)
3904 Error(
"llGetNextEmail",
"Email module not configured");
3909 email = emailModule.GetNextEmail(m_host.UUID, address, subject);
3914 m_ScriptEngine.PostObjectEvent(m_host.LocalId,
3928 m_host.AddScriptLPS(1);
3929 return m_host.UUID.ToString();
3934 m_host.AddScriptLPS(1);
3935 return UUID.Random().ToString();
3940 m_host.AddScriptLPS(1);
3942 if (!m_host.ParentGroup.IsDeleted)
3944 m_host.ParentGroup.RootPart.SetBuoyancy((float)buoyancy);
3956 m_host.AddScriptLPS(1);
3961 hoverType = PIDHoverType.GroundAndWater;
3963 m_host.SetHoverHeight((float)height, hoverType, (
float)tau);
3968 m_host.AddScriptLPS(1);
3969 m_host.SetHoverHeight(0f, PIDHoverType.Ground, 0f);
3974 m_host.AddScriptLPS(1);
3977 m_ScriptEngine.SetMinEventDelay(m_item.ItemID, delay);
3979 catch (NotImplementedException)
3982 NotImplemented(
"llMinEventDelay",
"In DotNetEngine");
3988 m_host.AddScriptLPS(1);
3989 Deprecated(
"llSoundPreload",
"Use llPreloadSound instead");
3994 m_host.AddScriptLPS(1);
3999 if(sog == null || sog.IsDeleted)
4002 if (strength == 0 || !sog.UsesPhysics || sog.IsAttachment)
4004 llSetLocalRot(target);
4008 sog.RotLookAt(target, (float)strength, (
float)damping);
4014 m_host.AddScriptLPS(1);
4027 m_host.AddScriptLPS(1);
4029 if (m_item.PermsGranter ==
UUID.Zero)
4034 ScenePresence presence = World.GetScenePresence(m_item.PermsGranter);
4036 if (presence != null)
4039 UUID animID = ScriptUtils.GetAssetIdFromItemName(m_host, anim, (int)AssetType.Animation);
4040 if (animID ==
UUID.Zero)
4041 presence.Animator.AddAnimation(anim, m_host.UUID);
4043 presence.Animator.AddAnimation(animID, m_host.UUID);
4050 m_host.AddScriptLPS(1);
4052 if (m_item.PermsGranter ==
UUID.Zero)
4057 ScenePresence presence = World.GetScenePresence(m_item.PermsGranter);
4059 if (presence != null)
4061 UUID animID = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, anim);
4063 if (animID ==
UUID.Zero)
4064 presence.Animator.RemoveAnimation(anim);
4066 presence.Animator.RemoveAnimation(animID,
true);
4073 m_host.AddScriptLPS(1);
4078 m_host.AddScriptLPS(1);
4083 m_host.AddScriptLPS(1);
4084 TargetOmega(m_host, axis, spinrate, gain);
4090 if ( ( pa == null || !pa.
IsPhysical ) && gain == 0.0d )
4092 part.UpdateAngularVelocity(axis * spinrate);
4097 m_host.AddScriptLPS(1);
4098 return m_ScriptEngine.GetStartParameter(m_item.ItemID);
4105 if (!
UUID.TryParse(agent, out agentID))
4108 if (agentID ==
UUID.Zero || perm == 0)
4110 llReleaseControls();
4112 m_item.PermsGranter = UUID.Zero;
4113 m_item.PermsMask = 0;
4115 m_ScriptEngine.PostScriptEvent(m_item.ItemID,
new EventParams(
4116 "run_time_permissions",
new Object[] {
4124 llReleaseControls();
4126 m_host.AddScriptLPS(1);
4128 int implicitPerms = 0;
4130 if (m_host.ParentGroup.IsAttachment && (
UUID)agent == m_host.ParentGroup.AttachedAvatar)
4133 implicitPerms = ScriptBaseClass.PERMISSION_TAKE_CONTROLS |
4134 ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION |
4135 ScriptBaseClass.PERMISSION_CONTROL_CAMERA |
4136 ScriptBaseClass.PERMISSION_TRACK_CAMERA |
4137 ScriptBaseClass.PERMISSION_ATTACH |
4138 ScriptBaseClass.PERMISSION_OVERRIDE_ANIMATIONS;
4142 if (m_host.ParentGroup.GetSittingAvatars().SingleOrDefault(sp => sp.UUID == agentID) != null)
4145 implicitPerms = ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION |
4146 ScriptBaseClass.PERMISSION_CONTROL_CAMERA |
4147 ScriptBaseClass.PERMISSION_TRACK_CAMERA |
4148 ScriptBaseClass.PERMISSION_TAKE_CONTROLS;
4152 if (
World.GetExtraSetting(
"auto_grant_attach_perms") ==
"true")
4155 if (
World.GetExtraSetting(
"auto_grant_all_perms") ==
"true")
4157 implicitPerms = perm;
4161 if ((perm & (~implicitPerms)) == 0)
4163 m_host.TaskInventory.LockItemsForWrite(
true);
4164 m_host.TaskInventory[m_item.ItemID].PermsGranter = agentID;
4165 m_host.TaskInventory[m_item.ItemID].PermsMask = perm;
4166 m_host.TaskInventory.LockItemsForWrite(
false);
4168 m_ScriptEngine.PostScriptEvent(m_item.ItemID,
new EventParams(
4169 "run_time_permissions",
new Object[] {
4178 if (presence != null)
4183 if (npcModule != null && npcModule.
IsNPC(agentID,
World))
4187 lock (m_host.TaskInventory)
4189 m_host.TaskInventory[m_item.ItemID].PermsGranter = agentID;
4190 m_host.TaskInventory[m_item.ItemID].PermsMask = perm;
4193 m_ScriptEngine.PostScriptEvent(
4204 string ownerName = resolveName(m_host.ParentGroup.RootPart.OwnerID);
4205 if (ownerName ==
String.Empty)
4206 ownerName =
"(hippos)";
4208 if (!m_waitingForScriptAnswer)
4210 m_host.TaskInventory.LockItemsForWrite(
true);
4211 m_host.TaskInventory[m_item.ItemID].PermsGranter = agentID;
4212 m_host.TaskInventory[m_item.ItemID].PermsMask = 0;
4213 m_host.TaskInventory.LockItemsForWrite(
false);
4215 presence.ControllingClient.OnScriptAnswer += handleScriptAnswer;
4216 m_waitingForScriptAnswer=
true;
4219 presence.ControllingClient.SendScriptQuestion(
4220 m_host.UUID, m_host.ParentGroup.RootPart.Name, ownerName, m_item.ItemID, perm);
4226 m_ScriptEngine.PostScriptEvent(
4231 void handleScriptAnswer(
IClientAPI client, UUID taskID, UUID itemID,
int answer)
4233 if (taskID != m_host.UUID)
4236 client.OnScriptAnswer -= handleScriptAnswer;
4237 m_waitingForScriptAnswer =
false;
4240 llReleaseControls();
4242 m_host.TaskInventory.LockItemsForWrite(
true);
4243 m_host.TaskInventory[m_item.ItemID].PermsMask = answer;
4244 m_host.TaskInventory.LockItemsForWrite(
false);
4246 m_ScriptEngine.PostScriptEvent(m_item.ItemID,
new EventParams(
4247 "run_time_permissions",
new Object[] {
4254 m_host.AddScriptLPS(1);
4256 return m_item.PermsGranter.ToString();
4261 m_host.AddScriptLPS(1);
4263 int perms = m_item.PermsMask;
4265 if (m_automaticLinkPermission)
4266 perms |= ScriptBaseClass.PERMISSION_CHANGE_LINKS;
4273 m_host.AddScriptLPS(1);
4275 if (m_host.ParentGroup.PrimCount > 1)
4277 return m_host.LinkNum;
4287 List<SceneObjectPart> parts = GetLinkParts(linknumber);
4288 if (parts.Count > 0)
4293 part.SetFaceColorAlpha(face, color, null);
4301 m_host.AddScriptLPS(1);
4305 if (!
UUID.TryParse(target, out targetID))
4309 && !m_automaticLinkPermission)
4311 Error(
"llCreateLink",
"PERMISSION_CHANGE_LINKS permission not set");
4315 CreateLink(target, parent);
4322 if (!
UUID.TryParse(target, out targetID))
4335 if (targetPart != null)
4339 parentPrim = m_host.ParentGroup;
4340 childPrim = targetPart.ParentGroup;
4344 parentPrim = targetPart.ParentGroup;
4345 childPrim = m_host.ParentGroup;
4349 childPrim.RootPart.ClearUpdateSchedule();
4350 parentPrim.LinkToGroup(childPrim,
true);
4353 parentPrim.TriggerScriptChangedEvent(Changed.LINK);
4354 parentPrim.RootPart.CreateSelected =
true;
4355 parentPrim.HasGroupChanged =
true;
4356 parentPrim.ScheduleGroupForFullUpdate();
4361 client = sp.ControllingClient;
4364 parentPrim.SendPropertiesToClient(client);
4366 ScriptSleep(m_sleepMsOnCreateLink);
4371 m_host.AddScriptLPS(1);
4374 && !m_automaticLinkPermission)
4376 Error(
"llBreakLink",
"PERMISSION_CHANGE_LINKS permission not set");
4396 case ScriptBaseClass.LINK_ROOT:
4398 case ScriptBaseClass.LINK_SET:
4399 case ScriptBaseClass.LINK_ALL_OTHERS:
4400 case ScriptBaseClass.LINK_ALL_CHILDREN:
4401 case ScriptBaseClass.LINK_THIS:
4404 if (part.
UUID != m_host.UUID)
4412 childPrim = parentPrim.GetLinkNumPart(linknum);
4413 if (childPrim.
UUID == m_host.UUID)
4421 List<SceneObjectPart> parts =
new List<SceneObjectPart>(parentPrim.Parts);
4422 parts.Remove(parentPrim.RootPart);
4423 if (parts.Count > 0)
4429 parentPrim.DelinkFromGroup(part.LocalId,
true);
4435 parentPrim.HasGroupChanged =
true;
4436 parentPrim.ScheduleGroupForFullUpdate();
4437 parentPrim.TriggerScriptChangedEvent(Changed.LINK);
4439 if (parts.Count > 0)
4442 parts.Remove(newRoot);
4448 part.ClearUpdateSchedule();
4449 newRoot.ParentGroup.LinkToGroup(part.ParentGroup);
4454 newRoot.ParentGroup.HasGroupChanged =
true;
4455 newRoot.ParentGroup.ScheduleGroupForFullUpdate();
4460 if (childPrim == null)
4463 parentPrim.DelinkFromGroup(childPrim.LocalId,
true);
4464 parentPrim.HasGroupChanged =
true;
4465 parentPrim.ScheduleGroupForFullUpdate();
4466 parentPrim.TriggerScriptChangedEvent(Changed.LINK);
4472 m_host.AddScriptLPS(1);
4477 && !m_automaticLinkPermission)
4479 Error(
"llBreakAllLinks",
"Script trying to link but PERMISSION_CHANGE_LINKS permission not set!");
4491 List<SceneObjectPart> parts =
new List<SceneObjectPart>(parentPrim.Parts);
4492 parts.Remove(parentPrim.RootPart);
4496 parentPrim.DelinkFromGroup(part.LocalId,
true);
4497 parentPrim.TriggerScriptChangedEvent(Changed.LINK);
4499 parentPrim.HasGroupChanged =
true;
4500 parentPrim.ScheduleGroupForFullUpdate();
4505 m_host.AddScriptLPS(1);
4509 return part.UUID.ToString();
4513 if (linknum > m_host.ParentGroup.PrimCount || (linknum == 1 && m_host.ParentGroup.PrimCount == 1))
4515 linknum -= (m_host.ParentGroup.PrimCount) + 1;
4518 return UUID.Zero.ToString();
4521 if (avatars.Count > linknum)
4523 return avatars[linknum].UUID.ToString();
4526 return UUID.Zero.ToString();
4571 m_host.AddScriptLPS(1);
4578 return ScriptBaseClass.NULL_KEY;
4583 m_host.AddScriptLPS(1);
4586 m_host.TaskInventory.LockItemsForRead(
true);
4587 foreach (KeyValuePair<UUID, TaskInventoryItem> inv
in m_host.TaskInventory)
4589 if (inv.Value.Type == type || type == -1)
4595 m_host.TaskInventory.LockItemsForRead(
false);
4601 m_host.AddScriptLPS(1);
4602 ArrayList keys =
new ArrayList();
4604 m_host.TaskInventory.LockItemsForRead(
true);
4605 foreach (KeyValuePair<UUID, TaskInventoryItem> inv
in m_host.TaskInventory)
4607 if (inv.Value.Type == type || type == -1)
4609 keys.Add(inv.Value.Name);
4612 m_host.TaskInventory.LockItemsForRead(
false);
4614 if (keys.Count == 0)
4616 return String.Empty;
4619 if (keys.Count > number)
4621 return (
string)keys[number];
4623 return String.Empty;
4628 m_host.AddScriptLPS(1);
4635 m_host.AddScriptLPS(1);
4637 UUID destId = UUID.Zero;
4639 if (!
UUID.TryParse(destination, out destId))
4641 Error(
"llGiveInventory",
"Can't parse destination key '" + destination +
"'");
4649 Error(
"llGiveInventory",
"Can't find inventory object '" + inventory +
"'");
4653 UUID objId = item.ItemID;
4656 if (
World.GetSceneObjectPart(destId) != null)
4659 World.MoveTaskInventoryItem(destId, m_host, objId);
4665 if (presence == null)
4668 World.UserAccountService.GetUserAccount(
4669 World.RegionInfo.ScopeID,
4672 if (account == null)
4674 GridUserInfo info = World.GridUserService.GetGridUserInfo(destId.ToString());
4675 if(info == null || info.
Online ==
false)
4677 Error(
"llGiveInventory",
"Can't find destination '" + destId.ToString() +
"'");
4685 InventoryItemBase agentItem = World.MoveTaskInventoryItem(destId, UUID.Zero, m_host, objId, out message);
4687 if (agentItem == null)
4693 byte[] bucket =
new byte[1];
4694 bucket[0] = (byte)item.
Type;
4699 m_host.OwnerID, m_host.Name, destId,
4700 (byte)InstantMessageDialog.TaskInventoryOffered,
4701 false, item.Name+
". "+m_host.Name+
" is located at "+
4702 World.RegionInfo.RegionName+
" "+
4703 m_host.AbsolutePosition.ToString(),
4704 agentItem.
ID,
true, m_host.AbsolutePosition,
4709 if (
World.TryGetScenePresence(destId, out sp))
4711 sp.ControllingClient.SendInstantMessage(msg);
4715 if (m_TransferModule != null)
4716 m_TransferModule.SendInstantMessage(msg, delegate(
bool success) {});
4720 ScriptSleep(m_sleepMsOnGiveInventory);
4724 [DebuggerNonUserCode]
4727 m_host.AddScriptLPS(1);
4734 if (item.ItemID == m_item.ItemID)
4737 m_host.Inventory.RemoveInventoryItem(item.ItemID);
4742 m_host.AddScriptLPS(1);
4743 Vector3 av3 = Util.Clip(color, 0.0f, 1.0f);
4744 if (text.Length > 254)
4745 text = text.Remove(254);
4750 data = Util.UTF8.GetBytes(text);
4751 if (data.Length > 254)
4752 text = text.Substring(0, text.Length - 1);
4753 }
while (data.Length > 254);
4755 m_host.SetText(text, av3, Util.Clip((float)alpha, 0.0f, 1.0f));
4762 m_host.AddScriptLPS(1);
4763 return World.RegionInfo.RegionSettings.WaterHeight;
4768 m_host.AddScriptLPS(1);
4770 m_host.PassTouches =
true;
4772 m_host.PassTouches =
false;
4777 m_host.AddScriptLPS(1);
4780 if (
UUID.TryParse(
id, out uuid))
4786 if (!m_userInfoCache.TryGetValue(uuid, out ce))
4788 account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, uuid);
4789 if (account == null)
4791 m_userInfoCache[uuid] = null;
4792 return UUID.Zero.ToString();
4795 PresenceInfo[] pinfos = World.PresenceService.GetAgents(
new string[] { uuid.ToString() });
4796 if (pinfos != null && pinfos.Length > 0)
4808 ce.time = Util.EnvironmentTickCount();
4809 ce.account = account;
4811 m_userInfoCache[uuid] = ce;
4816 return UUID.Zero.ToString();
4818 account = ce.account;
4822 if (Util.EnvironmentTickCount() < ce.time ||
4823 (Util.EnvironmentTickCount() - ce.time) >= LlRequestAgentDataCacheTimeoutMs)
4825 PresenceInfo[] pinfos = World.PresenceService.GetAgents(
new string[] { uuid.ToString() });
4826 if (pinfos != null && pinfos.Length > 0)
4839 ce.time = Util.EnvironmentTickCount();
4843 string reply = String.Empty;
4847 case ScriptBaseClass.DATA_ONLINE:
4853 case ScriptBaseClass.DATA_NAME:
4854 reply = account.FirstName +
" " + account.LastName;
4856 case ScriptBaseClass.DATA_BORN:
4857 DateTime born =
new DateTime(1970, 1, 1, 0, 0, 0, 0);
4858 born = born.AddSeconds(account.Created);
4859 reply = born.ToString(
"yyyy-MM-dd");
4861 case ScriptBaseClass.DATA_RATING:
4862 reply =
"0,0,0,0,0,0";
4865 reply = account.UserLevel.ToString();
4867 case ScriptBaseClass.DATA_PAYINFO:
4871 return UUID.Zero.ToString();
4874 UUID rq = UUID.Random();
4876 UUID tid = AsyncCommands.
4877 DataserverPlugin.RegisterRequest(m_host.LocalId,
4878 m_item.ItemID, rq.ToString());
4881 DataserverPlugin.DataserverReply(rq.ToString(), reply);
4883 ScriptSleep(m_sleepMsOnRequestAgentData);
4884 return tid.ToString();
4888 Error(
"llRequestAgentData",
"Invalid UUID passed to llRequestAgentData.");
4895 m_host.AddScriptLPS(1);
4899 if (item.
Type == 3 && item.
Name == name)
4901 UUID tid = AsyncCommands.
4902 DataserverPlugin.RegisterRequest(m_host.LocalId,
4903 m_item.ItemID, item.AssetID.ToString());
4905 Vector3 region =
new Vector3(
World.RegionInfo.WorldLocX,
World.RegionInfo.WorldLocY, 0);
4907 World.AssetService.Get(item.AssetID.ToString(),
this,
4908 delegate(
string i,
object sender,
AssetBase a)
4914 region = lm.
Position +
new Vector3(rx, ry, 0) - region;
4916 string reply = region.ToString();
4918 DataserverPlugin.DataserverReply(i.ToString(),
4922 ScriptSleep(m_sleepMsOnRequestInventoryData);
4923 return tid.ToString();
4927 ScriptSleep(m_sleepMsOnRequestInventoryData);
4928 return String.Empty;
4933 m_host.AddScriptLPS(1);
4934 m_host.ParentGroup.Damage = (float)damage;
4939 m_host.AddScriptLPS(1);
4941 if (
UUID.TryParse(agent, out agentId))
4955 GridRegion regionInfo = World.GridService.GetRegionByUUID(UUID.Zero,
new UUID(
"2b02daac-e298-42fa-9a75-f488d37896e6"));
4956 if (regionInfo != null)
4958 World.RequestTeleportLocation(
4959 presence.ControllingClient, regionInfo.RegionHandle,
new Vector3(128, 128, 23), Vector3.Zero,
4967 ScriptSleep(m_sleepMsOnSetDamage);
4972 m_host.AddScriptLPS(1);
4975 if (
UUID.TryParse(agent, out agentId))
4980 if (destination ==
String.Empty)
4981 destination = World.RegionInfo.RegionName;
4983 if (m_item.PermsGranter == agentId)
4987 DoLLTeleport(presence, destination, targetPos, targetLookAt);
4992 if (m_host.ParentGroup.AttachmentPoint != 0 && m_host.OwnerID == presence.
UUID)
4994 DoLLTeleport(presence, destination, targetPos, targetLookAt);
4999 if (presence.
GodLevel >= 200)
return;
5002 ILandObject agentLand = World.LandChannel.GetLandObject(presence.AbsolutePosition);
5003 ILandObject objectLand = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
5004 if (m_host.OwnerID == objectLand.LandData.OwnerID && m_host.OwnerID == agentLand.
LandData.
OwnerID)
5006 DoLLTeleport(presence, destination, targetPos, targetLookAt);
5015 m_host.AddScriptLPS(1);
5018 ulong regionHandle = Util.RegionWorldLocToHandle((uint)global_coords.x, (uint)global_coords.y);
5020 if (
UUID.TryParse(agent, out agentId))
5023 if (m_host.OwnerID != agentId)
5035 if (m_item.PermsGranter == agentId)
5038 if (m_host.ParentGroup.AttachmentPoint != 0 && m_host.ParentGroup.FromItemID ==
UUID.Zero)
5043 World.RequestTeleportLocation(presence.ControllingClient, regionHandle, targetPos, targetLookAt, (uint)
TeleportFlags.ViaLocation);
5049 private void DoLLTeleport(
ScenePresence sp,
string destination, Vector3 targetPos, Vector3 targetLookAt)
5051 UUID assetID = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, destination);
5055 if (assetID ==
UUID.Zero)
5057 World.RequestTeleportLocation(sp.ControllingClient, destination, targetPos, targetLookAt, (uint)
TeleportFlags.ViaLocation);
5061 AssetBase lma = World.AssetService.Get(assetID.ToString());
5065 if (lma.Type != (sbyte)AssetType.Landmark)
5070 World.RequestTeleportLocation(sp.ControllingClient, lm.RegionHandle, targetPos, targetLookAt, (uint)
TeleportFlags.ViaLocation);
5073 public void llTextBox(
string agent,
string message,
int chatChannel)
5080 m_host.AddScriptLPS(1);
5082 if (!
UUID.TryParse(agent,out av))
5084 Error(
"llTextBox",
"First parameter must be a key");
5088 if (message ==
string.Empty)
5090 Error(
"llTextBox",
"Empty message");
5092 else if (Encoding.UTF8.GetByteCount(message) > 512)
5094 Error(
"llTextBox",
"Message longer than 512 bytes");
5098 dm.SendTextBoxToUser(av, message, chatChannel, m_host.Name, m_host.UUID, m_host.OwnerID);
5099 ScriptSleep(m_sleepMsOnTextBox);
5105 m_host.AddScriptLPS(1);
5109 tm.ModifyTerrain(m_host.OwnerID, m_host.AbsolutePosition, (byte) brush, (byte) action, m_host.OwnerID);
5115 m_host.AddScriptLPS(1);
5117 if(impact_sound ==
"")
5119 m_host.CollisionSoundVolume = (float)impact_volume;
5120 m_host.CollisionSound = m_host.invalidCollisionSoundUUID;
5121 m_host.CollisionSoundType = 0;
5125 m_host.CollisionSound = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, impact_sound, AssetType.Sound);
5126 m_host.CollisionSoundVolume = (float)impact_volume;
5127 m_host.CollisionSoundType = 1;
5133 m_host.AddScriptLPS(1);
5136 if (presence == null)
5141 if (presence != null)
5148 string movementAnimation = presence.Animator.CurrentMovementAnimation;
5149 string lslMovementAnimation;
5151 if (MovementAnimationsForLSL.TryGetValue(movementAnimation, out lslMovementAnimation))
5152 return lslMovementAnimation;
5156 return String.Empty;
5161 m_host.AddScriptLPS(1);
5163 List<SceneObjectPart> parts = GetLinkParts(linknumber);
5172 partItemID = item.ItemID;
5173 int linkNumber = m_host.LinkNum;
5174 if (m_host.ParentGroup.PrimCount == 1)
5177 object[] resobj =
new object[]
5182 m_ScriptEngine.PostScriptEvent(partItemID,
5192 m_host.AddScriptLPS(1);
5193 bool pushrestricted = World.RegionInfo.RegionSettings.RestrictPushing;
5194 bool pushAllowed =
false;
5196 bool pusheeIsAvatar =
false;
5197 UUID targetID = UUID.Zero;
5199 if (!
UUID.TryParse(target,out targetID))
5203 Vector3 PusheePos = Vector3.Zero;
5209 pusheeIsAvatar =
true;
5216 if (avatar.
GodLevel > 0 && m_host.OwnerID != targetID)
5224 if (sitPart != null)
5225 PusheePos = sitPart.AbsolutePosition;
5227 PusheePos = pusheeav.AbsolutePosition;
5230 if (!pusheeIsAvatar)
5233 pusheeob = World.GetSceneObjectPart((
UUID)target);
5236 if (pusheeob == null)
5243 PusheePos = pusheeob.AbsolutePosition;
5250 ILandObject targetlandObj = World.LandChannel.GetLandObject(PusheePos);
5253 if (targetlandObj == null)
5265 ILandObject targetlandObj = World.LandChannel.GetLandObject(PusheePos);
5266 if (targetlandObj == null)
5274 if ((targetlandObj.
LandData.
Flags & (uint)ParcelFlags.RestrictPushObject) == (uint)ParcelFlags.RestrictPushObject)
5279 m_host.OwnerID == targetID)
5298 float distance = (PusheePos - m_host.AbsolutePosition).Length();
5299 float distance_term = distance * distance * distance;
5301 float pusher_mass = m_host.ParentGroup.GetMass();
5303 float PUSH_ATTENUATION_DISTANCE = 17f;
5304 float PUSH_ATTENUATION_SCALE = 5f;
5305 float distance_attenuation = 1f;
5306 if (distance > PUSH_ATTENUATION_DISTANCE)
5308 float normalized_units = 1f + (distance - PUSH_ATTENUATION_DISTANCE) / PUSH_ATTENUATION_SCALE;
5309 distance_attenuation = 1f / normalized_units;
5312 Vector3 applied_linear_impulse = impulse;
5314 float impulse_length = applied_linear_impulse.Length();
5316 float desired_energy = impulse_length * pusher_mass;
5317 if (desired_energy > 0f)
5318 desired_energy += distance_term;
5320 float scaling_factor = 1f;
5321 scaling_factor *= distance_attenuation;
5322 applied_linear_impulse *= scaling_factor;
5328 if (pusheeav != null)
5337 applied_linear_impulse *= pusheeav.GetWorldRotation();
5340 pa.AddForce(applied_linear_impulse,
true);
5346 if (pusheeob != null)
5350 pusheeob.ApplyImpulse(applied_linear_impulse, local != 0);
5359 m_host.AddScriptLPS(1);
5362 m_host.PassCollisions =
false;
5366 m_host.PassCollisions =
true;
5372 m_host.AddScriptLPS(1);
5374 return m_item.Name != null ? m_item.Name : String.Empty;
5379 m_host.AddScriptLPS(1);
5384 linkedPart = m_host.ParentGroup.RootPart;
5386 linkedPart = m_host;
5388 linkedPart = m_host.ParentGroup.GetLinkNumPart(link);
5390 return GetNumberOfSides(linkedPart);
5395 m_host.AddScriptLPS(1);
5397 return GetNumberOfSides(m_host);
5402 int sides = part.GetNumberOfSides();
5404 if (part.
GetPrimType() == PrimType.SPHERE && part.Shape.ProfileHollow > 0)
5442 m_host.AddScriptLPS(1);
5444 double x, y, z, s, t;
5446 s = Math.Cos(angle * 0.5);
5447 t = Math.Sin(angle * 0.5);
5448 axis = LSL_Vector.Norm(axis);
5463 m_host.AddScriptLPS(1);
5465 if (Math.Abs(rot.s) > 1)
5468 double s = Math.Sqrt(1 - rot.s * rot.s);
5475 double invS = 1.0 / s;
5476 if (rot.s < 0) invS = -invS;
5477 return new LSL_Vector(rot.x * invS, rot.y * invS, rot.z * invS);
5485 m_host.AddScriptLPS(1);
5487 if (Math.Abs(rot.s) > 1)
5490 double angle = 2 * Math.Acos(rot.s);
5491 if (angle > Math.PI)
5492 angle = 2 * Math.PI - angle;
5499 m_host.AddScriptLPS(1);
5500 return (
double)Math.Acos(val);
5505 m_host.AddScriptLPS(1);
5506 return (
double)Math.Asin(val);
5512 m_host.AddScriptLPS(1);
5514 double aa = (a.x * a.x + a.y * a.y + a.z * a.z + a.s * a.s);
5515 double bb = (b.x * b.x + b.y * b.y + b.z * b.z + b.s * b.s);
5516 double aa_bb = aa * bb;
5517 if (aa_bb == 0)
return 0.0;
5518 double ab = (a.x * b.x + a.y * b.y + a.z * b.z + a.s * b.s);
5519 double quotient = (ab * ab) / aa_bb;
5520 if (quotient >= 1.0)
return 0.0;
5521 return Math.Acos(2 * quotient - 1);
5526 m_host.AddScriptLPS(1);
5531 return UUID.Zero.ToString();
5533 if ((item.CurrentPermissions
5534 & (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify))
5537 return item.AssetID.ToString();
5540 return UUID.Zero.ToString();
5545 m_host.AddScriptLPS(1);
5548 m_host.ParentGroup.RootPart.AllowedDrop =
true;
5550 m_host.ParentGroup.RootPart.AllowedDrop =
false;
5553 m_host.ParentGroup.RootPart.aggregateScriptEvents();
5558 m_host.AddScriptLPS(1);
5561 Vector3 SunFloatVector3;
5565 SunFloatVector3 = World.RegionInfo.RegionSettings.SunVector;
5566 SunDoubleVector3.x = (double)SunFloatVector3.X;
5567 SunDoubleVector3.y = (
double)SunFloatVector3.Y;
5568 SunDoubleVector3.z = (double)SunFloatVector3.Z;
5570 return SunDoubleVector3;
5575 m_host.AddScriptLPS(1);
5576 return GetTextureOffset(m_host, face);
5581 Primitive.TextureEntry tex = part.Shape.Textures;
5587 if (face >= 0 && face < GetNumberOfSides(part))
5589 offset.x = tex.GetFace((uint)face).OffsetU;
5590 offset.y = tex.GetFace((uint)face).OffsetV;
5602 m_host.AddScriptLPS(1);
5603 Primitive.TextureEntry tex = m_host.Shape.Textures;
5609 scale.x = tex.GetFace((uint)side).RepeatU;
5610 scale.y = tex.GetFace((uint)side).RepeatV;
5617 m_host.AddScriptLPS(1);
5618 return GetTextureRot(m_host, face);
5623 Primitive.TextureEntry tex = part.Shape.Textures;
5628 if (face >= 0 && face < GetNumberOfSides(part))
5630 return tex.GetFace((uint)face).Rotation;
5640 m_host.AddScriptLPS(1);
5641 return source.IndexOf(pattern);
5646 m_host.AddScriptLPS(1);
5648 if (
UUID.TryParse(
id, out key))
5656 return obj.OwnerID.ToString();
5658 catch (KeyNotFoundException)
5665 return UUID.Zero.ToString();
5671 m_host.AddScriptLPS(1);
5673 return new LSL_Vector(m_host.GetCenterOfMass());
5678 m_host.AddScriptLPS(1);
5684 return src.Sort(stride, ascending);
5689 m_host.AddScriptLPS(1);
5696 m_host.AddScriptLPS(1);
5699 index = src.Length + index;
5701 if (index >= src.Length || index < 0)
5717 return (LSL_Integer)src.Data[index];
5719 return Convert.ToInt32(((
LSL_Float)src.Data[index]).value);
5720 return new LSL_Integer(src.Data[index].ToString());
5722 catch (FormatException)
5730 m_host.AddScriptLPS(1);
5733 index = src.Length + index;
5735 if (index >= src.Length || index < 0)
5750 if (src.Data[index] is
LSL_Key &&
UUID.TryParse(src.Data[index].ToString(), out uuidt))
5752 return Convert.ToDouble(
new LSL_Integer(src.Data[index].ToString()).value);
5758 return Convert.ToDouble(((
LSL_Integer)src.Data[index]).value);
5760 return Convert.ToDouble(((
LSL_Float)src.Data[index]).value);
5763 string str = ((
LSL_String) src.Data[index]).m_string;
5764 Match m = Regex.Match(str,
"^\\s*(-?\\+?[,0-9]+\\.?[0-9]*)");
5765 if (m != Match.Empty)
5769 if (!Double.TryParse(str, out d))
5776 return Convert.ToDouble(src.Data[index]);
5778 catch (FormatException)
5786 m_host.AddScriptLPS(1);
5789 index = src.Length + index;
5791 if (index >= src.Length || index < 0)
5793 return String.Empty;
5795 return src.Data[index].ToString();
5800 m_host.AddScriptLPS(1);
5803 index = src.Length + index;
5806 if (index >= src.Length || index < 0)
5820 src.Data[index].ToString() ==
"00000000-0000-0000-0000-000000000000"))
5825 return src.Data[index].ToString();
5830 m_host.AddScriptLPS(1);
5833 index = src.Length + index;
5835 if (index >= src.Length || index < 0)
5839 if (src.Data[index].GetType() == typeof(
LSL_Vector))
5857 return new LSL_Vector(src.Data[index].ToString());
5863 m_host.AddScriptLPS(1);
5866 index = src.Length + index;
5868 if (index >= src.Length || index < 0)
5884 else if (src.Data[index].GetType() == typeof(LSL_Rotation))
5886 return (LSL_Rotation)src.Data[index];
5896 m_host.AddScriptLPS(1);
5897 return src.GetSublist(start, end);
5902 return src.DeleteSublist(start, end);
5907 m_host.AddScriptLPS(1);
5910 index = src.Length + index;
5912 if (index >= src.Length)
5917 if (src.Data[index] is
LSL_Integer || src.Data[index] is Int32)
5919 if (src.Data[index] is
LSL_Float || src.Data[index] is Single || src.Data[index] is Double)
5924 if (
UUID.TryParse(src.Data[index].ToString(), out tuuid))
5951 m_host.AddScriptLPS(1);
5953 return string.Join(
", ",
5954 (
new List<object>(src.Data)).ConvertAll<
string>(o =>
5956 return o.ToString();
5976 m_host.AddScriptLPS(1);
5978 for (
int i = 0; i < src.Length; i++)
5994 result.Add(
new LSL_String(src.Substring(start,length).Trim()));
6009 result.Add(
new LSL_String(src.Substring(start,length).Trim()));
6033 m_host.AddScriptLPS(1);
6044 if (src.Length != stride && src.Length % stride == 0)
6046 chunkk = src.Length/stride;
6048 chunks =
new int[chunkk];
6050 for (
int i = 0; i < chunkk; i++)
6056 for (
int i = chunkk - 1; i > 0; i--)
6059 int index = rand.Next(i + 1);
6062 int tmp = chunks[i];
6063 chunks[i] = chunks[index];
6064 chunks[index] = tmp;
6071 for (
int i = 0; i < chunkk; i++)
6073 for (
int j = 0; j < stride; j++)
6075 result.Add(src.Data[chunks[i] * stride + j]);
6081 object[] array =
new object[src.Length];
6082 Array.Copy(src.Data, 0, array, 0, src.Length);
6101 int[] si =
new int[2];
6102 int[] ei =
new int[2];
6103 bool twopass =
false;
6105 m_host.AddScriptLPS(1);
6110 start = src.Length+start;
6112 end = src.Length+end;
6117 if (start > src.Length)
6120 if (end > src.Length)
6154 for (
int i = 0; i < src.Length; i += stride)
6156 if (i<=ei[0] && i>=si[0])
6157 result.Add(src.Data[i]);
6158 if (twopass && i>=si[1] && i<=ei[1])
6159 result.Add(src.Data[i]);
6162 else if (stride < 0)
6164 for (
int i = src.Length - 1; i >= 0; i += stride)
6166 if (i <= ei[0] && i >= si[0])
6167 result.Add(src.Data[i]);
6168 if (twopass && i >= si[1] && i <= ei[1])
6169 result.Add(src.Data[i]);
6175 if (start%stride == 0)
6177 result.Add(src.Data[start]);
6186 m_host.AddScriptLPS(1);
6198 m_host.AddScriptLPS(1);
6204 m_host.AddScriptLPS(1);
6205 if (name ==
"agent_limit")
6207 return World.RegionInfo.RegionSettings.AgentLimit.ToString();
6209 else if (name ==
"dynamic_pathfinding")
6213 else if (name ==
"estate_id")
6215 return World.RegionInfo.EstateSettings.EstateID.ToString();
6217 else if (name ==
"estate_name")
6219 return World.RegionInfo.EstateSettings.EstateName;
6221 else if (name ==
"frame_number")
6223 return World.Frame.ToString();
6225 else if (name ==
"region_cpu_ratio")
6229 else if (name ==
"region_idle")
6233 else if (name ==
"region_product_name")
6236 return World.RegionInfo.RegionType;
6240 else if (name ==
"region_product_sku")
6244 else if (name ==
"region_start_time")
6246 return World.UnixStartTime.ToString();
6248 else if (name ==
"sim_channel")
6252 else if (name ==
"sim_version")
6254 return World.GetSimulatorVersion();
6256 else if (name ==
"simulator_hostname")
6259 return UrlModule.ExternalHostNameForLSL;
6280 m_host.AddScriptLPS(1);
6284 index = index+dest.Length;
6293 pref = dest.GetSublist(0,index-1);
6294 if (index < dest.Length)
6296 suff = dest.GetSublist(index,-1);
6297 return pref + src + suff;
6306 if (index < dest.Length)
6308 suff = dest.GetSublist(index,-1);
6332 int length = src.Length - test.Length + 1;
6334 m_host.AddScriptLPS(1);
6337 if (src.Length != 0 && test.Length != 0)
6339 for (
int i = 0; i < length; i++)
6341 int needle = llGetListEntryType(test, 0).value;
6342 int haystack = llGetListEntryType(src, i).value;
6349 if ((needle == haystack) && (src.Data[i].Equals(test.Data[0]) || test.Data[0].Equals(src.Data[i])))
6352 for (j = 1; j < test.Length; j++)
6354 needle = llGetListEntryType(test, j).value;
6355 haystack = llGetListEntryType(src, i+j).value;
6357 if ((needle != haystack) || (!(src.Data[i+j].Equals(test.Data[j]) || test.Data[j].Equals(src.Data[i+j]))))
6361 if (j == test.Length)
6375 m_host.AddScriptLPS(1);
6376 return m_host.Name !=null ? m_host.Name : String.Empty;
6381 m_host.AddScriptLPS(1);
6382 m_host.Name = name != null ? name : String.Empty;
6387 m_host.AddScriptLPS(1);
6388 DateTime date = DateTime.Now.ToUniversalTime();
6389 string result = date.ToString(
"yyyy-MM-dd");
6395 m_host.AddScriptLPS(1);
6412 edge.y = dir.y / Math.Abs(dir.y);
6420 mag = (World.RegionInfo.RegionSizeX - pos.x) / dir.x;
6424 mag = (pos.x/dir.x);
6427 mag = Math.Abs(mag);
6429 edge.y = pos.y + (dir.y * mag);
6431 if (edge.y >
World.RegionInfo.RegionSizeY || edge.y < 0)
6434 edge.y = dir.y / Math.Abs(dir.y);
6440 edge.x = dir.x / Math.Abs(dir.x);
6444 List<GridRegion> neighbors = World.GridService.GetNeighbours(World.RegionInfo.ScopeID, World.RegionInfo.RegionID);
6446 uint neighborX = World.RegionInfo.RegionLocX + (uint)dir.x;
6447 uint neighborY =
World.RegionInfo.RegionLocY + (uint)dir.y;
6465 m_host.AddScriptLPS(1);
6468 if (!
UUID.TryParse(
id, out key))
6487 flags |= ScriptBaseClass.AGENT_ALWAYS_RUN;
6492 flags |= ScriptBaseClass.AGENT_ATTACHMENTS;
6497 if ((agent.
AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0)
6499 flags |= ScriptBaseClass.AGENT_FLYING;
6500 flags |= ScriptBaseClass.AGENT_IN_AIR;
6503 if ((agent.
AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_AWAY) != 0)
6505 flags |= ScriptBaseClass.AGENT_AWAY;
6508 UUID busy =
new UUID(
"efcf670c-2d18-8128-973a-034ebc806b67");
6509 UUID[] anims = agent.Animator.GetAnimationArray();
6510 if (
Array.Exists<
UUID>(anims, a => {
return a == busy; }))
6512 flags |= ScriptBaseClass.AGENT_BUSY;
6516 if ((
agent.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0)
6518 flags |= ScriptBaseClass.AGENT_MOUSELOOK;
6521 if ((
agent.State & (byte)AgentState.Typing) != (byte)0)
6523 flags |= ScriptBaseClass.AGENT_TYPING;
6526 string agentMovementAnimation = agent.Animator.CurrentMovementAnimation;
6528 if (agentMovementAnimation ==
"CROUCH")
6530 flags |= ScriptBaseClass.AGENT_CROUCHING;
6533 if (agentMovementAnimation ==
"WALK" || agentMovementAnimation ==
"CROUCHWALK")
6535 flags |= ScriptBaseClass.AGENT_WALKING;
6547 flags |= ScriptBaseClass.AGENT_IN_AIR;
6550 if (
agent.ParentPart != null)
6552 flags |= ScriptBaseClass.AGENT_ON_OBJECT;
6553 flags |= ScriptBaseClass.AGENT_SITTING;
6556 if (
agent.Animator.Animations.ImplicitDefaultAnimation.AnimID
6559 flags |= ScriptBaseClass.AGENT_SITTING;
6562 if (
agent.Appearance.VisualParams[(
int)AvatarAppearance.VPElement.SHAPE_MALE] > 0)
6564 flags |= ScriptBaseClass.AGENT_MALE;
6573 m_host.AddScriptLPS(1);
6574 if (
World.AgentPreferencesService == null)
6576 Error(
"llGetAgentLanguage",
"No AgentPreferencesService present");
6581 if (
UUID.TryParse(
id, out key))
6599 m_host.AddScriptLPS(1);
6603 bool regionWide = scope == ScriptBaseClass.AGENT_LIST_REGION;
6604 bool parcelOwned = scope == ScriptBaseClass.AGENT_LIST_PARCEL_OWNER;
6605 bool parcel = scope == ScriptBaseClass.AGENT_LIST_PARCEL;
6609 if (!regionWide && !parcelOwned && !parcel)
6611 result.Add(
"INVALID_SCOPE");
6616 UUID id = UUID.Zero;
6618 if (parcel || parcelOwned)
6620 land = World.LandChannel.GetLandObject(m_host.ParentGroup.RootPart.GetWorldPosition());
6629 id = land.LandData.OwnerID;
6633 id = land.LandData.GlobalID;
6638 World.ForEachRootScenePresence(
6646 land = World.LandChannel.GetLandObject(ssp.AbsolutePosition);
6662 if (result.Length > 99)
6673 m_host.AddScriptLPS(1);
6674 m_host.AdjustSoundGain(volume);
6675 ScriptSleep(m_sleepMsOnAdjustSoundVolume);
6680 m_host.AddScriptLPS(1);
6681 m_host.SoundRadius = radius;
6686 m_host.AddScriptLPS(1);
6688 if (
UUID.TryParse(
id,out key))
6692 if (presence != null)
6694 return presence.ControllingClient.Name;
6698 if (
World.GetSceneObjectPart(key) != null)
6700 return World.GetSceneObjectPart(
key).Name;
6703 return String.Empty;
6708 public void llSetTextureAnim(
int mode,
int face,
int sizex,
int sizey,
double start,
double length,
double rate)
6710 m_host.AddScriptLPS(1);
6712 SetTextureAnim(m_host, mode, face, sizex, sizey, start, length, rate);
6715 public void llSetLinkTextureAnim(
int linknumber,
int mode,
int face,
int sizex,
int sizey,
double start,
double length,
double rate)
6717 m_host.AddScriptLPS(1);
6719 List<SceneObjectPart> parts = GetLinkParts(linknumber);
6725 SetTextureAnim(part, mode, face, sizex, sizey, start, length, rate);
6733 private void SetTextureAnim(
SceneObjectPart part,
int mode,
int face,
int sizex,
int sizey,
double start,
double length,
double rate)
6736 Primitive.TextureAnimation pTexAnim =
new Primitive.TextureAnimation();
6737 pTexAnim.Flags = (Primitive.TextureAnimMode)mode;
6743 pTexAnim.Face = (uint)face;
6744 pTexAnim.Length = (float)length;
6745 pTexAnim.Rate = (float)rate;
6746 pTexAnim.SizeX = (uint)sizex;
6747 pTexAnim.SizeY = (uint)sizey;
6748 pTexAnim.Start = (float)start;
6750 part.AddTextureAnimation(pTexAnim);
6751 part.SendFullUpdateToAllClients();
6752 part.ParentGroup.HasGroupChanged =
true;
6758 m_host.AddScriptLPS(1);
6759 if (m_SoundModule != null)
6761 m_SoundModule.TriggerSoundLimited(m_host.UUID,
6762 ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound, AssetType.Sound), volume,
6763 bottom_south_west, top_north_east);
6769 m_host.AddScriptLPS(1);
6771 if (
UUID.TryParse(pest, out agentID))
6774 if (presence != null)
6777 ILandObject land = World.LandChannel.GetLandObject(presence.AbsolutePosition);
6783 Vector3 p = World.GetNearestAllowedPosition(presence, land);
6784 presence.TeleportWithMomentum(p, null);
6785 presence.ControllingClient.SendAlertMessage(
"You have been ejected from this land");
6789 ScriptSleep(m_sleepMsOnEjectFromLand);
6794 return ParseString2List(str, separators, in_spacers,
false);
6799 m_host.AddScriptLPS(1);
6801 if (
UUID.TryParse(
id, out key))
6804 if (presence != null)
6826 m_host.AddScriptLPS(1);
6827 ILandObject land = World.LandChannel.GetLandObject((float)pos.x, (
float)pos.y);
6829 return UUID.Zero.ToString();
6830 return land.LandData.OwnerID.ToString();
6840 m_host.AddScriptLPS(1);
6843 if (avatar == null || avatar.IsChildAgent)
6845 agentSize = ScriptBaseClass.ZERO_VECTOR;
6850 Vector3 s = avatar.Appearance.AvatarSize;
6858 m_host.AddScriptLPS(1);
6860 if (!
UUID.TryParse(
id, out uuid))
6864 if (uuid == m_host.ParentGroup.RootPart.GroupID)
6868 if (uuid ==
UUID.Zero)
6873 if (presence != null)
6878 IClientAPI client = presence.ControllingClient;
6879 if (m_host.ParentGroup.RootPart.GroupID == client.
ActiveGroupId)
6902 m_host.AddScriptLPS(1);
6905 if (
UUID.TryParse(
id, out key))
6908 List<ScenePresence> sittingAvatars = m_host.ParentGroup.GetSittingAvatars();
6912 if (sittingAvatars.Contains(av))
6926 ILandObject parcel = World.LandChannel.GetLandObject(av.AbsolutePosition);
6930 (m_host.OwnerID == m_host.GroupID && m_host.GroupID == parcel.
LandData.
GroupID
6943 m_host.AddScriptLPS(1);
6951 vsl.Z = (float)(((vsn.x * vsn.x) + (vsn.y * vsn.y)) / (-1 * vsn.z));
6964 m_host.AddScriptLPS(1);
6965 Vector3 pos = m_host.GetWorldPosition() + (Vector3)offset;
6969 else if (pos.X >=
World.Heightmap.Width)
6970 pos.X = World.Heightmap.Width - 1;
6973 else if (pos.Y >=
World.Heightmap.Height)
6974 pos.Y = World.Heightmap.Height - 1;
6977 Vector3 p0 =
new Vector3(pos.X, pos.Y,
6978 (
float)
World.Heightmap[(
int)pos.X, (
int)pos.Y]);
6979 Vector3 p1 =
new Vector3();
6980 Vector3 p2 =
new Vector3();
6981 if ((pos.X + 1.0f) >=
World.Heightmap.Width)
6982 p1 =
new Vector3(pos.X + 1.0f, pos.Y,
6983 (
float)
World.Heightmap[(
int)pos.X, (
int)pos.Y]);
6985 p1 =
new Vector3(pos.X + 1.0f, pos.Y,
6986 (
float)
World.Heightmap[(
int)(pos.X + 1.0f), (
int)pos.Y]);
6987 if ((pos.Y + 1.0f) >=
World.Heightmap.Height)
6988 p2 =
new Vector3(pos.X, pos.Y + 1.0f,
6989 (
float)
World.Heightmap[(
int)pos.X, (
int)pos.Y]);
6991 p2 =
new Vector3(pos.X, pos.Y + 1.0f,
6992 (
float)
World.Heightmap[(
int)pos.X, (
int)(pos.Y + 1.0f)]);
6995 Vector3 v0 =
new Vector3(p1.X - p0.X, p1.Y - p0.Y, p1.Z - p0.Z);
6996 Vector3 v1 =
new Vector3(p2.X - p0.X, p2.Y - p0.Y, p2.Z - p0.Z);
7001 Vector3 vsn =
new Vector3();
7002 vsn.X = (v0.Y * v1.Z) - (v0.Z * v1.Y);
7003 vsn.Y = (v0.Z * v1.X) - (v0.X * v1.Z);
7004 vsn.Z = (v0.X * v1.Y) - (v0.Y * v1.X);
7014 m_host.AddScriptLPS(1);
7021 m_host.AddScriptLPS(1);
7022 return m_host.ParentGroup.AttachmentPoint;
7027 m_host.AddScriptLPS(1);
7034 m_host.AddScriptLPS(1);
7035 if (m_UrlModule != null)
7036 return new LSL_Integer(m_UrlModule.GetFreeUrls());
7043 m_host.AddScriptLPS(1);
7044 return World.RegionInfo.RegionName;
7049 m_host.AddScriptLPS(1);
7050 return (
double)World.TimeDilation;
7058 m_host.AddScriptLPS(1);
7059 return World.StatsReporter.LastReportedSimFPS;
7074 PSYS_PART_FLAGS = 0,
7075 PSYS_PART_START_COLOR = 1,
7076 PSYS_PART_START_ALPHA = 2,
7077 PSYS_PART_END_COLOR = 3,
7078 PSYS_PART_END_ALPHA = 4,
7079 PSYS_PART_START_SCALE = 5,
7080 PSYS_PART_END_SCALE = 6,
7081 PSYS_PART_MAX_AGE = 7,
7083 PSYS_SRC_PATTERN = 9,
7084 PSYS_SRC_INNERANGLE = 10,
7085 PSYS_SRC_OUTERANGLE = 11,
7086 PSYS_SRC_TEXTURE = 12,
7087 PSYS_SRC_BURST_RATE = 13,
7088 PSYS_SRC_BURST_PART_COUNT = 15,
7089 PSYS_SRC_BURST_RADIUS = 16,
7090 PSYS_SRC_BURST_SPEED_MIN = 17,
7091 PSYS_SRC_BURST_SPEED_MAX = 18,
7092 PSYS_SRC_MAX_AGE = 19,
7093 PSYS_SRC_TARGET_KEY = 20,
7094 PSYS_SRC_OMEGA = 21,
7095 PSYS_SRC_ANGLE_BEGIN = 22,
7096 PSYS_SRC_ANGLE_END = 23,
7097 PSYS_PART_BLEND_FUNC_SOURCE = 24,
7098 PSYS_PART_BLEND_FUNC_DEST = 25,
7099 PSYS_PART_START_GLOW = 26,
7100 PSYS_PART_END_GLOW = 27
7103 internal Primitive.ParticleSystem.ParticleDataFlags ConvertUINTtoFlags(uint flags)
7105 Primitive.ParticleSystem.ParticleDataFlags returnval = Primitive.ParticleSystem.ParticleDataFlags.None;
7112 Primitive.ParticleSystem ps =
new Primitive.ParticleSystem();
7115 ps.PartStartColor =
new Color4(1.0f, 1.0f, 1.0f, 1.0f);
7116 ps.PartEndColor =
new Color4(1.0f, 1.0f, 1.0f, 1.0f);
7117 ps.PartStartScaleX = 1.0f;
7118 ps.PartStartScaleY = 1.0f;
7119 ps.PartEndScaleX = 1.0f;
7120 ps.PartEndScaleY = 1.0f;
7121 ps.BurstSpeedMin = 1.0f;
7122 ps.BurstSpeedMax = 1.0f;
7123 ps.BurstRate = 0.1f;
7124 ps.PartMaxAge = 10.0f;
7125 ps.BurstPartCount = 1;
7126 ps.BlendFuncSource = ScriptBaseClass.PSYS_PART_BF_SOURCE_ALPHA;
7127 ps.BlendFuncDest = ScriptBaseClass.PSYS_PART_BF_ONE_MINUS_SOURCE_ALPHA;
7128 ps.PartStartGlow = 0.0f;
7129 ps.PartEndGlow = 0.0f;
7136 m_host.AddScriptLPS(1);
7138 List<SceneObjectPart> parts = GetLinkParts(linknumber);
7142 SetParticleSystem(part, rules,
"llLinkParticleSystem");
7148 m_host.AddScriptLPS(1);
7149 SetParticleSystem(m_host, rules,
"llParticleSystem");
7154 if (rules.Length == 0)
7156 part.RemoveParticleSystem();
7157 part.ParentGroup.HasGroupChanged =
true;
7161 Primitive.ParticleSystem prules = getNewParticleSystemWithSLDefaultValues();
7167 for (
int i = 0; i < rules.Length; i += 2)
7172 psystype = rules.GetLSLIntegerItem(i);
7174 catch (InvalidCastException)
7176 Error(originFunc,
string.Format(
"Error running particle system params index #{0}: particle system parameter type must be integer", i));
7181 case (
int)ScriptBaseClass.PSYS_PART_FLAGS:
7184 prules.PartDataFlags = (Primitive.ParticleSystem.ParticleDataFlags)(uint)rules.GetLSLIntegerItem(i + 1);
7186 catch(InvalidCastException)
7188 Error(originFunc,
string.Format(
"Error running rule PSYS_PART_FLAGS: arg #{0} - parameter 1 must be integer", i + 1));
7193 case (
int)ScriptBaseClass.PSYS_PART_START_COLOR:
7196 tempv = rules.GetVector3Item(i + 1);
7198 catch(InvalidCastException)
7200 Error(originFunc,
string.Format(
"Error running rule PSYS_PART_START_COLOR: arg #{0} - parameter 1 must be vector", i + 1));
7203 prules.PartStartColor.R = (float)tempv.x;
7204 prules.PartStartColor.G = (
float)tempv.y;
7205 prules.PartStartColor.B = (float)tempv.z;
7208 case (
int)ScriptBaseClass.PSYS_PART_START_ALPHA:
7211 tempf = (float)rules.GetLSLFloatItem(i + 1);
7213 catch(InvalidCastException)
7215 Error(originFunc,
string.Format(
"Error running rule PSYS_PART_START_ALPHA: arg #{0} - parameter 1 must be float", i + 1));
7218 prules.PartStartColor.A = tempf;
7221 case (
int)ScriptBaseClass.PSYS_PART_END_COLOR:
7224 tempv = rules.GetVector3Item(i + 1);
7226 catch(InvalidCastException)
7228 Error(originFunc,
string.Format(
"Error running rule PSYS_PART_END_COLOR: arg #{0} - parameter 1 must be vector", i + 1));
7231 prules.PartEndColor.R = (float)tempv.x;
7232 prules.PartEndColor.G = (
float)tempv.y;
7233 prules.PartEndColor.B = (float)tempv.z;
7236 case (
int)ScriptBaseClass.PSYS_PART_END_ALPHA:
7239 tempf = (float)rules.GetLSLFloatItem(i + 1);
7241 catch(InvalidCastException)
7243 Error(originFunc,
string.Format(
"Error running rule PSYS_PART_END_ALPHA: arg #{0} - parameter 1 must be float", i + 1));
7246 prules.PartEndColor.A = tempf;
7249 case (
int)ScriptBaseClass.PSYS_PART_START_SCALE:
7252 tempv = rules.GetVector3Item(i + 1);
7254 catch(InvalidCastException)
7256 Error(originFunc,
string.Format(
"Error running rule PSYS_PART_START_SCALE: arg #{0} - parameter 1 must be vector", i + 1));
7259 prules.PartStartScaleX = validParticleScale((
float)tempv.x);
7260 prules.PartStartScaleY = validParticleScale((
float)tempv.y);
7263 case (
int)ScriptBaseClass.PSYS_PART_END_SCALE:
7266 tempv = rules.GetVector3Item(i + 1);
7268 catch(InvalidCastException)
7270 Error(originFunc,
string.Format(
"Error running rule PSYS_PART_END_SCALE: arg #{0} - parameter 1 must be vector", i + 1));
7273 prules.PartEndScaleX = validParticleScale((
float)tempv.x);
7274 prules.PartEndScaleY = validParticleScale((
float)tempv.y);
7277 case (
int)ScriptBaseClass.PSYS_PART_MAX_AGE:
7280 tempf = (float)rules.GetLSLFloatItem(i + 1);
7282 catch(InvalidCastException)
7284 Error(originFunc,
string.Format(
"Error running rule PSYS_PART_MAX_AGE: arg #{0} - parameter 1 must be float", i + 1));
7287 prules.PartMaxAge = tempf;
7290 case (
int)ScriptBaseClass.PSYS_SRC_ACCEL:
7293 tempv = rules.GetVector3Item(i + 1);
7295 catch(InvalidCastException)
7297 Error(originFunc,
string.Format(
"Error running rule PSYS_SRC_ACCEL: arg #{0} - parameter 1 must be vector", i + 1));
7300 prules.PartAcceleration.X = (float)tempv.x;
7301 prules.PartAcceleration.Y = (
float)tempv.y;
7302 prules.PartAcceleration.Z = (float)tempv.z;
7305 case (
int)ScriptBaseClass.PSYS_SRC_PATTERN:
7308 tmpi = (int)rules.GetLSLIntegerItem(i + 1);
7310 catch(InvalidCastException)
7312 Error(originFunc,
string.Format(
"Error running rule PSYS_SRC_PATTERN: arg #{0} - parameter 1 must be integer", i + 1));
7315 prules.Pattern = (Primitive.ParticleSystem.SourcePattern)tmpi;
7322 case (
int)ScriptBaseClass.PSYS_SRC_INNERANGLE:
7325 tempf = (float)rules.GetLSLFloatItem(i + 1);
7327 catch(InvalidCastException)
7329 Error(originFunc,
string.Format(
"Error running rule PSYS_SRC_INNERANGLE: arg #{0} - parameter 1 must be float", i + 1));
7332 prules.InnerAngle = (float)tempf;
7333 prules.PartFlags &= 0xFFFFFFFD;
7336 case (
int)ScriptBaseClass.PSYS_SRC_OUTERANGLE:
7339 tempf = (float)rules.GetLSLFloatItem(i + 1);
7341 catch(InvalidCastException)
7343 Error(originFunc,
string.Format(
"Error running rule PSYS_SRC_OUTERANGLE: arg #{0} - parameter 1 must be float", i + 1));
7346 prules.OuterAngle = (float)tempf;
7347 prules.PartFlags &= 0xFFFFFFFD;
7350 case (
int)ScriptBaseClass.PSYS_PART_BLEND_FUNC_SOURCE:
7353 tmpi = (int)rules.GetLSLIntegerItem(i + 1);
7355 catch(InvalidCastException)
7357 Error(originFunc,
string.Format(
"Error running rule PSYS_PART_BLEND_FUNC_SOURCE: arg #{0} - parameter 1 must be integer", i + 1));
7360 prules.BlendFuncSource = (byte)tmpi;
7363 case (
int)ScriptBaseClass.PSYS_PART_BLEND_FUNC_DEST:
7366 tmpi = (int)rules.GetLSLIntegerItem(i + 1);
7368 catch(InvalidCastException)
7370 Error(originFunc,
string.Format(
"Error running rule PSYS_PART_BLEND_FUNC_DEST: arg #{0} - parameter 1 must be integer", i + 1));
7373 prules.BlendFuncDest = (byte)tmpi;
7376 case (
int)ScriptBaseClass.PSYS_PART_START_GLOW:
7379 tempf = (float)rules.GetLSLFloatItem(i + 1);
7381 catch(InvalidCastException)
7383 Error(originFunc,
string.Format(
"Error running rule PSYS_PART_START_GLOW: arg #{0} - parameter 1 must be float", i + 1));
7386 prules.PartStartGlow = (float)tempf;
7389 case (
int)ScriptBaseClass.PSYS_PART_END_GLOW:
7392 tempf = (float)rules.GetLSLFloatItem(i + 1);
7394 catch(InvalidCastException)
7396 Error(originFunc,
string.Format(
"Error running rule PSYS_PART_END_GLOW: arg #{0} - parameter 1 must be float", i + 1));
7399 prules.PartEndGlow = (float)tempf;
7402 case (
int)ScriptBaseClass.PSYS_SRC_TEXTURE:
7405 prules.Texture = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, rules.GetLSLStringItem(i + 1));
7407 catch(InvalidCastException)
7409 Error(originFunc,
string.Format(
"Error running rule PSYS_SRC_TEXTURE: arg #{0} - parameter 1 must be string or key", i + 1));
7414 case (
int)ScriptBaseClass.PSYS_SRC_BURST_RATE:
7417 tempf = (float)rules.GetLSLFloatItem(i + 1);
7419 catch(InvalidCastException)
7421 Error(originFunc,
string.Format(
"Error running rule PSYS_SRC_BURST_RATE: arg #{0} - parameter 1 must be float", i + 1));
7424 prules.BurstRate = (float)tempf;
7427 case (
int)ScriptBaseClass.PSYS_SRC_BURST_PART_COUNT:
7430 prules.BurstPartCount = (byte)(
int)rules.GetLSLIntegerItem(i + 1);
7432 catch(InvalidCastException)
7434 Error(originFunc,
string.Format(
"Error running rule PSYS_SRC_BURST_PART_COUNT: arg #{0} - parameter 1 must be integer", i + 1));
7439 case (
int)ScriptBaseClass.PSYS_SRC_BURST_RADIUS:
7442 tempf = (float)rules.GetLSLFloatItem(i + 1);
7444 catch(InvalidCastException)
7446 Error(originFunc,
string.Format(
"Error running rule PSYS_SRC_BURST_RADIUS: arg #{0} - parameter 1 must be float", i + 1));
7449 prules.BurstRadius = (float)tempf;
7452 case (
int)ScriptBaseClass.PSYS_SRC_BURST_SPEED_MIN:
7455 tempf = (float)rules.GetLSLFloatItem(i + 1);
7457 catch(InvalidCastException)
7459 Error(originFunc,
string.Format(
"Error running rule PSYS_SRC_BURST_SPEED_MIN: arg #{0} - parameter 1 must be float", i + 1));
7462 prules.BurstSpeedMin = (float)tempf;
7465 case (
int)ScriptBaseClass.PSYS_SRC_BURST_SPEED_MAX:
7468 tempf = (float)rules.GetLSLFloatItem(i + 1);
7470 catch(InvalidCastException)
7472 Error(originFunc,
string.Format(
"Error running rule PSYS_SRC_BURST_SPEED_MAX: arg #{0} - parameter 1 must be float", i + 1));
7475 prules.BurstSpeedMax = (float)tempf;
7478 case (
int)ScriptBaseClass.PSYS_SRC_MAX_AGE:
7481 tempf = (float)rules.GetLSLFloatItem(i + 1);
7483 catch(InvalidCastException)
7485 Error(originFunc,
string.Format(
"Error running rule PSYS_SRC_MAX_AGE: arg #{0} - parameter 1 must be float", i + 1));
7488 prules.MaxAge = (float)tempf;
7491 case (
int)ScriptBaseClass.PSYS_SRC_TARGET_KEY:
7493 if (
UUID.TryParse(rules.Data[i + 1].ToString(), out
key))
7495 prules.Target =
key;
7499 prules.Target = part.UUID;
7503 case (
int)ScriptBaseClass.PSYS_SRC_OMEGA:
7507 tempv = rules.GetVector3Item(i + 1);
7509 catch(InvalidCastException)
7511 Error(originFunc,
string.Format(
"Error running rule PSYS_SRC_OMEGA: arg #{0} - parameter 1 must be vector", i + 1));
7514 prules.AngularVelocity.X = (float)tempv.x;
7515 prules.AngularVelocity.Y = (
float)tempv.y;
7516 prules.AngularVelocity.Z = (float)tempv.z;
7519 case (
int)ScriptBaseClass.PSYS_SRC_ANGLE_BEGIN:
7522 tempf = (float)rules.GetLSLFloatItem(i + 1);
7524 catch(InvalidCastException)
7526 Error(originFunc,
string.Format(
"Error running rule PSYS_SRC_ANGLE_BEGIN: arg #{0} - parameter 1 must be float", i + 1));
7529 prules.InnerAngle = (float)tempf;
7530 prules.PartFlags |= 0x02;
7533 case (
int)ScriptBaseClass.PSYS_SRC_ANGLE_END:
7536 tempf = (float)rules.GetLSLFloatItem(i + 1);
7538 catch (InvalidCastException)
7540 Error(originFunc,
string.Format(
"Error running rule PSYS_SRC_ANGLE_END: arg #{0} - parameter 1 must be float", i + 1));
7543 prules.OuterAngle = (float)tempf;
7544 prules.PartFlags |= 0x02;
7551 part.AddNewParticleSystem(prules);
7552 part.ParentGroup.HasGroupChanged =
true;
7554 part.SendFullUpdateToAllClients();
7557 private float validParticleScale(
float value)
7559 if (value > 4.0f)
return 4.0f;
7565 m_host.AddScriptLPS(1);
7566 if (m_host.PhysActor != null)
7568 float ground = (float)llGround(
new LSL_Types.Vector3(0, 0, 0));
7569 float waterLevel = (float)llWater(
new LSL_Types.Vector3(0, 0, 0));
7573 hoverType = PIDHoverType.GroundAndWater;
7574 if (ground < waterLevel)
7575 height += waterLevel;
7584 m_host.SetHoverHeight((float)height, hoverType, (
float)tau);
7590 m_host.AddScriptLPS(1);
7593 if (!
UUID.TryParse(destination, out destID))
7596 List<UUID> itemList =
new List<UUID>();
7598 foreach (
Object item
in inventory.Data)
7600 string rawItemString = item.ToString();
7603 if (
UUID.TryParse(rawItemString, out itemID))
7605 itemList.Add(itemID);
7611 if (taskItem != null)
7612 itemList.Add(taskItem.ItemID);
7616 if (itemList.Count == 0)
7619 UUID folderID = m_ScriptEngine.World.MoveTaskInventoryItems(destID, category, m_host, itemList);
7621 if (folderID ==
UUID.Zero)
7624 if (m_TransferModule != null)
7626 byte[] bucket =
new byte[] { (byte)AssetType.Folder };
7628 Vector3 pos = m_host.AbsolutePosition;
7631 m_host.OwnerID, m_host.Name, destID,
7632 (byte)InstantMessageDialog.TaskInventoryOffered,
7633 false,
string.Format(
"'{0}'", category),
7636 folderID,
false, pos,
7639 m_TransferModule.SendInstantMessage(msg, delegate(
bool success) {});
7645 m_host.AddScriptLPS(1);
7647 if (!m_host.ParentGroup.IsDeleted)
7649 m_host.ParentGroup.RootPart.SetVehicleType(type);
7657 m_host.AddScriptLPS(1);
7659 if (!m_host.ParentGroup.IsDeleted)
7661 m_host.ParentGroup.RootPart.SetVehicleFloatParam(param, (float)value);
7669 m_host.AddScriptLPS(1);
7671 if (!m_host.ParentGroup.IsDeleted)
7673 m_host.ParentGroup.RootPart.SetVehicleVectorParam(param, vec);
7681 m_host.AddScriptLPS(1);
7683 if (!m_host.ParentGroup.IsDeleted)
7685 m_host.ParentGroup.RootPart.SetVehicleRotationParam(param, rot);
7691 m_host.AddScriptLPS(1);
7693 if (!m_host.ParentGroup.IsDeleted)
7695 m_host.ParentGroup.RootPart.SetVehicleFlags(flags,
false);
7701 m_host.AddScriptLPS(1);
7703 if (!m_host.ParentGroup.IsDeleted)
7705 m_host.ParentGroup.RootPart.SetVehicleFlags(flags,
true);
7712 if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0)
7715 part.SitTargetPosition = offset;
7716 part.SitTargetOrientation = rot;
7717 part.ParentGroup.HasGroupChanged =
true;
7722 m_host.AddScriptLPS(1);
7723 SitTarget(m_host, offset, rot);
7728 m_host.AddScriptLPS(1);
7730 SitTarget(m_host.ParentGroup.RootPart, offset, rot);
7732 SitTarget(m_host, offset, rot);
7738 SitTarget(part, offset, rot);
7745 m_host.AddScriptLPS(1);
7746 return m_host.SitTargetAvatar.ToString();
7752 m_host.AddScriptLPS(1);
7757 return UUID.Zero.ToString();
7759 List<SceneObjectPart> parts = GetLinkParts(linknum);
7760 if (parts.Count == 0)
7761 return UUID.Zero.ToString();
7762 return parts[0].SitTargetAvatar.ToString();
7768 m_host.AddScriptLPS(1);
7770 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
7772 if (
World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned,
false))
7776 expires = Util.UnixTimeSinceEpoch() + (
int)(3600.0 * hours);
7778 if (
UUID.TryParse(avatar, out key))
7780 int idx = land.LandData.ParcelAccessList.FindIndex(
7792 land.LandData.ParcelAccessList.RemoveAt(idx);
7796 entry.AgentID =
key;
7797 entry.Flags = AccessList.Access;
7798 entry.Expires = expires;
7800 land.LandData.ParcelAccessList.Add(entry);
7802 World.EventManager.TriggerLandObjectUpdated((uint)land.
LandData.
LocalID, land);
7805 ScriptSleep(m_sleepMsOnAddToLandPassList);
7810 m_host.AddScriptLPS(1);
7811 m_host.TouchName = text;
7816 m_host.AddScriptLPS(1);
7817 m_host.SitName = text;
7822 m_host.AddScriptLPS(1);
7823 m_host.SetCameraEyeOffset(offset);
7825 if (m_host.ParentGroup.RootPart.GetCameraEyeOffset() == Vector3.Zero)
7826 m_host.ParentGroup.RootPart.SetCameraEyeOffset(offset);
7831 m_host.AddScriptLPS(1);
7832 m_host.SetCameraAtOffset(offset);
7834 if (m_host.ParentGroup.RootPart.GetCameraAtOffset() == Vector3.Zero)
7835 m_host.ParentGroup.RootPart.SetCameraAtOffset(offset);
7840 m_host.AddScriptLPS(1);
7850 case ScriptBaseClass.LINK_ROOT:
7851 part = m_host.ParentGroup.RootPart;
7853 case ScriptBaseClass.LINK_THIS:
7857 part = m_host.ParentGroup.GetLinkNumPart(link);
7863 part.SetCameraEyeOffset(eye);
7864 part.SetCameraAtOffset(at);
7870 m_host.AddScriptLPS(1);
7871 if (src.Length == 0)
7873 return String.Empty;
7875 string ret = String.Empty;
7876 foreach (
object o
in src.Data)
7878 ret = ret + o.ToString() + seperator;
7880 ret = ret.Substring(0, ret.Length - seperator.Length);
7886 m_host.AddScriptLPS(1);
7887 bool result = World.ScriptDanger(m_host.LocalId, pos);
7906 m_host.AddScriptLPS(1);
7908 if (!
UUID.TryParse(avatar,out av))
7910 Error(
"llDialog",
"First parameter must be a key");
7914 int length = buttons.Length;
7917 Error(
"llDialog",
"At least 1 button must be shown");
7922 Error(
"llDialog",
"No more than 12 buttons can be shown");
7926 if (message ==
string.Empty)
7928 Error(
"llDialog",
"Empty message");
7930 else if (Encoding.UTF8.GetByteCount(message) > 512)
7932 Error(
"llDialog",
"Message longer than 512 bytes");
7935 string[] buts =
new string[length];
7936 for (
int i = 0; i < length; i++)
7938 if (buttons.Data[i].ToString() == String.Empty)
7940 Error(
"llDialog",
"Button label cannot be blank");
7950 buts[i] = buttons.Data[i].ToString();
7953 dm.SendDialogToUser(
7954 av, m_host.Name, m_host.UUID, m_host.OwnerID,
7955 message,
new UUID(
"00000000-0000-2222-3333-100000001000"), chat_channel, buts);
7957 ScriptSleep(m_sleepMsOnDialog);
7962 m_host.AddScriptLPS(1);
7964 if (!m_host.ParentGroup.IsDeleted)
7965 m_host.ParentGroup.ScriptSetVolumeDetect(detect != 0);
7970 m_host.AddScriptLPS(1);
7971 Deprecated(
"llRemoteLoadScript",
"Use llRemoteLoadScriptPin instead");
7972 ScriptSleep(m_sleepMsOnRemoteLoadScript);
7977 m_host.AddScriptLPS(1);
7978 m_host.ScriptAccessPin = pin;
7983 m_host.AddScriptLPS(1);
7985 UUID destId = UUID.Zero;
7987 if (!
UUID.TryParse(target, out destId))
7989 Error(
"llRemoteLoadScriptPin",
"Can't parse key '" + target +
"'");
7994 if (m_host.UUID == destId)
8003 if (item == null || item.
Type != 10)
8005 Error(
"llRemoteLoadScriptPin",
"Can't find script '" + name +
"'");
8012 if ((item.
BasePermissions & (uint)
PermissionMask.Transfer) != 0 || dest.ParentGroup.RootPart.OwnerID == m_host.ParentGroup.RootPart.OwnerID)
8015 World.RezScriptFromPrim(item.ItemID, m_host, destId, pin, running, start_param);
8018 m_host.Inventory.RemoveInventoryItem(item.ItemID);
8022 ScriptSleep(m_sleepMsOnRemoteLoadScriptPin);
8027 m_host.AddScriptLPS(1);
8028 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<
IXMLRPC>();
8029 if (xmlrpcMod != null && xmlrpcMod.IsEnabled())
8031 UUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_host.LocalId, m_item.ItemID, UUID.Zero);
8033 if (xmlRpcRouter != null)
8035 string ExternalHostName = m_ScriptEngine.World.RegionInfo.ExternalHostName;
8037 xmlRpcRouter.RegisterNewReceiver(m_ScriptEngine.ScriptModule, channelID, m_host.UUID,
8038 m_item.ItemID, String.Format(
"http://{0}:{1}/", ExternalHostName,
8039 xmlrpcMod.Port.ToString()));
8041 object[] resobj =
new object[]
8050 m_ScriptEngine.PostScriptEvent(m_item.ItemID,
new EventParams(
"remote_data", resobj,
8053 ScriptSleep(m_sleepMsOnOpenRemoteDataChannel);
8058 m_host.AddScriptLPS(1);
8059 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<
IXMLRPC>();
8060 ScriptSleep(m_sleepMsOnSendRemoteData);
8061 if (xmlrpcMod == null)
8063 return (xmlrpcMod.SendRemoteData(m_host.LocalId, m_item.ItemID, channel, dest, idata, sdata)).ToString();
8068 m_host.AddScriptLPS(1);
8069 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<
IXMLRPC>();
8070 if (xmlrpcMod != null)
8071 xmlrpcMod.RemoteDataReply(channel, message_id, sdata, idata);
8072 ScriptSleep(m_sleepMsOnRemoteDataReply);
8077 m_host.AddScriptLPS(1);
8080 if (xmlRpcRouter != null)
8082 xmlRpcRouter.UnRegisterReceiver(channel, m_item.ItemID);
8085 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<
IXMLRPC>();
8086 if (xmlrpcMod != null)
8087 xmlrpcMod.CloseXMLRPCChannel((
UUID)channel);
8088 ScriptSleep(m_sleepMsOnCloseRemoteDataChannel);
8093 m_host.AddScriptLPS(1);
8094 return Util.Md5Hash(String.Format(
"{0}:{1}", src, nonce.ToString()), Encoding.UTF8);
8099 m_host.AddScriptLPS(1);
8100 return Util.SHA1Hash(src, Encoding.UTF8).ToLower();
8106 ObjectShapePacket.ObjectDataBlock shapeBlock =
new ObjectShapePacket.ObjectDataBlock();
8110 if (holeshape != (
int)ScriptBaseClass.PRIM_HOLE_DEFAULT &&
8112 holeshape != (
int)ScriptBaseClass.PRIM_HOLE_SQUARE &&
8117 shapeBlock.PathCurve = pathcurve;
8118 shapeBlock.ProfileCurve = (byte)holeshape;
8119 shapeBlock.ProfileCurve += profileshape;
8136 if (cut.y - cut.x < 0.02f)
8138 cut.x = cut.y - 0.02f;
8145 shapeBlock.ProfileBegin = (ushort)(50000 * cut.x);
8146 shapeBlock.ProfileEnd = (ushort)(50000 * (1 - cut.y));
8156 if (profileshape != (byte)ProfileCurve.Square &&
8172 shapeBlock.ProfileHollow = (ushort)(50000 * hollow);
8173 if (twist.x < -1.0f)
8181 if (twist.y < -1.0f)
8199 tempFloat = (float)(100.0d * twist.x);
8200 shapeBlock.PathTwistBegin = (sbyte)tempFloat;
8201 tempFloat = (float)(100.0d * twist.y);
8202 shapeBlock.PathTwist = (sbyte)tempFloat;
8204 shapeBlock.ObjectLocalID = part.LocalId;
8206 part.Shape.SculptEntry =
false;
8217 ObjectShapePacket.ObjectDataBlock shapeBlock;
8219 shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist, profileshape, pathcurve);
8237 tempFloat = (float)(100.0d * (2.0d - taper_b.x));
8238 shapeBlock.PathScaleX = (byte)tempFloat;
8239 tempFloat = (float)(100.0d * (2.0d - taper_b.y));
8240 shapeBlock.PathScaleY = (byte)tempFloat;
8241 if (topshear.x < -0.5f)
8245 if (topshear.x > 0.5f)
8249 if (topshear.y < -0.5f)
8253 if (topshear.y > 0.5f)
8257 tempFloat = (float)(100.0d * topshear.x);
8258 shapeBlock.PathShearX = (byte)tempFloat;
8259 tempFloat = (float)(100.0d * topshear.y);
8260 shapeBlock.PathShearY = (byte)tempFloat;
8262 part.Shape.SculptEntry =
false;
8263 part.UpdateShape(shapeBlock);
8272 ObjectShapePacket.ObjectDataBlock shapeBlock;
8274 shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist, profileshape, pathcurve);
8277 shapeBlock.PathBegin = shapeBlock.ProfileBegin;
8278 shapeBlock.PathEnd = shapeBlock.ProfileEnd;
8280 shapeBlock.PathScaleX = 100;
8281 shapeBlock.PathScaleY = 100;
8299 if (dimple.y - dimple.x < 0.02f)
8301 dimple.x = dimple.y - 0.02f;
8302 if (dimple.x < 0.0f)
8308 shapeBlock.ProfileBegin = (ushort)(50000 * dimple.x);
8309 shapeBlock.ProfileEnd = (ushort)(50000 * (1 - dimple.y));
8311 part.Shape.SculptEntry =
false;
8312 part.UpdateShape(shapeBlock);
8316 protected void SetPrimitiveShapeParams(
SceneObjectPart part,
int holeshape,
LSL_Vector cut,
float hollow,
LSL_Vector twist,
LSL_Vector holesize,
LSL_Vector topshear,
LSL_Vector profilecut,
LSL_Vector taper_a,
float revolutions,
float radiusoffset,
float skew, byte profileshape, byte pathcurve)
8322 ObjectShapePacket.ObjectDataBlock shapeBlock;
8324 shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist, profileshape, pathcurve);
8327 shapeBlock.PathBegin = shapeBlock.ProfileBegin;
8328 shapeBlock.PathEnd = shapeBlock.ProfileEnd;
8330 if (holesize.x < 0.01f)
8334 if (holesize.x > 1f)
8338 if (holesize.y < 0.01f)
8342 if (holesize.y > 0.5f)
8346 tempFloat = (float)(100.0d * (2.0d - holesize.x));
8347 shapeBlock.PathScaleX = (byte)tempFloat;
8348 tempFloat = (float)(100.0d * (2.0d - holesize.y));
8349 shapeBlock.PathScaleY = (byte)tempFloat;
8350 if (topshear.x < -0.5f)
8354 if (topshear.x > 0.5f)
8358 if (topshear.y < -0.5f)
8362 if (topshear.y > 0.5f)
8366 tempFloat = (float)(100.0d * topshear.x);
8367 shapeBlock.PathShearX = (byte)tempFloat;
8368 tempFloat = (float)(100.0d * topshear.y);
8369 shapeBlock.PathShearY = (byte)tempFloat;
8370 if (profilecut.x < 0f)
8374 if (profilecut.x > 1f)
8378 if (profilecut.y < 0f)
8382 if (profilecut.y > 1f)
8386 if (profilecut.y - profilecut.x < 0.02f)
8388 profilecut.x = profilecut.y - 0.02f;
8389 if (profilecut.x < 0.0f)
8391 profilecut.x = 0.0f;
8392 profilecut.y = 0.02f;
8395 shapeBlock.ProfileBegin = (ushort)(50000 * profilecut.x);
8396 shapeBlock.ProfileEnd = (ushort)(50000 * (1 - profilecut.y));
8397 if (taper_a.x < -1f)
8405 if (taper_a.y < -1f)
8413 tempFloat = (float)(100.0d * taper_a.x);
8414 shapeBlock.PathTaperX = (sbyte)tempFloat;
8415 tempFloat = (float)(100.0d * taper_a.y);
8416 shapeBlock.PathTaperY = (sbyte)tempFloat;
8417 if (revolutions < 1f)
8421 if (revolutions > 4f)
8425 tempFloat = 66.66667f * (revolutions - 1.0f);
8426 shapeBlock.PathRevolutions = (byte)tempFloat;
8428 if (radiusoffset < 0f)
8432 if (radiusoffset > 1f)
8436 tempFloat = 100.0f * radiusoffset;
8437 shapeBlock.PathRadiusOffset = (sbyte)tempFloat;
8446 tempFloat = 100.0f * skew;
8447 shapeBlock.PathSkew = (sbyte)tempFloat;
8449 part.Shape.SculptEntry =
false;
8450 part.UpdateShape(shapeBlock);
8459 ObjectShapePacket.ObjectDataBlock shapeBlock =
new ObjectShapePacket.ObjectDataBlock();
8462 if (!
UUID.TryParse(map, out sculptId))
8463 sculptId = ScriptUtils.GetAssetIdFromItemName(m_host, map, (
int)AssetType.Texture);
8465 if (sculptId ==
UUID.Zero)
8468 shapeBlock.PathCurve = pathcurve;
8469 shapeBlock.ObjectLocalID = part.LocalId;
8470 shapeBlock.PathScaleX = 100;
8471 shapeBlock.PathScaleY = 150;
8473 int flag = type & (ScriptBaseClass.PRIM_SCULPT_FLAG_INVERT | ScriptBaseClass.PRIM_SCULPT_FLAG_MIRROR);
8476 type != (ScriptBaseClass.PRIM_SCULPT_TYPE_PLANE | flag) &&
8478 type != (ScriptBaseClass.PRIM_SCULPT_TYPE_TORUS | flag))
8484 part.Shape.SetSculptProperties((byte)type, sculptId);
8485 part.Shape.SculptEntry =
true;
8486 part.UpdateShape(shapeBlock);
8491 m_host.AddScriptLPS(1);
8495 ScriptSleep(m_sleepMsOnSetPrimitiveParams);
8500 m_host.AddScriptLPS(1);
8502 SetLinkPrimParams(linknumber, rules,
"llSetLinkPrimitiveParams");
8504 ScriptSleep(m_sleepMsOnSetLinkPrimitiveParams);
8509 m_host.AddScriptLPS(1);
8511 SetLinkPrimParams(linknumber, rules,
"llSetLinkPrimitiveParamsFast");
8514 private void SetLinkPrimParams(
int linknumber,
LSL_List rules,
string originFunc)
8516 List<object> parts =
new List<object>();
8517 List<SceneObjectPart> prims = GetLinkParts(linknumber);
8518 List<ScenePresence> avatars = GetLinkAvatars(linknumber);
8525 uint rulesParsed = 0;
8527 if (parts.Count > 0)
8529 foreach (
object part
in parts)
8532 remaining = SetPrimParams((SceneObjectPart)part, rules, originFunc, ref rulesParsed);
8534 remaining = SetPrimParams((
ScenePresence)part, rules, originFunc, ref rulesParsed);
8537 while (remaining.Length > 2)
8539 linknumber = remaining.GetLSLIntegerItem(0);
8540 rules = remaining.GetSublist(1, -1);
8542 prims = GetLinkParts(linknumber);
8543 avatars = GetLinkAvatars(linknumber);
8544 foreach (SceneObjectPart p
in prims)
8550 foreach (
object part
in parts)
8552 if (part is SceneObjectPart)
8553 remaining = SetPrimParams((SceneObjectPart)part, rules, originFunc, ref rulesParsed);
8555 remaining = SetPrimParams((
ScenePresence)part, rules, originFunc, ref rulesParsed);
8564 uint rulesParsed = 0;
8568 if (entity is SceneObjectPart)
8569 remaining = SetPrimParams((SceneObjectPart)entity, rules, originFunc, ref rulesParsed);
8571 remaining = SetAgentParams((
ScenePresence)entity, rules, originFunc, ref rulesParsed);
8574 while (remaining.Length > 2)
8579 linknumber = remaining.GetLSLIntegerItem(0);
8581 catch(InvalidCastException)
8583 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_LINK_TARGET: parameter 2 must be integer", rulesParsed));
8587 rules = remaining.GetSublist(1, -1);
8588 entities = GetLinkEntities(linknumber);
8592 if (entity is SceneObjectPart)
8593 remaining = SetPrimParams((SceneObjectPart)entity, rules, originFunc, ref rulesParsed);
8595 remaining = SetAgentParams((
ScenePresence)entity, rules, originFunc, ref rulesParsed);
8609 if (frames.Data.Length > 0)
8612 group.RootPart.KeyframeMotion.Delete();
8613 group.RootPart.KeyframeMotion = null;
8620 while (idx < options.Data.Length)
8622 int option = (int)options.GetLSLIntegerItem(idx++);
8623 int remain = options.Data.Length - idx;
8627 case ScriptBaseClass.KFM_MODE:
8630 int modeval = (int)options.GetLSLIntegerItem(idx++);
8633 case ScriptBaseClass.KFM_FORWARD:
8634 mode = KeyframeMotion.PlayMode.Forward;
8636 case ScriptBaseClass.KFM_REVERSE:
8637 mode = KeyframeMotion.PlayMode.Reverse;
8639 case ScriptBaseClass.KFM_LOOP:
8640 mode = KeyframeMotion.PlayMode.Loop;
8642 case ScriptBaseClass.KFM_PING_PONG:
8643 mode = KeyframeMotion.PlayMode.PingPong;
8647 case ScriptBaseClass.KFM_DATA:
8650 int dataval = (int)options.GetLSLIntegerItem(idx++);
8656 group.RootPart.KeyframeMotion =
new KeyframeMotion(group, mode, data);
8665 while (idx < frames.Data.Length)
8667 int remain = frames.Data.Length - idx;
8669 if (remain < elemLength)
8673 frame.Position = null;
8674 frame.Rotation = null;
8679 frame.Position =
new Vector3((
float)tempv.x, (
float)tempv.y, (
float)tempv.z);
8684 Quaternion q =
new Quaternion((
float)tempq.x, (
float)tempq.y, (
float)tempq.z, (
float)tempq.s);
8689 float tempf = (float)frames.GetLSLFloatItem(idx++);
8690 frame.TimeMS = (int)(tempf * 1000.0f);
8692 keyframes.Add(frame);
8695 group.RootPart.KeyframeMotion.SetKeyframes(keyframes.ToArray());
8696 group.RootPart.KeyframeMotion.Start();
8703 if (options.Data.Length == 0)
8705 group.RootPart.KeyframeMotion.Stop();
8711 while (idx < options.Data.Length)
8713 int option = (int)options.GetLSLIntegerItem(idx++);
8717 case ScriptBaseClass.KFM_COMMAND:
8718 int cmd = (int)options.GetLSLIntegerItem(idx++);
8721 case ScriptBaseClass.KFM_CMD_PLAY:
8722 group.RootPart.KeyframeMotion.Start();
8724 case ScriptBaseClass.KFM_CMD_STOP:
8725 group.RootPart.KeyframeMotion.Stop();
8727 case ScriptBaseClass.KFM_CMD_PAUSE:
8728 group.RootPart.KeyframeMotion.Pause();
8741 result.Add(
new LSL_Float(m_host.GravityModifier));
8742 result.Add(
new LSL_Float(m_host.Restitution));
8743 result.Add(
new LSL_Float(m_host.Friction));
8744 result.Add(
new LSL_Float(m_host.Density));
8749 private void SetPhysicsMaterial(SceneObjectPart part,
int material_bits,
8750 float material_density,
float material_friction,
8751 float material_restitution,
float material_gravity_modifier)
8761 physdata.
Density = material_density;
8763 physdata.
Friction = material_friction;
8765 physdata.
Bounce = material_restitution;
8773 float material_gravity_modifier,
float material_restitution,
8774 float material_friction,
float material_density)
8776 SetPhysicsMaterial(m_host, material_bits, material_density, material_friction, material_restitution, material_gravity_modifier);
8781 private Vector3 Zrot(Quaternion r)
8785 m = r.X * r.X + r.Y * r.Y + r.Z * r.Z + r.W * r.W;
8786 if (Math.Abs(1.0 - m) > 0.000001)
8788 m = 1.0 / Math.Sqrt(m);
8795 x = 2 * (r.X * r.Z + r.Y * r.W);
8796 y = 2 * (-r.X * r.W + r.Y * r.Z);
8797 z = -r.X * r.X - r.Y * r.Y + r.Z * r.Z + r.W * r.W;
8799 return new Vector3((
float)x, (
float)y, (
float)z);
8812 bool positionChanged =
false;
8813 LSL_Vector currentPosition = GetPartLocalPos(part);
8817 while (idx < rules.Length)
8820 int code = rules.GetLSLIntegerItem(idx++);
8822 int remain = rules.Length - idx;
8830 case ScriptBaseClass.PRIM_POSITION:
8831 case ScriptBaseClass.PRIM_POS_LOCAL:
8837 v = rules.GetVector3Item(idx++);
8839 catch(InvalidCastException)
8842 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_POSITION: arg #{1} - parameter 1 must be vector", rulesParsed, idx - idxStart - 1));
8844 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_POS_LOCAL: arg #{1} - parameter 1 must be vector", rulesParsed, idx - idxStart - 1));
8848 currentPosition = GetSetPosTarget(part, v, currentPosition,
true);
8850 currentPosition = GetSetPosTarget(part, v, currentPosition,
false);
8851 positionChanged =
true;
8854 case ScriptBaseClass.PRIM_SIZE:
8858 v=rules.GetVector3Item(idx++);
8862 case ScriptBaseClass.PRIM_ROTATION:
8868 q = rules.GetQuaternionItem(idx++);
8870 catch(InvalidCastException)
8872 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_ROTATION: arg #{1} - parameter 1 must be rotation", rulesParsed, idx - idxStart - 1));
8884 SceneObjectPart rootPart = part.ParentGroup.RootPart;
8890 case ScriptBaseClass.PRIM_TYPE:
8896 code = (int)rules.GetLSLIntegerItem(idx++);
8898 catch(InvalidCastException)
8900 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE: arg #{1} - parameter 1 must be integer", rulesParsed, idx - idxStart - 1));
8904 remain = rules.Length - idx;
8917 case ScriptBaseClass.PRIM_TYPE_BOX:
8923 face = (int)rules.GetLSLIntegerItem(idx++);
8925 catch(InvalidCastException)
8927 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_BOX: arg #{1} - parameter 2 must be integer", rulesParsed, idx - idxStart - 1));
8932 v = rules.GetVector3Item(idx++);
8934 catch(InvalidCastException)
8936 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_BOX: arg #{1} - parameter 3 must be vector", rulesParsed, idx - idxStart - 1));
8941 hollow = (float)rules.GetLSLFloatItem(idx++);
8943 catch(InvalidCastException)
8945 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_BOX: arg #{1} - parameter 4 must be float", rulesParsed, idx - idxStart - 1));
8950 twist = rules.GetVector3Item(idx++);
8952 catch(InvalidCastException)
8954 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_BOX: arg #{1} - parameter 5 must be vector", rulesParsed, idx - idxStart - 1));
8959 taper_b = rules.GetVector3Item(idx++);
8961 catch(InvalidCastException)
8963 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_BOX: arg #{1} - parameter 6 must be vector", rulesParsed, idx - idxStart - 1));
8968 topshear = rules.GetVector3Item(idx++);
8970 catch(InvalidCastException)
8972 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_BOX: arg #{1} - parameter 7 must be vector", rulesParsed, idx - idxStart - 1));
8976 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear,
8980 case ScriptBaseClass.PRIM_TYPE_CYLINDER:
8986 face = (int)rules.GetLSLIntegerItem(idx++);
8988 catch(InvalidCastException)
8990 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_CYLINDER: arg #{1} - parameter 3 must be integer", rulesParsed, idx - idxStart - 1));
8995 v = rules.GetVector3Item(idx++);
8997 catch(InvalidCastException)
8999 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_CYLINDER: arg #{1} - parameter 4 must be vector", rulesParsed, idx - idxStart - 1));
9004 hollow = (float)rules.GetLSLFloatItem(idx++);
9006 catch(InvalidCastException)
9008 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_CYLINDER: arg #{1} - parameter 5 must be float", rulesParsed, idx - idxStart - 1));
9013 twist = rules.GetVector3Item(idx++);
9015 catch(InvalidCastException)
9017 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_CYLINDER: arg #{1} - parameter 6 must be vector", rulesParsed, idx - idxStart - 1));
9022 taper_b = rules.GetVector3Item(idx++);
9024 catch(InvalidCastException)
9026 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_CYLINDER: arg #{1} - parameter 7 must be vector", rulesParsed, idx - idxStart - 1));
9031 topshear = rules.GetVector3Item(idx++);
9033 catch(InvalidCastException)
9035 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_CYLINDER: arg #{1} - parameter 8 must be vector", rulesParsed, idx - idxStart - 1));
9038 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear,
9042 case ScriptBaseClass.PRIM_TYPE_PRISM:
9048 face = (int)rules.GetLSLIntegerItem(idx++);
9050 catch(InvalidCastException)
9052 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_PRISM: arg #{1} - parameter 3 must be integer", rulesParsed, idx - idxStart - 1));
9057 v = rules.GetVector3Item(idx++);
9059 catch(InvalidCastException)
9061 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_PRISM: arg #{1} - parameter 4 must be vector", rulesParsed, idx - idxStart - 1));
9066 hollow = (float)rules.GetLSLFloatItem(idx++);
9068 catch(InvalidCastException)
9070 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_PRISM: arg #{1} - parameter 5 must be float", rulesParsed, idx - idxStart - 1));
9075 twist = rules.GetVector3Item(idx++);
9077 catch(InvalidCastException)
9079 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_PRISM: arg #{1} - parameter 6 must be vector", rulesParsed, idx - idxStart - 1));
9084 taper_b = rules.GetVector3Item(idx++);
9086 catch(InvalidCastException)
9088 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_PRISM: arg #{1} - parameter 7 must be vector", rulesParsed, idx - idxStart - 1));
9093 topshear = rules.GetVector3Item(idx++);
9095 catch(InvalidCastException)
9097 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_PRISM: arg #{1} - parameter 8 must be vector", rulesParsed, idx - idxStart - 1));
9100 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear,
9104 case ScriptBaseClass.PRIM_TYPE_SPHERE:
9110 face = (int)rules.GetLSLIntegerItem(idx++);
9112 catch(InvalidCastException)
9114 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_SPHERE: arg #{1} - parameter 3 must be integer", rulesParsed, idx - idxStart - 1));
9119 v = rules.GetVector3Item(idx++);
9121 catch(InvalidCastException)
9123 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_SPHERE: arg #{1} - parameter 4 must be vector", rulesParsed, idx - idxStart - 1));
9128 hollow = (float)rules.GetLSLFloatItem(idx++);
9130 catch(InvalidCastException)
9132 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_SPHERE: arg #{1} - parameter 5 must be float", rulesParsed, idx - idxStart - 1));
9137 twist = rules.GetVector3Item(idx++);
9139 catch(InvalidCastException)
9141 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_SPHERE: arg #{1} - parameter 6 must be vector", rulesParsed, idx - idxStart - 1));
9146 taper_b = rules.GetVector3Item(idx++);
9148 catch(InvalidCastException)
9150 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_SPHERE: arg #{1} - parameter 7 must be vector", rulesParsed, idx - idxStart - 1));
9153 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b,
9157 case ScriptBaseClass.PRIM_TYPE_TORUS:
9163 face = (int)rules.GetLSLIntegerItem(idx++);
9165 catch(InvalidCastException)
9167 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TORUS: arg #{1} - parameter 3 must be integer", rulesParsed, idx - idxStart - 1));
9172 v = rules.GetVector3Item(idx++);
9174 catch(InvalidCastException)
9176 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TORUS: arg #{1} - parameter 4 must be vector", rulesParsed, idx - idxStart - 1));
9181 hollow = (float)rules.GetLSLFloatItem(idx++);
9183 catch(InvalidCastException)
9185 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TORUS: arg #{1} - parameter 5 must be float", rulesParsed, idx - idxStart - 1));
9190 twist = rules.GetVector3Item(idx++);
9192 catch(InvalidCastException)
9194 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TORUS: arg #{1} - parameter 6 must be vector", rulesParsed, idx - idxStart - 1));
9199 holesize = rules.GetVector3Item(idx++);
9201 catch(InvalidCastException)
9203 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TORUS: arg #{1} - parameter 7 must be vector", rulesParsed, idx - idxStart - 1));
9208 topshear = rules.GetVector3Item(idx++);
9210 catch(InvalidCastException)
9212 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TORUS: arg #{1} - parameter 8 must be vector", rulesParsed, idx - idxStart - 1));
9217 profilecut = rules.GetVector3Item(idx++);
9219 catch(InvalidCastException)
9221 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TORUS: arg #{1} - parameter 9 must be vector", rulesParsed, idx - idxStart - 1));
9226 taper_b = rules.GetVector3Item(idx++);
9228 catch(InvalidCastException)
9230 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TORUS: arg #{1} - parameter 10 must be vector", rulesParsed, idx - idxStart - 1));
9235 revolutions = (float)rules.GetLSLFloatItem(idx++);
9237 catch(InvalidCastException)
9239 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TORUS: arg #{1} - parameter 11 must be float", rulesParsed, idx - idxStart - 1));
9244 radiusoffset = (float)rules.GetLSLFloatItem(idx++);
9246 catch(InvalidCastException)
9248 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TORUS: arg #{1} - parameter 12 must be float", rulesParsed, idx - idxStart - 1));
9253 skew = (float)rules.GetLSLFloatItem(idx++);
9255 catch(InvalidCastException)
9257 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TORUS: arg #{1} - parameter 13 must be vector", rulesParsed, idx - idxStart - 1));
9260 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b,
9264 case ScriptBaseClass.PRIM_TYPE_TUBE:
9270 face = (int)rules.GetLSLIntegerItem(idx++);
9272 catch(InvalidCastException)
9274 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TUBE: arg #{1} - parameter 3 must be integer", rulesParsed, idx - idxStart - 1));
9279 v = rules.GetVector3Item(idx++);
9281 catch(InvalidCastException)
9283 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TUBE: arg #{1} - parameter 4 must be vector", rulesParsed, idx - idxStart - 1));
9288 hollow = (float)rules.GetLSLFloatItem(idx++);
9290 catch(InvalidCastException)
9292 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TUBE: arg #{1} - parameter 5 must be float", rulesParsed, idx - idxStart - 1));
9297 twist = rules.GetVector3Item(idx++);
9299 catch(InvalidCastException)
9301 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TUBE: arg #{1} - parameter 6 must be vector", rulesParsed, idx - idxStart - 1));
9306 holesize = rules.GetVector3Item(idx++);
9308 catch(InvalidCastException)
9310 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TUBE: arg #{1} - parameter 7 must be vector", rulesParsed, idx - idxStart - 1));
9315 topshear = rules.GetVector3Item(idx++);
9317 catch(InvalidCastException)
9319 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TUBE: arg #{1} - parameter 8 must be vector", rulesParsed, idx - idxStart - 1));
9324 profilecut = rules.GetVector3Item(idx++);
9326 catch(InvalidCastException)
9328 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TUBE: arg #{1} - parameter 9 must be vector", rulesParsed, idx - idxStart - 1));
9333 taper_b = rules.GetVector3Item(idx++);
9335 catch(InvalidCastException)
9337 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TUBE: arg #{1} - parameter 10 must be vector", rulesParsed, idx - idxStart - 1));
9342 revolutions = (float)rules.GetLSLFloatItem(idx++);
9344 catch(InvalidCastException)
9346 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TUBE: arg #{1} - parameter 11 must be float", rulesParsed, idx - idxStart - 1));
9351 radiusoffset = (float)rules.GetLSLFloatItem(idx++);
9353 catch(InvalidCastException)
9355 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TUBE: arg #{1} - parameter 12 must be float", rulesParsed, idx - idxStart - 1));
9360 skew = (float)rules.GetLSLFloatItem(idx++);
9362 catch(InvalidCastException)
9364 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TUBE: arg #{1} - parameter 13 must be float", rulesParsed, idx - idxStart - 1));
9367 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b,
9371 case ScriptBaseClass.PRIM_TYPE_RING:
9377 face = (int)rules.GetLSLIntegerItem(idx++);
9379 catch(InvalidCastException)
9381 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_RING: arg #{1} - parameter 3 must be integer", rulesParsed, idx - idxStart - 1));
9386 v = rules.GetVector3Item(idx++);
9388 catch(InvalidCastException)
9390 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_RING: arg #{1} - parameter 4 must be vector", rulesParsed, idx - idxStart - 1));
9395 hollow = (float)rules.GetLSLFloatItem(idx++);
9397 catch(InvalidCastException)
9399 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_RING: arg #{1} - parameter 5 must be float", rulesParsed, idx - idxStart - 1));
9404 twist = rules.GetVector3Item(idx++);
9406 catch(InvalidCastException)
9408 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_RING: arg #{1} - parameter 6 must be vector", rulesParsed, idx - idxStart - 1));
9413 holesize = rules.GetVector3Item(idx++);
9415 catch(InvalidCastException)
9417 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_RING: arg #{1} - parameter 7 must be vector", rulesParsed, idx - idxStart - 1));
9422 topshear = rules.GetVector3Item(idx++);
9424 catch(InvalidCastException)
9426 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_RING: arg #{1} - parameter 8 must be vector", rulesParsed, idx - idxStart - 1));
9431 profilecut = rules.GetVector3Item(idx++);
9433 catch(InvalidCastException)
9435 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_RING: arg #{1} - parameter 9 must be vector", rulesParsed, idx - idxStart - 1));
9440 taper_b = rules.GetVector3Item(idx++);
9442 catch(InvalidCastException)
9444 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_RING: arg #{1} - parameter 10 must be vector", rulesParsed, idx - idxStart - 1));
9449 revolutions = (float)rules.GetLSLFloatItem(idx++);
9451 catch(InvalidCastException)
9453 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_RING: arg #{1} - parameter 11 must be float", rulesParsed, idx - idxStart - 1));
9458 radiusoffset = (float)rules.GetLSLFloatItem(idx++);
9460 catch(InvalidCastException)
9462 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_RING: arg #{1} - parameter 12 must be float", rulesParsed, idx - idxStart - 1));
9467 skew = (float)rules.GetLSLFloatItem(idx++);
9469 catch(InvalidCastException)
9471 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_RING: arg #{1} - parameter 13 must be float", rulesParsed, idx - idxStart - 1));
9474 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b,
9478 case ScriptBaseClass.PRIM_TYPE_SCULPT:
9482 string map = rules.Data[idx++].ToString();
9485 face = (int)rules.GetLSLIntegerItem(idx++);
9487 catch(InvalidCastException)
9489 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_SCULPT: arg #{1} - parameter 4 must be integer", rulesParsed, idx - idxStart - 1));
9492 SetPrimitiveShapeParams(part, map, face, (byte)
Extrusion.Curve1);
9498 case ScriptBaseClass.PRIM_TEXTURE:
9502 face=(int)rules.GetLSLIntegerItem(idx++);
9508 tex = rules.Data[idx++].ToString();
9511 repeats = rules.GetVector3Item(idx++);
9513 catch(InvalidCastException)
9515 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TEXTURE: arg #{1} - parameter 3 must be vector", rulesParsed, idx - idxStart - 1));
9520 offsets = rules.GetVector3Item(idx++);
9522 catch(InvalidCastException)
9524 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TEXTURE: arg #{1} - parameter 4 must be vector", rulesParsed, idx - idxStart - 1));
9529 rotation = (double)rules.GetLSLFloatItem(idx++);
9531 catch(InvalidCastException)
9533 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TEXTURE: arg #{1} - parameter 5 must be float", rulesParsed, idx - idxStart - 1));
9537 SetTexture(part, tex, face);
9538 ScaleTexture(part, repeats.x, repeats.y, face);
9539 OffsetTexture(part, offsets.x, offsets.y, face);
9540 RotateTexture(part, rotation, face);
9544 case ScriptBaseClass.PRIM_COLOR:
9553 face = (int)rules.GetLSLIntegerItem(idx++);
9555 catch(InvalidCastException)
9557 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_COLOR: arg #{1} - parameter 2 must be integer", rulesParsed, idx - idxStart - 1));
9562 color = rules.GetVector3Item(idx++);
9564 catch(InvalidCastException)
9566 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_COLOR: arg #{1} - parameter 3 must be vector", rulesParsed, idx - idxStart - 1));
9571 alpha = (double)rules.GetLSLFloatItem(idx++);
9573 catch(InvalidCastException)
9575 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_COLOR: arg #{1} - parameter 4 must be float", rulesParsed, idx - idxStart - 1));
9579 part.SetFaceColorAlpha(face, color, alpha);
9583 case ScriptBaseClass.PRIM_FLEXIBLE:
9596 flexi = rules.GetLSLIntegerItem(idx++);
9598 catch(InvalidCastException)
9600 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_FLEXIBLE: arg #{1} - parameter 2 must be integer", rulesParsed, idx - idxStart - 1));
9605 softness = rules.GetLSLIntegerItem(idx++);
9607 catch(InvalidCastException)
9609 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_FLEXIBLE: arg #{1} - parameter 3 must be integer", rulesParsed, idx - idxStart - 1));
9614 gravity = (float)rules.GetLSLFloatItem(idx++);
9616 catch(InvalidCastException)
9618 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_FLEXIBLE: arg #{1} - parameter 4 must be float", rulesParsed, idx - idxStart - 1));
9623 friction = (float)rules.GetLSLFloatItem(idx++);
9625 catch(InvalidCastException)
9627 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_FLEXIBLE: arg #{1} - parameter 5 must be float", rulesParsed, idx - idxStart - 1));
9632 wind = (float)rules.GetLSLFloatItem(idx++);
9634 catch(InvalidCastException)
9636 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_FLEXIBLE: arg #{1} - parameter 6 must be float", rulesParsed, idx - idxStart - 1));
9641 tension = (float)rules.GetLSLFloatItem(idx++);
9643 catch(InvalidCastException)
9645 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_FLEXIBLE: arg #{1} - parameter 7 must be float", rulesParsed, idx - idxStart - 1));
9650 force = rules.GetVector3Item(idx++);
9652 catch(InvalidCastException)
9654 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_FLEXIBLE: arg #{1} - parameter 8 must be vector", rulesParsed, idx - idxStart - 1));
9658 SetFlexi(part, flexi, softness, gravity, friction, wind, tension, force);
9662 case ScriptBaseClass.PRIM_POINT_LIGHT:
9673 light = rules.GetLSLIntegerItem(idx++);
9675 catch(InvalidCastException)
9677 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_POINT_LIGHT: arg #{1} - parameter 2 must be integer", rulesParsed, idx - idxStart - 1));
9682 lightcolor = rules.GetVector3Item(idx++);
9684 catch(InvalidCastException)
9686 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_POINT_LIGHT: arg #{1} - parameter 3 must be vector", rulesParsed, idx - idxStart - 1));
9691 intensity = (float)rules.GetLSLFloatItem(idx++);
9693 catch(InvalidCastException)
9695 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_POINT_LIGHT: arg #{1} - parameter 4 must be float", rulesParsed, idx - idxStart - 1));
9700 radius = (float)rules.GetLSLFloatItem(idx++);
9702 catch(InvalidCastException)
9704 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_POINT_LIGHT: arg #{1} - parameter 5 must be float", rulesParsed, idx - idxStart - 1));
9709 falloff = (float)rules.GetLSLFloatItem(idx++);
9711 catch(InvalidCastException)
9713 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_POINT_LIGHT: arg #{1} - parameter 6 must be float", rulesParsed, idx - idxStart - 1));
9717 SetPointLight(part, light, lightcolor, intensity, radius, falloff);
9721 case ScriptBaseClass.PRIM_GLOW:
9729 face = rules.GetLSLIntegerItem(idx++);
9731 catch(InvalidCastException)
9733 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_GLOW: arg #{1} - parameter 2 must be integer", rulesParsed, idx - idxStart - 1));
9738 glow = (float)rules.GetLSLFloatItem(idx++);
9740 catch(InvalidCastException)
9742 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_GLOW: arg #{1} - parameter 3 must be float", rulesParsed, idx - idxStart - 1));
9746 SetGlow(part, face, glow);
9750 case ScriptBaseClass.PRIM_BUMP_SHINY:
9759 face = (int)rules.GetLSLIntegerItem(idx++);
9761 catch(InvalidCastException)
9763 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_BUMP_SHINY: arg #{1} - parameter 2 must be integer", rulesParsed, idx - idxStart - 1));
9768 shiny = (int)rules.GetLSLIntegerItem(idx++);
9770 catch(InvalidCastException)
9772 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_BUMP_SHINY: arg #{1} - parameter 3 must be integer", rulesParsed, idx - idxStart - 1));
9777 bump = (Bumpiness)(
int)rules.GetLSLIntegerItem(idx++);
9779 catch(InvalidCastException)
9781 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_BUMP_SHINY: arg #{1} - parameter 4 must be integer", rulesParsed, idx - idxStart - 1));
9785 SetShiny(part, face, shiny, bump);
9789 case ScriptBaseClass.PRIM_FULLBRIGHT:
9796 face = rules.GetLSLIntegerItem(idx++);
9798 catch(InvalidCastException)
9800 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_FULLBRIGHT: arg #{1} - parameter 2 must be integer", rulesParsed, idx - idxStart - 1));
9805 st = rules.GetLSLIntegerItem(idx++);
9807 catch(InvalidCastException)
9809 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_FULLBRIGHT: arg #{1} - parameter 4 must be integer", rulesParsed, idx - idxStart - 1));
9812 SetFullBright(part, face , st);
9815 case ScriptBaseClass.PRIM_MATERIAL:
9822 mat = rules.GetLSLIntegerItem(idx++);
9824 catch(InvalidCastException)
9826 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_MATERIAL: arg #{1} - parameter 2 must be integer", rulesParsed, idx - idxStart - 1));
9829 if (mat < 0 || mat > 7)
9832 part.Material = Convert.ToByte(mat);
9835 case ScriptBaseClass.PRIM_PHANTOM:
9839 string ph = rules.Data[idx++].ToString();
9840 part.ParentGroup.ScriptSetPhantomStatus(ph.Equals(
"1"));
9844 case ScriptBaseClass.PRIM_PHYSICS:
9847 string phy = rules.Data[idx++].ToString();
9848 part.ScriptSetPhysicsStatus(phy.Equals(
"1"));
9851 case ScriptBaseClass.PRIM_PHYSICS_SHAPE_TYPE:
9859 shape_type = rules.GetLSLIntegerItem(idx++);
9861 catch(InvalidCastException)
9863 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_PHYSICS_SHAPE_TYPE: arg #{1} - parameter 2 must be integer", rulesParsed, idx - idxStart - 1));
9868 physdata.Density = part.Density;
9869 physdata.Bounce = part.Restitution;
9870 physdata.GravitationModifier = part.GravityModifier;
9873 part.UpdateExtraPhysics(physdata);
9877 case (
int)ScriptBaseClass.PRIM_PHYSICS_MATERIAL:
9881 int material_bits = rules.GetLSLIntegerItem(idx++);
9882 float material_density = (float)rules.GetLSLFloatItem(idx++);
9883 float material_friction = (float)rules.GetLSLFloatItem(idx++);
9884 float material_restitution = (float)rules.GetLSLFloatItem(idx++);
9885 float material_gravity_modifier = (float)rules.GetLSLFloatItem(idx++);
9887 SetPhysicsMaterial(part, material_bits, material_density, material_friction, material_restitution, material_gravity_modifier);
9891 case (
int)ScriptBaseClass.PRIM_TEMP_ON_REZ:
9894 string temp = rules.Data[idx++].ToString();
9896 part.ParentGroup.ScriptSetTemporaryStatus(temp.Equals(
"1"));
9900 case ScriptBaseClass.PRIM_TEXGEN:
9908 face = rules.GetLSLIntegerItem(idx++);
9910 catch(InvalidCastException)
9912 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TEXGEN: arg #{1} - parameter 2 must be integer", rulesParsed, idx - idxStart - 1));
9917 style = rules.GetLSLIntegerItem(idx++);
9919 catch(InvalidCastException)
9921 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TEXGEN: arg #{1} - parameter 3 must be integer", rulesParsed, idx - idxStart - 1));
9924 SetTexGen(part, face, style);
9926 case ScriptBaseClass.PRIM_TEXT:
9935 primText = rules.GetLSLStringItem(idx++);
9937 catch(InvalidCastException)
9939 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TEXT: arg #{1} - parameter 2 must be string", rulesParsed, idx - idxStart - 1));
9944 primTextColor = rules.GetVector3Item(idx++);
9946 catch(InvalidCastException)
9948 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TEXT: arg #{1} - parameter 3 must be vector", rulesParsed, idx - idxStart - 1));
9953 primTextAlpha = rules.GetLSLFloatItem(idx++);
9955 catch(InvalidCastException)
9957 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_TEXT: arg #{1} - parameter 4 must be float", rulesParsed, idx - idxStart - 1));
9960 Vector3 av3 = Util.Clip(primTextColor, 0.0f, 1.0f);
9961 part.SetText(primText, av3, Util.Clip((float)primTextAlpha, 0.0f, 1.0f));
9965 case ScriptBaseClass.PRIM_NAME:
9970 string primName = rules.GetLSLStringItem(idx++);
9971 part.Name = primName;
9973 catch(InvalidCastException)
9975 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_NAME: arg #{1} - parameter 2 must be string", rulesParsed, idx - idxStart - 1));
9979 case ScriptBaseClass.PRIM_DESC:
9984 string primDesc = rules.GetLSLStringItem(idx++);
9985 part.Description = primDesc;
9987 catch(InvalidCastException)
9989 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_DESC: arg #{1} - parameter 2 must be string", rulesParsed, idx - idxStart - 1));
9993 case ScriptBaseClass.PRIM_ROT_LOCAL:
9999 rot = rules.GetQuaternionItem(idx++);
10001 catch(InvalidCastException)
10003 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_ROT_LOCAL: arg #{1} - parameter 2 must be rotation", rulesParsed, idx - idxStart - 1));
10009 case ScriptBaseClass.PRIM_OMEGA:
10018 axis = rules.GetVector3Item(idx++);
10020 catch(InvalidCastException)
10022 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_OMEGA: arg #{1} - parameter 2 must be vector", rulesParsed, idx - idxStart - 1));
10027 spinrate = rules.GetLSLFloatItem(idx++);
10029 catch(InvalidCastException)
10031 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_OMEGA: arg #{1} - parameter 3 must be float", rulesParsed, idx - idxStart - 1));
10036 gain = rules.GetLSLFloatItem(idx++);
10038 catch(InvalidCastException)
10040 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_OMEGA: arg #{1} - parameter 4 must be float", rulesParsed, idx - idxStart - 1));
10043 TargetOmega(part, axis, (
double)spinrate, (
double)gain);
10046 case ScriptBaseClass.PRIM_SLICE:
10052 slice = rules.GetVector3Item(idx++);
10054 catch(InvalidCastException)
10056 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_SLICE: arg #{1} - parameter 2 must be vector", rulesParsed, idx - idxStart - 1));
10059 part.UpdateSlice((float)slice.x, (
float)slice.y);
10062 case ScriptBaseClass.PRIM_LINK_TARGET:
10066 return rules.GetSublist(idx, -1);
10069 Error(originFunc,
string.Format(
"Error running rule #{0}: arg #{1} - unsupported parameter", rulesParsed, idx - idxStart));
10074 catch (InvalidCastException e)
10076 Error(originFunc,
string.Format(
"Error running rule #{0}: arg #{1} - ", rulesParsed, idx - idxStart) + e.Message);
10080 if (positionChanged)
10086 parent.UpdateGroupPosition(currentPosition);
10091 part.OffsetPosition = currentPosition;
10095 part.ScheduleTerseUpdate();
10110 while (idx < rules.Length)
10113 int code = rules.GetLSLIntegerItem(idx++);
10115 int remain = rules.Length - idx;
10120 case ScriptBaseClass.PRIM_POSITION:
10121 case ScriptBaseClass.PRIM_POS_LOCAL:
10127 sp.OffsetPosition = rules.GetVector3Item(idx++);
10129 catch(InvalidCastException)
10133 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_POSITION: arg #{1} - parameter 2 must be vector", rulesParsed, idx - idxStart - 1));
10137 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_POS_LOCAL: arg #{1} - parameter 2 must be vector", rulesParsed, idx - idxStart - 1));
10143 case ScriptBaseClass.PRIM_ROTATION:
10151 inRot = rules.GetQuaternionItem(idx++);
10153 catch(InvalidCastException)
10155 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_ROTATION: arg #{1} - parameter 2 must be rotation", rulesParsed, idx - idxStart - 1));
10159 SceneObjectPart parentPart = sp.ParentPart;
10161 if (parentPart != null)
10162 sp.Rotation = m_host.GetWorldRotation() * inRot;
10166 case ScriptBaseClass.PRIM_ROT_LOCAL:
10172 sp.Rotation = rules.GetQuaternionItem(idx++);
10174 catch(InvalidCastException)
10176 Error(originFunc,
string.Format(
"Error running rule #{0} -> PRIM_ROT_LOCAL: arg #{1} - parameter 2 must be rotation", rulesParsed, idx - idxStart - 1));
10182 case ScriptBaseClass.PRIM_TYPE:
10183 Error(originFunc,
"PRIM_TYPE disallowed on agent");
10186 case ScriptBaseClass.PRIM_OMEGA:
10187 Error(originFunc,
"PRIM_OMEGA disallowed on agent");
10190 case ScriptBaseClass.PRIM_LINK_TARGET:
10194 return rules.GetSublist(idx, -1);
10198 string.Format(
"Error running rule #{0} on agent: arg #{1} - disallowed on agent", rulesParsed, idx - idxStart));
10203 catch (InvalidCastException e)
10207 string.Format(
"Error running rule #{0}: arg #{1} - ", rulesParsed, idx - idxStart) + e.Message);
10215 m_host.AddScriptLPS(1);
10218 byte[] encData_byte;
10219 encData_byte = Util.UTF8.GetBytes(str);
10220 string encodedData = Convert.ToBase64String(encData_byte);
10221 return encodedData;
10225 Error(
"llBase64ToString",
"Error encoding string");
10226 return String.Empty;
10232 m_host.AddScriptLPS(1);
10235 byte[] b = Convert.FromBase64String(str);
10236 return Encoding.UTF8.GetString(b);
10240 Error(
"llBase64ToString",
"Error decoding string");
10241 return String.Empty;
10249 string b64 =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
10252 m_host.AddScriptLPS(1);
10254 if (str1 ==
String.Empty)
10255 return String.Empty;
10256 if (str2 ==
String.Empty)
10259 int len = str2.Length;
10260 if ((len % 4) != 0)
10262 while (str2.EndsWith(
"="))
10263 str2 = str2.Substring(0, str2.Length - 1);
10269 str2 = str2.Substring(0, str2.Length - 1);
10280 data1 = Convert.FromBase64String(str1);
10281 data2 = Convert.FromBase64String(str2);
10303 while (str1.EndsWith(
"="))
10305 str1 = str1.Substring(0, str1.Length - 1);
10308 while (str2.EndsWith(
"="))
10309 str2 = str2.Substring(0, str2.Length - 1);
10311 byte[] d1 =
new byte[str1.Length];
10312 byte[] d2 =
new byte[str2.Length];
10314 for (
int i = 0 ; i < str1.Length ; i++)
10316 int idx = b64.IndexOf(str1.Substring(i, 1));
10322 for (
int i = 0 ; i < str2.Length ; i++)
10324 int idx = b64.IndexOf(str2.Substring(i, 1));
10330 string output = String.Empty;
10332 for (
int pos = 0 ; pos < d1.Length ; pos++)
10333 output += b64[d1[pos] ^ d2[pos % d2.Length]];
10341 while (padding-- > 0)
10349 m_host.AddScriptLPS(1);
10350 Deprecated(
"llRemoteDataSetRegion",
"Use llOpenRemoteDataChannel instead");
10355 m_host.AddScriptLPS(1);
10356 return (
double)Math.Log10(val);
10361 m_host.AddScriptLPS(1);
10362 return (
double)Math.Log(val);
10367 m_host.AddScriptLPS(1);
10374 anims = av.Animator.GetAnimationArray();
10375 foreach (
UUID foo
in anims)
10376 l.Add(
new LSL_Key(foo.ToString()));
10382 m_host.AddScriptLPS(1);
10384 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
10386 if (land.LandData.OwnerID != m_host.OwnerID)
10389 land.SetMusicUrl(url);
10391 ScriptSleep(m_sleepMsOnSetParcelMusicURL);
10396 m_host.AddScriptLPS(1);
10398 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
10400 if (land.LandData.OwnerID != m_host.OwnerID)
10401 return String.Empty;
10403 return land.GetMusicUrl();
10408 m_host.AddScriptLPS(1);
10410 return new LSL_Vector(m_host.ParentGroup.AbsolutePosition);
10424 m_host.AddScriptLPS(1);
10426 if (m_host.ParentGroup.AttachmentPoint != 0)
10428 ScenePresence avatar = World.GetScenePresence(m_host.ParentGroup.AttachedAvatar);
10429 if (avatar != null)
10430 if ((avatar.
AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0)
10431 q = avatar.CameraRotation;
10433 q = avatar.GetWorldRotation();
10435 q = m_host.ParentGroup.GroupRotation;
10438 q = m_host.ParentGroup.GroupRotation;
10445 return m_host.Description!=null?m_host.Description:String.Empty;
10450 m_host.AddScriptLPS(1);
10451 m_host.Description = desc!=null?desc:String.Empty;
10456 m_host.AddScriptLPS(1);
10457 return m_host.CreatorID.ToString();
10462 m_host.AddScriptLPS(1);
10463 return DateTime.Now.ToUniversalTime().ToString(
"yyyy-MM-ddTHH:mm:ss.fffffffZ");
10468 m_host.AddScriptLPS(1);
10470 return m_host.ParentGroup.PrimCount + m_host.ParentGroup.GetSittingAvatarsCount();
10486 m_host.AddScriptLPS(1);
10487 UUID objID = UUID.Zero;
10491 if (!
UUID.TryParse(obj, out objID))
10500 SceneObjectPart part = World.GetSceneObjectPart(objID);
10502 objID = part.ParentGroup.AttachedAvatar;
10506 if (presence != null)
10513 Vector3 box = presence.Appearance.AvatarBoxSize * 0.5f;
10538 lower =
new LSL_Vector(-box.X - 0.1125, -box.Y, box.Z * -1.0f);
10539 upper =
new LSL_Vector(box.X + 0.1125, box.Y, box.Z * -1.0f);
10544 lower =
new LSL_Vector(-box.X, -box.Y, -box.Z);
10545 upper =
new LSL_Vector(box.X, box.Y, box.Z);
10548 if (lower.x > upper.x)
10550 if (lower.y > upper.y)
10552 if (lower.z > upper.z)
10560 part = World.GetSceneObjectPart(objID);
10573 Vector3[] offsets = Scene.GetCombinedBoundingBox(
new List<SceneObjectGroup> { part.ParentGroup },
10574 out minX, out maxX, out minY, out maxY, out minZ, out maxZ);
10576 minX -= offsets[0].X;
10577 maxX -= offsets[0].X;
10578 minY -= offsets[0].Y;
10579 maxY -= offsets[0].Y;
10580 minZ -= offsets[0].Z;
10581 maxZ -= offsets[0].Z;
10587 lower =
new LSL_Vector(minX + 0.05f, minY + 0.05f, minZ + 0.05f);
10588 upper =
new LSL_Vector(maxX - 0.05f, maxY - 0.05f, maxZ - 0.05f);
10590 if (lower.x > upper.x)
10592 if (lower.y > upper.y)
10594 if (lower.z > upper.z)
10611 private void BoundingBoxOfScenePresence(
ScenePresence sp, out Vector3 lower, out Vector3 upper)
10617 float height = sp.Appearance.AvatarHeight + m_avatarHeightCorrection;
10627 lower =
new Vector3(m_lABB1SitX0, m_lABB1SitY0, m_lABB1SitZ0 + m_lABB1SitZ1 * height);
10628 upper =
new Vector3(m_lABB2SitX0, m_lABB2SitY0, m_lABB2SitZ0 + m_lABB2SitZ1 * height);
10633 lower =
new Vector3(m_lABB1GrsX0, m_lABB1GrsY0, m_lABB1GrsZ0 + m_lABB1GrsZ1 * height);
10634 upper =
new Vector3(m_lABB2GrsX0, m_lABB2GrsY0, m_lABB2GrsZ0 + m_lABB2GrsZ1 * height);
10639 lower =
new Vector3(m_lABB1StdX0, m_lABB1StdY0, m_lABB1StdZ0 + m_lABB1StdZ1 * height);
10640 upper =
new Vector3(m_lABB2StdX0, m_lABB2StdY0, m_lABB2StdZ0 + m_lABB2StdZ1 * height);
10647 return new LSL_Vector(m_host.GetGeometricCenter());
10652 m_host.AddScriptLPS(1);
10656 LSL_List remaining = GetPrimParams(m_host, rules, ref result);
10658 while ((
object)remaining != null && remaining.Length > 2)
10660 int linknumber = remaining.GetLSLIntegerItem(0);
10661 rules = remaining.GetSublist(1, -1);
10662 List<SceneObjectPart> parts = GetLinkParts(linknumber);
10664 foreach (SceneObjectPart part
in parts)
10665 remaining = GetPrimParams(part, rules, ref result);
10673 m_host.AddScriptLPS(1);
10678 List<SceneObjectPart> parts;
10679 List<ScenePresence> avatars;
10684 while (rules.Length > 0)
10686 parts = GetLinkParts(linknumber);
10687 avatars = GetLinkAvatars(linknumber);
10690 foreach (SceneObjectPart part
in parts)
10692 remaining = GetPrimParams(part, rules, ref res);
10696 remaining = GetPrimParams(avatar, rules, ref res);
10699 if (remaining.Length > 0)
10701 linknumber = remaining.GetLSLIntegerItem(0);
10702 rules = remaining.GetSublist(1, -1);
10714 while (idx < rules.Length)
10716 int code = (int)rules.GetLSLIntegerItem(idx++);
10717 int remain = rules.Length - idx;
10721 case (
int)ScriptBaseClass.PRIM_MATERIAL:
10725 case (
int)ScriptBaseClass.PRIM_PHYSICS:
10732 case (
int)ScriptBaseClass.PRIM_TEMP_ON_REZ:
10739 case (
int)ScriptBaseClass.PRIM_PHANTOM:
10746 case (
int)ScriptBaseClass.PRIM_POSITION:
10753 case (
int)ScriptBaseClass.PRIM_SIZE:
10757 case (
int)ScriptBaseClass.PRIM_ROTATION:
10758 res.Add(GetPartRot(part));
10761 case (
int)ScriptBaseClass.PRIM_PHYSICS_SHAPE_TYPE:
10765 case (
int)ScriptBaseClass.PRIM_TYPE:
10770 double topshearx = (double)(sbyte)Shape.PathShearX / 100.0;
10771 double topsheary = (double)(sbyte)Shape.PathShearY / 100.0;
10774 case ScriptBaseClass.PRIM_TYPE_BOX:
10775 case ScriptBaseClass.PRIM_TYPE_CYLINDER:
10776 case ScriptBaseClass.PRIM_TYPE_PRISM:
10782 res.Add(
new LSL_Vector(topshearx, topsheary, 0));
10785 case ScriptBaseClass.PRIM_TYPE_SPHERE:
10793 case ScriptBaseClass.PRIM_TYPE_SCULPT:
10798 case ScriptBaseClass.PRIM_TYPE_RING:
10799 case ScriptBaseClass.PRIM_TYPE_TUBE:
10800 case ScriptBaseClass.PRIM_TYPE_TORUS:
10817 res.Add(
new LSL_Vector(topshearx, topsheary, 0));
10850 case (
int)ScriptBaseClass.PRIM_TEXTURE:
10854 int face = (int)rules.GetLSLIntegerItem(idx++);
10855 Primitive.TextureEntry tex = part.Shape.Textures;
10858 for (face = 0; face < GetNumberOfSides(part); face++)
10860 Primitive.TextureEntryFace texface = tex.GetFace((uint)face);
10862 res.Add(
new LSL_String(texface.TextureID.ToString()));
10869 res.Add(
new LSL_Float(texface.Rotation));
10874 if (face >= 0 && face < GetNumberOfSides(part))
10876 Primitive.TextureEntryFace texface = tex.GetFace((uint)face);
10878 res.Add(
new LSL_String(texface.TextureID.ToString()));
10885 res.Add(
new LSL_Float(texface.Rotation));
10890 case (
int)ScriptBaseClass.PRIM_COLOR:
10894 face = (int)rules.GetLSLIntegerItem(idx++);
10896 tex = part.Shape.Textures;
10900 for (face = 0; face < GetNumberOfSides(part); face++)
10902 texcolor = tex.GetFace((uint)face).RGBA;
10911 texcolor = tex.GetFace((uint)face).RGBA;
10919 case (
int)ScriptBaseClass.PRIM_BUMP_SHINY:
10923 face = (int)rules.GetLSLIntegerItem(idx++);
10925 tex = part.Shape.Textures;
10929 for (face = 0; face < GetNumberOfSides(part); face++)
10931 Shininess shinyness = tex.GetFace((uint)face).Shiny;
10932 if (shinyness == Shininess.High)
10934 shiny = ScriptBaseClass.PRIM_SHINY_HIGH;
10936 else if (shinyness == Shininess.Medium)
10938 shiny = ScriptBaseClass.PRIM_SHINY_MEDIUM;
10940 else if (shinyness == Shininess.Low)
10942 shiny = ScriptBaseClass.PRIM_SHINY_LOW;
10946 shiny = ScriptBaseClass.PRIM_SHINY_NONE;
10949 res.Add(
new LSL_Integer((
int)tex.GetFace((uint)face).Bump));
10954 Shininess shinyness = tex.GetFace((uint)face).Shiny;
10955 if (shinyness == Shininess.High)
10957 shiny = ScriptBaseClass.PRIM_SHINY_HIGH;
10959 else if (shinyness == Shininess.Medium)
10961 shiny = ScriptBaseClass.PRIM_SHINY_MEDIUM;
10963 else if (shinyness == Shininess.Low)
10965 shiny = ScriptBaseClass.PRIM_SHINY_LOW;
10969 shiny = ScriptBaseClass.PRIM_SHINY_NONE;
10972 res.Add(
new LSL_Integer((
int)tex.GetFace((uint)face).Bump));
10976 case (
int)ScriptBaseClass.PRIM_FULLBRIGHT:
10980 face = (int)rules.GetLSLIntegerItem(idx++);
10982 tex = part.Shape.Textures;
10986 for (face = 0; face < GetNumberOfSides(part); face++)
10988 if (tex.GetFace((uint)face).Fullbright ==
true)
10990 fullbright = ScriptBaseClass.TRUE;
10994 fullbright = ScriptBaseClass.FALSE;
11001 if (tex.GetFace((uint)face).Fullbright ==
true)
11003 fullbright = ScriptBaseClass.TRUE;
11007 fullbright = ScriptBaseClass.FALSE;
11013 case (
int)ScriptBaseClass.PRIM_FLEXIBLE:
11030 case (
int)ScriptBaseClass.PRIM_TEXGEN:
11035 face = (int)rules.GetLSLIntegerItem(idx++);
11037 tex = part.Shape.Textures;
11040 for (face = 0; face < GetNumberOfSides(part); face++)
11042 if (tex.GetFace((uint)face).TexMapType == MappingType.Planar)
11054 if (tex.GetFace((uint)face).TexMapType == MappingType.Planar)
11065 case (
int)ScriptBaseClass.PRIM_POINT_LIGHT:
11066 shape = part.Shape;
11080 case (
int)ScriptBaseClass.PRIM_GLOW:
11084 face = (int)rules.GetLSLIntegerItem(idx++);
11086 tex = part.Shape.Textures;
11090 for (face = 0; face < GetNumberOfSides(part); face++)
11092 primglow = tex.GetFace((uint)face).Glow;
11098 primglow = tex.GetFace((uint)face).Glow;
11103 case (
int)ScriptBaseClass.PRIM_TEXT:
11104 Color4 textColor = part.GetTextColor();
11112 case (
int)ScriptBaseClass.PRIM_NAME:
11116 case (
int)ScriptBaseClass.PRIM_DESC:
11119 case (
int)ScriptBaseClass.PRIM_ROT_LOCAL:
11123 case (
int)ScriptBaseClass.PRIM_POS_LOCAL:
11124 res.Add(
new LSL_Vector(GetPartLocalPos(part)));
11126 case (
int)ScriptBaseClass.PRIM_SLICE:
11127 PrimType prim_type = part.GetPrimType();
11128 bool useProfileBeginEnd = (prim_type == PrimType.SPHERE || prim_type == PrimType.TORUS || prim_type == PrimType.TUBE || prim_type == PrimType.RING);
11135 case (
int)ScriptBaseClass.PRIM_LINK_TARGET:
11141 return rules.GetSublist(idx, -1);
11151 m_host.AddScriptLPS(1);
11152 ScriptSleep(m_sleepMsOnGetPrimMediaParams);
11153 return GetPrimMediaParams(m_host, face, rules);
11158 m_host.AddScriptLPS(1);
11159 ScriptSleep(m_sleepMsOnGetLinkMedia);
11161 return GetPrimMediaParams(m_host.ParentGroup.RootPart, face, rules);
11163 return GetPrimMediaParams(m_host, face, rules);
11166 SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link);
11168 return GetPrimMediaParams(part, face, rules);
11174 private LSL_List GetPrimMediaParams(SceneObjectPart part,
int face,
LSL_List rules)
11183 if (null == module)
11186 MediaEntry me = module.GetMediaEntry(part, face);
11194 for (
int i = 0; i < rules.Length; i++)
11196 int code = (int)rules.GetLSLIntegerItem(i);
11200 case ScriptBaseClass.PRIM_MEDIA_ALT_IMAGE_ENABLE:
11205 case ScriptBaseClass.PRIM_MEDIA_CONTROLS:
11206 if (me.Controls == MediaControls.Standard)
11212 case ScriptBaseClass.PRIM_MEDIA_CURRENT_URL:
11216 case ScriptBaseClass.PRIM_MEDIA_HOME_URL:
11220 case ScriptBaseClass.PRIM_MEDIA_AUTO_LOOP:
11221 res.Add(me.AutoLoop ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE);
11224 case ScriptBaseClass.PRIM_MEDIA_AUTO_PLAY:
11225 res.Add(me.AutoPlay ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE);
11228 case ScriptBaseClass.PRIM_MEDIA_AUTO_SCALE:
11229 res.Add(me.AutoScale ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE);
11232 case ScriptBaseClass.PRIM_MEDIA_AUTO_ZOOM:
11233 res.Add(me.AutoZoom ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE);
11236 case ScriptBaseClass.PRIM_MEDIA_FIRST_CLICK_INTERACT:
11237 res.Add(me.InteractOnFirstClick ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE);
11240 case ScriptBaseClass.PRIM_MEDIA_WIDTH_PIXELS:
11244 case ScriptBaseClass.PRIM_MEDIA_HEIGHT_PIXELS:
11248 case ScriptBaseClass.PRIM_MEDIA_WHITELIST_ENABLE:
11249 res.Add(me.EnableWhiteList ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE);
11252 case ScriptBaseClass.PRIM_MEDIA_WHITELIST:
11253 string[] urls = (
string[])me.WhiteList.Clone();
11255 for (
int j = 0; j < urls.Length; j++)
11256 urls[j] = Uri.EscapeDataString(urls[j]);
11258 res.Add(
new LSL_String(
string.Join(
", ", urls)));
11261 case ScriptBaseClass.PRIM_MEDIA_PERMS_INTERACT:
11262 res.Add(
new LSL_Integer((
int)me.InteractPermissions));
11265 case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL:
11266 res.Add(
new LSL_Integer((
int)me.ControlPermissions));
11269 default:
return ScriptBaseClass.LSL_STATUS_MALFORMED_PARAMS;
11278 m_host.AddScriptLPS(1);
11279 ScriptSleep(m_sleepMsOnSetPrimMediaParams);
11280 return SetPrimMediaParams(m_host, face, rules);
11285 m_host.AddScriptLPS(1);
11286 ScriptSleep(m_sleepMsOnSetLinkMedia);
11288 return SetPrimMediaParams(m_host.ParentGroup.RootPart, face, rules);
11290 return SetPrimMediaParams(m_host, face, rules);
11293 SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link);
11295 return SetPrimMediaParams(part, face, rules);
11298 return ScriptBaseClass.LSL_STATUS_NOT_FOUND;
11310 if (null == module)
11311 return ScriptBaseClass.LSL_STATUS_NOT_SUPPORTED;
11313 MediaEntry me = module.GetMediaEntry(part, face);
11315 me =
new MediaEntry();
11319 while (i < rules.Length - 1)
11321 int code = rules.GetLSLIntegerItem(i++);
11325 case ScriptBaseClass.PRIM_MEDIA_ALT_IMAGE_ENABLE:
11326 me.EnableAlterntiveImage = (rules.GetLSLIntegerItem(i++) != 0 ?
true :
false);
11329 case ScriptBaseClass.PRIM_MEDIA_CONTROLS:
11330 int v = rules.GetLSLIntegerItem(i++);
11332 me.Controls = MediaControls.Standard;
11334 me.Controls = MediaControls.Mini;
11337 case ScriptBaseClass.PRIM_MEDIA_CURRENT_URL:
11338 me.CurrentURL = rules.GetLSLStringItem(i++);
11341 case ScriptBaseClass.PRIM_MEDIA_HOME_URL:
11342 me.HomeURL = rules.GetLSLStringItem(i++);
11345 case ScriptBaseClass.PRIM_MEDIA_AUTO_LOOP:
11346 me.AutoLoop = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ?
true :
false);
11349 case ScriptBaseClass.PRIM_MEDIA_AUTO_PLAY:
11350 me.AutoPlay = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ?
true :
false);
11353 case ScriptBaseClass.PRIM_MEDIA_AUTO_SCALE:
11354 me.AutoScale = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ?
true :
false);
11357 case ScriptBaseClass.PRIM_MEDIA_AUTO_ZOOM:
11358 me.AutoZoom = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ?
true :
false);
11361 case ScriptBaseClass.PRIM_MEDIA_FIRST_CLICK_INTERACT:
11362 me.InteractOnFirstClick = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ?
true :
false);
11365 case ScriptBaseClass.PRIM_MEDIA_WIDTH_PIXELS:
11366 me.Width = (int)rules.GetLSLIntegerItem(i++);
11369 case ScriptBaseClass.PRIM_MEDIA_HEIGHT_PIXELS:
11370 me.Height = (int)rules.GetLSLIntegerItem(i++);
11373 case ScriptBaseClass.PRIM_MEDIA_WHITELIST_ENABLE:
11374 me.EnableWhiteList = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ?
true :
false);
11377 case ScriptBaseClass.PRIM_MEDIA_WHITELIST:
11378 string[] rawWhiteListUrls = rules.GetLSLStringItem(i++).ToString().Split(
new char[] {
',' });
11379 List<string> whiteListUrls =
new List<string>();
11381 rawWhiteListUrls, delegate(
string rawUrl) { whiteListUrls.Add(rawUrl.Trim()); });
11382 me.WhiteList = whiteListUrls.ToArray();
11385 case ScriptBaseClass.PRIM_MEDIA_PERMS_INTERACT:
11386 me.InteractPermissions = (MediaPermission)(byte)(int)rules.GetLSLIntegerItem(i++);
11389 case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL:
11390 me.ControlPermissions = (MediaPermission)(byte)(int)rules.GetLSLIntegerItem(i++);
11393 default:
return ScriptBaseClass.LSL_STATUS_MALFORMED_PARAMS;
11397 module.SetMediaEntry(part, face, me);
11399 return ScriptBaseClass.LSL_STATUS_OK;
11404 m_host.AddScriptLPS(1);
11405 ScriptSleep(m_sleepMsOnClearPrimMedia);
11406 return ClearPrimMedia(m_host, face);
11411 m_host.AddScriptLPS(1);
11412 ScriptSleep(m_sleepMsOnClearLinkMedia);
11414 return ClearPrimMedia(m_host.ParentGroup.RootPart, face);
11416 return ClearPrimMedia(m_host, face);
11419 SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link);
11421 return ClearPrimMedia(part, face);
11424 return ScriptBaseClass.LSL_STATUS_NOT_FOUND;
11436 if (null == module)
11437 return ScriptBaseClass.LSL_STATUS_NOT_SUPPORTED;
11439 module.ClearMediaEntry(part, face);
11441 return ScriptBaseClass.LSL_STATUS_OK;
11500 protected static readonly
char[] i2ctable =
11502 'A',
'B',
'C',
'D',
'E',
'F',
'G',
'H',
11503 'I',
'J',
'K',
'L',
'M',
'N',
'O',
'P',
11504 'Q',
'R',
'S',
'T',
'U',
'V',
'W',
'X',
11506 'a',
'b',
'c',
'd',
'e',
'f',
'g',
'h',
11507 'i',
'j',
'k',
'l',
'm',
'n',
'o',
'p',
11508 'q',
'r',
's',
't',
'u',
'v',
'w',
'x',
11510 '0',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
11520 protected static readonly
int[] c2itable =
11522 -1,-1,-1,-1,-1,-1,-1,-1,
11523 -1,-1,-1,-1,-1,-1,-1,-1,
11524 -1,-1,-1,-1,-1,-1,-1,-1,
11525 -1,-1,-1,-1,-1,-1,-1,-1,
11526 -1,-1,-1,-1,-1,-1,-1,-1,
11527 -1,-1,-1,63,-1,-1,-1,64,
11528 53,54,55,56,57,58,59,60,
11529 61,62,-1,-1,-1,0,-1,-1,
11531 8,9,10,11,12,13,14,15,
11532 16,17,18,19,20,21,22,23,
11533 24,25,26,-1,-1,-1,-1,-1,
11534 -1,27,28,29,30,31,32,33,
11535 34,35,36,37,38,39,40,41,
11536 42,43,44,45,46,47,48,49,
11537 50,51,52,-1,-1,-1,-1,-1,
11538 -1,-1,-1,-1,-1,-1,-1,-1,
11539 -1,-1,-1,-1,-1,-1,-1,-1,
11540 -1,-1,-1,-1,-1,-1,-1,-1,
11541 -1,-1,-1,-1,-1,-1,-1,-1,
11542 -1,-1,-1,-1,-1,-1,-1,-1,
11543 -1,-1,-1,-1,-1,-1,-1,-1,
11544 -1,-1,-1,-1,-1,-1,-1,-1,
11545 -1,-1,-1,-1,-1,-1,-1,-1,
11546 -1,-1,-1,-1,-1,-1,-1,-1,
11547 -1,-1,-1,-1,-1,-1,-1,-1,
11548 -1,-1,-1,-1,-1,-1,-1,-1,
11549 -1,-1,-1,-1,-1,-1,-1,-1,
11550 -1,-1,-1,-1,-1,-1,-1,-1,
11551 -1,-1,-1,-1,-1,-1,-1,-1,
11552 -1,-1,-1,-1,-1,-1,-1,-1,
11553 -1,-1,-1,-1,-1,-1,-1,-1
11575 char[] imdt =
new char[8];
11577 m_host.AddScriptLPS(1);
11583 imdt[5] = i2ctable[number<<4 & 0x3F];
11584 imdt[4] = i2ctable[number>>2 & 0x3F];
11585 imdt[3] = i2ctable[number>>8 & 0x3F];
11586 imdt[2] = i2ctable[number>>14 & 0x3F];
11587 imdt[1] = i2ctable[number>>20 & 0x3F];
11588 imdt[0] = i2ctable[number>>26 & 0x3F];
11590 return new string(imdt);
11639 m_host.AddScriptLPS(1);
11643 if (str.Length > 8)
11653 if ((digit = c2itable[str[0]]) <= 0)
11655 return digit < 0 ? (int)0 : number;
11657 number += --digit<<26;
11659 if ((digit = c2itable[str[1]]) <= 0)
11661 return digit < 0 ? (int)0 : number;
11663 number += --digit<<20;
11665 if ((digit = c2itable[str[2]]) <= 0)
11667 return digit < 0 ? (int)0 : number;
11669 number += --digit<<14;
11671 if ((digit = c2itable[str[3]]) <= 0)
11673 return digit < 0 ? (int)0 : number;
11675 number += --digit<<8;
11677 if ((digit = c2itable[str[4]]) <= 0)
11679 return digit < 0 ? (int)0 : number;
11681 number += --digit<<2;
11683 if ((digit = c2itable[str[5]]) <= 0)
11685 return digit < 0 ? (int)0 : number;
11687 number += --digit>>4;
11696 m_host.AddScriptLPS(1);
11697 return DateTime.UtcNow.TimeOfDay.TotalSeconds;
11702 m_host.AddScriptLPS(1);
11704 if (m_UrlModule != null)
11705 return m_UrlModule.GetHttpHeader(
new UUID(request_id), header);
11706 return String.Empty;
11712 m_host.AddScriptLPS(1);
11714 return UrlModule.ExternalHostNameForLSL;
11767 return ParseString2List(src, separators, spacers,
true);
11772 int srclen = src.Length;
11773 int seplen = separators.Length;
11774 object[] separray = separators.Data;
11775 int spclen = spacers.Length;
11776 object[] spcarray = spacers.Data;
11778 string[] delarray =
new string[seplen+spclen];
11781 string[] outarray =
new string[srclen*2+1];
11786 m_host.AddScriptLPS(1);
11792 for (i = 0; i < seplen; i ++)
11794 d = separray[i].ToString();
11797 delarray[dellen++] = d;
11802 for (i = 0; i < spclen; i ++)
11804 d = spcarray[i].ToString();
11807 delarray[dellen++] = d;
11820 int earliestDel = -1;
11821 int earliestSrc = srclen;
11822 string earliestStr = null;
11823 for (j = 0; j < dellen; j ++)
11828 int index = src.IndexOf(d, i);
11831 delarray[j] = null;
11833 else if (index < earliestSrc)
11835 earliestSrc = index;
11838 if (index == i)
break;
11846 if (keepNulls || (earliestSrc > i))
11848 outarray[outlen++] = src.Substring(i, earliestSrc - i);
11854 if (earliestDel < 0)
break;
11859 if (earliestDel >= seplen)
11861 outarray[outlen++] = earliestStr;
11867 i = earliestSrc + earliestStr.Length;
11873 object[] outlist =
new object[outlen];
11874 for (i = 0; i < outlen; i ++)
11883 m_host.AddScriptLPS(1);
11889 permmask = (int)m_host.BaseMask;
11894 permmask = (int)m_host.OwnerMask;
11899 permmask = (int)m_host.GroupMask;
11904 permmask = (int)m_host.EveryoneMask;
11909 permmask = (int)m_host.NextOwnerMask;
11917 m_host.AddScriptLPS(1);
11919 if (m_ScriptEngine.Config.GetBoolean(
"AllowGodFunctions",
false))
11921 if (
World.Permissions.CanRunConsoleCommand(m_host.OwnerID))
11925 m_host.BaseMask = (uint)value;
11930 m_host.OwnerMask = (uint)value;
11935 m_host.GroupMask = (uint)value;
11940 m_host.EveryoneMask = (uint)value;
11945 m_host.NextOwnerMask = (uint)value;
11953 m_host.AddScriptLPS(1);
11963 return (
int)item.BasePermissions;
11965 return (
int)item.CurrentPermissions;
11967 return (
int)item.GroupPermissions;
11969 return (
int)item.EveryonePermissions;
11971 return (
int)item.NextPermissions;
11979 m_host.AddScriptLPS(1);
11981 if (m_ScriptEngine.Config.GetBoolean(
"AllowGodFunctions",
false))
11983 if (
World.Permissions.CanRunConsoleCommand(m_host.OwnerID))
11992 item.BasePermissions = (uint)value;
11995 item.CurrentPermissions = (uint)value;
11998 item.GroupPermissions = (uint)value;
12001 item.EveryonePermissions = (uint)value;
12004 item.NextPermissions = (uint)value;
12014 m_host.AddScriptLPS(1);
12020 Error(
"llGetInventoryCreator",
"Can't find item '" + item +
"'");
12022 return String.Empty;
12025 return item.CreatorID.ToString();
12030 m_host.AddScriptLPS(1);
12032 World.SimChatBroadcast(Utils.StringToBytes(msg),
ChatTypeEnum.Owner, 0,
12033 m_host.AbsolutePosition, m_host.Name, m_host.UUID,
false);
12040 m_host.AddScriptLPS(1);
12041 if (m_UrlModule != null)
12042 return m_UrlModule.RequestSecureURL(m_ScriptEngine.ScriptModule, m_host, m_item.ItemID, null).ToString();
12043 return UUID.Zero.ToString();
12052 m_host.AddScriptLPS(1);
12054 string reply = String.Empty;
12058 if (
World.RegionInfo.RegionName == simulator)
12061 info = World.GridService.GetRegionByName(m_ScriptEngine.World.RegionInfo.ScopeID, simulator);
12065 case ScriptBaseClass.DATA_SIM_POS:
12068 ScriptSleep(m_sleepMsOnRequestSimulatorData);
12069 return UUID.Zero.ToString();
12072 bool isHypergridRegion =
false;
12082 = (
RegionFlags)m_ScriptEngine.World.GridService.GetRegionFlags(
12084 isHypergridRegion = (regionFlags & RegionFlags.Hyperlink) != 0;
12087 if (isHypergridRegion)
12089 uint rx = 0, ry = 0;
12090 Utils.LongToUInts(Convert.ToUInt64(info.RegionSecret), out rx, out ry);
12106 case ScriptBaseClass.DATA_SIM_STATUS:
12112 case ScriptBaseClass.DATA_SIM_RATING:
12115 ScriptSleep(m_sleepMsOnRequestSimulatorData);
12116 return UUID.Zero.ToString();
12118 int access = info.Maturity;
12121 else if (access == 1)
12123 else if (access == 2)
12128 case ScriptBaseClass.DATA_SIM_RELEASE:
12130 ossl.CheckThreatLevel(ThreatLevel.High,
"llRequestSimulatorData");
12134 ScriptSleep(m_sleepMsOnRequestSimulatorData);
12135 return UUID.Zero.ToString();
12137 UUID rq = UUID.Random();
12139 UUID tid = AsyncCommands.
12140 DataserverPlugin.RegisterRequest(m_host.LocalId, m_item.ItemID, rq.ToString());
12143 DataserverPlugin.DataserverReply(rq.ToString(), reply);
12145 ScriptSleep(m_sleepMsOnRequestSimulatorData);
12146 return tid.ToString();
12151 return UUID.Zero.ToString();
12157 m_host.AddScriptLPS(1);
12159 if (m_UrlModule != null)
12160 return m_UrlModule.RequestURL(m_ScriptEngine.ScriptModule, m_host, m_item.ItemID, null).ToString();
12161 return UUID.Zero.ToString();
12166 m_host.AddScriptLPS(1);
12167 m_host.SetForceMouselook(mouselook != 0);
12172 m_host.AddScriptLPS(1);
12174 if (
UUID.TryParse(
id, out key))
12177 SceneObjectPart part = World.GetSceneObjectPart(
key);
12179 return part.ParentGroup.GetMass();
12183 if (avatar != null)
12185 if (avatar.IsChildAgent)
12193 return (
double)avatar.GetMass();
12216 m_host.AddScriptLPS(1);
12222 start = start+dest.Length;
12227 end = end+dest.Length;
12240 pref = dest.GetSublist(0,start-1);
12243 if (end + 1 < dest.Length)
12245 return pref + src + dest.GetSublist(end + 1, -1);
12258 else if (start == 0)
12260 if (end + 1 < dest.Length)
12261 return src + dest.GetSublist(end + 1, -1);
12267 if (end + 1 < dest.Length)
12268 return dest.GetSublist(end + 1, -1);
12281 return dest.GetSublist(end + 1, start - 1) + src;
12285 public void llLoadURL(
string avatar_id,
string message,
string url)
12287 m_host.AddScriptLPS(1);
12292 new UUID(avatar_id), m_host.Name, m_host.UUID, m_host.OwnerID,
false, message, url);
12294 ScriptSleep(m_sleepMsOnLoadURL);
12302 m_host.AddScriptLPS(1);
12306 ILandObject landObject = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
12307 if (!
World.Permissions.CanEditParcelProperties(m_host.OwnerID, landObject, GroupPowers.ChangeMedia,
false))
return;
12309 bool update =
false;
12312 LandData landData = landObject.LandData;
12313 string url = landData.MediaURL;
12314 string texture = landData.MediaID.ToString();
12315 bool autoAlign = landData.MediaAutoScale != 0;
12316 string mediaType =
"";
12317 string description =
"";
12326 for (
int i = 0; i < commandList.Data.Length; i++)
12331 case ParcelMediaCommandEnum.Agent:
12333 if ((i + 1) < commandList.Length)
12338 if (
UUID.TryParse((LSL_String)commandList.Data[i + 1], out agentID))
12340 presence = World.GetScenePresence(agentID);
12343 else Error(
"llParcelMediaCommandList",
"The argument of PARCEL_MEDIA_COMMAND_AGENT must be a key");
12348 case ParcelMediaCommandEnum.Loop:
12350 commandToSend = command;
12354 case ParcelMediaCommandEnum.Play:
12356 commandToSend = command;
12360 case ParcelMediaCommandEnum.Pause:
12361 case ParcelMediaCommandEnum.Stop:
12362 case ParcelMediaCommandEnum.Unload:
12363 commandToSend = command;
12366 case ParcelMediaCommandEnum.Url:
12367 if ((i + 1) < commandList.Length)
12374 else Error(
"llParcelMediaCommandList",
"The argument of PARCEL_MEDIA_COMMAND_URL must be a string");
12379 case ParcelMediaCommandEnum.Texture:
12380 if ((i + 1) < commandList.Length)
12384 texture = (
LSL_String)commandList.Data[i + 1];
12387 else Error(
"llParcelMediaCommandList",
"The argument of PARCEL_MEDIA_COMMAND_TEXTURE must be a string or a key");
12392 case ParcelMediaCommandEnum.Time:
12393 if ((i + 1) < commandList.Length)
12395 if (commandList.Data[i + 1] is
LSL_Float)
12397 time = (float)(LSL_Float)commandList.Data[i + 1];
12399 else Error(
"llParcelMediaCommandList",
"The argument of PARCEL_MEDIA_COMMAND_TIME must be a float");
12404 case ParcelMediaCommandEnum.AutoAlign:
12405 if ((i + 1) < commandList.Length)
12409 autoAlign = (
LSL_Integer)commandList.Data[i + 1];
12413 else Error(
"llParcelMediaCommandList",
"The argument of PARCEL_MEDIA_COMMAND_AUTO_ALIGN must be an integer");
12418 case ParcelMediaCommandEnum.Type:
12419 if ((i + 1) < commandList.Length)
12423 mediaType = (
LSL_String)commandList.Data[i + 1];
12426 else Error(
"llParcelMediaCommandList",
"The argument of PARCEL_MEDIA_COMMAND_TYPE must be a string");
12431 case ParcelMediaCommandEnum.Desc:
12432 if ((i + 1) < commandList.Length)
12436 description = (
LSL_String)commandList.Data[i + 1];
12439 else Error(
"llParcelMediaCommandList",
"The argument of PARCEL_MEDIA_COMMAND_DESC must be a string");
12444 case ParcelMediaCommandEnum.Size:
12445 if ((i + 2) < commandList.Length)
12449 if (commandList.Data[i + 2] is LSL_Integer)
12452 height = (LSL_Integer)commandList.Data[i + 2];
12455 else Error(
"llParcelMediaCommandList",
"The second argument of PARCEL_MEDIA_COMMAND_SIZE must be an integer");
12457 else Error(
"llParcelMediaCommandList",
"The first argument of PARCEL_MEDIA_COMMAND_SIZE must be an integer");
12463 NotImplemented(
"llParcelMediaCommandList",
"Parameter not supported yet: " + Enum.Parse(typeof(
ParcelMediaCommandEnum), commandList.Data[i].ToString()).ToString());
12474 if (presence == null)
12477 landData.MediaID =
new UUID(texture);
12478 landData.MediaAutoScale = autoAlign ? (byte)1 : (byte)0;
12479 landData.MediaWidth = width;
12480 landData.MediaHeight = height;
12481 landData.MediaType = mediaType;
12484 landObject.SetMediaUrl(url);
12491 sp.ControllingClient.SendParcelMediaUpdate(landData.MediaURL,
12493 landData.MediaAutoScale,
12504 presence.ControllingClient.SendParcelMediaUpdate(url,
12506 autoAlign ? (byte)1 : (byte)0,
12514 if (commandToSend != null)
12517 if (presence == null)
12524 sp.ControllingClient.SendParcelMediaCommand(0x4,
12531 presence.ControllingClient.SendParcelMediaCommand(0x4,
12535 ScriptSleep(m_sleepMsOnParcelMediaCommandList);
12540 m_host.AddScriptLPS(1);
12544 for (
int i = 0; i < aList.Data.Length; i++)
12547 if (aList.Data[i] != null)
12551 case ParcelMediaCommandEnum.Url:
12552 list.Add(
new LSL_String(
World.GetLandData(m_host.AbsolutePosition).MediaURL));
12554 case ParcelMediaCommandEnum.Desc:
12555 list.Add(
new LSL_String(
World.GetLandData(m_host.AbsolutePosition).Description));
12557 case ParcelMediaCommandEnum.Texture:
12558 list.Add(
new LSL_String(
World.GetLandData(m_host.AbsolutePosition).MediaID.ToString()));
12560 case ParcelMediaCommandEnum.Type:
12561 list.Add(
new LSL_String(
World.GetLandData(m_host.AbsolutePosition).MediaType));
12563 case ParcelMediaCommandEnum.Size:
12564 list.Add(
new LSL_String(
World.GetLandData(m_host.AbsolutePosition).MediaWidth));
12565 list.Add(
new LSL_String(
World.GetLandData(m_host.AbsolutePosition).MediaHeight));
12569 NotImplemented(
"llParcelMediaQuery",
"Parameter not supported yet: " + Enum.Parse(mediaCommandEnum.GetType() , aList.Data[i].ToString()).ToString());
12575 ScriptSleep(m_sleepMsOnParcelMediaQuery);
12581 m_host.AddScriptLPS(1);
12583 Math.DivRem(Convert.ToInt64(Math.Pow(a, b)), c, out tmp);
12584 ScriptSleep(m_sleepMsOnModPow);
12585 return Convert.ToInt32(tmp);
12590 m_host.AddScriptLPS(1);
12602 m_host.AddScriptLPS(1);
12604 if (quick_pay_buttons.Data.Length < 4)
12607 for (x=quick_pay_buttons.Data.Length; x<= 4; x++)
12609 quick_pay_buttons.Add(ScriptBaseClass.PAY_HIDE);
12612 int[] nPrice =
new int[5];
12614 nPrice[1] = quick_pay_buttons.GetLSLIntegerItem(0);
12615 nPrice[2] = quick_pay_buttons.GetLSLIntegerItem(1);
12616 nPrice[3] = quick_pay_buttons.GetLSLIntegerItem(2);
12617 nPrice[4] = quick_pay_buttons.GetLSLIntegerItem(3);
12618 m_host.ParentGroup.RootPart.PayPrice = nPrice;
12619 m_host.ParentGroup.HasGroupChanged =
true;
12624 m_host.AddScriptLPS(1);
12626 if (m_item.PermsGranter ==
UUID.Zero)
12627 return Vector3.Zero;
12631 Error(
"llGetCameraPos",
"No permissions to track the camera");
12632 return Vector3.Zero;
12636 ScenePresence presence = World.GetScenePresence(m_item.PermsGranter);
12637 if (presence != null)
12643 return Vector3.Zero;
12648 m_host.AddScriptLPS(1);
12650 if (m_item.PermsGranter ==
UUID.Zero)
12651 return Quaternion.Identity;
12655 Error(
"llGetCameraRot",
"No permissions to track the camera");
12656 return Quaternion.Identity;
12660 ScenePresence presence = World.GetScenePresence(m_item.PermsGranter);
12661 if (presence != null)
12666 return Quaternion.Identity;
12671 m_host.AddScriptLPS(1);
12672 Deprecated(
"llSetPrimURL",
"Use llSetPrimMediaParams instead");
12673 ScriptSleep(m_sleepMsOnSetPrimURL);
12678 m_host.AddScriptLPS(1);
12679 Deprecated(
"llRefreshPrimURL");
12680 ScriptSleep(m_sleepMsOnRefreshPrimURL);
12685 m_host.AddScriptLPS(1);
12688 return Uri.EscapeDataString(url);
12690 catch (Exception ex)
12692 return "llEscapeURL: " + ex.ToString();
12698 m_host.AddScriptLPS(1);
12701 return Uri.UnescapeDataString(url);
12703 catch (Exception ex)
12705 return "llUnescapeURL: " + ex.ToString();
12711 m_host.AddScriptLPS(1);
12712 DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, 0);
12713 if (detectedParams == null)
12715 if (m_host.ParentGroup.IsAttachment ==
true)
12718 detectedParams.Key = m_host.OwnerID;
12726 ScenePresence avatar = World.GetScenePresence(detectedParams.Key);
12727 if (avatar != null)
12729 avatar.ControllingClient.SendScriptTeleportRequest(m_host.Name,
12730 simname, pos, lookAt);
12732 ScriptSleep(m_sleepMsOnMapDestination);
12737 m_host.AddScriptLPS(1);
12739 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
12740 if (
World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned,
false))
12744 expires = Util.UnixTimeSinceEpoch() + (
int)(3600.0 * hours);
12746 if (
UUID.TryParse(avatar, out key))
12748 int idx = land.LandData.ParcelAccessList.FindIndex(
12760 land.LandData.ParcelAccessList.RemoveAt(idx);
12764 entry.AgentID =
key;
12765 entry.Flags = AccessList.Ban;
12766 entry.Expires = expires;
12768 land.LandData.ParcelAccessList.Add(entry);
12770 World.EventManager.TriggerLandObjectUpdated((uint)land.
LandData.
LocalID, land);
12773 ScriptSleep(m_sleepMsOnAddToLandBanList);
12778 m_host.AddScriptLPS(1);
12780 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
12781 if (
World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageAllowed,
false))
12783 if (
UUID.TryParse(avatar, out key))
12785 int idx = land.LandData.ParcelAccessList.FindIndex(
12795 land.LandData.ParcelAccessList.RemoveAt(idx);
12796 World.EventManager.TriggerLandObjectUpdated((uint)land.
LandData.
LocalID, land);
12800 ScriptSleep(m_sleepMsOnRemoveFromLandPassList);
12805 m_host.AddScriptLPS(1);
12807 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
12808 if (
World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned,
false))
12810 if (
UUID.TryParse(avatar, out key))
12812 int idx = land.LandData.ParcelAccessList.FindIndex(
12822 land.LandData.ParcelAccessList.RemoveAt(idx);
12823 World.EventManager.TriggerLandObjectUpdated((uint)land.
LandData.
LocalID, land);
12827 ScriptSleep(m_sleepMsOnRemoveFromLandBanList);
12832 m_host.AddScriptLPS(1);
12835 UUID objectID = m_host.ParentUUID;
12836 if (objectID ==
UUID.Zero)
12840 UUID agentID = m_item.PermsGranter;
12842 if (agentID ==
UUID.Zero)
12853 SortedDictionary<int, float> parameters =
new SortedDictionary<int, float>();
12854 object[] data = rules.Data;
12855 for (
int i = 0; i < data.Length; ++i)
12860 type = Convert.ToInt32(data[i++].ToString());
12864 Error(
"llSetCameraParams",
string.Format(
"Invalid camera param type {0}", data[i - 1]));
12867 if (i >= data.Length)
break;
12872 case ScriptBaseClass.CAMERA_FOCUS:
12873 case ScriptBaseClass.CAMERA_FOCUS_OFFSET:
12874 case ScriptBaseClass.CAMERA_POSITION:
12878 parameters.Add(type + 1, (float)v.x);
12884 case ScriptBaseClass.CAMERA_FOCUS:
12885 Error(
"llSetCameraParams",
"CAMERA_FOCUS: Parameter x is invalid");
12887 case ScriptBaseClass.CAMERA_FOCUS_OFFSET:
12888 Error(
"llSetCameraParams",
"CAMERA_FOCUS_OFFSET: Parameter x is invalid");
12890 case ScriptBaseClass.CAMERA_POSITION:
12891 Error(
"llSetCameraParams",
"CAMERA_POSITION: Parameter x is invalid");
12897 parameters.Add(type + 2, (float)v.y);
12903 case ScriptBaseClass.CAMERA_FOCUS:
12904 Error(
"llSetCameraParams",
"CAMERA_FOCUS: Parameter y is invalid");
12906 case ScriptBaseClass.CAMERA_FOCUS_OFFSET:
12907 Error(
"llSetCameraParams",
"CAMERA_FOCUS_OFFSET: Parameter y is invalid");
12909 case ScriptBaseClass.CAMERA_POSITION:
12910 Error(
"llSetCameraParams",
"CAMERA_POSITION: Parameter y is invalid");
12916 parameters.Add(type + 3, (float)v.z);
12922 case ScriptBaseClass.CAMERA_FOCUS:
12923 Error(
"llSetCameraParams",
"CAMERA_FOCUS: Parameter z is invalid");
12925 case ScriptBaseClass.CAMERA_FOCUS_OFFSET:
12926 Error(
"llSetCameraParams",
"CAMERA_FOCUS_OFFSET: Parameter z is invalid");
12928 case ScriptBaseClass.CAMERA_POSITION:
12929 Error(
"llSetCameraParams",
"CAMERA_POSITION: Parameter z is invalid");
12937 parameters.Add(type, (float)((LSL_Float)data[i]).value);
12939 parameters.Add(type, (float)((LSL_Integer)data[i]).value);
12944 parameters.Add(type, Convert.ToSingle(data[i]));
12948 Error(
"llSetCameraParams",
string.Format(
"{0}: Parameter is invalid", type));
12954 if (parameters.Count > 0) presence.ControllingClient.SendSetFollowCamProperties(objectID, parameters);
12959 m_host.AddScriptLPS(1);
12962 UUID objectID = m_host.ParentUUID;
12963 if (objectID ==
UUID.Zero)
12967 UUID agentID = m_item.PermsGranter;
12969 if (agentID ==
UUID.Zero)
12981 presence.ControllingClient.SendClearFollowCamProperties(objectID);
12986 m_host.AddScriptLPS(1);
12989 case ScriptBaseClass.LIST_STAT_RANGE:
12990 return src.Range();
12991 case ScriptBaseClass.LIST_STAT_MIN:
12993 case ScriptBaseClass.LIST_STAT_MAX:
12995 case ScriptBaseClass.LIST_STAT_MEAN:
12997 case ScriptBaseClass.LIST_STAT_MEDIAN:
12998 return LSL_List.ToDoubleList(src).Median();
12999 case ScriptBaseClass.LIST_STAT_NUM_COUNT:
13000 return src.NumericLength();
13001 case ScriptBaseClass.LIST_STAT_STD_DEV:
13002 return src.StdDev();
13003 case ScriptBaseClass.LIST_STAT_SUM:
13005 case ScriptBaseClass.LIST_STAT_SUM_SQUARES:
13006 return src.SumSqrs();
13007 case ScriptBaseClass.LIST_STAT_GEOMETRIC_MEAN:
13008 return src.GeometricMean();
13009 case ScriptBaseClass.LIST_STAT_HARMONIC_MEAN:
13010 return src.HarmonicMean();
13018 m_host.AddScriptLPS(1);
13019 return Util.UnixTimeSinceEpoch();
13024 m_host.AddScriptLPS(1);
13025 return (
int)World.LandChannel.GetLandObject((float)pos.x, (
float)pos.y).
LandData.
Flags;
13030 m_host.AddScriptLPS(1);
13032 if (estate == null)
13034 return (
int)estate.GetRegionFlags();
13039 m_host.AddScriptLPS(1);
13041 if (str1 ==
String.Empty)
13042 return String.Empty;
13043 if (str2 ==
String.Empty)
13046 int len = str2.Length;
13047 if ((len % 4) != 0)
13049 while (str2.EndsWith(
"="))
13050 str2 = str2.Substring(0, str2.Length - 1);
13056 str2 = str2.Substring(0, str2.Length - 1);
13067 data1 = Convert.FromBase64String(str1);
13068 data2 = Convert.FromBase64String(str2);
13075 byte[] d2 =
new Byte[data1.Length];
13078 if (data1.Length <= data2.Length)
13080 Array.Copy(data2, 0, d2, 0, data1.Length);
13084 while (pos < data1.Length)
13086 len = data1.Length - pos;
13087 if (len > data2.Length)
13088 len = data2.Length;
13090 Array.Copy(data2, 0, d2, pos, len);
13095 for (pos = 0 ; pos < data1.Length ; pos++ )
13096 data1[pos] ^= d2[pos];
13098 return Convert.ToBase64String(data1);
13108 m_host.AddScriptLPS(1);
13111 List<string> param =
new List<string>();
13115 for (
int i = 0; i < parameters.Data.Length; i += 2)
13117 ok = Int32.TryParse(parameters.Data[i].ToString(), out flag);
13118 if (!ok || flag < 0 ||
13121 Error(
"llHTTPRequest",
"Parameter " + i.ToString() +
" is an invalid flag");
13124 param.Add(parameters.Data[i].ToString());
13128 param.Add(parameters.Data[i+1].ToString());
13138 for (
int count = 1; count <= 8; ++count)
13141 if (parameters.Data.Length - i < 2)
13145 Error(
"llHTTPRequest",
"Missing name/value for custom header at parameter " + i.ToString());
13149 if (HttpStandardHeaders.Contains(parameters.Data[i].ToString(), StringComparer.OrdinalIgnoreCase))
13150 Error(
"llHTTPRequest",
"Name is invalid as a custom header at parameter " + i.ToString());
13152 param.Add(parameters.Data[i].ToString());
13153 param.Add(parameters.Data[i+1].ToString());
13157 if (i+2 >= parameters.Data.Length ||
13158 Char.IsDigit(parameters.Data[i].ToString()[0]))
13168 Vector3 position = m_host.AbsolutePosition;
13169 Vector3 velocity = m_host.Velocity;
13170 Quaternion
rotation = m_host.RotationOffset;
13171 string ownerName = String.Empty;
13172 ScenePresence scenePresence = World.GetScenePresence(m_host.OwnerID);
13173 if (scenePresence == null)
13174 ownerName = resolveName(m_host.OwnerID);
13176 ownerName = scenePresence.Name;
13180 Dictionary<string, string> httpHeaders =
new Dictionary<string, string>();
13182 string shard =
"OpenSim";
13183 IConfigSource config = m_ScriptEngine.ConfigSource;
13184 if (config.Configs[
"Network"] != null)
13186 shard = config.Configs[
"Network"].GetString(
"shard", shard);
13189 httpHeaders[
"X-SecondLife-Shard"] = shard;
13190 httpHeaders[
"X-SecondLife-Object-Name"] = m_host.Name;
13191 httpHeaders[
"X-SecondLife-Object-Key"] = m_host.UUID.ToString();
13192 httpHeaders[
"X-SecondLife-Region"] = string.Format(
"{0} ({1}, {2})", regionInfo.RegionName, regionInfo.RegionLocX, regionInfo.RegionLocY);
13193 httpHeaders[
"X-SecondLife-Local-Position"] = string.Format(
"({0:0.000000}, {1:0.000000}, {2:0.000000})", position.X, position.Y, position.Z);
13194 httpHeaders[
"X-SecondLife-Local-Velocity"] = string.Format(
"({0:0.000000}, {1:0.000000}, {2:0.000000})", velocity.X, velocity.Y, velocity.Z);
13195 httpHeaders[
"X-SecondLife-Local-Rotation"] = string.Format(
"({0:0.000000}, {1:0.000000}, {2:0.000000}, {3:0.000000})", rotation.X, rotation.Y, rotation.Z, rotation.W);
13196 httpHeaders[
"X-SecondLife-Owner-Name"] = ownerName;
13197 httpHeaders[
"X-SecondLife-Owner-Key"] = m_host.OwnerID.ToString();
13198 string userAgent = config.Configs[
"Network"].GetString(
"user_agent", null);
13199 if (userAgent != null)
13200 httpHeaders[
"User-Agent"] = userAgent;
13203 string[] urlParts = url.Split(
new char[] {
'\n'});
13204 if (urlParts.Length > 1)
13207 for (
int i = 1 ; i < urlParts.Length ; i++ )
13211 if (urlParts[i] ==
String.Empty)
13215 string[] headerParts = urlParts[i].Split(
new char[] {
':'}, 2);
13216 if (headerParts.Length != 2)
13219 string headerName = headerParts[0].Trim();
13220 string headerValue = headerParts[1].Trim();
13224 if (headerName.ToLower() ==
"x-secondlife-shard" ||
13225 headerName.ToLower() ==
"x-secondlife-object-name" ||
13226 headerName.ToLower() ==
"x-secondlife-object-key" ||
13227 headerName.ToLower() ==
"x-secondlife-region" ||
13228 headerName.ToLower() ==
"x-secondlife-local-position" ||
13229 headerName.ToLower() ==
"x-secondlife-local-velocity" ||
13230 headerName.ToLower() ==
"x-secondlife-local-rotation" ||
13231 headerName.ToLower() ==
"x-secondlife-owner-name" ||
13232 headerName.ToLower() ==
"x-secondlife-owner-key" ||
13233 headerName.ToLower() ==
"connection" ||
13234 headerName.ToLower() ==
"content-length" ||
13235 headerName.ToLower() ==
"from" ||
13236 headerName.ToLower() ==
"host" ||
13237 headerName.ToLower() ==
"proxy-authorization" ||
13238 headerName.ToLower() ==
"referer" ||
13239 headerName.ToLower() ==
"trailer" ||
13240 headerName.ToLower() ==
"transfer-encoding" ||
13241 headerName.ToLower() ==
"via" ||
13242 headerName.ToLower() ==
"authorization")
13245 httpHeaders[headerName] = headerValue;
13249 url = urlParts[0].Trim();
13250 int idx = url.IndexOf(
" HTTP/");
13252 url = url.Substring(0, idx);
13255 string authregex =
@"^(https?:\/\/)(\w+):(\w+)@(.*)$";
13256 Regex r =
new Regex(authregex);
13257 int[] gnums = r.GetGroupNumbers();
13258 Match m = r.Match(url);
13261 for (
int i = 1; i < gnums.Length; i++)
13266 if (m.Groups.Count == 5)
13268 httpHeaders[
"Authorization"] = String.Format(
"Basic {0}", Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes(m.Groups[2].ToString() +
":" + m.Groups[3].ToString())));
13269 url = m.Groups[1].ToString() + m.Groups[4].ToString();
13275 = httpScriptMod.StartHttpRequest(m_host.LocalId, m_item.ItemID, url, param, httpHeaders, body, out status);
13278 Error(
"llHttpRequest",
string.Format(
"Request to {0} disallowed by filter", url));
13280 if (reqID !=
UUID.Zero)
13281 return reqID.ToString();
13292 m_host.AddScriptLPS(1);
13294 if (m_UrlModule != null)
13295 m_UrlModule.HttpResponse(
new UUID(
id), status,body);
13300 m_host.AddScriptLPS(1);
13302 if (land.OwnerID == m_host.OwnerID)
13306 if (entry.
Flags == AccessList.Ban)
13308 land.ParcelAccessList.Remove(entry);
13312 ScriptSleep(m_sleepMsOnResetLandBanList);
13317 m_host.AddScriptLPS(1);
13319 if (land.OwnerID == m_host.OwnerID)
13323 if (entry.
Flags == AccessList.Access)
13325 land.ParcelAccessList.Remove(entry);
13329 ScriptSleep(m_sleepMsOnResetLandPassList);
13334 m_host.AddScriptLPS(1);
13336 ILandObject lo = World.LandChannel.GetLandObject((float)pos.x, (
float)pos.y);
13347 return pc.Simulator;
13366 return pc.Selected;
13376 m_host.AddScriptLPS(1);
13381 foreach (KeyValuePair<UUID, int> detectedParams
in land.GetLandObjectOwners())
13383 ret.Add(
new LSL_String(detectedParams.Key.ToString()));
13387 ScriptSleep(m_sleepMsOnGetParcelPrimOwners);
13393 m_host.AddScriptLPS(1);
13394 SceneObjectPart part = World.GetSceneObjectPart(
new UUID(object_id));
13401 return part.ParentGroup.PrimCount;
13407 m_host.AddScriptLPS(1);
13409 ILandObject lo = World.LandChannel.GetLandObject((float)pos.x, (
float)pos.y);
13415 return lo.GetSimulatorMaxPrimCount();
13417 return lo.GetParcelMaxPrimCount();
13422 m_host.AddScriptLPS(1);
13429 foreach (
object o
in param.Data)
13431 switch (o.ToString())
13461 m_host.AddScriptLPS(1);
13462 if (type == (
int)ScriptBaseClass.STRING_TRIM_HEAD) {
return src.TrimStart(); }
13463 if (type == (
int)ScriptBaseClass.STRING_TRIM_TAIL) {
return src.TrimEnd(); }
13464 if (type == (
int)ScriptBaseClass.STRING_TRIM) {
return src.Trim(); }
13470 m_host.AddScriptLPS(1);
13476 if (
UUID.TryParse(
id, out key))
13482 foreach (
object o
in args.Data)
13484 switch (
int.Parse(o.ToString()))
13486 case ScriptBaseClass.OBJECT_NAME:
13489 case ScriptBaseClass.OBJECT_DESC:
13492 case ScriptBaseClass.OBJECT_POS:
13498 avpos = av.OffsetPosition;
13503 avpos -= sitOffset;
13506 SceneObjectPart sitRoot = av.ParentPart.ParentGroup.RootPart;
13510 avpos = av.AbsolutePosition;
13512 ret.Add(
new LSL_Vector((
double)avpos.X, (
double)avpos.Y, (
double)avpos.Z));
13514 case ScriptBaseClass.OBJECT_ROT:
13515 Quaternion avrot = av.GetWorldRotation();
13518 case ScriptBaseClass.OBJECT_VELOCITY:
13519 Vector3 avvel = av.GetWorldVelocity();
13520 ret.Add(
new LSL_Vector((
double)avvel.X, (
double)avvel.Y, (
double)avvel.Z));
13522 case ScriptBaseClass.OBJECT_OWNER:
13525 case ScriptBaseClass.OBJECT_GROUP:
13528 case ScriptBaseClass.OBJECT_CREATOR:
13532 case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT:
13535 case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT:
13538 case ScriptBaseClass.OBJECT_SCRIPT_MEMORY:
13541 case ScriptBaseClass.OBJECT_SCRIPT_TIME:
13544 case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE:
13547 case ScriptBaseClass.OBJECT_SERVER_COST:
13550 case ScriptBaseClass.OBJECT_STREAMING_COST:
13553 case ScriptBaseClass.OBJECT_PHYSICS_COST:
13556 case ScriptBaseClass.OBJECT_CHARACTER_TIME:
13559 case ScriptBaseClass.OBJECT_ROOT:
13560 SceneObjectPart p = av.ParentPart;
13570 case ScriptBaseClass.OBJECT_ATTACHED_POINT:
13573 case ScriptBaseClass.OBJECT_PATHFINDING_TYPE:
13576 case ScriptBaseClass.OBJECT_PHYSICS:
13579 case ScriptBaseClass.OBJECT_PHANTOM:
13582 case ScriptBaseClass.OBJECT_TEMP_ON_REZ:
13585 case ScriptBaseClass.OBJECT_RENDER_WEIGHT:
13588 case ScriptBaseClass.OBJECT_HOVER_HEIGHT:
13591 case ScriptBaseClass.OBJECT_BODY_SHAPE_TYPE:
13597 ret.Add(shapeType);
13599 case ScriptBaseClass.OBJECT_LAST_OWNER_ID:
13612 SceneObjectPart obj = World.GetSceneObjectPart(
key);
13615 foreach (
object o
in args.Data)
13617 switch (
int.Parse(o.ToString()))
13619 case ScriptBaseClass.OBJECT_NAME:
13622 case ScriptBaseClass.OBJECT_DESC:
13625 case ScriptBaseClass.OBJECT_POS:
13626 Vector3 opos = obj.AbsolutePosition;
13627 ret.Add(
new LSL_Vector(opos.X, opos.Y, opos.Z));
13629 case ScriptBaseClass.OBJECT_ROT:
13630 Quaternion rot = Quaternion.Identity;
13634 ScenePresence sp = World.GetScenePresence(obj.ParentGroup.AttachedAvatar);
13637 rot = sp.GetWorldRotation();
13642 rot = obj.ParentGroup.GroupRotation;
13644 rot = obj.GetWorldRotation();
13651 case ScriptBaseClass.OBJECT_VELOCITY:
13652 Vector3 vel = Vector3.Zero;
13656 ScenePresence sp = World.GetScenePresence(obj.ParentGroup.AttachedAvatar);
13659 vel = sp.GetWorldVelocity();
13663 vel = obj.Velocity;
13668 case ScriptBaseClass.OBJECT_OWNER:
13671 case ScriptBaseClass.OBJECT_GROUP:
13674 case ScriptBaseClass.OBJECT_CREATOR:
13677 case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT:
13680 case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT:
13683 case ScriptBaseClass.OBJECT_SCRIPT_MEMORY:
13689 case ScriptBaseClass.OBJECT_SCRIPT_TIME:
13693 case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE:
13702 case ScriptBaseClass.OBJECT_SERVER_COST:
13708 case ScriptBaseClass.OBJECT_STREAMING_COST:
13712 case ScriptBaseClass.OBJECT_PHYSICS_COST:
13716 case ScriptBaseClass.OBJECT_CHARACTER_TIME:
13719 case ScriptBaseClass.OBJECT_ROOT:
13722 case ScriptBaseClass.OBJECT_ATTACHED_POINT:
13725 case ScriptBaseClass.OBJECT_PATHFINDING_TYPE:
13726 byte pcode = obj.Shape.PCode;
13728 || pcode == (byte)PCode.Grass
13729 || pcode == (byte)PCode.Tree
13730 || pcode == (byte)PCode.NewTree)
13739 case ScriptBaseClass.OBJECT_PHYSICS:
13749 case ScriptBaseClass.OBJECT_PHANTOM:
13759 case ScriptBaseClass.OBJECT_TEMP_ON_REZ:
13762 case ScriptBaseClass.OBJECT_RENDER_WEIGHT:
13765 case ScriptBaseClass.OBJECT_HOVER_HEIGHT:
13768 case ScriptBaseClass.OBJECT_BODY_SHAPE_TYPE:
13771 case ScriptBaseClass.OBJECT_LAST_OWNER_ID:
13788 internal UUID GetScriptByName(
string name)
13792 if (item == null || item.
Type != 10)
13795 return item.ItemID;
13803 internal void Error(
string command,
string message)
13805 string text = command +
": " + message;
13806 if (text.Length > 1023)
13808 text = text.Substring(0, 1023);
13812 m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID,
false);
13817 wComm.DeliverMessage(ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.Name, m_host.UUID, text);
13826 internal void NotImplemented(
string command,
string message =
"")
13828 if (throwErrorOnNotImplemented)
13832 message =
" - " + message;
13835 throw new NotImplementedException(
"Command not implemented: " + command + message);
13839 string text =
"Command not implemented";
13842 text = text +
" - " + message;
13845 Error(command, text);
13854 internal void Deprecated(
string command,
string message =
"")
13856 string text =
"Command deprecated";
13859 text = text +
" - " + message;
13862 Error(command, text);
13865 public delegate
void AssetRequestCallback(UUID assetID,
AssetBase asset);
13868 World.AssetService.Get(assetID.ToString(),
this,
13869 delegate(
string i,
object sender,
AssetBase a)
13871 UUID uuid = UUID.Zero;
13872 UUID.TryParse(i, out uuid);
13879 m_host.AddScriptLPS(1);
13881 UUID assetID = UUID.Zero;
13883 if (!
UUID.TryParse(name, out assetID))
13887 if (item != null && item.
Type == 7)
13888 assetID = item.AssetID;
13891 if (assetID ==
UUID.Zero)
13894 Error(
"llGetNumberOfNotecardLines",
"Can't find notecard '" + name +
"'");
13896 return UUID.Zero.ToString();
13899 string reqIdentifier = UUID.Random().ToString();
13902 UUID tid = AsyncCommands.DataserverPlugin.RegisterRequest(m_host.LocalId, m_item.ItemID, reqIdentifier);
13906 AsyncCommands.DataserverPlugin.DataserverReply(reqIdentifier, NotecardCache.GetLines(assetID).ToString());
13908 ScriptSleep(m_sleepMsOnGetNumberOfNotecardLines);
13909 return tid.ToString();
13914 if (a == null || a.
Type != 7)
13916 Error(
"llGetNumberOfNotecardLines",
"Can't find notecard '" + name +
"'");
13920 NotecardCache.Cache(id, a.Data);
13921 AsyncCommands.DataserverPlugin.DataserverReply(reqIdentifier, NotecardCache.GetLines(id).ToString());
13924 ScriptSleep(m_sleepMsOnGetNumberOfNotecardLines);
13925 return tid.ToString();
13930 m_host.AddScriptLPS(1);
13932 UUID assetID = UUID.Zero;
13934 if (!
UUID.TryParse(name, out assetID))
13938 if (item != null && item.
Type == 7)
13939 assetID = item.AssetID;
13942 if (assetID ==
UUID.Zero)
13945 Error(
"llGetNotecardLine",
"Can't find notecard '" + name +
"'");
13947 return UUID.Zero.ToString();
13950 string reqIdentifier = UUID.Random().ToString();
13953 UUID tid = AsyncCommands.DataserverPlugin.RegisterRequest(m_host.LocalId, m_item.ItemID, reqIdentifier);
13957 AsyncCommands.DataserverPlugin.DataserverReply(
13958 reqIdentifier, NotecardCache.GetLine(assetID, line, m_notecardLineReadCharsMax));
13960 ScriptSleep(m_sleepMsOnGetNotecardLine);
13961 return tid.ToString();
13966 if (a == null || a.
Type != 7)
13968 Error(
"llGetNotecardLine",
"Can't find notecard '" + name +
"'");
13972 string data = Encoding.UTF8.GetString(a.Data);
13974 NotecardCache.Cache(id, a.Data);
13975 AsyncCommands.DataserverPlugin.DataserverReply(
13976 reqIdentifier, NotecardCache.GetLine(assetID, line, m_notecardLineReadCharsMax));
13979 ScriptSleep(m_sleepMsOnGetNotecardLine);
13980 return tid.ToString();
13985 SceneObjectPart obj = World.GetSceneObjectPart(
new UUID(prim));
13989 if (obj.
OwnerID != m_host.OwnerID)
13992 SetEntityParams(
new List<ISceneEntity>() { obj }, rules, originFunc);
13997 SceneObjectPart obj = World.GetSceneObjectPart(
new UUID(prim));
14001 if (obj != null && obj.
OwnerID == m_host.OwnerID)
14003 LSL_List remaining = GetPrimParams(obj, rules, ref result);
14005 while (remaining.Length > 2)
14007 int linknumber = remaining.GetLSLIntegerItem(0);
14008 rules = remaining.GetSublist(1, -1);
14009 List<SceneObjectPart> parts = GetLinkParts(linknumber);
14011 foreach (SceneObjectPart part
in parts)
14012 remaining = GetPrimParams(part, rules, ref result);
14025 ossl.CheckThreatLevel(ThreatLevel.High,
"print");
14026 m_log.Info(
"LSL print():" + str);
14032 List<SceneObjectPart> parts = GetLinkParts(link);
14033 if (parts.Count < 1)
14036 return GetNumberOfSides(parts[0]);
14039 private string Name2Username(
string name)
14041 string[] parts = name.Split(
new char[] {
' '});
14042 if (parts.Length < 2)
14043 return name.ToLower();
14044 if (parts[1] ==
"Resident")
14045 return parts[0].ToLower();
14047 return name.Replace(
" ",
".").ToLower();
14052 return Name2Username(llKey2Name(
id));
14057 UUID rq = UUID.Random();
14059 AsyncCommands.DataserverPlugin.RegisterRequest(m_host.LocalId, m_item.ItemID, rq.ToString());
14061 AsyncCommands.DataserverPlugin.DataserverReply(rq.ToString(), Name2Username(llKey2Name(
id)));
14063 return rq.ToString();
14068 return llKey2Name(
id);
14073 UUID rq = UUID.Random();
14075 AsyncCommands.DataserverPlugin.RegisterRequest(m_host.LocalId, m_item.ItemID, rq.ToString());
14077 AsyncCommands.DataserverPlugin.DataserverReply(rq.ToString(), llKey2Name(
id));
14079 return rq.ToString();
14094 private bool InBoundingBox(
ScenePresence avatar, Vector3 point)
14096 float height = avatar.Appearance.AvatarHeight;
14097 Vector3 b1 = avatar.AbsolutePosition +
new Vector3(-0.22f, -0.22f, -height/2);
14098 Vector3 b2 = avatar.AbsolutePosition +
new Vector3(0.22f, 0.22f, height/2);
14100 if (point.X > b1.X && point.X < b2.X &&
14101 point.Y > b1.Y && point.Y < b2.Y &&
14102 point.Z > b1.Z && point.Z < b2.Z)
14107 private ContactResult[] AvatarIntersection(Vector3 rayStart, Vector3 rayEnd)
14109 List<ContactResult> contacts =
new List<ContactResult>();
14111 Vector3 ab = rayEnd - rayStart;
14115 Vector3 ac = sp.AbsolutePosition - rayStart;
14118 double d = Math.Abs(Vector3.Mag(Vector3.Cross(ab, ac)) / Vector3.Distance(rayStart, rayEnd));
14123 double d2 = Vector3.Dot(Vector3.Negate(ab), ac);
14128 double dp = Math.Sqrt(Vector3.Mag(ac) * Vector3.Mag(ac) - d * d);
14129 Vector3 p = rayStart + Vector3.Divide(Vector3.Multiply(ab, (float)dp), (float)Vector3.Mag(ab));
14131 if (!InBoundingBox(sp, p))
14135 result.ConsumerID = sp.LocalId;
14136 result.Depth = Vector3.Distance(rayStart, p);
14137 result.Normal = Vector3.Zero;
14140 contacts.Add(result);
14143 return contacts.ToArray();
14146 private ContactResult[] ObjectIntersection(Vector3 rayStart, Vector3 rayEnd,
bool includePhysical,
bool includeNonPhysical,
bool includePhantom)
14148 Ray ray =
new Ray(rayStart, Vector3.Normalize(rayEnd - rayStart));
14149 List<ContactResult> contacts =
new List<ContactResult>();
14151 Vector3 ab = rayEnd - rayStart;
14155 if (m_host.ParentGroup == group)
14163 if (!includePhantom)
14170 if (!includePhysical)
14175 if (!includeNonPhysical)
14188 float radius = 0.0f;
14190 group.GetAxisAlignedBoundingBoxRaw(out minX, out maxX, out minY, out maxY, out minZ, out maxZ);
14192 if (Math.Abs(minX) > radius)
14193 radius = Math.Abs(minX);
14194 if (Math.Abs(minY) > radius)
14195 radius = Math.Abs(minY);
14196 if (Math.Abs(minZ) > radius)
14197 radius = Math.Abs(minZ);
14198 if (Math.Abs(maxX) > radius)
14199 radius = Math.Abs(maxX);
14200 if (Math.Abs(maxY) > radius)
14201 radius = Math.Abs(maxY);
14202 if (Math.Abs(maxZ) > radius)
14203 radius = Math.Abs(maxZ);
14204 radius = radius*1.413f;
14205 Vector3 ac = group.AbsolutePosition - rayStart;
14208 double d = Math.Abs(Vector3.Mag(Vector3.Cross(ab, ac)) / Vector3.Distance(rayStart, rayEnd));
14215 double d2 = Vector3.Dot(Vector3.Negate(ab), ac);
14219 ray =
new Ray(rayStart, Vector3.Normalize(rayEnd - rayStart));
14222 if (!intersection.HitTF)
14225 Vector3 b1 = group.AbsolutePosition +
new Vector3(minX, minY, minZ);
14226 Vector3 b2 = group.AbsolutePosition +
new Vector3(maxX, maxY, maxZ);
14228 if (!(intersection.ipoint.X >= b1.X && intersection.ipoint.X <= b2.X &&
14229 intersection.ipoint.Y >= b1.Y && intersection.ipoint.Y <= b2.Y &&
14230 intersection.ipoint.Z >= b1.Z && intersection.ipoint.Z <= b2.Z))
14234 result.ConsumerID = group.LocalId;
14236 result.Normal = intersection.normal;
14237 result.Pos = intersection.ipoint;
14238 result.Depth = Vector3.Mag(rayStart - result.Pos);
14240 contacts.Add(result);
14243 return contacts.ToArray();
14246 private ContactResult? GroundIntersection(Vector3 rayStart, Vector3 rayEnd)
14248 double[,] heightfield = World.Heightmap.GetDoubles();
14249 List<ContactResult> contacts =
new List<ContactResult>();
14251 double min = 2048.0;
14255 for (
int x = 0 ; x < World.Heightmap.Width ; x++)
14257 for (
int y = 0 ; y < World.Heightmap.Height ; y++)
14259 if (heightfield[x, y] > max)
14260 max = heightfield[x, y];
14261 if (heightfield[x, y] < min)
14262 min = heightfield[x, y];
14270 if (rayStart.Z > max && rayEnd.Z >= rayStart.Z)
14274 if (rayStart.Z < min && rayEnd.Z <= rayStart.Z)
14277 List<Tri> trilist =
new List<Tri>();
14280 for (
int x = 1 ; x < World.Heightmap.Width ; x++)
14282 for (
int y = 1 ; y < World.Heightmap.Height ; y++)
14284 Tri t1 =
new Tri();
14285 Tri t2 =
new Tri();
14287 Vector3 p1 =
new Vector3(x-1, y-1, (
float)heightfield[x-1, y-1]);
14288 Vector3 p2 =
new Vector3(x, y-1, (
float)heightfield[x, y-1]);
14289 Vector3 p3 =
new Vector3(x, y, (
float)heightfield[x, y]);
14290 Vector3 p4 =
new Vector3(x-1, y, (
float)heightfield[x-1, y]);
14306 Vector3 rayDirection = rayEnd - rayStart;
14308 foreach (Tri t
in trilist)
14311 Vector3 u = t.p2 - t.p1;
14312 Vector3 v = t.p3 - t.p1;
14313 Vector3 n = Vector3.Cross(u, v);
14315 if (n == Vector3.Zero)
14318 Vector3 w0 = rayStart - t.p1;
14319 double a = -Vector3.Dot(n, w0);
14320 double b = Vector3.Dot(n, rayDirection);
14325 if (Math.Abs(b) < 0.000001)
14334 Vector3 ip = rayStart + Vector3.Multiply(rayDirection, (float)r);
14336 float uu = Vector3.Dot(u, u);
14337 float uv = Vector3.Dot(u, v);
14338 float vv = Vector3.Dot(v, v);
14339 Vector3 w = ip - t.p1;
14340 float wu = Vector3.Dot(w, u);
14341 float wv = Vector3.Dot(w, v);
14342 float d = uv * uv - uu * vv;
14344 float cs = (uv * wv - vv * wu) / d;
14345 if (cs < 0 || cs > 1.0)
14347 float ct = (uv * wu - uu * wv) / d;
14348 if (ct < 0 || (cs + ct) > 1.0)
14353 result.ConsumerID = 0;
14354 result.Depth = Vector3.Distance(rayStart, ip);
14358 contacts.Add(result);
14361 if (contacts.Count == 0)
14366 return (
int)(a.Depth - b.Depth);
14369 return contacts[0];
14396 if (m_useCastRayV3)
14397 return llCastRayV3(start, end, options);
14401 m_host.AddScriptLPS(1);
14403 Vector3 rayStart = start;
14404 Vector3 rayEnd = end;
14405 Vector3 dir = rayEnd - rayStart;
14407 float dist = Vector3.Mag(dir);
14410 bool detectPhantom =
false;
14412 int rejectTypes = 0;
14414 for (
int i = 0; i < options.Length; i += 2)
14416 if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_MAX_HITS)
14417 count = options.GetLSLIntegerItem(i + 1);
14418 else if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_DETECT_PHANTOM)
14419 detectPhantom = (options.GetLSLIntegerItem(i + 1) > 0);
14420 else if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_DATA_FLAGS)
14421 dataFlags = options.GetLSLIntegerItem(i + 1);
14422 else if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_REJECT_TYPES)
14423 rejectTypes = options.GetLSLIntegerItem(i + 1);
14429 List<ContactResult> results =
new List<ContactResult>();
14437 if (
World.SupportsRayCastFiltered())
14444 rayfilter |= RayFilterFlags.land;
14448 rayfilter |= RayFilterFlags.physical;
14449 if (checkNonPhysical)
14450 rayfilter |= RayFilterFlags.nonphysical;
14452 rayfilter |= RayFilterFlags.LSLPhantom;
14454 Vector3 direction = dir * ( 1/dist);
14463 int physcount = 4 * count;
14464 if (physcount > 20)
14467 object physresults;
14468 physresults = World.RayCastFiltered(rayStart, direction, dist, physcount, rayfilter);
14470 if (physresults == null)
14476 results = (List<ContactResult>)physresults;
14481 ContactResult[] agentHits = AvatarIntersection(rayStart, rayEnd);
14493 ContactResult[] objectHits = ObjectIntersection(rayStart, rayEnd,
false,
false,
true);
14502 ContactResult[] agentHits = AvatarIntersection(rayStart, rayEnd);
14507 if (checkPhysical || checkNonPhysical || detectPhantom)
14509 ContactResult[] objectHits = ObjectIntersection(rayStart, rayEnd, checkPhysical, checkNonPhysical, detectPhantom);
14510 for (
int iter = 0; iter < objectHits.Length; iter++)
14513 objectHits[iter].Depth = Vector3.Distance(objectHits[iter].Pos, rayStart);
14514 results.Add(objectHits[iter]);
14522 bool skipGroundCheck =
false;
14527 skipGroundCheck =
true;
14530 if (!skipGroundCheck)
14532 ContactResult? groundContact = GroundIntersection(rayStart, rayEnd);
14533 if (groundContact != null)
14540 return a.Depth.CompareTo(b.Depth);
14548 if (result.
Depth > dist)
14555 UUID itemID = UUID.Zero;
14558 SceneObjectPart part = World.GetSceneObjectPart(result.ConsumerID);
14569 itemID = part.
UUID;
14575 ScenePresence sp = World.GetScenePresence(result.ConsumerID);
14581 list.Add(
new LSL_String(itemID.ToString()));
14591 if (values >= count)
14613 m_host.AddScriptLPS(1);
14617 int calledMs = Environment.TickCount;
14618 Stopwatch stopWatch =
new Stopwatch();
14620 UUID regionId = World.RegionInfo.RegionID;
14621 UUID userId = UUID.Zero;
14622 int msAvailable = 0;
14624 if (m_host.ParentGroup.IsAttachment || m_host.ParentGroup.GetSittingAvatarsCount() > 0)
14626 userId = m_host.OwnerID;
14627 msAvailable = m_msPerAvatarInCastRay;
14632 LandData land = World.GetLandData(m_host.GetWorldPosition());
14634 msAvailable = m_msPerRegionInCastRay * land.Area / 65536;
14637 if (msAvailable > m_msMaxInCastRay)
14638 msAvailable = m_msMaxInCastRay;
14641 int fromCalledMs = calledMs - m_msThrottleInCastRay;
14642 lock (m_castRayCalls)
14644 for (
int i = m_castRayCalls.Count - 1; i >= 0; i--)
14647 if (m_castRayCalls[i].CalledMs < fromCalledMs)
14648 m_castRayCalls.RemoveAt(i);
14650 else if (m_castRayCalls[i].RegionId == regionId)
14653 if (m_castRayCalls[i].UserId == userId)
14654 msAvailable -= m_castRayCalls[i].UsedMs;
14660 if (msAvailable < m_msMinInCastRay)
14667 List<RayHit> rayHits =
new List<RayHit>();
14668 float tol = m_floatToleranceInCastRay;
14669 Vector3 pos1Ray = start;
14670 Vector3 pos2Ray = end;
14673 int rejectTypes = 0;
14676 bool detectPhantom =
false;
14677 for (
int i = 0; i < options.Length; i += 2)
14679 if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_REJECT_TYPES)
14680 rejectTypes = options.GetLSLIntegerItem(i + 1);
14681 else if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_DATA_FLAGS)
14682 dataFlags = options.GetLSLIntegerItem(i + 1);
14683 else if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_MAX_HITS)
14684 maxHits = options.GetLSLIntegerItem(i + 1);
14685 else if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_DETECT_PHANTOM)
14686 detectPhantom = (options.GetLSLIntegerItem(i + 1) != 0);
14688 if (maxHits > m_maxHitsInCastRay)
14689 maxHits = m_maxHitsInCastRay;
14690 bool rejectAgents = ((rejectTypes & ScriptBaseClass.RC_REJECT_AGENTS) != 0);
14691 bool rejectPhysical = ((rejectTypes & ScriptBaseClass.RC_REJECT_PHYSICAL) != 0);
14692 bool rejectNonphysical = ((rejectTypes & ScriptBaseClass.RC_REJECT_NONPHYSICAL) != 0);
14693 bool rejectLand = ((rejectTypes & ScriptBaseClass.RC_REJECT_LAND) != 0);
14694 bool getNormal = ((dataFlags & ScriptBaseClass.RC_GET_NORMAL) != 0);
14695 bool getRootKey = ((dataFlags & ScriptBaseClass.RC_GET_ROOT_KEY) != 0);
14696 bool getLinkNum = ((dataFlags & ScriptBaseClass.RC_GET_LINK_NUM) != 0);
14699 Vector3 vecRay = pos2Ray - pos1Ray;
14700 float rayLength = vecRay.Length();
14703 IRendering primMesher = null;
14704 List<string> renderers = RenderingLoader.ListRenderers(Util.ExecutingDirectory());
14705 if (renderers.Count < 1 || rayLength < tol || m_maxHitsInCastRay < 1)
14710 primMesher = RenderingLoader.LoadRenderer(renderers[0]);
14717 bool isPhysical = (group.RootPart != null && group.RootPart.PhysActor != null && group.RootPart.PhysActor.IsPhysical);
14718 bool isNonphysical = !isPhysical;
14719 bool isPhantom = group.IsPhantom || group.IsVolumeDetect;
14720 bool isAttachment = group.IsAttachment;
14721 bool doGroup =
true;
14722 if (isPhysical && rejectPhysical)
14724 if (isNonphysical && rejectNonphysical)
14726 if (isPhantom && detectPhantom)
14728 if (m_filterPartsInCastRay)
14730 if (isAttachment && !m_doAttachmentsInCastRay)
14736 foreach(SceneObjectPart part
in group.
Parts)
14739 if (m_filterPartsInCastRay)
14741 isPhysical = (part.PhysActor != null && part.PhysActor.IsPhysical);
14742 isNonphysical = !isPhysical;
14743 isPhantom = ((part.Flags & PrimFlags.Phantom) != 0) || (part.VolumeDetectActive);
14744 bool doPart =
true;
14745 if (isPhysical && rejectPhysical)
14747 if (isNonphysical && rejectNonphysical)
14749 if (isPhantom && detectPhantom)
14756 Vector3 scalePart = part.Scale;
14757 Vector3 posPart = part.GetWorldPosition();
14758 Quaternion rotPart = part.GetWorldRotation();
14759 Quaternion rotPartInv = Quaternion.Inverse(rotPart);
14760 Vector3 pos1RayProj = ((pos1Ray - posPart) * rotPartInv) / scalePart;
14761 Vector3 pos2RayProj = ((pos2Ray - posPart) * rotPartInv) / scalePart;
14764 Vector3 shapeBoxMax =
new Vector3(0.5f, 0.5f, 0.5f);
14766 shapeBoxMax = shapeBoxMax * (
new Vector3(m_primSafetyCoeffX, m_primSafetyCoeffY, m_primSafetyCoeffZ));
14767 shapeBoxMax = shapeBoxMax + (
new Vector3(tol, tol, tol));
14768 if (RayIntersectsShapeBox(pos1RayProj, pos2RayProj, shapeBoxMax))
14772 rayTrans.PartId = part.UUID;
14773 rayTrans.GroupId = part.ParentGroup.UUID;
14774 rayTrans.Link = group.PrimCount > 1 ? part.LinkNum : 0;
14775 rayTrans.ScalePart = scalePart;
14776 rayTrans.PositionPart = posPart;
14777 rayTrans.RotationPart = rotPart;
14778 rayTrans.ShapeNeedsEnds =
true;
14779 rayTrans.Position1Ray = pos1Ray;
14780 rayTrans.Position1RayProj = pos1RayProj;
14781 rayTrans.VectorRayProj = pos2RayProj - pos1RayProj;
14787 lod = (int)m_meshLodInCastRay;
14790 lod = (
int)m_sculptLodInCastRay;
14793 lod = (int)m_primLodInCastRay;
14797 FacetedMesh mesh = null;
14798 if (m_useMeshCacheInCastRay)
14800 meshKey = part.Shape.GetMeshKey(Vector3.One, (float)(4 << lod));
14801 lock (m_cachedMeshes)
14803 m_cachedMeshes.TryGetValue(meshKey, out mesh);
14811 Primitive omvPrim = part.Shape.ToOmvPrimitive(posPart, rotPart);
14812 byte[] sculptAsset = null;
14813 if (omvPrim.Sculpt != null)
14814 sculptAsset = World.AssetService.GetData(omvPrim.Sculpt.SculptTexture.ToString());
14817 if (omvPrim.Sculpt != null && omvPrim.Sculpt.Type ==
SculptType.Mesh && sculptAsset != null)
14819 AssetMesh meshAsset =
new AssetMesh(omvPrim.Sculpt.SculptTexture, sculptAsset);
14820 FacetedMesh.TryDecodeFromAsset(omvPrim, meshAsset, m_meshLodInCastRay, out mesh);
14826 else if (omvPrim.Sculpt != null && omvPrim.Sculpt.Type !=
SculptType.Mesh && sculptAsset != null)
14829 if (imgDecoder != null)
14831 Image sculpt = imgDecoder.DecodeToImage(sculptAsset);
14832 if (sculpt != null)
14834 mesh = primMesher.GenerateFacetedSculptMesh(omvPrim, (Bitmap)sculpt, m_sculptLodInCastRay);
14841 else if (omvPrim.Sculpt == null)
14844 omvPrim.PrimData.PathBegin == 0.0 && omvPrim.PrimData.PathEnd == 1.0 &&
14845 omvPrim.PrimData.PathTaperX == 0.0 && omvPrim.PrimData.PathTaperY == 0.0 &&
14846 omvPrim.PrimData.PathSkew == 0.0 &&
14847 omvPrim.PrimData.PathTwist - omvPrim.PrimData.PathTwistBegin == 0.0
14849 rayTrans.ShapeNeedsEnds =
false;
14850 mesh = primMesher.GenerateFacetedMesh(omvPrim, m_primLodInCastRay);
14854 if (m_useMeshCacheInCastRay && mesh != null)
14856 lock(m_cachedMeshes)
14858 if (!m_cachedMeshes.ContainsKey(meshKey))
14859 m_cachedMeshes.Add(meshKey, mesh);
14864 AddRayInFacetedMesh(mesh, rayTrans, ref rayHits);
14876 World.ForEachRootScenePresence(
14882 BoundingBoxOfScenePresence(sp, out lower, out upper);
14884 Vector3 scalePart = upper - lower;
14885 Vector3 posPart = sp.AbsolutePosition;
14886 Quaternion rotPart = sp.GetWorldRotation();
14887 Quaternion rotPartInv = Quaternion.Inverse(rotPart);
14888 posPart = posPart + (lower + upper) * 0.5f * rotPart;
14890 Vector3 pos1RayProj = ((pos1Ray - posPart) * rotPartInv) / scalePart;
14891 Vector3 pos2RayProj = ((pos2Ray - posPart) * rotPartInv) / scalePart;
14894 Vector3 shapeBoxMax =
new Vector3(0.5f + tol, 0.5f + tol, 0.5f + tol);
14895 if (RayIntersectsShapeBox(pos1RayProj, pos2RayProj, shapeBoxMax))
14899 rayTrans.PartId = sp.UUID;
14900 rayTrans.GroupId = sp.ParentPart != null ? sp.ParentPart.ParentGroup.UUID : sp.UUID;
14901 rayTrans.Link = sp.ParentPart != null ? UUID2LinkNumber(sp.
ParentPart, sp.
UUID) : 0;
14902 rayTrans.ScalePart = scalePart;
14903 rayTrans.PositionPart = posPart;
14904 rayTrans.RotationPart = rotPart;
14905 rayTrans.ShapeNeedsEnds =
false;
14906 rayTrans.Position1Ray = pos1Ray;
14907 rayTrans.Position1RayProj = pos1RayProj;
14908 rayTrans.VectorRayProj = pos2RayProj - pos1RayProj;
14912 int lod = (int)m_avatarLodInCastRay;
14913 ulong meshKey = prim.GetMeshKey(Vector3.One, (float)(4 << lod));
14914 FacetedMesh mesh = null;
14915 if (m_useMeshCacheInCastRay)
14917 lock (m_cachedMeshes)
14919 m_cachedMeshes.TryGetValue(meshKey, out mesh);
14927 prim.Scale = scalePart;
14928 Primitive omvPrim = prim.ToOmvPrimitive(posPart, rotPart);
14929 mesh = primMesher.GenerateFacetedMesh(omvPrim, m_avatarLodInCastRay);
14932 if (m_useMeshCacheInCastRay && mesh != null)
14934 lock(m_cachedMeshes)
14936 if (!m_cachedMeshes.ContainsKey(meshKey))
14937 m_cachedMeshes.Add(meshKey, mesh);
14943 AddRayInFacetedMesh(mesh, rayTrans, ref rayHits);
14958 List<Tri> triangles = TrisFromHeightmapUnderRay(pos1Ray, pos2Ray, out lower, out upper);
14961 if ((pos1Ray.Z >= lower.Z || pos2Ray.Z >= lower.Z) && (pos1Ray.Z <= upper.Z || pos2Ray.Z <= upper.Z))
14965 rayTrans.PartId = UUID.Zero;
14966 rayTrans.GroupId = UUID.Zero;
14968 rayTrans.ScalePart =
new Vector3 (1.0f, 1.0f, 1.0f);
14969 rayTrans.PositionPart = Vector3.Zero;
14970 rayTrans.RotationPart = Quaternion.Identity;
14971 rayTrans.ShapeNeedsEnds =
true;
14972 rayTrans.Position1Ray = pos1Ray;
14973 rayTrans.Position1RayProj = pos1Ray;
14974 rayTrans.VectorRayProj = vecRay;
14977 AddRayInTris(triangles, rayTrans, ref rayHits);
14983 rayHits.Sort((s1, s2) => s1.Distance.CompareTo(s2.Distance));
14986 for (
int t = 0; t < 2; t++)
14988 int maxHitsPerType = 0;
14989 UUID id = UUID.Zero;
14991 maxHitsPerType = m_maxHitsPerPrimInCastRay;
14993 maxHitsPerType = m_maxHitsPerObjectInCastRay;
14996 if (maxHitsPerType < m_maxHitsInCastRay)
14999 Hashtable hits =
new Hashtable();
15000 for (
int i = rayHits.Count - 1; i >= 0; i--)
15003 id = rayHits[i].PartId;
15005 id = rayHits[i].GroupId;
15006 if (hits.ContainsKey(
id))
15007 hits[
id] = (
int)hits[id] + 1;
15013 for (
int i = rayHits.Count - 1; i >= 0; i--)
15016 id = rayHits[i].PartId;
15018 id = rayHits[i].GroupId;
15019 int hit = (int)hits[
id];
15020 if (hit > m_maxHitsPerPrimInCastRay)
15022 rayHits.RemoveAt(i);
15031 int hitCount = rayHits.Count;
15032 if (hitCount > maxHits)
15033 hitCount = maxHits;
15034 for (
int i = 0; i < hitCount; i++)
15036 RayHit rayHit = rayHits[i];
15052 castRayCall.RegionId = regionId;
15053 castRayCall.UserId = userId;
15054 castRayCall.CalledMs = calledMs;
15055 castRayCall.UsedMs = (int)stopWatch.ElapsedMilliseconds;
15056 lock (m_castRayCalls)
15058 m_castRayCalls.Add(castRayCall);
15109 private bool RayIntersectsShapeBox(Vector3 pos1RayProj, Vector3 pos2RayProj, Vector3 shapeBoxMax)
15112 Vector3 rayBoxProjMin = Vector3.Min(pos1RayProj, pos2RayProj);
15113 Vector3 rayBoxProjMax = Vector3.Max(pos1RayProj, pos2RayProj);
15115 rayBoxProjMin.X > shapeBoxMax.X || rayBoxProjMin.Y > shapeBoxMax.Y || rayBoxProjMin.Z > shapeBoxMax.Z ||
15116 rayBoxProjMax.X < -shapeBoxMax.X || rayBoxProjMax.Y < -shapeBoxMax.Y || rayBoxProjMax.Z < -shapeBoxMax.Z
15123 Vector3 posProj = Vector3.Zero;
15124 Vector3 vecRayProj = pos2RayProj - pos1RayProj;
15127 if (Math.Abs(vecRayProj.X) > m_floatToleranceInCastRay)
15129 for (sign = -1; sign <= 1; sign += 2)
15131 dist = ((float)sign * shapeBoxMax.X - pos1RayProj.X) / vecRayProj.X;
15132 posProj = pos1RayProj + vecRayProj * dist;
15133 if (Math.Abs(posProj.Y) <= shapeBoxMax.Y && Math.Abs(posProj.Z) <= shapeBoxMax.Z)
15139 if (Math.Abs(vecRayProj.Y) > m_floatToleranceInCastRay)
15141 for (sign = -1; sign <= 1; sign += 2)
15143 dist = ((float)sign * shapeBoxMax.Y - pos1RayProj.Y) / vecRayProj.Y;
15144 posProj = pos1RayProj + vecRayProj * dist;
15145 if (Math.Abs(posProj.X) <= shapeBoxMax.X && Math.Abs(posProj.Z) <= shapeBoxMax.Z)
15151 if (Math.Abs(vecRayProj.Z) > m_floatToleranceInCastRay)
15153 for (sign = -1; sign <= 1; sign += 2)
15155 dist = ((float)sign * shapeBoxMax.Z - pos1RayProj.Z) / vecRayProj.Z;
15156 posProj = pos1RayProj + vecRayProj * dist;
15157 if (Math.Abs(posProj.X) <= shapeBoxMax.X && Math.Abs(posProj.Y) <= shapeBoxMax.Y)
15169 private void AddRayInFacetedMesh(FacetedMesh mesh, RayTrans rayTrans, ref List<RayHit> rayHits)
15173 foreach (Face face
in mesh.Faces)
15175 for (
int i = 0; i < face.Indices.Count; i += 3)
15177 Tri triangle =
new Tri();
15178 triangle.p1 = face.Vertices[face.Indices[i]].Position;
15179 triangle.p2 = face.Vertices[face.Indices[i + 1]].Position;
15180 triangle.p3 = face.Vertices[face.Indices[i + 2]].Position;
15181 AddRayInTri(triangle, rayTrans, ref rayHits);
15190 private void AddRayInTris(List<Tri> triangles, RayTrans rayTrans, ref List<RayHit> rayHits)
15192 foreach (Tri triangle
in triangles)
15194 AddRayInTri(triangle, rayTrans, ref rayHits);
15201 private void AddRayInTri(Tri triProj, RayTrans rayTrans, ref List<RayHit> rayHits)
15204 Vector3 posHitProj;
15205 Vector3 normalProj;
15206 if (HitRayInTri(triProj, rayTrans.Position1RayProj, rayTrans.VectorRayProj, out posHitProj, out normalProj))
15209 if (Math.Abs(Vector3.Dot(posHitProj, normalProj)) < m_floatToleranceInCastRay && !rayTrans.ShapeNeedsEnds)
15213 Vector3 posHit = rayTrans.PositionPart + (posHitProj * rayTrans.ScalePart) * rayTrans.RotationPart;
15214 Vector3 normal = Vector3.Normalize((normalProj * rayTrans.ScalePart) * rayTrans.RotationPart);
15217 float distance = Vector3.Distance(rayTrans.Position1Ray, posHit);
15218 for (
int i = rayHits.Count - 1; i >= 0; i--)
15220 if (rayHits[i].PartId != rayTrans.PartId)
15222 if (Math.Abs(rayHits[i].Distance - distance) < m_floatTolerance2InCastRay)
15227 RayHit rayHit =
new RayHit();
15228 rayHit.PartId = rayTrans.PartId;
15229 rayHit.GroupId = rayTrans.GroupId;
15230 rayHit.Link = rayTrans.Link;
15231 rayHit.Position = posHit;
15232 rayHit.Normal = normal;
15233 rayHit.Distance = distance;
15234 rayHits.Add(rayHit);
15241 bool HitRayInTri(Tri triProj, Vector3 pos1RayProj, Vector3 vecRayProj, out Vector3 posHitProj, out Vector3 normalProj)
15243 float tol = m_floatToleranceInCastRay;
15244 posHitProj = Vector3.Zero;
15247 Vector3 vec1Proj = triProj.p2 - triProj.p1;
15248 Vector3 vec2Proj = triProj.p3 - triProj.p2;
15249 Vector3 vec3Proj = triProj.p1 - triProj.p3;
15252 normalProj = Vector3.Cross(vec1Proj, vec2Proj);
15255 float divisor = Vector3.Dot(vecRayProj, normalProj);
15256 if (Math.Abs(divisor) < tol)
15260 if (divisor > tol && !m_detectExitsInCastRay)
15264 float distanceProj = Vector3.Dot(triProj.p1 - pos1RayProj, normalProj) / divisor;
15265 if (distanceProj < -tol || distanceProj > 1 + tol)
15269 posHitProj = pos1RayProj + vecRayProj * distanceProj;
15272 Vector3 triProjMin = Vector3.Min(Vector3.Min(triProj.p1, triProj.p2), triProj.p3);
15273 Vector3 triProjMax = Vector3.Max(Vector3.Max(triProj.p1, triProj.p2), triProj.p3);
15275 posHitProj.X < triProjMin.X - tol || posHitProj.Y < triProjMin.Y - tol || posHitProj.Z < triProjMin.Z - tol ||
15276 posHitProj.X > triProjMax.X + tol || posHitProj.Y > triProjMax.Y + tol || posHitProj.Z > triProjMax.Z + tol
15282 Vector3.Dot(Vector3.Cross(vec1Proj, normalProj), posHitProj - triProj.p1) > tol ||
15283 Vector3.Dot(Vector3.Cross(vec2Proj, normalProj), posHitProj - triProj.p2) > tol ||
15284 Vector3.Dot(Vector3.Cross(vec3Proj, normalProj), posHitProj - triProj.p3) > tol
15295 private List<Tri> TrisFromHeightmapUnderRay(Vector3 posStart, Vector3 posEnd, out Vector3 lower, out Vector3 upper)
15298 lower = Vector3.Min(posStart, posEnd);
15299 upper = Vector3.Max(posStart, posEnd);
15300 lower.X = (float)Math.Floor(lower.X);
15301 lower.Y = (float)Math.Floor(lower.Y);
15302 float zLower = float.MaxValue;
15303 upper.X = (float)Math.Ceiling(upper.X);
15304 upper.Y = (float)Math.Ceiling(upper.Y);
15305 float zUpper = float.MinValue;
15308 List<Tri> triangles =
new List<Tri>();
15311 Vector3 vec = posEnd - posStart;
15312 float xAbs = Math.Abs(vec.X);
15313 float yAbs = Math.Abs(vec.Y);
15320 else if (xAbs > yAbs || xAbs > 0.0f)
15323 vec =
new Vector3(1.0f, 1.0f, 0.0f);
15326 if ((bigX && vec.X < 0.0f) || (!bigX && vec.Y < 0.0f))
15328 Vector3 posTemp = posStart;
15335 float xFloorOld = 0.0f;
15336 float yFloorOld = 0.0f;
15337 Vector3 pos = posStart;
15338 float xFloor = (float)Math.Floor(pos.X);
15339 float yFloor = (float)Math.Floor(pos.Y);
15340 AddTrisFromHeightmap(xFloor, yFloor, ref triangles, ref zLower, ref zUpper);
15343 while (pos != posEnd)
15346 xFloorOld = xFloor;
15347 yFloorOld = yFloor;
15351 xFloor = (float)Math.Floor(pos.X);
15352 yFloor = (float)Math.Floor(pos.Y);
15353 if (bigX && pos.X > xFloor)
15355 pos.Y -= vec.Y * (pos.X - xFloor);
15358 else if (!bigX && pos.Y > yFloor)
15360 pos.X -= vec.X * (pos.Y - yFloor);
15365 if ((bigX && pos.X >= posEnd.X) || (!bigX && pos.Y >= posEnd.Y))
15368 xFloor = (float)Math.Floor(pos.X);
15369 yFloor = (float)Math.Floor(pos.Y);
15373 if ((bigX && xFloor != xFloorOld) || (!bigX && yFloor != yFloorOld))
15374 AddTrisFromHeightmap(xFloor, yFloor, ref triangles, ref zLower, ref zUpper);
15376 if (bigX && yFloor != yFloorOld)
15377 AddTrisFromHeightmap(xFloor, yFloorOld, ref triangles, ref zLower, ref zUpper);
15378 if (!bigX && xFloor != xFloorOld)
15379 AddTrisFromHeightmap(xFloorOld, yFloor, ref triangles, ref zLower, ref zUpper);
15393 private void AddTrisFromHeightmap(
float xPos,
float yPos, ref List<Tri> triangles, ref
float zLower, ref
float zUpper)
15395 int xInt = (int)xPos;
15396 int yInt = (int)yPos;
15399 int x = Util.Clamp<
int>(xInt+1, 0, World.Heightmap.Width - 1);
15400 int y = Util.Clamp<
int>(yInt+1, 0, World.Heightmap.Height - 1);
15401 Vector3 pos1 =
new Vector3(x, y, (
float)
World.Heightmap[x, y]);
15403 zLower = Math.Min(zLower, pos1.Z);
15404 zUpper = Math.Max(zUpper, pos1.Z);
15407 x = Util.Clamp<
int>(xInt, 0, World.Heightmap.Width - 1);
15408 y = Util.Clamp<
int>(yInt+1, 0, World.Heightmap.Height - 1);
15409 Vector3 pos2 =
new Vector3(x, y, (
float)
World.Heightmap[x, y]);
15411 zLower = Math.Min(zLower, pos2.Z);
15412 zUpper = Math.Max(zUpper, pos2.Z);
15415 x = Util.Clamp<
int>(xInt, 0, World.Heightmap.Width - 1);
15416 y = Util.Clamp<
int>(yInt, 0, World.Heightmap.Height - 1);
15417 Vector3 pos3 =
new Vector3(x, y, (
float)
World.Heightmap[x, y]);
15419 zLower = Math.Min(zLower, pos3.Z);
15420 zUpper = Math.Max(zUpper, pos3.Z);
15423 x = Util.Clamp<
int>(xInt+1, 0, World.Heightmap.Width - 1);
15424 y = Util.Clamp<
int>(yInt, 0, World.Heightmap.Height - 1);
15425 Vector3 pos4 =
new Vector3(x, y, (
float)
World.Heightmap[x, y]);
15427 zLower = Math.Min(zLower, pos4.Z);
15428 zUpper = Math.Max(zUpper, pos4.Z);
15431 Tri triangle1 =
new Tri();
15432 triangle1.p1 = pos1;
15433 triangle1.p2 = pos2;
15434 triangle1.p3 = pos3;
15435 triangles.Add(triangle1);
15438 Tri triangle2 =
new Tri();
15439 triangle2.p1 = pos3;
15440 triangle2.p2 = pos4;
15441 triangle2.p3 = pos1;
15442 triangles.Add(triangle2);
15448 private int UUID2LinkNumber(SceneObjectPart part, UUID
id)
15454 int linkCount = group.PrimCount + group.GetSittingAvatarsCount();
15455 for (
int link = linkCount; link > 0; link--)
15459 if (entity != null && entity.
UUID ==
id)
15469 m_host.AddScriptLPS(1);
15471 bool isAccount =
false;
15472 bool isGroup =
false;
15474 if (!estate.IsEstateOwner(m_host.OwnerID) || !estate.IsEstateManagerOrOwner(m_host.OwnerID))
15478 if (!
UUID.TryParse(avatar, out
id))
15481 UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, id);
15482 isAccount = account != null ?
true :
false;
15486 if (groups != null)
15489 isGroup = group != null ?
true :
false;
15499 case ScriptBaseClass.ESTATE_ACCESS_ALLOWED_AGENT_ADD:
15500 if (!isAccount)
return 0;
15501 if (estate.HasAccess(
id))
return 1;
15502 if (estate.IsBanned(
id,
World.GetUserFlags(
id)))
15503 estate.RemoveBan(id);
15504 estate.AddEstateUser(id);
15506 case ScriptBaseClass.ESTATE_ACCESS_ALLOWED_AGENT_REMOVE:
15507 if (!isAccount || !estate.HasAccess(
id))
return 0;
15508 estate.RemoveEstateUser(id);
15510 case ScriptBaseClass.ESTATE_ACCESS_ALLOWED_GROUP_ADD:
15511 if (!isGroup)
return 0;
15512 if (estate.GroupAccess(
id))
return 1;
15513 estate.AddEstateGroup(id);
15515 case ScriptBaseClass.ESTATE_ACCESS_ALLOWED_GROUP_REMOVE:
15516 if (!isGroup || !estate.GroupAccess(
id))
return 0;
15517 estate.RemoveEstateGroup(id);
15519 case ScriptBaseClass.ESTATE_ACCESS_BANNED_AGENT_ADD:
15520 if (!isAccount)
return 0;
15521 if (estate.IsBanned(
id,
World.GetUserFlags(
id)))
return 1;
15523 ban.EstateID = estate.EstateID;
15524 ban.BannedUserID = id;
15525 estate.AddBan(ban);
15527 case ScriptBaseClass.ESTATE_ACCESS_BANNED_AGENT_REMOVE:
15528 if (!isAccount || !estate.IsBanned(
id,
World.GetUserFlags(
id)))
return 0;
15529 estate.RemoveBan(id);
15538 m_host.AddScriptLPS(1);
15545 m_host.AddScriptLPS(1);
15547 return ScriptBaseClass.FALSE;
15552 m_host.AddScriptLPS(1);
15559 m_host.AddScriptLPS(1);
15566 m_host.AddScriptLPS(1);
15570 #region Not Implemented
15578 m_host.AddScriptLPS(1);
15580 if (m_SoundModule != null)
15581 m_SoundModule.SetSoundQueueing(m_host.UUID, queue == ScriptBaseClass.TRUE.value);
15586 m_host.AddScriptLPS(1);
15593 m_host.AddScriptLPS(1);
15595 if (!
World.Permissions.IsGod(m_host.OwnerID))
15596 NotImplemented(
"llGodLikeRezObject");
15598 AssetBase rezAsset = World.AssetService.Get(inventory);
15599 if (rezAsset == null)
15601 llSay(0,
"Asset not found");
15609 string xmlData = Utils.BytesToString(rezAsset.Data);
15610 group = SceneObjectSerializer.FromOriginalXmlFormat(xmlData);
15614 llSay(0,
"Asset not found");
15620 llSay(0,
"Asset not found");
15624 group.RootPart.AttachPoint = group.RootPart.Shape.State;
15625 group.RootPart.AttachedPos = group.AbsolutePosition;
15629 Vector3 llpos =
new Vector3((
float)pos.x, (
float)pos.y, (
float)pos.z);
15630 World.AddNewSceneObject(group,
true, llpos, Quaternion.Identity, Vector3.Zero);
15631 group.CreateScriptInstances(0,
true, World.DefaultScriptEngine, 3);
15632 group.ScheduleGroupForFullUpdate();
15635 group.RootPart.SetDieAtEdge(
true);
15637 group.ResumeScripts();
15639 m_ScriptEngine.PostObjectEvent(m_host.LocalId,
new EventParams(
15640 "object_rez",
new Object[] {
15642 group.RootPart.UUID.ToString()) },
15648 UUID txn = UUID.Random();
15650 Util.FireAndForget(delegate(
object x)
15653 string replydata = destination +
"," + amount.ToString();
15660 replydata =
"SERVICE_ERROR";
15664 m_host.AddScriptLPS(1);
15668 replydata =
"MISSING_PERMISSION_DEBIT";
15674 replydata =
"MISSING_PERMISSION_DEBIT";
15680 if (!
UUID.TryParse(destination, out toID))
15682 replydata =
"INVALID_AGENT";
15690 replydata =
"TRANSFERS_DISABLED";
15695 bool result = money.ObjectGiveMoney(
15696 m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount, txn, out reason);
15704 replydata = reason;
15708 m_ScriptEngine.PostScriptEvent(m_item.ItemID,
new EventParams(
15709 "transaction_result",
new Object[] {
15715 }, null,
"LSL_Api.llTransferLindenDollars");
15717 return txn.ToString();
15730 bool positionChanged =
false;
15733 while (idx < rules.Length)
15736 int code = rules.GetLSLIntegerItem(idx++);
15738 int remain = rules.Length - idx;
15743 case (
int)ScriptBaseClass.PRIM_POSITION:
15744 case (
int)ScriptBaseClass.PRIM_POS_LOCAL:
15750 v = rules.GetVector3Item(idx++);
15756 v = v + 2 * sitOffset;
15759 av.OffsetPosition =
new Vector3((
float)v.x, (
float)v.y, (
float)v.z);
15760 positionChanged =
true;
15764 case (
int)ScriptBaseClass.PRIM_ROTATION:
15770 r = rules.GetQuaternionItem(idx++);
15772 av.Rotation = m_host.GetWorldRotation() * r;
15773 positionChanged =
true;
15777 case (
int)ScriptBaseClass.PRIM_ROT_LOCAL:
15783 r = rules.GetQuaternionItem(idx++);
15786 positionChanged =
true;
15791 case (
int)ScriptBaseClass.PRIM_SIZE:
15792 case (
int)ScriptBaseClass.PRIM_MATERIAL:
15793 case (
int)ScriptBaseClass.PRIM_PHANTOM:
15794 case (
int)ScriptBaseClass.PRIM_PHYSICS:
15795 case (
int)ScriptBaseClass.PRIM_PHYSICS_SHAPE_TYPE:
15796 case (
int)ScriptBaseClass.PRIM_TEMP_ON_REZ:
15797 case (
int)ScriptBaseClass.PRIM_NAME:
15798 case (
int)ScriptBaseClass.PRIM_DESC:
15804 case (
int)ScriptBaseClass.PRIM_GLOW:
15805 case (
int)ScriptBaseClass.PRIM_FULLBRIGHT:
15806 case (
int)ScriptBaseClass.PRIM_TEXGEN:
15812 case (
int)ScriptBaseClass.PRIM_TYPE:
15815 code = (int)rules.GetLSLIntegerItem(idx++);
15816 remain = rules.Length - idx;
15819 case (
int)ScriptBaseClass.PRIM_TYPE_BOX:
15820 case (
int)ScriptBaseClass.PRIM_TYPE_CYLINDER:
15821 case (
int)ScriptBaseClass.PRIM_TYPE_PRISM:
15827 case (
int)ScriptBaseClass.PRIM_TYPE_SPHERE:
15833 case (
int)ScriptBaseClass.PRIM_TYPE_TORUS:
15834 case (
int)ScriptBaseClass.PRIM_TYPE_TUBE:
15835 case (
int)ScriptBaseClass.PRIM_TYPE_RING:
15841 case (
int)ScriptBaseClass.PRIM_TYPE_SCULPT:
15849 case (
int)ScriptBaseClass.PRIM_COLOR:
15850 case (
int)ScriptBaseClass.PRIM_TEXT:
15851 case (
int)ScriptBaseClass.PRIM_BUMP_SHINY:
15852 case (
int)ScriptBaseClass.PRIM_OMEGA:
15858 case (
int)ScriptBaseClass.PRIM_TEXTURE:
15859 case (
int)ScriptBaseClass.PRIM_POINT_LIGHT:
15860 case (
int)ScriptBaseClass.PRIM_PHYSICS_MATERIAL:
15866 case (
int)ScriptBaseClass.PRIM_FLEXIBLE:
15873 case (
int)ScriptBaseClass.PRIM_LINK_TARGET:
15877 return rules.GetSublist(idx, -1);
15881 catch (InvalidCastException e)
15883 Error(originFunc,
string.Format(
15884 " error running rule #{1}: arg #{2} ",
15885 rulesParsed, idx - idxStart) + e.Message);
15889 if (positionChanged)
15890 av.SendTerseUpdateToAllClients();
15901 SceneObjectPart sitPart = World.GetSceneObjectPart(avatar.ParentID);
15904 while (idx < rules.Length)
15906 int code = (int)rules.GetLSLIntegerItem(idx++);
15907 int remain = rules.Length - idx;
15911 case (
int)ScriptBaseClass.PRIM_MATERIAL:
15912 res.Add(
new LSL_Integer((
int)SOPMaterialData.SopMaterial.Flesh));
15915 case (
int)ScriptBaseClass.PRIM_PHYSICS:
15919 case (
int)ScriptBaseClass.PRIM_TEMP_ON_REZ:
15923 case (
int)ScriptBaseClass.PRIM_PHANTOM:
15927 case (
int)ScriptBaseClass.PRIM_POSITION:
15932 pos = avatar.OffsetPosition;
15940 SceneObjectPart sitroot = sitPart.ParentGroup.RootPart;
15941 pos = sitroot.AbsolutePosition + pos * sitroot.GetWorldRotation();
15944 pos = avatar.AbsolutePosition;
15949 case (
int)ScriptBaseClass.PRIM_SIZE:
15950 Vector3 s = avatar.Appearance.AvatarSize;
15955 case (
int)ScriptBaseClass.PRIM_ROTATION:
15959 case (
int)ScriptBaseClass.PRIM_TYPE:
15969 case (
int)ScriptBaseClass.PRIM_TEXTURE:
15973 int face = (int)rules.GetLSLIntegerItem(idx++);
15976 for (face = 0; face < 21; face++)
15986 if (face >= 0 && face < 21)
15996 case (
int)ScriptBaseClass.PRIM_COLOR:
16000 face = (int)rules.GetLSLIntegerItem(idx++);
16004 for (face = 0; face < 21; face++)
16017 case (
int)ScriptBaseClass.PRIM_BUMP_SHINY:
16020 face = (int)rules.GetLSLIntegerItem(idx++);
16024 for (face = 0; face < 21; face++)
16037 case (
int)ScriptBaseClass.PRIM_FULLBRIGHT:
16040 face = (int)rules.GetLSLIntegerItem(idx++);
16044 for (face = 0; face < 21; face++)
16055 case (
int)ScriptBaseClass.PRIM_FLEXIBLE:
16065 case (
int)ScriptBaseClass.PRIM_TEXGEN:
16069 face = (int)rules.GetLSLIntegerItem(idx++);
16073 for (face = 0; face < 21; face++)
16084 case (
int)ScriptBaseClass.PRIM_POINT_LIGHT:
16092 case (
int)ScriptBaseClass.PRIM_GLOW:
16095 face = (int)rules.GetLSLIntegerItem(idx++);
16099 for (face = 0; face < 21; face++)
16110 case (
int)ScriptBaseClass.PRIM_TEXT:
16116 case (
int)ScriptBaseClass.PRIM_NAME:
16120 case (
int)ScriptBaseClass.PRIM_DESC:
16124 case (
int)ScriptBaseClass.PRIM_ROT_LOCAL:
16125 Quaternion lrot = avatar.Rotation;
16126 res.Add(
new LSL_Rotation(lrot.X, lrot.Y, lrot.Z, lrot.W));
16129 case (
int)ScriptBaseClass.PRIM_POS_LOCAL:
16130 Vector3 lpos = avatar.OffsetPosition;
16135 lpos -= lsitOffset;
16138 res.Add(
new LSL_Vector(lpos.X,lpos.Y,lpos.Z));
16141 case (
int)ScriptBaseClass.PRIM_LINK_TARGET:
16145 return rules.GetSublist(idx, -1);
16154 string state = String.Empty;
16156 foreach (KeyValuePair<string, string> kvp
in MovementAnimationsForLSL)
16158 if (kvp.Value.ToLower() == ((string)animState).ToLower())
16165 if (state ==
String.Empty)
16171 if (m_item.PermsGranter ==
UUID.Zero)
16183 ScenePresence presence = World.GetScenePresence(m_item.PermsGranter);
16185 if (presence == null)
16190 animID = ScriptUtils.GetAssetIdFromItemName(m_host, anim, (int)AssetType.Animation);
16192 if (animID ==
UUID.Zero)
16194 String animupper = ((string)anim).ToUpperInvariant();
16195 DefaultAvatarAnimations.AnimsUUID.TryGetValue(animupper, out animID);
16198 if (animID ==
UUID.Zero)
16204 presence.SetAnimationOverride(state, animID);
16209 ScenePresence presence = World.GetScenePresence(m_item.PermsGranter);
16210 if (presence == null)
16213 if (m_item.PermsGranter ==
UUID.Zero)
16225 if (animState ==
"ALL")
16227 presence.SetAnimationOverride(
"ALL", UUID.Zero);
16231 string state = String.Empty;
16233 foreach (KeyValuePair<string, string> kvp
in MovementAnimationsForLSL)
16235 if (kvp.Value.ToLower() == ((string)animState).ToLower())
16242 if (state ==
String.Empty)
16247 presence.SetAnimationOverride(state, UUID.Zero);
16252 ScenePresence presence = World.GetScenePresence(m_item.PermsGranter);
16253 if (presence == null)
16254 return String.Empty;
16256 if (m_item.PermsGranter ==
UUID.Zero)
16259 return String.Empty;
16265 return String.Empty;
16268 string state = String.Empty;
16270 foreach (KeyValuePair<string, string> kvp
in MovementAnimationsForLSL)
16272 if (kvp.Value.ToLower() == ((string)animState).ToLower())
16279 if (state ==
String.Empty)
16281 return String.Empty;
16284 UUID animID = presence.GetAnimationOverride(state);
16285 if (animID ==
UUID.Zero)
16290 if (kvp.Value == animID)
16291 return kvp.Key.ToLower();
16300 return String.Empty;
16305 OSD o = OSDParser.DeserializeJson(json);
16306 OSD specVal = JsonGetSpecific(o, specifiers, 0);
16308 return specVal.AsString();
16315 OSD o = OSDParser.DeserializeJson(json);
16316 return (
LSL_List)ParseJsonNode(o);
16324 private object ParseJsonNode(
OSD node)
16326 if (node.Type == OSDType.Integer)
16328 if (node.Type == OSDType.Boolean)
16329 return new LSL_Integer(node.AsBoolean() ? 1 : 0);
16330 if (node.Type == OSDType.Real)
16332 if (node.Type == OSDType.UUID || node.Type == OSDType.String)
16334 if (node.Type == OSDType.Array)
16338 foreach (
OSD o
in ar)
16339 resp.Add(ParseJsonNode(o));
16342 if (node.Type == OSDType.Map)
16346 foreach (KeyValuePair<string, OSD> o
in ar)
16349 resp.Add(ParseJsonNode(o.Value));
16363 foreach (
object o
in values.Data)
16365 array.Add(ListToJson(o));
16367 return OSDParser.SerializeJsonString(array);
16372 for (
int i = 0; i < values.Data.Length; i += 2)
16375 return ScriptBaseClass.JSON_INVALID;
16376 map.Add(((
LSL_String)values.Data[i]).m_string, ListToJson(values.Data[i + 1]));
16378 return OSDParser.SerializeJsonString(map);
16380 return ScriptBaseClass.JSON_INVALID;
16382 catch (Exception ex)
16388 private OSD ListToJson(
object o)
16391 return OSD.FromReal(((
LSL_Float)o).value);
16396 return OSD.FromBoolean(
false);
16398 return OSD.FromBoolean(
true);
16399 return OSD.FromInteger(i);
16404 return OSD.FromString(((
LSL_Vector)o).ToString());
16410 return OSD.FromString(str);
16417 object spec = specifiers.Data[i];
16418 OSD nextVal = null;
16421 if (spec is LSL_Integer)
16426 if (spec is LSL_String)
16429 if (nextVal != null)
16431 if (specifiers.Data.Length - 1 > i)
16432 return JsonGetSpecific(nextVal, specifiers, i + 1);
16441 OSD o = OSDParser.DeserializeJson(json);
16442 JsonSetSpecific(o, specifiers, 0, value);
16443 return OSDParser.SerializeJsonString(o);
16448 return ScriptBaseClass.JSON_INVALID;
16451 private void JsonSetSpecific(
OSD o,
LSL_List specifiers,
int i, LSL_String val)
16453 object spec = specifiers.Data[i];
16455 OSD nextVal = null;
16459 if (spec is LSL_Integer)
16462 if (v >= array.Count)
16463 array.Add(JsonBuildRestOfSpec(specifiers, i + 1, val));
16468 array.Add(JsonBuildRestOfSpec(specifiers, i + 1, val));
16472 if (spec is LSL_String)
16474 OSDMap map = ((
OSDMap)o);
16475 if (map.ContainsKey(((LSL_String)spec).m_string))
16476 nextVal = map[((LSL_String)spec).m_string];
16478 map.Add(((
LSL_String)spec).m_string, JsonBuildRestOfSpec(specifiers, i + 1, val));
16481 if (nextVal != null)
16483 if (specifiers.Data.Length - 1 > i)
16485 JsonSetSpecific(nextVal, specifiers, i + 1, val);
16491 private OSD JsonBuildRestOfSpec(
LSL_List specifiers,
int i, LSL_String val)
16493 object spec = i >= specifiers.Data.Length ? null : specifiers.Data[i];
16497 return OSD.FromString(val);
16499 if (spec is LSL_Integer ||
16503 array.Add(JsonBuildRestOfSpec(specifiers, i + 1, val));
16506 else if (spec is LSL_String)
16508 OSDMap map =
new OSDMap();
16509 map.Add((
LSL_String)spec, JsonBuildRestOfSpec(specifiers, i + 1, val));
16517 OSD o = OSDParser.DeserializeJson(json);
16518 OSD specVal = JsonGetSpecific(o, specifiers, 0);
16519 if (specVal == null)
16520 return ScriptBaseClass.JSON_INVALID;
16521 switch (specVal.Type)
16523 case OSDType.Array:
16524 return ScriptBaseClass.JSON_ARRAY;
16525 case OSDType.Boolean:
16527 case OSDType.Integer:
16532 case OSDType.String:
16535 case OSDType.Unknown:
16538 return ScriptBaseClass.JSON_INVALID;
16550 private static Dictionary<UUID, Notecard> m_Notecards =
16551 new Dictionary<UUID, Notecard>();
16553 public static void Cache(UUID assetID, byte[] text)
16559 if (m_Notecards.ContainsKey(assetID))
16563 nc.lastRef = DateTime.Now;
16566 nc.text = SLUtil.ParseNotecardToArray(text);
16568 catch(SLUtil.NotANotecardFormatException)
16570 nc.text =
new string[0];
16572 m_Notecards[assetID] = nc;
16580 return m_Notecards.ContainsKey(assetID);
16586 if (!IsCached(assetID))
16591 m_Notecards[assetID].lastRef = DateTime.Now;
16592 return m_Notecards[assetID].text.Length;
16602 public static string GetLine(UUID assetID,
int lineNumber)
16604 if (lineNumber < 0)
16609 if (!IsCached(assetID))
16614 m_Notecards[assetID].lastRef = DateTime.Now;
16616 if (lineNumber >= m_Notecards[assetID].text.Length)
16619 data = m_Notecards[assetID].text[lineNumber];
16637 public static string GetLine(UUID assetID,
int lineNumber,
int maxLength)
16639 string line = GetLine(assetID, lineNumber);
16641 if (line.Length > maxLength)
16642 line = line.Substring(0, maxLength);
16651 foreach (
UUID key
in new List<UUID>(m_Notecards.Keys))
16654 if (nc.
lastRef.AddSeconds(30) < DateTime.Now)
16655 m_Notecards.Remove(key);
int GetNumberOfSides()
Get the number of sides that this part has.
void SetPos(SceneObjectPart part, LSL_Vector targetPos, bool adjust)
set object position, optionally capping the distance.
LSL_Integer llClearPrimMedia(LSL_Integer face)
void llGiveInventory(string destination, string inventory)
void llShout(int channelID, string text)
void llSetLinkCamera(LSL_Integer link, LSL_Vector eye, LSL_Vector at)
LSL_Vector llGetTextureScale(int side)
LSL_List llGetPrimMediaParams(int face, LSL_List rules)
void llGiveInventoryList(string destination, string category, LSL_List inventory)
void SetScale(SceneObjectPart part, LSL_Vector scale)
LSL_Integer llGiveMoney(string destination, int amount)
void llTeleportAgentHome(string agent)
void llMapDestination(string simname, LSL_Vector pos, LSL_Vector lookAt)
LSL_String llRequestDisplayName(string id)
const int STATUS_ROTATE_X
void llRotTargetRemove(int number)
LSL_String llKey2Name(string id)
OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat LSL_Float
LSL_Vector llGroundNormal(LSL_Vector offset)
OpenSim.Framework.Animation ImplicitDefaultAnimation
LSL_String llRequestURL()
LSL_String llGetPermissionsKey()
LSL_Vector llRot2Left(LSL_Rotation r)
void llOffsetTexture(double u, double v, int face)
const int PARCEL_COUNT_SELECTED
LSL_String llDetectedKey(int number)
LSL_Vector llGetLocalPos()
Quaternion GetWorldRotation()
Gets the rotation of this prim offset by the group rotation
LSL_Integer llGetListLength(LSL_List src)
void llSensorRepeat(string name, string id, int type, double range, double arc, double rate)
LSL_Rotation llGetRot()
See http://lslwiki.net/lslwiki/wakka.php?wakka=ChildRotation
IClientAPI ControllingClient
LSL_String llDumpList2String(LSL_List src, string seperator)
void llSetLinkPrimitiveParams(int linknumber, LSL_List rules)
LSL_String llGetCreator()
LSL_String llDetectedOwner(int number)
OpenSim.Region.ScriptEngine.Shared.LSL_Types.list LSL_List
IEntityInventory Inventory
This part's inventory
LSL_Float llList2Float(LSL_List src, int index)
void llRegionSay(int channelID, string text)
void llClearCameraParams()
void llSetVehicleFloatParam(int param, LSL_Float value)
void llAdjustSoundVolume(double volume)
LSL_Vector llDetectedTouchST(int index)
See http://wiki.secondlife.com/wiki/LlDetectedTouchST for details
LSL_Float llCos(double f)
void llSetColor(LSL_Vector color, int face)
LSL_String llGetLinkKey(int linknum)
const int PARCEL_COUNT_GROUP
LSL_List llGetPhysicsMaterial()
List< SceneObjectPart > GetLinkParts(int linkType)
OpenSim.Region.Framework.Scenes.PrimType PrimType
void llSetPrimitiveParams(LSL_List rules)
void SendFullUpdateToAllClients()
OpenMetaverse.StructuredData.OSDArray OSDArray
Contains all LSL ll-functions. This class will be in Default AppDomain.
void llOwnerSay(string msg)
LSL_Integer llList2Integer(LSL_List src, int index)
OpenSim.Framework.Constants.TeleportFlags TeleportFlags
void llTriggerSound(string sound, double volume)
Handles LSL commands that takes long time and returns an event, for example timers, HTTP requests, etc.
void llRequestPermissions(string agent, int perm)
void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector taper_b, LSL_Vector topshear, byte profileshape, byte pathcurve)
LSL_Integer llGetInventoryPermMask(string itemName, int mask)
int RegionCoordX
The co-ordinate of this region in region units.
LSL_Integer llGetLinkNumber()
LSL_String llGetRegionName()
void llRemoteLoadScript(string target, string name, int running, int start_param)
LSL_Float llFabs(double f)
List< ScenePresence > GetLinkAvatars(int linkType)
void llGroundRepel(double height, int water, double tau)
LSL_List llListReplaceList(LSL_List dest, LSL_List src, int start, int end)
llListReplaceList removes the sub-list defined by the inclusive indices start and end and inserts the...
LSL_Integer llGetSPMaxMemory()
LSL_Integer llSubStringIndex(string source, string pattern)
LSL_List llList2ListStrided(LSL_List src, int start, int end, int stride)
Elements in the source list starting with 0 and then every i+stride. If the stride is negative then t...
const int PRIM_HOLE_DEFAULT
LSL_Integer llGetUnixTime()
void llSensor(string name, string id, int type, double range, double arc)
void SetEntityParams(List< ISceneEntity > entities, LSL_List rules, string originFunc)
LSL_Key llList2Key(LSL_List src, int index)
static readonly LSLInteger RC_REJECT_PHYSICAL
static bool IsCached(UUID assetID)
void ScaleTexture(SceneObjectPart part, double u, double v, int face)
virtual void llSleep(double sec)
void llSetParcelMusicURL(string url)
bool HasAttachments()
Does this avatar have any attachments?
OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString LSL_Key
bool IsTemporary
Is this scene object temporary?
LSL_String llGetAnimation(string id)
void llWhisper(int channelID, string text)
static void Cache(UUID assetID, byte[] text)
void llAddToLandBanList(string avatar, double hours)
void llMakeExplosion(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset)
OpenSim.Framework.RegionInfo RegionInfo
void llLoopSoundMaster(string sound, double volume)
OpenSim.Services.Interfaces.PresenceInfo PresenceInfo
OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger LSL_Integer
const int STATUS_ROTATE_Y
Struct for llCastRay ray hits.
const int PRIM_HOLE_SQUARE
LSL_List llGetAgentList(LSL_Integer scope, LSL_List options)
http://wiki.secondlife.com/wiki/LlGetAgentList The list of options is currently not used in SL scope ...
void llSetObjectPermMask(int mask, int value)
LSL_Integer llDetectedGroup(int number)
LSL_Integer llSetPrimMediaParams(LSL_Integer face, LSL_List rules)
LSL_Integer llListen(int channelID, string name, string ID, string msg)
void llRotateTexture(double rotation, int face)
bool HasScriptedAttachments()
LSL_List llGetObjectDetails(string id, LSL_List args)
void llStartAnimation(string anim)
LSL_String llInsertString(string dest, int index, string src)
Insert string inserts the specified string identified by src at the index indicated by index...
const int GRAVITY_MULTIPLIER
List< LandAccessEntry > ParcelAccessList
List of access data for the parcel. User data, some bitflags, and a time
LSL_Vector llGetColor(int face)
LSL_Vector GetColor(SceneObjectPart part, int face)
PrimType GetPrimType()
Tell us what type this prim is
LSL_Integer llDetectedType(int number)
void llMoveToTarget(LSL_Vector target, double tau)
OpenSim.Framework.PermissionMask PermissionMask
LSL_Vector GetPartLocalPos(SceneObjectPart part)
static string GetLine(UUID assetID, int lineNumber, int maxLength)
Get a notecard line.
LSL_Integer llGetInventoryNumber(int type)
LSL_String llList2Json(LSL_String type, LSL_List values)
bool AttachToAvatar(int attachmentPoint)
Attach the object containing this script to the avatar that owns it.
LSL_String llDetectedName(int number)
LSL_String llList2String(LSL_List src, int index)
PhysicsActor PhysicsActor
Physical scene representation of this Avatar.
LSL_Integer llGetRegionAgentCount()
const int PERMISSION_OVERRIDE_ANIMATIONS
LSL_Float llAngleBetween(LSL_Rotation a, LSL_Rotation b)
void llResetLandPassList()
void llTextBox(string agent, string message, int chatChannel)
void llRezAtRoot(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param)
void llAddToLandPassList(string avatar, double hours)
LSL_Integer llDetectedTouchFace(int index)
See http://wiki.secondlife.com/wiki/LlDetectedTouchFace for details
float ScriptExecutionTime()
A float the value is a representative execution time in milliseconds of all scripts in the link set...
LSL_String llGetParcelMusicURL()
LSL_String llGetInventoryName(int type, int number)
void llSetAngularVelocity(LSL_Vector avel, int local)
OpenSim.Services.Interfaces.GridRegion GridRegion
LSL_List SetAgentParams(ScenePresence sp, LSL_List rules, string originFunc, ref uint rulesParsed)
LSL_Float llRot2Angle(LSL_Rotation rot)
LSL_Integer llDetectedLinkNumber(int number)
void llScriptProfiler(LSL_Integer flags)
void llSetPayPrice(int price, LSL_List quick_pay_buttons)
void llSetVehicleFlags(int flags)
void llDialog(string avatar, string message, LSL_List buttons, int chat_channel)
AvatarAppearance Appearance
OpenMetaverse.StructuredData.OSDMap OSDMap
void llSetLinkTexture(int linknumber, string texture, int face)
LSL_List llGetBoundingBox(string obj)
Full implementation of llGetBoundingBox according to SL 2015-04-15. http://wiki.secondlife.com/wiki/LlGetBoundingBox http://lslwiki.net/lslwiki/wakka.php?wakka=llGetBoundingBox Returns local bounding box of avatar without attachments if target is non-seated avatar or prim/mesh in avatar attachment. Returns local bounding box of object including seated avatars if target is seated avatar or prim/mesh in object. Uses meshing of prims for high accuracy or less accurate box models for speed.
const int PRIM_MEDIA_CONTROLS_MINI
LSL_Float llCloud(LSL_Vector offset)
LSL_List GetPrimitiveParamsEx(LSL_Key prim, LSL_List rules)
LSL_String llGetEnv(LSL_String name)
LSL_Vector GetSetPosTarget(SceneObjectPart part, LSL_Vector targetPos, LSL_Vector fromPos, bool adjust)
void llSetLocalRot(LSL_Rotation rot)
List< ISceneEntity > GetLinkEntities(SceneObjectPart part, int linkType)
const int OPT_LEGACY_LINKSET
LSL_Rotation llGetLocalRot()
LSL_Vector llDetectedPos(int number)
LSL_List GetPrimParams(SceneObjectPart part, LSL_List rules, ref LSL_List res)
LSL_List llGetParcelDetails(LSL_Vector pos, LSL_List param)
void llEjectFromLand(string pest)
void llCollisionSprite(string impact_sprite)
void llSetPos(LSL_Vector pos)
void llSound(string sound, double volume, int queue, int loop)
LSL_Float llFrand(double mag)
const int PARCEL_COUNT_OTHER
int ScriptCount()
Returns the total count of scripts in all parts inventories.
LSL_List llParcelMediaQuery(LSL_List aList)
void llSetVehicleVectorParam(int param, LSL_Vector vec)
LSL_Integer llRound(double f)
A scene object group is conceptually an object in the scene. The object is constituted of SceneObject...
void llCloseRemoteDataChannel(string channel)
void llMakeFountain(int particles, double scale, double vel, double lifetime, double arc, int bounce, string texture, LSL_Vector offset, double bounce_offset)
static int GetLines(UUID assetID)
bool CheckPermissions(UUID npcID, UUID callerID)
Check if the caller has permission to manipulate the given NPC.
void llSetLinkTextureAnim(int linknumber, int mode, int face, int sizex, int sizey, double start, double length, double rate)
void llReleaseCamera(string avatar)
void llPassCollisions(int pass)
LSL_List llCastRayV3(LSL_Vector start, LSL_Vector end, LSL_List options)
Implementation of llCastRay similar to SL 2015-04-21. http://wiki.secondlife.com/wiki/LlCastRay Uses ...
const int PERMISSION_CHANGE_LINKS
Represents an item in a task inventory
LSL_List llGetParcelPrimOwners(LSL_Vector pos)
void llGodLikeRezObject(string inventory, LSL_Vector pos)
sbyte Type
(sbyte) AssetType enum
float ScriptExecutionTime()
A float the value is a representative execution time in milliseconds of all scripts in all attachment...
void llScaleTexture(double u, double v, int face)
virtual LSL_Integer llGetFreeMemory()
LSL_Float llAsin(double val)
const int PERMISSION_TRIGGER_ANIMATION
void llMessageLinked(int linknumber, int num, string msg, string id)
LSL_Integer llGetNumberOfSides()
static string GetLine(UUID assetID, int lineNumber)
Get a notecard line.
LSL_Float llGetRegionFPS()
Returns the value reported in the client Statistics window
LSL_Integer llGetStatus(int status)
LSL_Integer llOverMyLand(string id)
LSL_Float llGetRegionTimeDilation()
const string JSON_INVALID
LSL_Float llAcos(double val)
LSL_Vector llRot2Euler(LSL_Rotation q1)
int RunningScriptCount()
Returns the total count of running scripts in all parts.
void DetachFromAvatar()
Detach the object containing this script from the avatar it is attached to.
LSL_List llParseString2List(string str, LSL_List separators, LSL_List in_spacers)
void llSetLinkAlpha(int linknumber, double alpha, int face)
LSL_Vector llList2Vector(LSL_List src, int index)
LSL_Vector llGetTextureOffset(int face)
const int STATUS_BLOCK_GRAB_OBJECT
void llMakeFire(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset)
LSL_Vector llGetCenterOfMass()
LSL_String llGetInventoryKey(string name)
LSL_String llUnescapeURL(string url)
void llSetAnimationOverride(LSL_String animState, LSL_String anim)
void llLinkParticleSystem(int linknumber, LSL_List rules)
LSL_Integer llGetAttached()
void llSetTouchText(string text)
Struct for llCastRay throttle data.
LSL_Integer llGetLinkNumberOfSides(LSL_Integer link)
LSL_String llGetObjectName()
void llTakeControls(int controls, int accept, int pass_on)
Records user information specific to a grid but which is not part of a user's account.
override Object InitializeLifetimeService()
void llListenRemove(int number)
void llSetObjectDesc(string desc)
LSL_Integer llGetFreeURLs()
LSL_Integer llScriptDanger(LSL_Vector pos)
LSL_String llToLower(string src)
LSL_Vector llWind(LSL_Vector offset)
LSL_String llAvatarOnLinkSitTarget(int linknum)
IScriptEngine m_ScriptEngine
PresenceType
Indicate the type of ScenePresence.
const int PRIM_HOLE_CIRCLE
void llMakeSmoke(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset)
static readonly LSLInteger LSL_STATUS_NOT_FOUND
static readonly LSLInteger RC_GET_LINK_NUM
void llSetHoverHeight(double height, int water, double tau)
Attempt to clamp the object on the Z axis at the given height over tau seconds.
void llSetScriptState(string name, int run)
LSL_Integer llGetScriptState(string name)
OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString LSL_String
void llSetPrimURL(string url)
LSL_Integer llGetParcelMaxPrims(LSL_Vector pos, int sim_wide)
OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString key
LSL_String llGetHTTPHeader(LSL_Key request_id, string header)
LSL_List llGetAnimationList(string id)
LSL_Rotation llList2Rot(LSL_List src, int index)
static List< SceneObjectPart > GetLinkParts(SceneObjectPart part, int linkType)
void SitTarget(SceneObjectPart part, LSL_Vector offset, LSL_Rotation rot)
const int PERMISSION_TRACK_CAMERA
void llLoadURL(string avatar_id, string message, string url)
void llTriggerSoundLimited(string sound, double volume, LSL_Vector top_north_east, LSL_Vector bottom_south_west)
void SetTexture(SceneObjectPart part, string texture, int face)
OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3 LSL_Vector
void llSetStatus(int status, int value)
void llSetVelocity(LSL_Vector vel, int local)
int RegionCoordY
The co-ordinate of this region in region units
virtual void ScriptSleep(int delay)
LSL_Integer llRotTarget(LSL_Rotation rot, double error)
LSL_Integer llListFindList(LSL_List src, LSL_List test)
Returns the index of the first occurrence of test in src.
void llRemoveFromLandPassList(string avatar)
LSL_String llGetDisplayName(string id)
LSL_Integer llGetParcelPrimCount(LSL_Vector pos, int category, int sim_wide)
bool UsesPhysics
Does this scene object use physics?
void SetPrimitiveShapeParams(SceneObjectPart part, string map, int type, byte pathcurve)
LSL_Float llAtan2(double x, double y)
void Initialize(IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item)
Initialize the API
LSL_Rotation llDetectedRot(int number)
LSL_Vector llRot2Axis(LSL_Rotation rot)
Returns the axis of rotation for a quaternion
UUID GlobalID
Global ID for the parcel. (3rd Party Integration)
bool IsDeleted
Signals whether this entity was in a scene but has since been removed from it.
LSL_String llJsonSetValue(LSL_String json, LSL_List specifiers, LSL_String value)
Asset class. All Assets are reference by this class or a class derived from this class ...
const int STATUS_ROTATE_Z
LSL_Vector llRot2Up(LSL_Rotation r)
void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate)
void SetPointLight(SceneObjectPart part, bool light, LSL_Vector color, float intensity, float radius, float falloff)
Set a light point on a part
LSL_Float llTan(double f)
const int PERMISSION_CONTROL_CAMERA
LSL_Vector llDetectedGrab(int number)
void llSetForce(LSL_Vector force, int local)
LSL_Integer llGetAgentInfo(string id)
Not fully implemented yet. Still to do:- AGENT_BUSY Remove as they are done
LSL_List llListSort(LSL_List src, int stride, int ascending)
An interface for a script API module to communicate with the engine it's running under ...
LSL_String llJsonGetValue(LSL_String json, LSL_List specifiers)
Keeps track of a specific piece of land's information
const int INVENTORY_SCRIPT
LSL_List llGetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules)
OpenSim.Framework.AssetLandmark AssetLandmark
void llSetKeyframedMotion(LSL_List frames, LSL_List options)
LSL_String llMD5String(string src, int nonce)
void llAttachToAvatar(int attachmentPoint)
void llPassTouches(int pass)
LSL_String llList2CSV(LSL_List src)
Process the supplied list and return the content of the list formatted as a comma separated list...
int RegionLocX
The location of this region in meters. DANGER DANGER! Note that this name means something different i...
int PrimCount
Number of prims in this group
void llSetRemoteScriptAccessPin(int pin)
LSL_Float llGetTimeOfDay()
static readonly LSLInteger FALSE
void llHTTPResponse(LSL_Key id, int status, string body)
LSL_String GetTexture(SceneObjectPart part, int face)
LSL_Vector llRot2Fwd(LSL_Rotation r)
void llPushObject(string target, LSL_Vector impulse, LSL_Vector ang_impulse, int local)
LSL_Float llGetObjectMass(string id)
void llParcelMediaCommandList(LSL_List commandList)
const int PRIM_MEDIA_CONTROLS_STANDARD
LSL_String llGetLinkName(int linknum)
Returns the name of the child prim or seated avatar matching the specified link number.
LSL_Integer llGetNumberOfPrims()
LSL_Rotation llRotBetween(LSL_Vector a, LSL_Vector b)
LSL_Float llLog(double val)
Vector3 Scale
Change the scale of this part.
void llSetAlpha(double alpha, int face)
void llPlaySound(string sound, double volume)
LSL_Float llGetWallclock()
LSL_Vector llGroundSlope(LSL_Vector offset)
void BreakLink(int linknum)
OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion rotation
UUID GroupID
Unique ID of the Group that owns
OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat LSL_Float
LSL_Integer llGetLinkNumberOfSides(int link)
LSL_Vector llDetectedTouchUV(int index)
See http://wiki.secondlife.com/wiki/LlDetectedTouchUV for details
void llSetCameraParams(LSL_List rules)
LSL_List SetPrimParams(ScenePresence av, LSL_List rules, string originFunc, ref uint rulesParsed)
LSL_Integer llModPow(int a, int b, int c)
RegionFlags
Region flags used internally by OpenSimulator to store installation specific information about region...
LSL_String llTransferLindenDollars(string destination, int amount)
LSL_Integer llGetStartParameter()
TaskInventoryDictionary TaskInventory
const int STATUS_CAST_SHADOWS
void llRemoveInventory(string name)
void llSetPhysicsMaterial(int material_bits, float material_gravity_modifier, float material_restitution, float material_friction, float material_density)
void llSetTorque(LSL_Vector torque, int local)
static readonly LSLInteger RC_REJECT_LAND
List< TaskInventoryItem > GetInventoryItems()
Get all inventory items.
const int STATUS_DIE_AT_EDGE
LSL_List llCSV2List(string src)
The supplied string is scanned for commas and converted into a list. Commas are only effective if the...
void llLookAt(LSL_Vector target, double strength, double damping)
LSL_String llXorBase64Strings(string str1, string str2)
LSL_Integer llSetRegionPos(LSL_Vector pos)
Tries to move the entire object so that the root prim is within 0.1m of position. http://wiki...
override Vector3 AbsolutePosition
Position of this avatar relative to the region the avatar is in
LSL_Integer llManageEstateAccess(int action, string avatar)
void llResetAnimationOverride(LSL_String animState)
void llStopMoveToTarget()
const int PRIM_HOLE_TRIANGLE
void UpdateExtraPhysics(ExtraPhysicsData physdata)
void llSitTarget(LSL_Vector offset, LSL_Rotation rot)
LSL_Integer llCeil(double f)
LSL_List GetPrimParams(ScenePresence avatar, LSL_List rules, ref LSL_List res)
uint AttachmentPoint
Attachment point of this scene object to an avatar.
LSL_List llDeleteSubList(LSL_List src, int start, int end)
void llSetScale(LSL_Vector scale)
void llSetBuoyancy(double buoyancy)
OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger LSL_Integer
Inventory Item - contains all the properties associated with an individual inventory piece...
LSL_String llGetTexture(int face)
LSL_Integer llEdgeOfWorld(LSL_Vector pos, LSL_Vector dir)
ISceneEntity GetLinkEntity(SceneObjectPart part, int linknum)
Get a given link entity from a linkset (linked objects and any sitting avatars).
virtual float AvatarHeight
void llSetTimerEvent(double sec)
LSL_Integer llFloor(double f)
LSL_Integer llBase64ToInteger(string str)
LSL_String llGetSubString(string src, int start, int end)
Return a portion of the designated string bounded by inclusive indices (start and end)...
LSL_String llGetTimestamp()
LSL_Vector llDetectedTouchBinormal(int index)
See http://wiki.secondlife.com/wiki/LlDetectedTouchBinormal for details
void llResetLandBanList()
OpenSim.Region.OptionalModules.Scripting.Minimodule.Object.SculptType SculptType
Quaternion CameraRotation
OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion LSL_Rotation
const int PARCEL_COUNT_TEMP
int RegionLocY
The location of this region in meters. DANGER DANGER! Note that this name means something different i...
LSL_Vector llDetectedTouchNormal(int index)
See http://wiki.secondlife.com/wiki/LlDetectedTouchNormal for details
bool IsPhantom
Is this scene object phantom?
LSL_Float llVecDist(LSL_Vector a, LSL_Vector b)
void SetFullBright(SceneObjectPart part, int face, bool bright)
void llSetDamage(double damage)
const int PERMISSION_TAKE_CONTROLS
static readonly LSLInteger RCERR_CAST_TIME_EXCEEDED
Details of a Parcel of land
void llSetVehicleRotationParam(int param, LSL_Rotation rot)
LSL_Vector llGetGeometricCenter()
virtual byte[] VisualParams
const int PRIM_SHINY_NONE
LSL_String llDeleteSubString(string src, int start, int end)
Delete substring removes the specified substring bounded by the inclusive indices start and end...
void llTargetOmega(LSL_Vector axis, double spinrate, double gain)
void llSetLinkPrimitiveParamsFast(int linknumber, LSL_List rules)
LSL_Vector llGroundContour(LSL_Vector offset)
PhysicsActor PhysActor
The representation of this part in the physics scene.
ScenePresenceAnimator Animator
LSL_List llJson2List(LSL_String json)
LSL_Float llVecMag(LSL_Vector v)
LSL_Vector GetTextureOffset(SceneObjectPart part, int face)
void RotateTexture(SceneObjectPart part, double rotation, int face)
void llLinkSitTarget(LSL_Integer link, LSL_Vector offset, LSL_Rotation rot)
const int PARCEL_COUNT_OWNER
void llResetOtherScript(string name)
static readonly LSLInteger RC_REJECT_NONPHYSICAL
void llSetForceAndTorque(LSL_Vector force, LSL_Vector torque, int local)
LSL_String llAvatarOnSitTarget()
LSL_List llListInsertList(LSL_List dest, LSL_List src, int index)
Insert the list identified by src into the list designated by dest such that the first new element ...
void llPointAt(LSL_Vector pos)
OpenMetaverse.StructuredData.OSD OSD
LSL_Integer llGetListEntryType(LSL_List src, int index)
LSL_Vector llGetSunDirection()
void llRemoveVehicleFlags(int flags)
LSL_String llSHA1String(string src)
LSL_String llRequestSecureURL()
LSL_Integer llClearLinkMedia(LSL_Integer link, LSL_Integer face)
LSL_String llGetAgentLanguage(string id)
LSL_Integer llGetObjectPermMask(int mask)
void llBreakLink(int linknum)
bool IsNPC(UUID agentID, Scene scene)
Check if the agent is an NPC.
LSL_String llRequestUsername(string id)
LSL_String llStringTrim(string src, int type)
LSL_String llHTTPRequest(string url, LSL_List parameters, string body)
LSL_Float llGetAndResetTime()
void llLoopSoundSlave(string sound, double volume)
LSL_String llGetAnimationOverride(LSL_String animState)
static readonly LSLInteger RC_GET_ROOT_KEY
LSL_String llToUpper(string src)
Quaternion Rotation
The rotation of the avatar.
Struct for transmitting parameters required for finding llCastRay ray hits.
LSL_Integer llGetMemoryLimit()
LSL_String llGetUsername(string id)
OpenSim.Region.ScriptEngine.Shared.LSL_Types.list LSL_List
void llListenControl(int number, int active)
LSL_List llParseStringKeepNulls(string src, LSL_List separators, LSL_List spacers)
LSL_Float llGetAlpha(int face)
void WithNotecard(UUID assetID, AssetRequestCallback cb)
LSL_Float llLog10(double val)
LSL_String llRequestInventoryData(string name)
void doObjectRez(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param, bool atRoot)
LSL_Float GetAlpha(SceneObjectPart part, int face)
void llRezObject(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param)
int GetNumberOfSides(SceneObjectPart part)
void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector holesize, LSL_Vector topshear, LSL_Vector profilecut, LSL_Vector taper_a, float revolutions, float radiusoffset, float skew, byte profileshape, byte pathcurve)
int ScriptCount()
Returns a count of the number of scripts in this groups parts.
Interactive OpenSim region server
LSL_Float GetTextureRot(SceneObjectPart part, int face)
HttpInitialRequestStatus
The initial status of the request before it is placed on the wire.
UUID ID
A UUID containing the ID for the inventory node itself
PresenceType PresenceType
LSL_String llJsonValueType(LSL_String json, LSL_List specifiers)
LSL_String llXorBase64StringsCorrect(string str1, string str2)
void llDetachFromAvatar()
LSL_String llRequestAgentData(string id, int data)
LSL_Vector llVecNorm(LSL_Vector v)
SceneObjectGroup ParentGroup
void SetRot(SceneObjectPart part, Quaternion rot)
LSL_Rotation llGetCameraRot()
LSL_Integer llStringLength(string str)
LSL_Float llGround(LSL_Vector offset)
void llSetContentType(LSL_Key id, LSL_Integer type)
OpenSim.Framework.Animation Animation
void llSetRot(LSL_Rotation rot)
LSL_String llGetObjectDesc()
void llCollisionSound(string impact_sound, double impact_volume)
LSL_Integer llSetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules)
void llAllowInventoryDrop(int add)
LSL_Rotation llEuler2Rot(LSL_Vector v)
void llModifyLand(int action, int brush)
LSL_List llGetPrimitiveParams(LSL_List rules)
const int PERMISSION_DEBIT
const int PARCEL_COUNT_TOTAL
LSL_String llGetNotecardLine(string name, int line)
LSL_String llIntegerToBase64(int number)
void llRotLookAt(LSL_Rotation target, double strength, double damping)
const int PRIM_SCULPT_TYPE_SPHERE
LSL_Integer llGetInventoryType(string name)
void llSetClickAction(int action)
LSL_Float llPow(double fbase, double fexponent)
OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger LSLInteger
void SetPrimitiveParamsEx(LSL_Key prim, LSL_List rules, string originFunc)
LSL_String llGetOwnerKey(string id)
LSL_Float llGetTextureRot(int face)
void llLoopSound(string sound, double volume)
TaskInventoryItem m_item
Used for script sleeps when we are using co-operative script termination.
uint ParentID
The parent ID of this part.
LSL_Vector llDetectedVel(int number)
LSL_Float llSin(double f)
const int PERMISSION_ATTACH
LSL_Vector llDetectedTouchPos(int index)
See http://wiki.secondlife.com/wiki/LlDetectedTouchPos for details
bool BlockGrabOverride
If true then grabs are blocked no matter what the individual part BlockGrab setting.
static readonly LSLInteger RCERR_UNKNOWN
void llSetInventoryPermMask(string itemName, int mask, int value)
bool IsGroupOwned
Returns true if the Land Parcel is owned by a group
void llResetScript()
Reset the named script. The script must be present in the same prim.
void llGetNextEmail(string address, string subject)
LSL_Integer llSameGroup(string id)
const int PERMISSION_TELEPORT
void llSay(int channelID, string text)
const int STATUS_RETURN_AT_EDGE
List< ISceneEntity > GetLinkEntities(int linkType)
const int PRIM_TEXGEN_DEFAULT
OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString LSL_String
void llSetVehicleType(int type)
int RunningScriptCount()
Returns a count of the number of running scripts in this groups parts.
uint Flags
Parcel settings. Access flags, Fly, NoPush, Voice, Scripts allowed, etc. ParcelFlags ...
void llPlaySoundSlave(string sound, double volume)
void llSetLinkColor(int linknumber, LSL_Vector color, int face)
void llStopAnimation(string anim)
LSL_String llGetInventoryCreator(string itemName)
LSL_List llList2List(LSL_List src, int start, int end)
void llApplyImpulse(LSL_Vector force, int local)
void llParticleSystem(LSL_List rules)
void SetShiny(SceneObjectPart part, int face, int shiny, Bumpiness bump)
LSL_Rotation llGetRootRotation()
http://lslwiki.net/lslwiki/wakka.php?wakka=llGetRot http://lslwiki.net/lslwiki/wakka.php?wakka=ChildRotation Also tested in sl in regards to the behaviour in attachments/mouselook In the root prim:- Returns the object rotation if not attached Returns the avatars rotation if attached Returns the camera rotation if attached and the avatar is in mouselook
void llCreateLink(string target, int parent)
void llRemoteDataReply(string channel, string message_id, string sdata, int idata)
void llOpenRemoteDataChannel()
LSL_Integer llSetMemoryLimit(LSL_Integer limit)
LSL_Integer llGetPermissions()
LSL_Rotation llAxes2Rot(LSL_Vector fwd, LSL_Vector left, LSL_Vector up)
LSL_String llSendRemoteData(string channel, string dest, int idata, string sdata)
LSL_String llRequestSimulatorData(string simulator, int data)
OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3 LSL_Vector
void llVolumeDetect(int detect)
void llReleaseURL(string url)
void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param)
OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString LSL_Key
Quaternion GetWorldRotation()
Gets the world rotation of this presence.
LSL_List llCastRay(LSL_Vector start, LSL_Vector end, LSL_List options)
void OffsetTexture(SceneObjectPart part, double u, double v, int face)
LSL_Float llSqrt(double f)
void SetColor(SceneObjectPart part, LSL_Vector color, int face)
void llSetCameraAtOffset(LSL_Vector offset)
void llEmail(string address, string subject, string message)
void CreateLink(string target, int parent)
void llTeleportAgentGlobalCoords(string agent, LSL_Vector global_coords, LSL_Vector targetPos, LSL_Vector targetLookAt)
void llMinEventDelay(double delay)
KeyframeMotion KeyframeMotion
const int LINK_ALL_OTHERS
LSL_String llGetSimulatorHostname()
LSL_Integer llGetObjectPrimCount(string object_id)
void SetGlow(SceneObjectPart part, int face, float glow)
virtual LSL_Integer llGetUsedMemory()
LSL_List llGetLinkPrimitiveParams(int linknumber, LSL_List rules)
void llTakeCamera(string avatar)
virtual string Name
The name of this entity
uint GetEffectiveObjectFlags()
const int PRIM_TEXGEN_PLANAR
LSL_List llListRandomize(LSL_List src, int stride)
Randomizes the list, be arbitrarily reordering sublists of stride elements. As the stride approaches ...
Holds all the data required to execute a scripting event.
void llApplyRotationalImpulse(LSL_Vector force, int local)
LSL_Integer llGetRegionFlags()
LSL_Integer llGetParcelFlags(LSL_Vector pos)
void llRemoteDataSetRegion()
LSL_String llGetNumberOfNotecardLines(string name)
void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector dimple, byte profileshape, byte pathcurve)
int LocalID
Internal ID of the parcel. Sometimes the client will try to use this value
void SetTexGen(SceneObjectPart part, int face, int style)
LSL_Float llWater(LSL_Vector offset)
const int PRIM_SCULPT_TYPE_CYLINDER
string resolveName(UUID objecUUID)
const int STATUS_BLOCK_GRAB
void TargetOmega(SceneObjectPart part, LSL_Vector axis, double spinrate, double gain)
LSL_Rotation llAxisAngle2Rot(LSL_Vector axis, double angle)
LSL_String llGetScriptName()
void llSetCameraEyeOffset(LSL_Vector offset)
void llSetTexture(string texture, int face)
OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion LSL_Rotation
LSL_Vector llGetCameraPos()
static readonly LSLInteger RC_REJECT_AGENTS
void SetAlpha(SceneObjectPart part, double alpha, int face)
void llInstantMessage(string user, string message)
void llTeleportAgent(string agent, string destination, LSL_Vector targetPos, LSL_Vector targetLookAt)
void llRegionSayTo(string target, int channel, string msg)
virtual void Sleep(int delay)
Provides methods from manipulating media-on-a-prim
SceneObjectPart ParentPart
If the avatar is sitting, the prim that it's sitting on. If not sitting then null.
void llSoundPreload(string sound)
void llCollisionFilter(string name, string id, int accept)
void llSetText(string text, LSL_Vector color, double alpha)
static readonly LSLInteger RC_GET_NORMAL
LSL_Vector llGetRegionCorner()
OpenSim.Framework.RegionFlags RegionFlags
LSL_Float llListStatistics(int operation, LSL_List src)
const int OBJECT_UNKNOWN_DETAIL
LSL_List SetPrimParams(SceneObjectPart part, LSL_List rules, string originFunc, ref uint rulesParsed)
void SetFlexi(SceneObjectPart part, bool flexi, int softness, float gravity, float friction, float wind, float tension, LSL_Vector Force)
Set flexi parameters of a part.
void llSetSoundRadius(double radius)
LSL_Vector llGetAgentSize(string id)
According to http://lslwiki.net/lslwiki/wakka.php?wakka=llGetAgentSize only the height of avatars var...
void llRemoveFromLandBanList(string avatar)
void llTargetRemove(int number)
LSL_Vector llGetRootPosition()
static Dictionary< string, UUID > AnimsUUID
Primitive.ParticleSystem getNewParticleSystemWithSLDefaultValues()
LSL_Float llGetGMTclock()
System.Timers.Timer Timer
bool IsAttachment
Is this scene object acting as an attachment?
LSL_String llGetLandOwnerAt(LSL_Vector pos)
void llForceMouselook(int mouselook)
LSL_String llStringToBase64(string str)
LSL_Integer llTarget(LSL_Vector position, double range)
void llSetSoundQueueing(int queue)
Quaternion RotationOffset
void state(string newState)
void llPreloadSound(string sound)
const int LINK_ALL_CHILDREN
ObjectShapePacket.ObjectDataBlock SetPrimitiveBlockShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, byte profileshape, byte pathcurve)
LSL_String llEscapeURL(string url)
uint ParentID
If the avatar is sitting, the local ID of the prim that it's sitting on. If not sitting then zero...
void llSetSitText(string text)
void llSetObjectName(string name)
UUID OwnerID
Owner Avatar or Group of the parcel. Naturally, all land masses must be owned by someone ...
LSL_String llBase64ToString(string str)