Ejemplo n.º 1
0
 private void OnDefeat()
 {
     foreach (Thing thing in things)
     {
         thing.SetFaction(null);
         thing.TryGetComp <CompSendSignalOnPawnProximity>()?.Expire();
         CompSendSignalOnCountdown compSendSignalOnCountdown = thing.TryGetComp <CompSendSignalOnCountdown>();
         if (compSendSignalOnCountdown != null)
         {
             compSendSignalOnCountdown.ticksLeft = 0;
         }
         ThingWithComps thingWithComps;
         if ((thingWithComps = (thing as ThingWithComps)) != null)
         {
             thingWithComps.BroadcastCompSignal("MechClusterDefeated");
         }
     }
     lord.Notify_MechClusterDefeated();
     for (int i = 0; i < thingsToNotifyOnDefeat.Count; i++)
     {
         thingsToNotifyOnDefeat[i].Notify_LordDestroyed();
     }
     mechClusterDefeated = true;
     foreach (Pawn item in base.Map.mapPawns.FreeColonistsSpawned)
     {
         item.needs?.mood?.thoughts.memories.TryGainMemory(ThoughtDefOf.DefeatedMechCluster);
     }
     QuestUtility.SendQuestTargetSignals(lord.questTags, "AllEnemiesDefeated");
     Messages.Message("MessageMechClusterDefeated".Translate(), new LookTargets(defSpot, base.Map), MessageTypeDefOf.PositiveEvent);
     SoundDefOf.MechClusterDefeated.PlayOneShotOnCamera(base.Map);
 }
Ejemplo n.º 2
0
        public override string GetLabel()
        {
            int count = ActivatorCountdowns.Count;

            if (count > 1)
            {
                return("ActivatorCountdownMultiple".Translate(count));
            }
            if (count == 0)
            {
                return("");
            }
            CompSendSignalOnCountdown compSendSignalOnCountdown = ActivatorCountdowns[0].TryGetComp <CompSendSignalOnCountdown>();

            return("ActivatorCountdown".Translate(compSendSignalOnCountdown.ticksLeft.ToStringTicksToPeriod()));
        }
Ejemplo n.º 3
0
        public override void CompTick()
        {
            CompPowerTrader comp = parent.GetComp <CompPowerTrader>();

            if (comp != null && !comp.PowerOn)
            {
                return;
            }
            CompSendSignalOnCountdown comp2 = parent.GetComp <CompSendSignalOnCountdown>();

            if (comp2 != null && comp2.ticksLeft <= 0)
            {
                return;
            }
            CompInitiatable comp3 = parent.GetComp <CompInitiatable>();

            if (comp3 != null && !comp3.Initiated)
            {
                return;
            }
            if (Props.emissionInterval != -1 && !Props.maintain)
            {
                if (ticksSinceLastEmitted >= Props.emissionInterval)
                {
                    Emit();
                    ticksSinceLastEmitted = 0;
                }
                else
                {
                    ticksSinceLastEmitted++;
                }
            }
            else if (mote == null)
            {
                Emit();
            }
            if (Props.maintain && mote != null)
            {
                mote.Maintain();
            }
        }