diff options
author | Melanie | 2012-08-24 00:16:58 +0100 |
---|---|---|
committer | Melanie | 2012-08-24 00:16:58 +0100 |
commit | 1747030d19dce124805d70847cff88dcf0a76b07 (patch) | |
tree | f24fbd4eaa00fd75cd6f579e16368ea0be68fcb3 /OpenSim | |
parent | Fix bad child prim permissions that can make objects change perms after rezzing (diff) | |
parent | implementing function to allow scripts to self-replicate as if the owner dupl... (diff) | |
download | opensim-SC-1747030d19dce124805d70847cff88dcf0a76b07.zip opensim-SC-1747030d19dce124805d70847cff88dcf0a76b07.tar.gz opensim-SC-1747030d19dce124805d70847cff88dcf0a76b07.tar.bz2 opensim-SC-1747030d19dce124805d70847cff88dcf0a76b07.tar.xz |
Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim
Diffstat (limited to 'OpenSim')
3 files changed, 80 insertions, 1 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 1e8b51b..119c2ac 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -2895,6 +2895,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2895 | } | 2895 | } |
2896 | }); | 2896 | }); |
2897 | } | 2897 | } |
2898 | |||
2899 | public LSL_Float osGetHealth(string avatar) | ||
2900 | { | ||
2901 | CheckThreatLevel(ThreatLevel.None, "osGetHealth"); | ||
2902 | m_host.AddScriptLPS(1); | ||
2903 | |||
2904 | LSL_Float health = new LSL_Float(-1); | ||
2905 | ScenePresence presence = World.GetScenePresence(new UUID(avatar)); | ||
2906 | if (presence != null) health = presence.Health; | ||
2907 | return health; | ||
2908 | } | ||
2898 | 2909 | ||
2899 | public void osCauseDamage(string avatar, double damage) | 2910 | public void osCauseDamage(string avatar, double damage) |
2900 | { | 2911 | { |
@@ -3333,5 +3344,55 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3333 | 3344 | ||
3334 | return new LSL_Key(m_host.ParentGroup.FromPartID.ToString()); | 3345 | return new LSL_Key(m_host.ParentGroup.FromPartID.ToString()); |
3335 | } | 3346 | } |
3347 | |||
3348 | public void osRezDuplicate(LSL_Vector offset, LSL_Rotation rot) | ||
3349 | { | ||
3350 | CheckThreatLevel(ThreatLevel.High, "osRezDuplicate"); | ||
3351 | m_host.AddScriptLPS(1); | ||
3352 | |||
3353 | Vector3 v = new Vector3((float)offset.x, (float)offset.y, (float)offset.z); | ||
3354 | Quaternion r = new Quaternion( | ||
3355 | (float)rot.x, | ||
3356 | (float)rot.y, | ||
3357 | (float)rot.z, | ||
3358 | (float)rot.s | ||
3359 | ); | ||
3360 | |||
3361 | Vector3 destination = m_host.ParentGroup.AbsolutePosition + v; | ||
3362 | |||
3363 | if (!World.Permissions.CanRezObject( | ||
3364 | m_host.ParentGroup.PrimCount, | ||
3365 | m_host.OwnerID, | ||
3366 | destination | ||
3367 | )) | ||
3368 | { | ||
3369 | OSSLShoutError("Cannot duplicate object to destination, owner cannot rez objects at destination parcel."); | ||
3370 | |||
3371 | ScriptSleep(100); | ||
3372 | } | ||
3373 | else | ||
3374 | { | ||
3375 | SceneObjectGroup duplicate = World.SceneGraph.DuplicateObject( | ||
3376 | m_host.ParentGroup.LocalId, | ||
3377 | v, | ||
3378 | m_host.ParentGroup.RootPart.GetEffectiveObjectFlags(), | ||
3379 | m_host.OwnerID, | ||
3380 | m_host.GroupID, | ||
3381 | r | ||
3382 | ); | ||
3383 | |||
3384 | m_ScriptEngine.PostObjectEvent(m_host.LocalId, new EventParams( | ||
3385 | "object_rez", new Object[] { | ||
3386 | new LSL_String( | ||
3387 | duplicate.RootPart.UUID.ToString()) }, | ||
3388 | new DetectParams[0])); | ||
3389 | |||
3390 | ScriptSleep(100); | ||
3391 | m_ScriptEngine.PostObjectEvent(duplicate.LocalId, new EventParams( | ||
3392 | "on_rez", new Object[]{ | ||
3393 | new LSL_Integer(0)}, | ||
3394 | new DetectParams[0])); | ||
3395 | } | ||
3396 | } | ||
3336 | } | 3397 | } |
3337 | } \ No newline at end of file | 3398 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 1f000a3..8c90df4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | |||
@@ -258,6 +258,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
258 | int osGetSimulatorMemory(); | 258 | int osGetSimulatorMemory(); |
259 | void osKickAvatar(string FirstName,string SurName,string alert); | 259 | void osKickAvatar(string FirstName,string SurName,string alert); |
260 | void osSetSpeed(string UUID, LSL_Float SpeedModifier); | 260 | void osSetSpeed(string UUID, LSL_Float SpeedModifier); |
261 | LSL_Float osGetHealth(string avatar); | ||
261 | void osCauseHealing(string avatar, double healing); | 262 | void osCauseHealing(string avatar, double healing); |
262 | void osCauseDamage(string avatar, double damage); | 263 | void osCauseDamage(string avatar, double damage); |
263 | LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules); | 264 | LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules); |
@@ -305,5 +306,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
305 | /// </summary> | 306 | /// </summary> |
306 | /// <returns>Rezzing object key or NULL_KEY if rezzed by agent or otherwise unknown.</returns> | 307 | /// <returns>Rezzing object key or NULL_KEY if rezzed by agent or otherwise unknown.</returns> |
307 | LSL_Key osGetRezzingObject(); | 308 | LSL_Key osGetRezzingObject(); |
309 | |||
310 | /// <summary> | ||
311 | /// Duplicates an object as if the owner duplicated it. | ||
312 | /// </summary> | ||
313 | /// <param name="offset"></param> | ||
314 | /// <param name="rot"></param> | ||
315 | void osRezDuplicate(vector offset, rotation rot); | ||
308 | } | 316 | } |
309 | } | 317 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 94405d2..9a2f859 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -865,7 +865,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
865 | { | 865 | { |
866 | m_OSSL_Functions.osSetSpeed(UUID, SpeedModifier); | 866 | m_OSSL_Functions.osSetSpeed(UUID, SpeedModifier); |
867 | } | 867 | } |
868 | 868 | ||
869 | public LSL_Float osGetHealth(string avatar) | ||
870 | { | ||
871 | return m_OSSL_Functions.osGetHealth(avatar); | ||
872 | } | ||
873 | |||
869 | public void osCauseDamage(string avatar, double damage) | 874 | public void osCauseDamage(string avatar, double damage) |
870 | { | 875 | { |
871 | m_OSSL_Functions.osCauseDamage(avatar, damage); | 876 | m_OSSL_Functions.osCauseDamage(avatar, damage); |
@@ -950,5 +955,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
950 | { | 955 | { |
951 | return m_OSSL_Functions.osGetRezzingObject(); | 956 | return m_OSSL_Functions.osGetRezzingObject(); |
952 | } | 957 | } |
958 | |||
959 | public void osRezDuplicate(vector offset, rotation rot) | ||
960 | { | ||
961 | m_OSSL_Functions.osRezDuplicate(offset, rot); | ||
962 | } | ||
953 | } | 963 | } |
954 | } | 964 | } |