Ejemplo n.º 1
0
        protected void InternalRemoveEntity( )
        {
            try
            {
                if (NetworkManager == null)
                {
                    return;
                }

                BaseObject.InvokeEntityMethod(NetworkManager, BaseEntityBroadcastRemovalMethod);
            }
            catch (Exception ex)
            {
                ApplicationLog.BaseLog.Error(ex);
            }
        }
Ejemplo n.º 2
0
        protected void InternalRemoveEntity()
        {
            try
            {
                if (SandboxGameAssemblyWrapper.IsDebugging)
                {
                    LogManager.APILog.WriteLine(this.GetType().Name + " '" + Name + "': Calling 'Close' to remove entity");
                }

                BaseObject.InvokeEntityMethod(BackingObject, "Close");
            }
            catch (Exception ex)
            {
                LogManager.APILog.WriteLineAndConsole("Failed to remove entity '" + Name + "'");
                LogManager.ErrorLog.WriteLine(ex);
            }
        }
Ejemplo n.º 3
0
        protected virtual void InternalRefreshBackingDataList()
        {
            try
            {
                if (m_rawDataListResourceLock.Owned)
                {
                    return;
                }
                if (WorldManager.Instance.IsWorldSaving)
                {
                    return;
                }
                if (WorldManager.Instance.InternalGetResourceLock() == null)
                {
                    return;
                }
                if (WorldManager.Instance.InternalGetResourceLock().Owned)
                {
                    return;
                }

                m_rawDataListResourceLock.AcquireExclusive();

                if (m_backingObject == null)
                {
                    return;
                }
                var rawValue = BaseObject.InvokeEntityMethod(m_backingObject, m_backingSourceMethod);
                if (rawValue == null)
                {
                    return;
                }
                m_rawDataList = UtilityFunctions.ConvertList(rawValue);

                m_rawDataListResourceLock.ReleaseExclusive();
            }
            catch (Exception ex)
            {
                LogManager.ErrorLog.WriteLine(ex);
                m_rawDataListResourceLock.ReleaseExclusive();
            }
        }
Ejemplo n.º 4
0
        public static void BroadcastRemoveEntity(IMyEntity entity, bool safe = true)
        {
            Object result = BaseObject.GetEntityPropertyValue(entity, BaseEntity.BaseEntityGetNetManagerMethod);

            //Object result = BaseEntity.InvokeEntityMethod( entity, BaseEntity.BaseEntityGetNetManagerMethod );
            if (result == null)
            {
                return;
            }

            if (safe)
            {
                SandboxGameAssemblyWrapper.Instance.GameAction(() =>
                {
                    BaseObject.InvokeEntityMethod(result, BaseEntityBroadcastRemovalMethod);
                });
            }
            else
            {
                BaseObject.InvokeEntityMethod(result, BaseEntityBroadcastRemovalMethod);
            }
        }
Ejemplo n.º 5
0
        protected void InternalUpdateMaxRequiredInput( )
        {
            try
            {
                if (m_powerRateCallback == null)
                {
                    return;
                }

                BaseObject.SetEntityFieldValue(BackingObject, PowerReceiverInputRateCallbackField, m_powerRateCallback);

                BaseObject.SetEntityFieldValue(BackingObject, PowerReceiverMaxRequiredInputField, m_maxRequiredInput);

                BaseObject.InvokeEntityMethod(BackingObject, PowerReceiverSetMaxRequiredInputMethod, new object[] { m_maxRequiredInput });

                m_powerManager.UnregisterPowerReceiver(m_parent);
                m_powerManager.RegisterPowerReceiver(m_parent);
            }
            catch (Exception ex)
            {
                LogManager.ErrorLog.WriteLine(ex);
            }
        }
Ejemplo n.º 6
0
 protected void InternalUpdatePowerOutput()
 {
     BaseObject.InvokeEntityMethod(m_powerProducer, PowerProducerSetCurrentOutputMethod, new object[] { m_powerOutput });
 }
Ejemplo n.º 7
0
 protected void InternalRemoveEntity()
 {
     BaseObject.InvokeEntityMethod(NetworkManager, BaseEntityBroadcastRemovalMethod);
 }