コード例 #1
0
        public void llLinkSitTarget(LSL_Integer link, LSL_Vector offset, LSL_Rotation rot)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return;

            // LSL quaternions can normalize to 0, normal Quaternions can't.
            if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0)
                rot.z = 1; // ZERO_ROTATION = 0,0,0,1

            List<ISceneChildEntity> entities = GetLinkParts(link);
            if (entities.Count == 0)
                return;

            entities[0].SitTargetPosition = new Vector3((float) offset.x, (float) offset.y, (float) offset.z);
            entities[0].SitTargetOrientation = Rot2Quaternion(rot);
        }
コード例 #2
0
        public void llSitTarget(LSL_Vector offset, LSL_Rotation rot)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return;

            // LSL quaternions can normalize to 0, normal Quaternions can't.
            if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0)
                rot.z = 1; // ZERO_ROTATION = 0,0,0,1

            m_host.SitTargetPosition = new Vector3((float) offset.x, (float) offset.y, (float) offset.z);
            m_host.SitTargetOrientation = Rot2Quaternion(rot);
        }
コード例 #3
0
        public void llTargetOmega(LSL_Vector axis, LSL_Float spinrate, LSL_Float gain)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return;

            m_host.OmegaAxis = new Vector3((float) axis.x, (float) axis.y, (float) axis.z);
            m_host.OmegaGain = gain;
            m_host.OmegaSpinRate = spinrate;

            m_host.GenerateRotationalVelocityFromOmega();
            ScriptData script = ScriptProtection.GetScript(m_itemID);
            if (script != null)
                script.TargetOmegaWasSet = true;
            m_host.ScheduleTerseUpdate();
            //m_host.SendTerseUpdateToAllClients();
        }
コード例 #4
0
        public void llSetText(string text, LSL_Vector color, LSL_Float alpha)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return;

            Vector3 av3 = new Vector3(Util.Clip((float) color.x, 0.0f, 1.0f),
                                      Util.Clip((float) color.y, 0.0f, 1.0f),
                                      Util.Clip((float) color.z, 0.0f, 1.0f));
            m_host.SetText(text.Length > 254 ? text.Remove(254) : text, av3, Util.Clip((float) alpha, 0.0f, 1.0f));
            //m_host.ParentGroup.HasGroupChanged = true;
            //m_host.ParentGroup.ScheduleGroupForFullUpdate();
        }
コード例 #5
0
        public void llSetVehicleVectorParam(int param, LSL_Vector vec)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return;

            if (m_host.ParentEntity != null)
            {
                if (!m_host.ParentEntity.IsDeleted)
                {
                    m_host.ParentEntity.RootChild.SetVehicleVectorParam(param,
                                                                        new Vector3((float) vec.x, (float) vec.y,
                                                                                    (float) vec.z));
                }
            }
        }
コード例 #6
0
        public void llSetLinkColor(int linknumber, LSL_Vector color, int face)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return;

            List<ISceneChildEntity> parts = GetLinkParts(linknumber);

            foreach (ISceneChildEntity part in parts)
                part.SetFaceColor(new Vector3((float) color.x, (float) color.y, (float) color.z), face);
        }
コード例 #7
0
        public LSL_Integer llSetRegionPos(LSL_Vector pos)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
                return ScriptBaseClass.FALSE;

            SetPos(m_host, pos, false);

            return ScriptBaseClass.TRUE;
        }
コード例 #8
0
 public void llPointAt(LSL_Vector pos)
 {
 }
