Ejemplo n.º 1
0
 public static bool TryGetLookTargets(SignalArgs args, string name, out LookTargets lookTargets)
 {
     if (args.TryGetArg(name, out lookTargets))
     {
         return(true);
     }
     if (args.TryGetArg(name, out Thing arg))
     {
         lookTargets = arg;
         return(true);
     }
     if (args.TryGetArg(name, out WorldObject arg2))
     {
         lookTargets = arg2;
         return(true);
     }
     if (args.TryGetArg(name, out GlobalTargetInfo arg3))
     {
         lookTargets = arg3;
         return(true);
     }
     if (args.TryGetArg(name, out TargetInfo arg4))
     {
         lookTargets = arg4;
         return(true);
     }
     lookTargets = LookTargets.Invalid;
     return(false);
 }
 protected override bool Pass(SignalArgs args)
 {
     if (faction == null || other == null || faction == other)
     {
         return(false);
     }
     return(faction.HostileTo(other));
 }
Ejemplo n.º 3
0
 private QuestEndOutcome GetOutcome(SignalArgs args)
 {
     if (args.TryGetArg("OUTCOME", out QuestEndOutcome arg))
     {
         return(arg);
     }
     return(QuestEndOutcome.Unknown);
 }
Ejemplo n.º 4
0
 public override void Notify_QuestSignalReceived(Signal signal)
 {
     if (signal.tag == inSignal)
     {
         SignalArgs args = new SignalArgs(signal.args);
         if (outSignalOutcomeArg.HasValue)
         {
             args.Add(outSignalOutcomeArg.Value.Named("OUTCOME"));
         }
         args.Add(faction.Named("FACTION"));
         Find.SignalManager.SendSignal(new Signal(outSignal, args));
     }
 }
 protected override bool Pass(SignalArgs args)
 {
     if (pawns.NullOrEmpty())
     {
         return(false);
     }
     foreach (Pawn pawn in pawns)
     {
         if (pawn.Destroyed || pawn.InMentalState || pawn.health.hediffSet.BleedRateTotal > 0.001f)
         {
             return(true);
         }
     }
     return(false);
 }
 protected override bool Pass(SignalArgs args)
 {
     if (pawns.NullOrEmpty())
     {
         return(false);
     }
     foreach (Pawn pawn in pawns)
     {
         if (!pawn.Destroyed && pawn.IsColonistPlayerControlled)
         {
             return(true);
         }
     }
     return(false);
 }
 protected override void DoAction(SignalArgs args)
 {
     if (args.TryGetArg("SUBJECT", out Pawn arg))
     {
         ChoiceLetter choiceLetter = letter as ChoiceLetter;
         if (choiceLetter != null)
         {
             choiceLetter.text = choiceLetter.text.Resolve().Formatted(arg.LabelShort, arg.Named("PAWN")).AdjustedFor(arg);
         }
         if (!letter.lookTargets.IsValid())
         {
             letter.lookTargets = arg;
         }
     }
     Find.LetterStack.ReceiveLetter(letter);
 }
        protected override bool Pass(SignalArgs args)
        {
            if (pawns.NullOrEmpty())
            {
                return(false);
            }
            ThingOwner directlyHeldThings = transporter.TryGetComp <CompTransporter>().GetDirectlyHeldThings();

            foreach (Pawn pawn in pawns)
            {
                if (directlyHeldThings.Contains(pawn))
                {
                    return(true);
                }
            }
            return(false);
        }
Ejemplo n.º 9
0
 protected abstract void DoAction(SignalArgs args);
Ejemplo n.º 10
0
 protected override void Enable(SignalArgs receivedArgs)
 {
     base.Enable(receivedArgs);
     resolvedInspectString = receivedArgs.GetFormattedText(inspectString);
 }
Ejemplo n.º 11
0
        protected override void DoAction(SignalArgs args)
        {
            if (points <= 0f)
            {
                return;
            }
            List <Pawn> list = new List <Pawn>();

            foreach (Pawn item in GenerateAmbushPawns())
            {
                IntVec3 result;
                if (spawnPawnsOnEdge)
                {
                    if (!CellFinder.TryFindRandomEdgeCellWith((IntVec3 x) => x.Standable(base.Map) && !x.Fogged(base.Map) && base.Map.reachability.CanReachColony(x), base.Map, CellFinder.EdgeRoadChance_Ignore, out result))
                    {
                        Find.WorldPawns.PassToWorld(item);
                        break;
                    }
                }
                else if (!SiteGenStepUtility.TryFindSpawnCellAroundOrNear(spawnAround, spawnNear, base.Map, out result))
                {
                    Find.WorldPawns.PassToWorld(item);
                    break;
                }
                GenSpawn.Spawn(item, result, base.Map);
                if (!spawnPawnsOnEdge)
                {
                    for (int i = 0; i < 10; i++)
                    {
                        MoteMaker.ThrowAirPuffUp(item.DrawPos, base.Map);
                    }
                }
                list.Add(item);
            }
            if (!list.Any())
            {
                return;
            }
            if (ambushType == SignalActionAmbushType.Manhunters)
            {
                for (int j = 0; j < list.Count; j++)
                {
                    list[j].health.AddHediff(HediffDefOf.Scaria);
                    list[j].mindState.mentalStateHandler.TryStartMentalState(MentalStateDefOf.ManhunterPermanent);
                }
            }
            else
            {
                Faction faction = list[0].Faction;
                LordMaker.MakeNewLord(faction, new LordJob_AssaultColony(faction), base.Map, list);
            }
            if (!spawnPawnsOnEdge)
            {
                for (int k = 0; k < list.Count; k++)
                {
                    list[k].jobs.StartJob(JobMaker.MakeJob(JobDefOf.Wait, 120));
                    list[k].Rotation = Rot4.Random;
                }
            }
            Find.LetterStack.ReceiveLetter("LetterLabelAmbushInExistingMap".Translate(), "LetterAmbushInExistingMap".Translate(Faction.OfPlayer.def.pawnsPlural).CapitalizeFirst(), LetterDefOf.ThreatBig, list[0]);
        }
Ejemplo n.º 12
0
 public static void SendQuestTargetSignals(List <string> questTags, string signalPart, SignalArgs args)
 {
     if (questTags != null)
     {
         for (int i = 0; i < questTags.Count; i++)
         {
             Find.SignalManager.SendSignal(new Signal(questTags[i] + "." + signalPart, args));
         }
     }
 }
Ejemplo n.º 13
0
 protected override void Enable(SignalArgs receivedArgs)
 {
     base.Enable(receivedArgs);
     killed = 0;
 }
 protected override void Enable(SignalArgs receivedArgs)
 {
     signalsReceived.Clear();
     base.Enable(receivedArgs);
 }