Esempio n. 1
0
        public static bool TryScanForMotion(IncidentParms parms, IncidentDef incidentDef)
        {
            // Can spot?
            if (!ResearchProjectDefOf.BasicScoutingTehniques.IsFinished)
            {
                return(false);
            }

            // Detected
            float spottingPower = CalculateSpottingPower((Map)parms.target);

            if (spottingPower < new IntRange(0, 100).RandomInRange)
            {
                return(false);
            }

            // Delay
            IDelayHolder delay = DelayRaid(parms, incidentDef);

            // Indentify type
            IncidentDef spottedType = TryIdentifyType(parms, incidentDef, spottingPower);

            // Send Letter and Alert
            NotifySpotted(parms, delay, spottedType);

            return(true);
        }
Esempio n. 2
0
        public void SetAlertIncident(IDelayHolder delay, IncidentDef incidentDef)
        {
            string alertDescription = incidentDef?.LabelCap ?? "S.UnidentifiedMovement".Translate();

            this.delay  = delay;
            description = alertDescription;
        }
Esempio n. 3
0
 public static Letter NewLetter(IncidentParms parms, IDelayHolder delay, IncidentDef incidentDef = null)
 {
     if (incidentDef == null || parms.points > -1f)
     {
         return(LetterMaker.MakeLetter(LetterLabel.Translate(), GetLetterText(delay, parms, incidentDef), LetterDefOf.ThreatBig, new TargetInfo(parms.spawnCenter, (Map)parms.target)));
     }
     return(LetterMaker.MakeLetter(LetterLabel.Translate(), GetLetterText(delay, parms, incidentDef), LetterDefOf.NeutralEvent, new TargetInfo(parms.spawnCenter, (Map)parms.target)));
 }
Esempio n. 4
0
        private static IDelayHolder DelayRaid(IncidentParms parms, IncidentDef incidentDef)
        {
            IDelayHolder   delay = CalculateDelay(parms);
            QueuedIncident qi    = new QueuedIncident(new FiringIncident(incidentDef, null, parms), delay.GetGlobalDelay());

            Find.Storyteller.incidentQueue.Add(qi);

            return(delay);
        }
Esempio n. 5
0
        private static string GetLetterText(IDelayHolder delay, IncidentParms parms, IncidentDef incidentDef = null)
        {
            StringBuilder letterText = new StringBuilder();

            // description (detected text)
            letterText.AppendLine(GetDescription(parms, incidentDef));

            // count
            letterText.AppendLine("S.LetterQuantityUnidendified".Translate());

            // type
            letterText.AppendLine(GetTypeDescription(parms, incidentDef));

            // arrival time
            letterText.Append("S.LetterTime".Translate());
            letterText.Append(" " + delay.ToStringRelativeDelayToPeriod());

            return(letterText.ToString());
        }
Esempio n. 6
0
 public AlertIncident(IDelayHolder delay, IncidentDef incidentDef) : this()
 {
     SetAlertIncident(delay, incidentDef);
 }
Esempio n. 7
0
 private static void NotifySpotted(IncidentParms parms, IDelayHolder delay, IncidentDef incidentDef = null)
 {
     Find.LetterStack.ReceiveLetter(SpottedLetter.NewLetter(parms, delay, incidentDef));
     Alert_Spotted.AddIncident(new AlertIncident(delay, incidentDef));
 }