コード例 #9
0
        public void llPushObject(string target, LSL_Vector impulse, LSL_Vector ang_impulse, int local)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return;

            bool pushAllowed = false;

            bool pusheeIsAvatar = false;
            UUID targetID = UUID.Zero;

            if (!UUID.TryParse(target, out targetID))
                return;

            IScenePresence pusheeav = null;
            Vector3 PusheePos = Vector3.Zero;
            ISceneChildEntity pusheeob = null;

            IScenePresence avatar = World.GetScenePresence(targetID);
            if (avatar != null)
            {
                pusheeIsAvatar = true;

                // Pushee is in GodMode this pushing object isn't owned by them
                if (avatar.GodLevel > 0 && m_host.OwnerID != targetID)
                    return;

                pusheeav = avatar;

                // Find pushee position
                // Pushee Linked?
                if (pusheeav.ParentID != UUID.Zero)
                {
                    ISceneChildEntity parentobj = World.GetSceneObjectPart(pusheeav.ParentID);
                    PusheePos = parentobj != null ? parentobj.AbsolutePosition : pusheeav.AbsolutePosition;
                }
                else
                {
                    PusheePos = pusheeav.AbsolutePosition;
                }
            }

            if (!pusheeIsAvatar)
            {
                // not an avatar so push is not affected by parcel flags
                pusheeob = World.GetSceneObjectPart(UUID.Parse(target));

                // We can't find object
                if (pusheeob == null)
                    return;

                // Object not pushable.  Not an attachment and has no physics component
                if (!pusheeob.IsAttachment && pusheeob.PhysActor == null)
                    return;

                PusheePos = pusheeob.AbsolutePosition;
                pushAllowed = true;
            }
            else
            {
                IParcelManagementModule parcelManagement = World.RequestModuleInterface<IParcelManagementModule>();
                if (World.RegionInfo.RegionSettings.RestrictPushing)
                {
                    pushAllowed = m_host.OwnerID == targetID ||
                                  m_host.ParentEntity.Scene.Permissions.IsGod(m_host.OwnerID);
                }
                else
                {
                    if (parcelManagement != null)
                    {
                        ILandObject targetlandObj = parcelManagement.GetLandObject(PusheePos.X, PusheePos.Y);
                        if (targetlandObj == null)
                            // We didn't find the parcel but region isn't push restricted so assume it's ok
                            pushAllowed = true;
                        else
                        {
                            // Parcel push restriction
                            pushAllowed = (targetlandObj.LandData.Flags & (uint) ParcelFlags.RestrictPushObject) !=
                                          (uint) ParcelFlags.RestrictPushObject ||
                                          m_host.ParentEntity.Scene.Permissions.CanPushObject(m_host.OwnerID,
                                                                                              targetlandObj);
                        }
                    }
                }
            }

            if (pushAllowed)
            {
                float distance = (PusheePos - m_host.AbsolutePosition).Length();
                float distance_term = distance*distance*distance; // Script Energy
                float pusher_mass = m_host.GetMass();

                const float PUSH_ATTENUATION_DISTANCE = 17f;
                const float PUSH_ATTENUATION_SCALE = 5f;
                float distance_attenuation = 1f;
                if (distance > PUSH_ATTENUATION_DISTANCE)
                {
                    float normalized_units = 1f + (distance - PUSH_ATTENUATION_DISTANCE)/PUSH_ATTENUATION_SCALE;
                    distance_attenuation = 1f/normalized_units;
                }

                Vector3 applied_linear_impulse = new Vector3((float) impulse.x, (float) impulse.y, (float) impulse.z);
                {
                    float impulse_length = applied_linear_impulse.Length();

                    float desired_energy = impulse_length*pusher_mass;
                    if (desired_energy > 0f)
                        desired_energy += distance_term;

                    float scaling_factor = 1f;
                    scaling_factor *= distance_attenuation;
                    applied_linear_impulse *= scaling_factor;
                }
                if (pusheeIsAvatar)
                {
                    if (pusheeav != null)
                    {
                        PhysicsActor pa = pusheeav.PhysicsActor;

                        if (pa != null)
                        {
                            if (local != 0)
                            {
                                applied_linear_impulse *= m_host.GetWorldRotation();
                            }
                            //Put a limit on it...
                            int MaxPush = (int) pusheeav.PhysicsActor.Mass*25;

                            if (applied_linear_impulse.X > 0 &&
                                Math.Abs(applied_linear_impulse.X) > MaxPush)
                                applied_linear_impulse.X = MaxPush;
                            if (applied_linear_impulse.X < 0 &&
                                Math.Abs(applied_linear_impulse.X) > MaxPush)
                                applied_linear_impulse.X = -MaxPush;

                            if (applied_linear_impulse.Y > 0 &&
                                Math.Abs(applied_linear_impulse.X) > MaxPush)
                                applied_linear_impulse.Y = MaxPush;
                            if (applied_linear_impulse.Y < 0 &&
                                Math.Abs(applied_linear_impulse.X) > MaxPush)
                                applied_linear_impulse.Y = -MaxPush;

                            if (applied_linear_impulse.Z > 0 &&
                                Math.Abs(applied_linear_impulse.X) > MaxPush)
                                applied_linear_impulse.Z = MaxPush;
                            if (applied_linear_impulse.Z < 0 &&
                                Math.Abs(applied_linear_impulse.Z) > MaxPush)
                                applied_linear_impulse.Z = -MaxPush;

                            pa.AddForce(applied_linear_impulse, true);
                        }
                    }
                }
                else
                {
                    if (pusheeob.PhysActor != null)
                    {
                        pusheeob.ApplyImpulse(applied_linear_impulse, local != 0);
                    }
                }
            }
        }
