Beispiel #1
0
 public float MitigateSurge()
 {
     if (compBreakdownable == null || !compBreakdownable.BrokenDown)
     {
         if (breakdownOnTrip)
         {
             if (compBreakdownable != null)
             {
                 compBreakdownable.DoBreakdown();
                 return(surgeMitigation);
             }
         }
         else if (compFlickable != null)
         {
             if (compFlickable.SwitchIsOn)
             {
                 compFlickable.ResetToOn();
                 compFlickable.DoFlick();
                 FlickUtility.UpdateFlickDesignation(parent);
                 return(surgeMitigation);
             }
         }
     }
     return(0.0f);
 }
            public static bool UpdateFlickDesignation_Prefix(Thing t)
            {
                try
                {
                    int         CGT = Find.TickManager.TicksGame;
                    CompSkyMind csm = t.TryGetComp <CompSkyMind>();
                    if (csm == null)
                    {
                        return(true);
                    }

                    //Eviter les mods qui ont des doublons sur leur Comp_PropertieFlickable (cf Vanilla truc muche)
                    if (csm.lastRemoteFlickGT == CGT)
                    {
                        return(false);
                    }

                    String txt;

                    //Si serveur principal installé sur la map alors automatisation du flick
                    if (Utils.GCATPP.isThereSkyCloudCore())
                    {
                        if (!csm.connected)
                        {
                            return(true);
                        }

                        CompFlickable cf = t.TryGetComp <CompFlickable>();
                        if (cf != null)
                        {
                            //Affichage texte
                            if (cf.SwitchIsOn)
                            {
                                txt = "ATPP_FlickDisable".Translate();
                                Utils.playVocal("soundDefSkyCloudDeviceDeactivated");
                            }
                            else
                            {
                                txt = "ATPP_FlickEnable".Translate();
                                Utils.playVocal("soundDefSkyCloudDeviceActivated");
                            }

                            MoteMaker.ThrowText(t.TrueCenter() + new Vector3(0.5f, 0f, 0.5f), t.Map, txt, Color.white, -1f);

                            cf.DoFlick();
                            csm.lastRemoteFlickGT = CGT;
                        }

                        return(false);
                    }
                    return(true);
                }
                catch (Exception e)
                {
                    Log.Message("[ATPP] FlickUtility.UpdateFlickDesignation " + e.Message + " " + e.StackTrace);
                    return(true);
                }
            }
 public override void SpawnSetup(Map map)
 {
     base.SpawnSetup(map);
     if (flick == 0)
     {
         flick = 1;
         flickableComp.DoFlick();
     }
 }
 public float ProduceThing(float amount)
 {
     if (compFlickable != null)
     {
         compFlickable.ResetToOn();
         compFlickable.DoFlick();
         FlickUtility.UpdateFlickDesignation(parent);
         return(surgeMitigation);
     }
     return(0.0f);
 }
Beispiel #5
0
        // Token: 0x0600006E RID: 110 RVA: 0x00004338 File Offset: 0x00002538
        public override void TickRare()
        {
            var tempRange = default(FloatRange);

            GetSafeTemps(this, UseFixed, out var tempMin, out var tempMax);
            tempRange.min = tempMin;
            tempRange.max = tempMax;
            if (UseFixed && RPGVentCheckTemps(this, tempRange) || !UseFixed)
            {
                if (!InRangeATM && VentIsWorking(this))
                {
                    InRangeATM = !InRangeATM;
                    if (!flickableComp.SwitchIsOn)
                    {
                        flickableComp.DoFlick();
                    }
                }

                if (!FlickUtility.WantsToBeOn(this))
                {
                    return;
                }

                if (VentIsWorking(this))
                {
                    GenTemperature.EqualizeTemperaturesThroughBuilding(this, 20f, true);
                    return;
                }

                GenTemperature.EqualizeTemperaturesThroughBuilding(this, 14f, true);
            }
            else
            {
                InRangeATM = false;
                if (VentIsWorking(this) && flickableComp.SwitchIsOn)
                {
                    flickableComp.DoFlick();
                }
            }
        }
        public void CheckNeedsFlick()
        {
            if (master == null)
            {
                return;
            }
            CompFlickable masterflickable = master.TryGetComp <CompFlickable>();
            CompFlickable flickable       = this.TryGetComp <CompFlickable>();

            if (masterflickable.SwitchIsOn != flickable.SwitchIsOn)
            {
                flickable.DoFlick();
            }
        }
 public override IEnumerable <Command> CompGetGizmosExtra()
 {
     if (canSwitchModes)
     {
         Command_Action commandModeSwitch = new Command_Action();
         commandModeSwitch.groupKey = 676192;
         if (switchedToChunkSilo)
         {
             commandModeSwitch.defaultLabel = "CompRTDeviceModeSwitcher_StockpileModeLabel".Translate();
             commandModeSwitch.defaultDesc  = "CompRTDeviceModeSwitcher_StockpileModeDesc".Translate();
             commandModeSwitch.icon         = Resources.stockpileTexture;
         }
         else
         {
             commandModeSwitch.defaultLabel = "CompRTDeviceModeSwitcher_ChunkSiloModeLabel".Translate();
             commandModeSwitch.defaultDesc  = "CompRTDeviceModeSwitcher_ChunkSiloModeDesc".Translate();
             commandModeSwitch.icon         = Resources.chunkSiloTexture;
         }
         commandModeSwitch.action = () =>
         {
             CompFlickable compFlickable = parent.TryGetComp <CompFlickable>();
             if (compFlickable != null)
             {
                 compFlickable.ResetToOn();
                 compFlickable.DoFlick();
                 FlickUtility.UpdateFlickDesignation(parent);
             }
             if (switchedToChunkSilo)
             {
                 CompRTQuantumChunkSilo compChunkSilo = parent.TryGetComp <CompRTQuantumChunkSilo>();
                 if (compChunkSilo != null)
                 {
                     compChunkSilo.EmptyOut();
                 }
             }
             switchedToChunkSilo = !switchedToChunkSilo;
             SortOutComps();
         };
         yield return(commandModeSwitch);
     }
 }