Пример #1
0
 public static lsl_list ToDoubleList(lsl_list src)
 {
     lsl_list ret = new lsl_list();
     double entry;
     for (int i = 0; i < src.Data.Length - 1; i++)
     {
         if (double.TryParse(src.Data[i].ToString(), out entry))
         {
             ret.Add(entry);
         }
     }
     return ret;
 }
Пример #2
0
        public lsl_list llGetObjectDetails(IScriptInstance script, string objectID, lsl_list details)
        {
            lsl_list ret = new lsl_list();
            UUID key;
            ISceneEntity obj;

            if (UUID.TryParse(objectID, out key) && script.Host.Scene.TryGetEntity(key, out obj))
            {
                for (int i = 0, len = details.Length; i < len; i++)
                {
                    int item = details.GetLSLIntegerItem(i);

                    switch (item)
                    {
                        case LSLScriptBase.OBJECT_CREATOR:
                            ret.Add(obj.CreatorID.ToString());
                            break;

                        case LSLScriptBase.OBJECT_DESC:
                            if (obj is LLPrimitive)
                                ret.Add(((LLPrimitive)obj).Prim.Properties.Description);
                            else
                                ret.Add(String.Empty);
                            break;

                        case LSLScriptBase.OBJECT_GROUP:
                            ret.Add(obj.GroupID.ToString());
                            break;

                        case LSLScriptBase.OBJECT_NAME:
                            ret.Add(obj.Name);
                            break;

                        case LSLScriptBase.OBJECT_OWNER:
                            ret.Add(obj.OwnerID.ToString());
                            break;

                        case LSLScriptBase.OBJECT_POS:
                            ret.Add(obj.ScenePosition); // TODO: Verify that this matches LSL
                            break;

                        case LSLScriptBase.OBJECT_ROT:
                            ret.Add(obj.SceneRotation); // TODO: Verify that this matches LSL
                            break;

                        case LSLScriptBase.OBJECT_VELOCITY:
                            if (obj is IPhysical)
                                ret.Add(((IPhysical)obj).Velocity);
                            else
                                ret.Add(Vector3.Zero);
                            break;
                    }
                }
            }
            else
            {
                // TODO: Return status of non LLPrimitive objects
                m_log.Warn("llGetObjectDetails called for non LLPrimitive target in object \"" + script.Host.Name + "\" at " + script.Host.ScenePosition);
            }

            return ret;
        }