コード例 #10
0
        public void llMoveToTarget(LSL_Vector target, double tau)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return;

            m_host.MoveToTarget(new Vector3((float) target.x, (float) target.y, (float) target.z), (float) tau);
        }
コード例 #11
0
 public void llNavigateTo(LSL_Vector point, LSL_List options)
 {
     List<Vector3> positions = new List<Vector3>() {point.ToVector3()};
     List<TravelMode> travelMode = new List<TravelMode>() {TravelMode.Walk};
     IBotManager botManager = World.RequestModuleInterface<IBotManager>();
     int flags = 0;
     if (options.Length > 0)
         flags |= options.GetLSLIntegerItem(0);
     if (botManager != null)
         botManager.SetBotMap(m_host.ParentEntity.UUID, positions, travelMode, flags, m_host.ParentEntity.OwnerID);
 }
コード例 #12
0
        public DateTime llMapDestination(string simname, LSL_Vector pos, LSL_Vector lookAt)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
                return DateTime.Now;

            UUID avatarID = m_host.OwnerID;
            DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_host.UUID, m_itemID, 0);
            // only works on the first detected avatar
            //This only works in touch events or if the item is attached to the avatar
            if (detectedParams == null && !m_host.IsAttachment) return DateTime.Now;

            if (detectedParams != null)
                avatarID = detectedParams.Key;

            IScenePresence avatar = World.GetScenePresence(avatarID);
            if (avatar != null)
            {
                IMuteListModule module = m_host.ParentEntity.Scene.RequestModuleInterface<IMuteListModule>();
                if (module != null)
                {
                    bool cached = false; //Unneeded
                    if (module.GetMutes(avatar.UUID, out cached).Any(mute => mute.MuteID == m_host.OwnerID))
                    {
                        return DateTime.Now; //If the avatar is muted, they don't get any contact from the muted av
                    }
                }
                avatar.ControllingClient.SendScriptTeleportRequest(m_host.Name, simname,
                                                                   new Vector3((float) pos.x, (float) pos.y,
                                                                               (float) pos.z),
                                                                   new Vector3((float) lookAt.x, (float) lookAt.y,
                                                                               (float) lookAt.z));
            }
            return PScriptSleep(1000);
        }
