diff options
author | Justin Clark-Casey (justincc) | 2011-10-27 02:06:59 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-10-27 02:06:59 +0100 |
commit | 2db6a8ce8f8c600eb660aa9f47e08e12693923b2 (patch) | |
tree | 212df09dbc12e031034b630e7c455bc30b3dbb5b /OpenSim | |
parent | Fix a bug I introduced yesterday in ODE physics where prim scripts would only... (diff) | |
parent | Merge branch 'master' of /home/opensim/var/repo/opensim (diff) | |
download | opensim-SC_OLD-2db6a8ce8f8c600eb660aa9f47e08e12693923b2.zip opensim-SC_OLD-2db6a8ce8f8c600eb660aa9f47e08e12693923b2.tar.gz opensim-SC_OLD-2db6a8ce8f8c600eb660aa9f47e08e12693923b2.tar.bz2 opensim-SC_OLD-2db6a8ce8f8c600eb660aa9f47e08e12693923b2.tar.xz |
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim')
3 files changed, 93 insertions, 14 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index b8e9878..82701ce 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -3325,12 +3325,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3325 | public void llTargetOmega(LSL_Vector axis, double spinrate, double gain) | 3325 | public void llTargetOmega(LSL_Vector axis, double spinrate, double gain) |
3326 | { | 3326 | { |
3327 | m_host.AddScriptLPS(1); | 3327 | m_host.AddScriptLPS(1); |
3328 | m_host.AngularVelocity = new Vector3((float)(axis.x * spinrate), (float)(axis.y * spinrate), (float)(axis.z * spinrate)); | 3328 | TargetOmega(m_host, axis, spinrate, gain); |
3329 | m_host.ScheduleTerseUpdate(); | ||
3330 | m_host.SendTerseUpdateToAllClients(); | ||
3331 | m_host.ParentGroup.HasGroupChanged = true; | ||
3332 | } | 3329 | } |
3333 | 3330 | ||
3331 | protected void TargetOmega(SceneObjectPart part, LSL_Vector axis, double spinrate, double gain) | ||
3332 | { | ||
3333 | part.AngularVelocity = new Vector3((float)(axis.x * spinrate), (float)(axis.y * spinrate), (float)(axis.z * spinrate)); | ||
3334 | part.ScheduleTerseUpdate(); | ||
3335 | part.SendTerseUpdateToAllClients(); | ||
3336 | part.ParentGroup.HasGroupChanged = true; | ||
3337 | } | ||
3338 | |||
3334 | public LSL_Integer llGetStartParameter() | 3339 | public LSL_Integer llGetStartParameter() |
3335 | { | 3340 | { |
3336 | m_host.AddScriptLPS(1); | 3341 | m_host.AddScriptLPS(1); |
@@ -7014,10 +7019,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7014 | { | 7019 | { |
7015 | m_host.AddScriptLPS(1); | 7020 | m_host.AddScriptLPS(1); |
7016 | 7021 | ||
7017 | List<SceneObjectPart> parts = GetLinkParts(linknumber); | 7022 | setLinkPrimParams(linknumber, rules); |
7018 | |||
7019 | foreach (SceneObjectPart part in parts) | ||
7020 | SetPrimParams(part, rules); | ||
7021 | 7023 | ||
7022 | ScriptSleep(200); | 7024 | ScriptSleep(200); |
7023 | } | 7025 | } |
@@ -7026,6 +7028,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7026 | { | 7028 | { |
7027 | m_host.AddScriptLPS(1); | 7029 | m_host.AddScriptLPS(1); |
7028 | 7030 | ||
7031 | setLinkPrimParams(linknumber, rules); | ||
7032 | } | ||
7033 | |||
7034 | protected void setLinkPrimParams(int linknumber, LSL_List rules) | ||
7035 | { | ||
7029 | List<SceneObjectPart> parts = GetLinkParts(linknumber); | 7036 | List<SceneObjectPart> parts = GetLinkParts(linknumber); |
7030 | 7037 | ||
7031 | foreach (SceneObjectPart part in parts) | 7038 | foreach (SceneObjectPart part in parts) |
@@ -7395,6 +7402,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7395 | LSL_Rotation lr = rules.GetQuaternionItem(idx++); | 7402 | LSL_Rotation lr = rules.GetQuaternionItem(idx++); |
7396 | SetRot(part, Rot2Quaternion(lr)); | 7403 | SetRot(part, Rot2Quaternion(lr)); |
7397 | break; | 7404 | break; |
7405 | case (int)ScriptBaseClass.PRIM_OMEGA: | ||
7406 | if (remain < 3) | ||
7407 | return; | ||
7408 | LSL_Vector axis = rules.GetVector3Item(idx++); | ||
7409 | LSL_Float spinrate = rules.GetLSLFloatItem(idx++); | ||
7410 | LSL_Float gain = rules.GetLSLFloatItem(idx++); | ||
7411 | TargetOmega(part, axis, (double)spinrate, (double)gain); | ||
7412 | break; | ||
7413 | case (int)ScriptBaseClass.PRIM_LINK_TARGET: | ||
7414 | if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. | ||
7415 | return; | ||
7416 | LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++); | ||
7417 | LSL_List new_rules = rules.GetSublist(idx, -1); | ||
7418 | setLinkPrimParams((int)new_linknumber, new_rules); | ||
7419 | return; | ||
7398 | } | 7420 | } |
7399 | } | 7421 | } |
7400 | } | 7422 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 52d787d..3cfc3c9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -113,11 +113,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
113 | { | 113 | { |
114 | public List<UUID> AllowedCreators; | 114 | public List<UUID> AllowedCreators; |
115 | public List<UUID> AllowedOwners; | 115 | public List<UUID> AllowedOwners; |
116 | public List<string> AllowedOwnerClasses; | ||
116 | 117 | ||
117 | public FunctionPerms() | 118 | public FunctionPerms() |
118 | { | 119 | { |
119 | AllowedCreators = new List<UUID>(); | 120 | AllowedCreators = new List<UUID>(); |
120 | AllowedOwners = new List<UUID>(); | 121 | AllowedOwners = new List<UUID>(); |
122 | AllowedOwnerClasses = new List<string>(); | ||
121 | } | 123 | } |
122 | } | 124 | } |
123 | 125 | ||
@@ -245,6 +247,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
245 | // Default behavior | 247 | // Default behavior |
246 | perms.AllowedOwners = null; | 248 | perms.AllowedOwners = null; |
247 | perms.AllowedCreators = null; | 249 | perms.AllowedCreators = null; |
250 | perms.AllowedOwnerClasses = null; | ||
248 | } | 251 | } |
249 | else | 252 | else |
250 | { | 253 | { |
@@ -265,12 +268,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
265 | foreach (string id in ids) | 268 | foreach (string id in ids) |
266 | { | 269 | { |
267 | string current = id.Trim(); | 270 | string current = id.Trim(); |
268 | UUID uuid; | 271 | if (current.ToUpper() == "PARCEL_GROUP_MEMBER" || current.ToUpper() == "PARCEL_OWNER" || current.ToUpper() == "ESTATE_MANAGER" || current.ToUpper() == "ESTATE_OWNER") |
269 | |||
270 | if (UUID.TryParse(current, out uuid)) | ||
271 | { | 272 | { |
272 | if (uuid != UUID.Zero) | 273 | if (!perms.AllowedOwnerClasses.Contains(current)) |
273 | perms.AllowedOwners.Add(uuid); | 274 | perms.AllowedOwnerClasses.Add(current.ToUpper()); |
275 | } | ||
276 | else | ||
277 | { | ||
278 | UUID uuid; | ||
279 | |||
280 | if (UUID.TryParse(current, out uuid)) | ||
281 | { | ||
282 | if (uuid != UUID.Zero) | ||
283 | perms.AllowedOwners.Add(uuid); | ||
284 | } | ||
274 | } | 285 | } |
275 | } | 286 | } |
276 | 287 | ||
@@ -326,11 +337,55 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
326 | String.Format("{0} permission error. Can't find script in prim inventory.", | 337 | String.Format("{0} permission error. Can't find script in prim inventory.", |
327 | function)); | 338 | function)); |
328 | } | 339 | } |
340 | |||
341 | UUID ownerID = ti.OwnerID; | ||
342 | |||
343 | //OSSL only may be used if objet is in the same group as the parcel | ||
344 | if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("PARCEL_GROUP_MEMBER")) | ||
345 | { | ||
346 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | ||
347 | |||
348 | if (land.LandData.GroupID == ti.GroupID && land.LandData.GroupID != UUID.Zero) | ||
349 | { | ||
350 | return; | ||
351 | } | ||
352 | } | ||
353 | |||
354 | //Only Parcelowners may use the function | ||
355 | if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("PARCEL_OWNER")) | ||
356 | { | ||
357 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | ||
358 | |||
359 | if (land.LandData.OwnerID == ownerID) | ||
360 | { | ||
361 | return; | ||
362 | } | ||
363 | } | ||
364 | |||
365 | //Only Estate Managers may use the function | ||
366 | if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("ESTATE_MANAGER")) | ||
367 | { | ||
368 | //Only Estate Managers may use the function | ||
369 | if (World.RegionInfo.EstateSettings.IsEstateManager(ownerID) && World.RegionInfo.EstateSettings.EstateOwner != ownerID) | ||
370 | { | ||
371 | return; | ||
372 | } | ||
373 | } | ||
374 | |||
375 | //Only regionowners may use the function | ||
376 | if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("ESTATE_OWNER")) | ||
377 | { | ||
378 | if (World.RegionInfo.EstateSettings.EstateOwner == ownerID) | ||
379 | { | ||
380 | return; | ||
381 | } | ||
382 | } | ||
383 | |||
329 | if (!m_FunctionPerms[function].AllowedCreators.Contains(ti.CreatorID)) | 384 | if (!m_FunctionPerms[function].AllowedCreators.Contains(ti.CreatorID)) |
330 | OSSLError( | 385 | OSSLError( |
331 | String.Format("{0} permission denied. Script creator is not in the list of users allowed to execute this function and prim owner also has no permission.", | 386 | String.Format("{0} permission denied. Script creator is not in the list of users allowed to execute this function and prim owner also has no permission.", |
332 | function)); | 387 | function)); |
333 | if (ti.CreatorID != ti.OwnerID) | 388 | if (ti.CreatorID != ownerID) |
334 | { | 389 | { |
335 | if ((ti.CurrentPermissions & (uint)PermissionMask.Modify) != 0) | 390 | if ((ti.CurrentPermissions & (uint)PermissionMask.Modify) != 0) |
336 | OSSLError( | 391 | OSSLError( |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index 4b008a4..ce4661c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs | |||
@@ -321,6 +321,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
321 | public const int PRIM_NAME = 27; | 321 | public const int PRIM_NAME = 27; |
322 | public const int PRIM_DESC = 28; | 322 | public const int PRIM_DESC = 28; |
323 | public const int PRIM_ROT_LOCAL = 29; | 323 | public const int PRIM_ROT_LOCAL = 29; |
324 | public const int PRIM_OMEGA = 32; | ||
325 | public const int PRIM_LINK_TARGET = 34; | ||
324 | public const int PRIM_TEXGEN_DEFAULT = 0; | 326 | public const int PRIM_TEXGEN_DEFAULT = 0; |
325 | public const int PRIM_TEXGEN_PLANAR = 1; | 327 | public const int PRIM_TEXGEN_PLANAR = 1; |
326 | 328 | ||