Ejemplo n.º 1
0
        public ISceneEntity CreateEntity(
            ISceneEntity baseEntity, UUID ownerID, UUID groupID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape)
        {
            if (Array.IndexOf(creationCapabilities, (PCode)shape.PCode) < 0)
            {
                MainConsole.Instance.DebugFormat("[VEGETATION]: PCode {0} not handled by {1}", shape.PCode, Name);
                return(null);
            }

            ISceneChildEntity rootPart = baseEntity.GetChildPart(baseEntity.UUID);

            // if grass or tree, make phantom
            //rootPart.TrimPermissions();
            rootPart.AddFlag(PrimFlags.Phantom);
            if (rootPart.Shape.PCode != (byte)PCode.Grass)
            {
                AdaptTree(ref shape);
            }

            m_scene.SceneGraph.AddPrimToScene(baseEntity);
            baseEntity.SetGroup(groupID, ownerID, true);
            baseEntity.ScheduleGroupUpdate(PrimUpdateFlags.ForcedFullUpdate);

            return(baseEntity);
        }
Ejemplo n.º 2
0
        public ISceneEntity CreateEntity(
            ISceneEntity sceneObject, UUID ownerID, UUID groupID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape)
        {
            if (Array.IndexOf(creationCapabilities, (PCode)shape.PCode) < 0)
            {
                MainConsole.Instance.DebugFormat("[VEGETATION]: PCode {0} not handled by {1}", shape.PCode, Name);
                return(null);
            }

            ISceneChildEntity rootPart = sceneObject.GetChildPart(sceneObject.UUID);

            rootPart.AddFlag(PrimFlags.Phantom);
            if (rootPart.Shape.PCode != (byte)PCode.Grass)
            {
                // Tree size has to be adapted depending on its type
                switch ((Tree)rootPart.Shape.State)
                {
                case Tree.Cypress1:
                case Tree.Cypress2:
                case Tree.Palm1:
                case Tree.Palm2:
                case Tree.WinterAspen:
                    rootPart.Scale = new Vector3(4, 4, 10);
                    break;

                case Tree.WinterPine1:
                case Tree.WinterPine2:
                    rootPart.Scale = new Vector3(4, 4, 20);
                    break;

                case Tree.Dogwood:
                    rootPart.Scale = new Vector3(6.5f, 6.5f, 6.5f);
                    break;

                // case... other tree types
                // tree.Scale = new Vector3(?, ?, ?);
                // break;

                default:
                    rootPart.Scale = new Vector3(4, 4, 4);
                    break;
                }
            }

            sceneObject.SetGroup(groupID, UUID.Zero, false);
            m_scene.SceneGraph.AddPrimToScene(sceneObject);
            sceneObject.ScheduleGroupUpdate(PrimUpdateFlags.ForcedFullUpdate);

            return(sceneObject);
        }