コード例 #13
0
        public DateTime llMakeSmoke(int particles, double scale, double vel, double lifetime, double arc, string texture,
                                    LSL_Vector offset)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
                return DateTime.Now;

            /*llParticleSystem([
               PSYS_PART_FLAGS,            PSYS_PART_INTERP_COLOR_MASK | PSYS_PART_INTERP_SCALE_MASK | PSYS_PART_EMISSIVE_MASK | PSYS_PART_WIND_MASK,
               PSYS_SRC_PATTERN,           PSYS_SRC_PATTERN_ANGLE_CONE,
               PSYS_PART_START_COLOR,      <1.0, 1.0, 1.0>,
               PSYS_PART_END_COLOR,        <1.0, 1.0, 1.0>,
               PSYS_PART_START_ALPHA,      1.00,
               PSYS_PART_END_ALPHA,        0.05,
               PSYS_PART_START_SCALE,      <particle_scale, particle_scale, 0.0>,
               PSYS_PART_END_SCALE,        <10, 10, 0.0>,
               PSYS_PART_MAX_AGE,          3.0,
               PSYS_SRC_ACCEL,             <0.0, 0.0, 0.0>,
               PSYS_SRC_TEXTURE,           source_texture_id,
               PSYS_SRC_BURST_RATE,        10.0 / particle_count,
               PSYS_SRC_ANGLE_BEGIN,       0.0,
               PSYS_SRC_ANGLE_END,         source_cone * PI,
               PSYS_SRC_BURST_PART_COUNT,  1,
               PSYS_SRC_BURST_RADIUS,      0.0,
               PSYS_SRC_BURST_SPEED_MIN,   particle_speed,
               PSYS_SRC_BURST_SPEED_MAX,   particle_speed,
               PSYS_SRC_MAX_AGE,           particle_lifetime / 2,
               PSYS_SRC_OMEGA,             <0.0, 0.0, 0.0>
               ]);*/
            List<object> list = new List<object>
                                    {
                                        ScriptBaseClass.PSYS_PART_FLAGS,
                                        ScriptBaseClass.PSYS_PART_INTERP_COLOR_MASK |
                                        ScriptBaseClass.PSYS_PART_INTERP_SCALE_MASK |
                                        ScriptBaseClass.PSYS_PART_EMISSIVE_MASK | ScriptBaseClass.PSYS_PART_WIND_MASK,
                                        ScriptBaseClass.PSYS_SRC_PATTERN,
                                        ScriptBaseClass.PSYS_SRC_PATTERN_ANGLE_CONE,
                                        ScriptBaseClass.PSYS_PART_START_COLOR,
                                        new LSL_Vector(1, 1, 1),
                                        ScriptBaseClass.PSYS_PART_END_COLOR,
                                        new LSL_Vector(1, 1, 1),
                                        ScriptBaseClass.PSYS_PART_START_ALPHA,
                                        new LSL_Float(1),
                                        ScriptBaseClass.PSYS_PART_END_ALPHA,
                                        new LSL_Float(0.05),
                                        ScriptBaseClass.PSYS_PART_START_SCALE,
                                        new LSL_Vector(scale, scale, 0),
                                        ScriptBaseClass.PSYS_PART_END_SCALE,
                                        new LSL_Vector(10, 10, 0),
                                        ScriptBaseClass.PSYS_PART_MAX_AGE,
                                        new LSL_Float(3),
                                        ScriptBaseClass.PSYS_SRC_ACCEL,
                                        new LSL_Vector(0, 0, 0),
                                        ScriptBaseClass.PSYS_SRC_TEXTURE,
                                        new LSL_String(texture),
                                        ScriptBaseClass.PSYS_SRC_BURST_RATE,
                                        new LSL_Float(10/particles),
                                        ScriptBaseClass.PSYS_SRC_ANGLE_BEGIN,
                                        new LSL_Float(0.0),
                                        ScriptBaseClass.PSYS_SRC_ANGLE_END,
                                        new LSL_Float(arc*Math.PI),
                                        ScriptBaseClass.PSYS_SRC_BURST_PART_COUNT,
                                        new LSL_Integer(1),
                                        ScriptBaseClass.PSYS_SRC_BURST_RADIUS,
                                        new LSL_Float(0.0),
                                        ScriptBaseClass.PSYS_SRC_BURST_SPEED_MIN,
                                        new LSL_Float(vel),
                                        ScriptBaseClass.PSYS_SRC_BURST_SPEED_MAX,
                                        new LSL_Float(vel),
                                        ScriptBaseClass.PSYS_SRC_MAX_AGE,
                                        new LSL_Float(lifetime/2),
                                        ScriptBaseClass.PSYS_SRC_OMEGA,
                                        new LSL_Vector(0, 0, 0)
                                    };

            llParticleSystem(new LSL_Types.list(list.ToArray()));
            return PScriptSleep(100);
        }
