diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
4 files changed, 77 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 958527a..fd4c7ad 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -7632,6 +7632,36 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7632 | } | 7632 | } |
7633 | } | 7633 | } |
7634 | 7634 | ||
7635 | private void SetPhysicsMaterial(SceneObjectPart part, int material_bits, | ||
7636 | float material_density, float material_friction, | ||
7637 | float material_restitution, float material_gravity_modifier) | ||
7638 | { | ||
7639 | ExtraPhysicsData physdata = new ExtraPhysicsData(); | ||
7640 | physdata.PhysShapeType = (PhysShapeType)part.PhysicsShapeType; | ||
7641 | physdata.Density = part.Density; | ||
7642 | physdata.Friction = part.Friction; | ||
7643 | physdata.Bounce = part.Bounciness; | ||
7644 | physdata.GravitationModifier = part.GravityModifier; | ||
7645 | |||
7646 | if ((material_bits & (int)ScriptBaseClass.DENSITY) != 0) | ||
7647 | physdata.Density = material_density; | ||
7648 | if ((material_bits & (int)ScriptBaseClass.FRICTION) != 0) | ||
7649 | physdata.Friction = material_friction; | ||
7650 | if ((material_bits & (int)ScriptBaseClass.RESTITUTION) != 0) | ||
7651 | physdata.Bounce = material_restitution; | ||
7652 | if ((material_bits & (int)ScriptBaseClass.GRAVITY_MULTIPLIER) != 0) | ||
7653 | physdata.GravitationModifier = material_gravity_modifier; | ||
7654 | |||
7655 | part.UpdateExtraPhysics(physdata); | ||
7656 | } | ||
7657 | |||
7658 | public void llSetPhysicsMaterial(int material_bits, | ||
7659 | float material_gravity_modifier, float material_restitution, | ||
7660 | float material_friction, float material_density) | ||
7661 | { | ||
7662 | SetPhysicsMaterial(m_host, material_bits, material_density, material_friction, material_restitution, material_gravity_modifier); | ||
7663 | } | ||
7664 | |||
7635 | public void llSetLinkPrimitiveParams(int linknumber, LSL_List rules) | 7665 | public void llSetLinkPrimitiveParams(int linknumber, LSL_List rules) |
7636 | { | 7666 | { |
7637 | llSetLinkPrimitiveParamsFast(linknumber, rules); | 7667 | llSetLinkPrimitiveParamsFast(linknumber, rules); |
@@ -8043,6 +8073,36 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8043 | part.ScriptSetPhysicsStatus(physics); | 8073 | part.ScriptSetPhysicsStatus(physics); |
8044 | break; | 8074 | break; |
8045 | 8075 | ||
8076 | case (int)ScriptBaseClass.PRIM_PHYSICS_SHAPE_TYPE: | ||
8077 | if (remain < 1) | ||
8078 | return; | ||
8079 | |||
8080 | int shape_type = rules.GetLSLIntegerItem(idx++); | ||
8081 | |||
8082 | ExtraPhysicsData physdata = new ExtraPhysicsData(); | ||
8083 | physdata.Density = part.Density; | ||
8084 | physdata.Bounce = part.Bounciness; | ||
8085 | physdata.GravitationModifier = part.GravityModifier; | ||
8086 | physdata.PhysShapeType = (PhysShapeType)shape_type; | ||
8087 | |||
8088 | part.UpdateExtraPhysics(physdata); | ||
8089 | |||
8090 | break; | ||
8091 | |||
8092 | case (int)ScriptBaseClass.PRIM_PHYSICS_MATERIAL: | ||
8093 | if (remain < 5) | ||
8094 | return; | ||
8095 | |||
8096 | int material_bits = rules.GetLSLIntegerItem(idx++); | ||
8097 | float material_density = (float)rules.GetLSLFloatItem(idx++); | ||
8098 | float material_friction = (float)rules.GetLSLFloatItem(idx++); | ||
8099 | float material_restitution = (float)rules.GetLSLFloatItem(idx++); | ||
8100 | float material_gravity_modifier = (float)rules.GetLSLFloatItem(idx++); | ||
8101 | |||
8102 | SetPhysicsMaterial(part, material_bits, material_density, material_friction, material_restitution, material_gravity_modifier); | ||
8103 | |||
8104 | break; | ||
8105 | |||
8046 | case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ: | 8106 | case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ: |
8047 | if (remain < 1) | 8107 | if (remain < 1) |
8048 | return; | 8108 | return; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 8d97a7c..b976dc3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | |||
@@ -417,6 +417,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
417 | LSL_String llXorBase64Strings(string str1, string str2); | 417 | LSL_String llXorBase64Strings(string str1, string str2); |
418 | LSL_String llXorBase64StringsCorrect(string str1, string str2); | 418 | LSL_String llXorBase64StringsCorrect(string str1, string str2); |
419 | LSL_Integer llGetLinkNumberOfSides(LSL_Integer link); | 419 | LSL_Integer llGetLinkNumberOfSides(LSL_Integer link); |
420 | void llSetPhysicsMaterial(int material_bits, float material_gravity_modifier, float material_restitution, float material_friction, float material_density); | ||
420 | 421 | ||
421 | void SetPrimitiveParamsEx(LSL_Key prim, LSL_List rules); | 422 | void SetPrimitiveParamsEx(LSL_Key prim, LSL_List rules); |
422 | LSL_List GetLinkPrimitiveParamsEx(LSL_Key prim, LSL_List rules); | 423 | LSL_List GetLinkPrimitiveParamsEx(LSL_Key prim, LSL_List rules); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index ba75253..4ce3cf1 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs | |||
@@ -570,6 +570,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
570 | public const int PRIM_MEDIA_PERM_OWNER = 1; | 570 | public const int PRIM_MEDIA_PERM_OWNER = 1; |
571 | public const int PRIM_MEDIA_PERM_GROUP = 2; | 571 | public const int PRIM_MEDIA_PERM_GROUP = 2; |
572 | public const int PRIM_MEDIA_PERM_ANYONE = 4; | 572 | public const int PRIM_MEDIA_PERM_ANYONE = 4; |
573 | |||
574 | public const int PRIM_PHYSICS_SHAPE_TYPE = 30; | ||
575 | public const int PRIM_PHYSICS_SHAPE_PRIM = 0; | ||
576 | public const int PRIM_PHYSICS_SHAPE_CONVEX = 2; | ||
577 | public const int PRIM_PHYSICS_SHAPE_NONE = 1; | ||
578 | |||
579 | public const int PRIM_PHYSICS_MATERIAL = 31; | ||
580 | public const int DENSITY = 1; | ||
581 | public const int FRICTION = 2; | ||
582 | public const int RESTITUTION = 4; | ||
583 | public const int GRAVITY_MULTIPLIER = 8; | ||
573 | 584 | ||
574 | // extra constants for llSetPrimMediaParams | 585 | // extra constants for llSetPrimMediaParams |
575 | public static readonly LSLInteger LSL_STATUS_OK = new LSLInteger(0); | 586 | public static readonly LSLInteger LSL_STATUS_OK = new LSLInteger(0); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index a8d1ddb..bf58d13 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | |||
@@ -1949,5 +1949,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
1949 | { | 1949 | { |
1950 | m_LSL_Functions.llSetKeyframedMotion(frames, options); | 1950 | m_LSL_Functions.llSetKeyframedMotion(frames, options); |
1951 | } | 1951 | } |
1952 | |||
1953 | public void llSetPhysicsMaterial(int material_bits, float material_gravity_modifier, float material_restitution, float material_friction, float material_density) | ||
1954 | { | ||
1955 | m_LSL_Functions.llSetPhysicsMaterial(material_bits, material_gravity_modifier, material_restitution, material_friction, material_density); | ||
1956 | } | ||
1952 | } | 1957 | } |
1953 | } | 1958 | } |