Esempio n. 1
0
        private void growTrees()
        {
            foreach (Copse copse in m_copse)
            {
                if (!copse.m_frozen)
                {
                    foreach (UUID tree in copse.m_trees)
                    {
                        IEntity ent;
                        if (m_scene.Entities.TryGetValue(tree, out ent))
                        {
                            SceneObjectPart s_tree = ((SceneObjectGroup)ent).RootPart;

                            if (s_tree.Scale.X < copse.m_maximum_scale.X && s_tree.Scale.Y < copse.m_maximum_scale.Y && s_tree.Scale.Z < copse.m_maximum_scale.Z)
                            {
                                s_tree.Scale += copse.m_rate;
                                s_tree.ParentGroup.HasGroupChanged = true;
                                s_tree.ScheduleUpdate(PrimUpdateFlags.FindBest);
                            }
                        }
                        else
                        {
                            m_log.DebugFormat("[TREES]: Tree not in scene {0}", tree);
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        public void PlayfwdState(SceneObjectPart part)
        {
            if (part != null)
            {
                bool ChangedScale = false;
                bool ChangedRot   = false;
                bool ChangedPos   = false;
                part.Undoing = true;

                if (part.UUID == part.ParentGroup.UUID)
                {
                    if (Position != Vector3.Zero)
                    {
                        ChangedPos = true;
                        part.ParentGroup.AbsolutePosition = Position;
                    }
                    if (Rotation != Quaternion.Identity)
                    {
                        ChangedRot = true;
                        part.UpdateRotation(Rotation);
                    }
                    if (Scale != Vector3.Zero)
                    {
                        ChangedScale = true;
                        part.Resize(Scale);
                    }

                    foreach (SceneObjectPart child in part.ParentGroup.ChildrenList)
                    {
                        if (child.UUID != part.UUID)
                        {
                            child.Redo(); //No updates here, child redo will do it on their own
                        }
                    }
                }
                else
                {
                    if (Position != Vector3.Zero)
                    {
                        ChangedPos = true;
                        part.FixOffsetPosition(Position, false);
                    }
                    if (Rotation != Quaternion.Identity)
                    {
                        ChangedRot = true;
                        part.ParentGroup.Rotation = (Rotation);
                    }
                    if (Scale != Vector3.Zero)
                    {
                        ChangedScale = true;
                        part.Resize(Scale);
                    }
                }

                part.ScheduleUpdate((ChangedScale ? PrimUpdateFlags.Shape : PrimUpdateFlags.None) |
                                    (ChangedPos ? PrimUpdateFlags.Position : PrimUpdateFlags.None) |
                                    (ChangedRot ? PrimUpdateFlags.Rotation : PrimUpdateFlags.None));
                part.Undoing = false;
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Start all the scripts contained in this prim's inventory
        /// </summary>
        public void CreateScriptInstances(int startParam, bool postOnRez, int stateSource, UUID RezzedFrom)
        {
            List <TaskInventoryItem> LSLItems = GetInventoryScripts();

            if (LSLItems.Count == 0)
            {
                return;
            }
            HasInventoryChanged = true;

            bool SendUpdate = m_part.AddFlag(PrimFlags.Scripted);

            m_part.ParentGroup.Scene.EventManager.TriggerRezScripts(
                m_part, LSLItems.ToArray(), startParam, postOnRez, stateSource, RezzedFrom);
            if (SendUpdate)
            {
                m_part.ScheduleUpdate(PrimUpdateFlags.PrimFlags); //We only need to send a compressed
            }
        }
Esempio n. 4
0
        public void PlaybackState(SceneObjectPart part)
        {
            if (part != null)
            {
                part.Undoing = true;

                bool ChangedScale = false;
                bool ChangedRot   = false;
                bool ChangedPos   = false;

                if (part.UUID == part.ParentGroup.UUID)
                {
                    if (Position != Vector3.Zero)
                    {
                        ChangedPos = true;
                        part.ParentGroup.AbsolutePosition = Position;
                    }
                    ChangedRot          = true;
                    part.RotationOffset = Rotation;
                    if (Scale != Vector3.Zero)
                    {
                        ChangedScale = true;
                        part.Scale   = Scale;
                    }

#if (!ISWIN)
                    foreach (SceneObjectPart child in part.ParentGroup.ChildrenList)
                    {
                        if (child.UUID != part.UUID)
                        {
                            child.Undo(); //No updates here, child undo will do it on their own
                        }
                    }
#else
                    foreach (SceneObjectPart child in part.ParentGroup.ChildrenList.Where(child => child.UUID != part.UUID))
                    {
                        child.Undo(); //No updates here, child undo will do it on their own
                    }
#endif
                }
                else
                {
                    if (Position != Vector3.Zero)
                    {
                        ChangedPos = true;
                        part.FixOffsetPosition(Position, false);
                    }
                    ChangedRot = true;
                    part.UpdateRotation(Rotation);
                    if (Scale != Vector3.Zero)
                    {
                        ChangedScale = true;
                        part.Resize(Scale);
                    }
                }
                part.Undoing = false;
                part.ScheduleUpdate((ChangedScale ? PrimUpdateFlags.Shape : PrimUpdateFlags.None) |
                                    (ChangedPos ? PrimUpdateFlags.Position : PrimUpdateFlags.None) |
                                    (ChangedRot ? PrimUpdateFlags.Rotation : PrimUpdateFlags.None));
            }
        }