コード例 #14
0
        public void llLookAt(LSL_Vector target, double strength, double damping)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return;

            LookAt(target, strength, damping, m_host);
        }
コード例 #15
0
        public void llSetForceAndTorque(LSL_Vector force, LSL_Vector torque, int local)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return;

            llSetForce(force, local);
            llSetTorque(torque, local);
        }
コード例 #16
0
        public LSL_Key llRequestSimulatorData(string simulator, int data)
        {
            UUID tid = UUID.Zero;

            try
            {
                if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return "";

                string reply = String.Empty;

                GridRegion info = World.RegionInfo.RegionName == simulator
                                      ? new GridRegion(World.RegionInfo)
                                      : World.GridService.GetRegionByName(World.RegionInfo.AllScopeIDs, simulator);

                switch (data)
                {
                    case 5: // DATA_SIM_POS
                        if (info == null)
                            break;

                        reply = new LSL_Vector(
                            info.RegionLocX,
                            info.RegionLocY,
                            0).ToString();
                        break;
                    case 6: // DATA_SIM_STATUS
                        if (info != null)
                        {
                            reply = (info.Flags & (int) RegionFlags.RegionOnline) != 0 ? "up" : "down";
                        }
                            //if() starting
                            //if() stopping
                            //if() crashed
                        else
                            reply = "unknown";
                        break;
                    case 7: // DATA_SIM_RATING
                        if (info == null)
                            break;

                        uint access = Util.ConvertAccessLevelToMaturity(info.Access);
                        if (access == 0)
                            reply = "PG";
                        else if (access == 1)
                            reply = "MATURE";
                        else if (access == 2)
                            reply = "ADULT";
                        else
                            reply = "UNKNOWN";
                        break;
                    case 128:
                        try
                        {
                            if (
                                !ScriptProtection.CheckThreatLevel(ThreatLevel.High, "llRequestSimulatorData", m_host,
                                                                   "LSL", m_itemID)) return "";
                            reply = "Aurora";
                        }
                        catch
                        {
                            reply = "";
                        }
                        break;
                }
                if (reply != "")
                {
                    UUID rq = UUID.Random();

                    DataserverPlugin dataserverPlugin = (DataserverPlugin) m_ScriptEngine.GetScriptPlugin("Dataserver");

                    tid = dataserverPlugin.RegisterRequest(m_host.UUID, m_itemID, rq.ToString());

                    dataserverPlugin.AddReply(rq.ToString(), reply, 1000);
                }
            }
            catch
            {
            }

            ScriptSleep(1000);
            return (LSL_Key) tid.ToString();
        }
コード例 #17
0
        public void llSetLinkCamera(LSL_Integer link, LSL_Vector eye, LSL_Vector at)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return;

            List<ISceneChildEntity> entities = GetLinkParts(link);
            if (entities.Count > 0)
            {
                entities[0].CameraEyeOffset = new Vector3((float) eye.x, (float) eye.y, (float) eye.z);
                entities[0].CameraAtOffset = new Vector3((float) at.x, (float) at.y, (float) at.z);
            }
        }
コード例 #18
0
 public DateTime llRezObject(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param)
 {
     return llRezPrim(inventory, pos, vel, rot, param, false, true, true, true);
 }
