// Conditions and colors go here.
        void CheckAndSetEmissives(bool _force = false)
        {
            foreach (var emissive in EmissiveDataSet)
            {
                if (Block.IsFunctional)
                {
                    if (Block.IsWorking)
                    {
                        if (EmissiveColor != emissive.FullyWorkingEmissiveColor || _force)
                        {
                            EmissiveColor = emissive.FullyWorkingEmissiveColor;
                            Block.SetEmissiveParts(emissive.EmissiveMaterialName, EmissiveColor, emissive.FullyWorkingEmissiveGlow);

                            if (HasSubpart)
                            {
                                Block.SetEmissivePartsForSubparts(emissive.EmissiveMaterialName, EmissiveColor, emissive.FullyWorkingEmissiveGlow);
                                // PLACEHOLDER
                                //ApplyEmissiveToSubparts(SubpartList, emissive.EmissiveMaterialName, EmissiveColor, emissive.FullyWorkingEmissiveGlow);
                            }
                        }
                    }
                    else
                    {
                        if (EmissiveColor != emissive.BustedEmissiveColor || _force)
                        {
                            EmissiveColor = emissive.BustedEmissiveColor;
                            Block.SetEmissiveParts(emissive.EmissiveMaterialName, EmissiveColor, emissive.BustedEmissiveGlow);

                            if (HasSubpart)
                            {
                                Block.SetEmissivePartsForSubparts(emissive.EmissiveMaterialName, EmissiveColor, emissive.BustedEmissiveGlow);
                                // PLACEHOLDER
                                //ApplyEmissiveToSubparts(SubpartList, emissive.EmissiveMaterialName, EmissiveColor, emissive.BustedEmissiveGlow);
                            }
                        }
                    }
                }
                else
                {
                    if (EmissiveColor != emissive.BustedEmissiveColor || _force)
                    {
                        EmissiveColor = emissive.BustedEmissiveColor;
                        Block.SetEmissiveParts(emissive.EmissiveMaterialName, EmissiveColor, emissive.BustedEmissiveGlow);

                        if (HasSubpart)
                        {
                            Block.SetEmissivePartsForSubparts(emissive.EmissiveMaterialName, EmissiveColor, emissive.BustedEmissiveGlow);
                            // PLACEHOLDER
                            //ApplyEmissiveToSubparts(SubpartList, emissive.EmissiveMaterialName, EmissiveColor, emissive.BustedEmissiveGlow);
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        public override void UpdateBeforeSimulation()
        {
            if (IsWorking())
            {
                if (_range < _maxrange && _count == 30)
                {
                    _range += (_maxrange / 20f);
                    _tblock.SetEmissiveParts("Emissive0", Color.Green, (_range / _maxrange));
                }
                else
                {
                    _tblock.SetEmissiveParts("Emissive0", Color.Green, 1.0f);
                }
                if (!MyAPIGateway.Utilities.IsDedicated)
                {
                    showRange(_range);
                }
                else
                {
                    sendPoke(_range);
                }
                if (_count++ == 60)
                {
                    gridEffects();
                }
            }
            else if (_wasOn)
            {
                _tblock.SetEmissiveParts("Emissive0", Color.DarkRed, 0.20f);
                _range = 0f;
            }

            if (IsWorking() != _wasOn && _ublock.Components.TryGet(out _sink))
            {
                _sink.Update();
                _tblock.RefreshCustomInfo();
                _wasOn = IsWorking();
            }
        }