Beispiel #1
0
        // -----------------------------------------------------------------
        /// <summary>
        /// </summary>
        // -----------------------------------------------------------------
        public UUID NBAddEntity(UUID hostID, UUID scriptID,
                                UUID domainID, UUID bodyID,
                                object[] value, int canMove, int canAttract,
                                float mass, Vector3 velocity)
        {
            m_log.DebugFormat("[N-BodyModule] add entity {0} to domain {1}", bodyID, domainID);

            lock (m_domainStore)
            {
                if (m_domainStore.ContainsKey(domainID))
                {
                    NBodyGroup nbg = m_domainStore[domainID];


                    if (!ValidateVector(value, nbg.Dimension))
                    {
                        GenerateRuntimeError("nbody value has the wrong length");
                    }

                    m_domainStore[domainID].AddEntity(bodyID, NormalizeVector(value), canMove, canAttract, mass, velocity);
                }
            }

            return(domainID);
        }
Beispiel #2
0
        // -----------------------------------------------------------------
        /// <summary>
        /// returns == [ latitude, longitude ]
        /// </summary>
        // -----------------------------------------------------------------
        public UUID NBCreateDomain(UUID hostID, UUID scriptID,
                                   Vector3 center, float range, int dimension, float timescale, int simtype)
        {
            m_log.DebugFormat("[N-BodyModule] Create domain");

            UUID domainID = UUID.Random();

            lock (m_domainStore)
            {
                try
                {
                    NBodyGroup nbg = NBodyGroup.CreateNBodyGroup(m_scene, (NBodyGroup.AttractorType)simtype);
                    nbg.CenterPoint = center;
                    nbg.MaxRange    = range;
                    nbg.Dimension   = dimension;
                    nbg.TimeScale   = timescale;
                    nbg.Enabled     = false;

                    m_domainStore.Add(domainID, nbg);
                }
                catch (Exception e)
                {
                    m_log.WarnFormat("[N-BodyModule] exception while creating domain; {0}", e.Message);
                    return(UUID.Zero);
                }
            }

            m_lastTick = Util.EnvironmentTickCount();
            m_updateTimer.Start();

            m_log.DebugFormat("[N-BodyModule] created {0}", domainID);
            return(domainID);
        }
Beispiel #3
0
        // -----------------------------------------------------------------
        /// <summary>
        /// </summary>
        // -----------------------------------------------------------------
        public int NBDisableDomain(UUID hostID, UUID scriptID, UUID domainID)
        {
            m_log.DebugFormat("[N-BodyModule] disable domain {0}", domainID);
            lock (m_domainStore)
            {
                if (m_domainStore.ContainsKey(domainID))
                {
                    NBodyGroup nbg = m_domainStore[domainID];
                    nbg.Enabled = false;
                }
            }

            return(1);
        }
Beispiel #4
0
        // -----------------------------------------------------------------
        /// <summary>
        /// </summary>
        // -----------------------------------------------------------------
        public float NBSetTimeScale(UUID hostID, UUID scriptID, UUID domainID, float timescale)
        {
            m_log.DebugFormat("[N-BodyModule] set timescale for domain {0}", domainID);
            lock (m_domainStore)
            {
                if (m_domainStore.ContainsKey(domainID))
                {
                    NBodyGroup nbg = m_domainStore[domainID];
                    nbg.TimeScale = timescale;
                }
            }

            return(timescale);
        }
Beispiel #5
0
        // -----------------------------------------------------------------
        /// <summary>
        /// </summary>
        // -----------------------------------------------------------------
        public int NBDump(UUID hostID, UUID scriptID, UUID domainID)
        {
            // m_log.WarnFormat("[N-BodyModule] dump domain {0}",domainID);
            lock (m_domainStore)
            {
                if (m_domainStore.ContainsKey(domainID))
                {
                    NBodyGroup nbg = m_domainStore[domainID];
                    nbg.Dump();
                }
                else
                {
                    m_log.WarnFormat("[N-BodyModule] unknown domain {0}", domainID);
                }
            }

            return(1);
        }