コード例 #19
0
        public DateTime llSetPos(LSL_Vector pos)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
                return DateTime.Now;

            SetPos(m_host, pos, true);

            return PScriptSleep(200);
        }
コード例 #20
0
        public LSL_Rotation llRotBetween(LSL_Vector a, LSL_Vector b)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
                return new LSL_Rotation();
            //A and B should both be normalized

            LSL_Rotation rotBetween;
            // Check for zero vectors. If either is zero, return zero rotation. Otherwise,
            // continue calculation.
            if (a == new LSL_Vector(0.0f, 0.0f, 0.0f) || b == new LSL_Vector(0.0f, 0.0f, 0.0f))
            {
                rotBetween = new LSL_Rotation(0.0f, 0.0f, 0.0f, 1.0f);
            }
            else
            {
                a = LSL_Vector.Norm(a);
                b = LSL_Vector.Norm(b);
                double dotProduct = LSL_Vector.Dot(a, b);
                // There are two degenerate cases possible. These are for vectors 180 or
                // 0 degrees apart. These have to be detected and handled individually.
                //
                // Check for vectors 180 degrees apart.
                // A dot product of -1 would mean the angle between vectors is 180 degrees.
                if (dotProduct < -0.9999999f)
                {
                    // First assume X axis is orthogonal to the vectors.
                    LSL_Vector orthoVector = new LSL_Vector(1.0f, 0.0f, 0.0f);
                    orthoVector = orthoVector - a*(a.x/LSL_Vector.Dot(a, a));
                    // Check for near zero vector. A very small non-zero number here will create
                    // a rotation in an undesired direction.
                    rotBetween = LSL_Vector.Mag(orthoVector) > 0.0001
                                     ? new LSL_Rotation(orthoVector.x, orthoVector.y, orthoVector.z, 0.0f)
                                     : new LSL_Rotation(0.0f, 0.0f, 1.0f, 0.0f);
                }
                    // Check for parallel vectors.
                    // A dot product of 1 would mean the angle between vectors is 0 degrees.
                else if (dotProduct > 0.9999999f)
                {
                    // Set zero rotation.
                    rotBetween = new LSL_Rotation(0.0f, 0.0f, 0.0f, 1.0f);
                }
                else
                {
                    // All special checks have been performed so get the axis of rotation.
                    LSL_Vector crossProduct = LSL_Vector.Cross(a, b);
                    // Quarternion s value is the length of the unit vector + dot product.
                    double qs = 1.0 + dotProduct;
                    rotBetween = new LSL_Rotation(crossProduct.x, crossProduct.y, crossProduct.z, qs);
                    // Normalize the rotation.
                    double mag = LSL_Rotation.Mag(rotBetween);
                    // We shouldn't have to worry about a divide by zero here. The qs value will be
                    // non-zero because we already know if we're here, then the dotProduct is not -1 so
                    // qs will not be zero. Also, we've already handled the input vectors being zero so the
                    // crossProduct vector should also not be zero.
                    rotBetween.x = rotBetween.x/mag;
                    rotBetween.y = rotBetween.y/mag;
                    rotBetween.z = rotBetween.z/mag;
                    rotBetween.s = rotBetween.s/mag;
                    // Check for undefined values and set zero rotation if any found. This code might not actually be required
                    // any longer since zero vectors are checked for at the top.
                    if (Double.IsNaN(rotBetween.x) || Double.IsNaN(rotBetween.y) || Double.IsNaN(rotBetween.z) ||
                        Double.IsNaN(rotBetween.s))
                    {
                        rotBetween = new LSL_Rotation(0.0f, 0.0f, 0.0f, 1.0f);
                    }
                }
            }
            return rotBetween;
        }
コード例 #21
0
        public void llSetScale(LSL_Vector scale)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return;

            SetScale(m_host, scale);
        }
コード例 #22
0
        public LSL_Integer llScriptDanger(LSL_Vector pos)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return 0;

            bool result = m_ScriptEngine.PipeEventsForScript(m_host,
                                                             new Vector3((float) pos.x, (float) pos.y, (float) pos.z));
            if (result)
            {
                return 1;
            }
            return 0;
        }
コード例 #23
0
        public void llSetTorque(LSL_Vector torque, int local)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return;

            m_host.SetAngularImpulse(new Vector3((float) torque.x, (float) torque.y, (float) torque.z), local != 0);
        }
コード例 #24
0
        public void llSetCameraEyeOffset(LSL_Vector offset)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return;

            m_host.CameraEyeOffset = new Vector3((float) offset.x, (float) offset.y, (float) offset.z);
        }
コード例 #25
0
        public void llSetVelocity(LSL_Vector force, LSL_Integer local)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return;
            Vector3 velocity = new Vector3((float) force.x, (float) force.y, (float) force.z);
            if (local == 1)
            {
                Quaternion grot = m_host.GetWorldRotation();
                Quaternion AXgrot = grot;
                Vector3 AXimpulsei = velocity;
                Vector3 newimpulse = AXimpulsei*AXgrot;
                velocity = newimpulse;
            }

            if (m_host.ParentEntity.RootChild.PhysActor != null)
                m_host.ParentEntity.RootChild.PhysActor.Velocity = velocity;
        }
コード例 #26
0
        public void llSetColor(LSL_Vector color, int face)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return;

            m_host.SetFaceColor(new Vector3((float) color.x, (float) color.y, (float) color.z), face);
        }
コード例 #27
0
        public LSL_Integer llTarget(LSL_Vector position, LSL_Float range)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return 0;

            return m_host.registerTargetWaypoint(
                new Vector3((float) position.x, (float) position.y, (float) position.z), (float) range);
        }
コード例 #28
0
        public void llSetForce(LSL_Vector force, int local)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return;

            if (m_host.ParentEntity != null)
            {
                if (!m_host.ParentEntity.IsDeleted)
                {
                    if (local != 0)
                        force *= llGetRot();

                    m_host.ParentEntity.RootChild.SetForce(new Vector3((float) force.x, (float) force.y, (float) force.z));
                }
            }
        }
コード例 #29
0
        public void llTeleportAgent(LSL_Key avatar, LSL_String landmark, LSL_Vector position, LSL_Vector look_at)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return;

            UUID invItemID = InventorySelf();

            if (invItemID == UUID.Zero)
                return;

            lock (m_host.TaskInventory)
            {
                if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero)
                {
                    ShoutError("No permissions to teleport the agent");
                    return;
                }

                if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TELEPORT) == 0)
                {
                    ShoutError("No permissions to teleport the agent");
                    return;
                }
            }

            TaskInventoryItem item = null;
            lock (m_host.TaskInventory)
            {
                foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
                {
                    if (inv.Value.Name == landmark)
                        item = inv.Value;
                }
            }
            if (item == null && landmark != "")
                return;

            IScenePresence presence = World.GetScenePresence(m_host.OwnerID);
            if (presence != null)
            {
                IEntityTransferModule module = World.RequestModuleInterface<IEntityTransferModule>();
                if (module != null)
                {
                    if (landmark == "")
                        module.Teleport(presence, World.RegionInfo.RegionHandle,
                                        position.ToVector3(), look_at.ToVector3(), (uint) TeleportFlags.ViaLocation);
                    else
                    {
                        AssetLandmark lm = new AssetLandmark(
                            World.AssetService.Get(item.AssetID.ToString()));
                        module.Teleport(presence, lm.RegionHandle, lm.Position,
                                        look_at.ToVector3(), (uint) TeleportFlags.ViaLocation);
                    }
                }
            }
        }
コード例 #30
0
        public void llLinkLookAt(LSL_Integer link, LSL_Vector target, double strength, double damping)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return;

            List<ISceneChildEntity> parts = GetLinkParts(link);

            foreach (ISceneChildEntity part in parts)
                LookAt(target, strength, damping, part);
        }