Пример #1
0
 public static void Notify_PawnLostForTutor(Pawn pawn, Map map)
 {
     if (!map.IsPlayerHome && map.mapPawns.FreeColonistsSpawnedCount != 0 && !AnyHostileActiveThreatToPlayer(map))
     {
         LessonAutoActivator.TeachOpportunity(ConceptDefOf.ReformCaravan, OpportunityType.Important);
     }
 }
Пример #2
0
 private void Tick(int interval)
 {
     if (this.Active)
     {
         float rotProgress        = this.RotProgress;
         float ambientTemperature = base.parent.AmbientTemperature;
         float num = GenTemperature.RotRateAtTemperature(ambientTemperature);
         this.RotProgress += num * (float)interval;
         if (this.Stage == RotStage.Rotting && this.PropsRot.rotDestroys)
         {
             if (base.parent.Spawned && base.parent.Map.slotGroupManager.SlotGroupAt(base.parent.Position) != null)
             {
                 Messages.Message("MessageRottedAwayInStorage".Translate(base.parent.Label).CapitalizeFirst(), MessageTypeDefOf.NegativeEvent);
                 LessonAutoActivator.TeachOpportunity(ConceptDefOf.SpoilageAndFreezers, OpportunityType.GoodToKnow);
             }
             base.parent.Destroy(DestroyMode.Vanish);
         }
         else if (Mathf.FloorToInt((float)(rotProgress / 60000.0)) != Mathf.FloorToInt((float)(this.RotProgress / 60000.0)) && this.ShouldTakeRotDamage())
         {
             if (this.Stage == RotStage.Rotting && this.PropsRot.rotDamagePerDay > 0.0)
             {
                 base.parent.TakeDamage(new DamageInfo(DamageDefOf.Rotting, GenMath.RoundRandom(this.PropsRot.rotDamagePerDay), -1f, null, null, null, DamageInfo.SourceCategory.ThingOrUnknown));
             }
             else if (this.Stage == RotStage.Dessicated && this.PropsRot.dessicatedDamagePerDay > 0.0)
             {
                 base.parent.TakeDamage(new DamageInfo(DamageDefOf.Rotting, GenMath.RoundRandom(this.PropsRot.dessicatedDamagePerDay), -1f, null, null, null, DamageInfo.SourceCategory.ThingOrUnknown));
             }
         }
     }
 }
Пример #3
0
 public override void PostOpen()
 {
     base.PostOpen();
     Find.GameInitData.ChooseRandomStartingTile();
     LessonAutoActivator.TeachOpportunity(ConceptDefOf.WorldCameraMovement, OpportunityType.Important);
     TutorSystem.Notify_Event("PageStart-SelectStartingSite");
 }
 public void Notify_ReceivedThing(Thing newItem)
 {
     if (newItem.def.storedConceptLearnOpportunity != null)
     {
         LessonAutoActivator.TeachOpportunity(newItem.def.storedConceptLearnOpportunity, OpportunityType.GoodToKnow);
     }
 }
Пример #5
0
 public override void Activate()
 {
     if (Find.World.renderer.wantedMode == WorldRenderMode.None)
     {
         Find.World.renderer.wantedMode = WorldRenderMode.Planet;
         if (this.resetViewNextTime)
         {
             this.resetViewNextTime = false;
             Find.World.UI.Reset();
         }
         LessonAutoActivator.TeachOpportunity(ConceptDefOf.FormCaravan, OpportunityType.Important);
         Find.MainTabsRoot.EscapeCurrentTab(false);
         SoundDefOf.TabOpen.PlayOneShotOnCamera(null);
     }
     else if (Find.MainTabsRoot.OpenTab != null && Find.MainTabsRoot.OpenTab != MainButtonDefOf.Inspect)
     {
         Find.MainTabsRoot.EscapeCurrentTab(false);
         SoundDefOf.TabOpen.PlayOneShotOnCamera(null);
     }
     else
     {
         Find.World.renderer.wantedMode = WorldRenderMode.None;
         SoundDefOf.TabClose.PlayOneShotOnCamera(null);
     }
 }
Пример #6
0
        protected override bool TryExecuteWorker(IncidentParms parms)
        {
            Map         map         = (Map)parms.target;
            PawnKindDef pawnKindDef = default(PawnKindDef);

            if (!ManhunterPackIncidentUtility.TryFindManhunterAnimalKind(parms.points, map.Tile, out pawnKindDef))
            {
                return(false);
            }
            IntVec3 intVec = default(IntVec3);

            if (!RCellFinder.TryFindRandomPawnEntryCell(out intVec, map, CellFinder.EdgeRoadChance_Animal, (Predicate <IntVec3>)null))
            {
                return(false);
            }
            List <Pawn> list = ManhunterPackIncidentUtility.GenerateAnimals(pawnKindDef, map.Tile, (float)(parms.points * 1.3999999761581421));
            Rot4        rot  = Rot4.FromAngleFlat((map.Center - intVec).AngleFlat);

            for (int i = 0; i < list.Count; i++)
            {
                Pawn    pawn = list[i];
                IntVec3 loc  = CellFinder.RandomClosewalkCellNear(intVec, map, 10, null);
                GenSpawn.Spawn(pawn, loc, map, rot, false);
                pawn.mindState.mentalStateHandler.TryStartMentalState(MentalStateDefOf.ManhunterPermanent, null, false, false, null);
                pawn.mindState.exitMapAfterTick = Find.TickManager.TicksGame + Rand.Range(60000, 135000);
            }
            Find.LetterStack.ReceiveLetter("LetterLabelManhunterPackArrived".Translate(), "ManhunterPackArrived".Translate(pawnKindDef.GetLabelPlural(-1)), LetterDefOf.ThreatBig, list[0], null);
            Find.TickManager.slower.SignalForceNormalSpeedShort();
            LessonAutoActivator.TeachOpportunity(ConceptDefOf.ForbiddingDoors, OpportunityType.Critical);
            LessonAutoActivator.TeachOpportunity(ConceptDefOf.AllowedAreas, OpportunityType.Important);
            return(true);
        }
Пример #7
0
 private static void TryInitiateLesson(ConceptDef conc)
 {
     if (Find.Tutor.learningReadout.TryActivateConcept(conc))
     {
         LessonAutoActivator.SetLastLessonTimeToNow();
     }
 }
Пример #8
0
        public static void TeachOpportunity(ConceptDef conc, Thing subject, OpportunityType opp)
        {
            if (TutorSystem.AdaptiveTrainingEnabled && !PlayerKnowledgeDatabase.IsComplete(conc))
            {
                float value = 999f;
                switch (opp)
                {
                case OpportunityType.GoodToKnow:
                    value = 60f;
                    break;

                case OpportunityType.Important:
                    value = 80f;
                    break;

                case OpportunityType.Critical:
                    value = 100f;
                    break;

                default:
                    Log.Error("Unknown need");
                    break;
                }
                LessonAutoActivator.opportunities[conc] = value;
                if ((int)opp < 1 && Find.Tutor.learningReadout.ActiveConceptsCount >= 4)
                {
                    return;
                }
                LessonAutoActivator.TryInitiateLesson(conc);
            }
        }
Пример #9
0
 public override void SpawnSetup(Map map, bool respawningAfterLoad)
 {
     base.SpawnSetup(map, respawningAfterLoad);
     RecalcPathsOnAndAroundMe(map);
     LessonAutoActivator.TeachOpportunity(ConceptDefOf.HomeArea, this, OpportunityType.Important);
     ticksSinceSpread = (int)(SpreadInterval * Rand.Value);
 }
Пример #10
0
 private void Tick(int interval)
 {
     if (Active)
     {
         float rotProgress        = RotProgress;
         float ambientTemperature = parent.AmbientTemperature;
         float num = GenTemperature.RotRateAtTemperature(ambientTemperature);
         RotProgress += num * (float)interval;
         if (Stage == RotStage.Rotting && PropsRot.rotDestroys)
         {
             if (parent.IsInAnyStorage() && parent.SpawnedOrAnyParentSpawned)
             {
                 Messages.Message("MessageRottedAwayInStorage".Translate(parent.Label, parent).CapitalizeFirst(), new TargetInfo(parent.PositionHeld, parent.MapHeld), MessageTypeDefOf.NegativeEvent);
                 LessonAutoActivator.TeachOpportunity(ConceptDefOf.SpoilageAndFreezers, OpportunityType.GoodToKnow);
             }
             parent.Destroy();
         }
         else if (Mathf.FloorToInt(rotProgress / 60000f) != Mathf.FloorToInt(RotProgress / 60000f) && ShouldTakeRotDamage())
         {
             if (Stage == RotStage.Rotting && PropsRot.rotDamagePerDay > 0f)
             {
                 parent.TakeDamage(new DamageInfo(DamageDefOf.Rotting, (float)GenMath.RoundRandom(PropsRot.rotDamagePerDay)));
             }
             else if (Stage == RotStage.Dessicated && PropsRot.dessicatedDamagePerDay > 0f)
             {
                 parent.TakeDamage(new DamageInfo(DamageDefOf.Rotting, (float)GenMath.RoundRandom(PropsRot.dessicatedDamagePerDay)));
             }
         }
     }
 }
Пример #11
0
        protected override bool TryExecuteWorker(IncidentParms parms)
        {
            Map         map        = (Map)parms.target;
            PawnKindDef animalKind = parms.pawnKind;

            if ((animalKind == null && !ManhunterPackIncidentUtility.TryFindManhunterAnimalKind(parms.points, map.Tile, out animalKind)) || ManhunterPackIncidentUtility.GetAnimalsCount(animalKind, parms.points) == 0)
            {
                return(false);
            }
            IntVec3 result = parms.spawnCenter;

            if (!result.IsValid && !RCellFinder.TryFindRandomPawnEntryCell(out result, map, CellFinder.EdgeRoadChance_Animal))
            {
                return(false);
            }
            List <Pawn> list = ManhunterPackIncidentUtility.GenerateAnimals_NewTmp(animalKind, map.Tile, parms.points * 1f, parms.pawnCount);
            Rot4        rot  = Rot4.FromAngleFlat((map.Center - result).AngleFlat);

            for (int i = 0; i < list.Count; i++)
            {
                Pawn    pawn = list[i];
                IntVec3 loc  = CellFinder.RandomClosewalkCellNear(result, map, 10);
                QuestUtility.AddQuestTag(GenSpawn.Spawn(pawn, loc, map, rot), parms.questTag);
                pawn.health.AddHediff(HediffDefOf.Scaria);
                pawn.mindState.mentalStateHandler.TryStartMentalState(MentalStateDefOf.ManhunterPermanent);
                pawn.mindState.exitMapAfterTick = Find.TickManager.TicksGame + Rand.Range(60000, 120000);
            }
            SendStandardLetter("LetterLabelManhunterPackArrived".Translate(), "ManhunterPackArrived".Translate(animalKind.GetLabelPlural()), LetterDefOf.ThreatBig, parms, list[0]);
            Find.TickManager.slower.SignalForceNormalSpeedShort();
            LessonAutoActivator.TeachOpportunity(ConceptDefOf.ForbiddingDoors, OpportunityType.Critical);
            LessonAutoActivator.TeachOpportunity(ConceptDefOf.AllowedAreas, OpportunityType.Important);
            return(true);
        }
 public static void CheckDrugAddictionTeachOpportunity(Pawn pawn)
 {
     if (pawn.RaceProps.IsFlesh && pawn.Spawned && (pawn.Faction == Faction.OfPlayer || pawn.HostFaction == Faction.OfPlayer) && AddictedToAnything(pawn))
     {
         LessonAutoActivator.TeachOpportunity(ConceptDefOf.DrugAddiction, pawn, OpportunityType.Important);
     }
 }
 public virtual void Notify_ReceivedThing(Thing newItem)
 {
     if (base.Faction == Faction.OfPlayer && newItem.def.storedConceptLearnOpportunity != null)
     {
         LessonAutoActivator.TeachOpportunity(newItem.def.storedConceptLearnOpportunity, OpportunityType.GoodToKnow);
     }
 }
        public static void KnowledgeDemonstrated(ConceptDef conc, KnowledgeAmount know)
        {
            float num = know switch
            {
                KnowledgeAmount.FrameDisplayed => (Event.current.type == EventType.Repaint) ? 0.004f : 0f,
                KnowledgeAmount.FrameInteraction => 0.008f,
                KnowledgeAmount.TinyInteraction => 0.03f,
                KnowledgeAmount.SmallInteraction => 0.1f,
                KnowledgeAmount.SpecificInteraction => 0.4f,
                KnowledgeAmount.Total => 1f,
                KnowledgeAmount.NoteClosed => 0.5f,
                KnowledgeAmount.NoteTaught => 1f,
                _ => throw new NotImplementedException(),
            };

            if (!(num <= 0f))
            {
                SetKnowledge(conc, GetKnowledge(conc) + num);
                LessonAutoActivator.Notify_KnowledgeDemonstrated(conc);
                if (Find.ActiveLesson != null)
                {
                    Find.ActiveLesson.Notify_KnowledgeDemonstrated(conc);
                }
            }
        }
Пример #15
0
        public static string DebugString()
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendLine("RelaxDesire: " + LessonAutoActivator.RelaxDesire);
            IEnumerable <ConceptDef> allDefs = DefDatabase <ConceptDef> .AllDefs;

            if (LessonAutoActivator.< > f__mg$cache0 == null)
            {
                LessonAutoActivator.< > f__mg$cache0 = new Func <ConceptDef, float>(LessonAutoActivator.GetDesire);
            }
            foreach (ConceptDef conceptDef in allDefs.OrderByDescending(LessonAutoActivator.< > f__mg$cache0))
            {
                if (PlayerKnowledgeDatabase.IsComplete(conceptDef))
                {
                    stringBuilder.AppendLine(conceptDef.defName + " complete");
                }
                else
                {
                    stringBuilder.AppendLine(string.Concat(new string[]
                    {
                        conceptDef.defName,
                        "\n   know ",
                        PlayerKnowledgeDatabase.GetKnowledge(conceptDef).ToString("F3"),
                        "\n   need ",
                        LessonAutoActivator.opportunities[conceptDef].ToString("F3"),
                        "\n   des ",
                        LessonAutoActivator.GetDesire(conceptDef).ToString("F3")
                    }));
                }
            }
            return(stringBuilder.ToString());
        }
Пример #16
0
 public override void SpawnSetup(Map map, bool respawningAfterLoad)
 {
     base.SpawnSetup(map, respawningAfterLoad);
     powerComp = GetComp <CompPowerTrader>();
     LessonAutoActivator.TeachOpportunity(ConceptDefOf.BuildOrbitalTradeBeacon, OpportunityType.GoodToKnow);
     LessonAutoActivator.TeachOpportunity(ConceptDefOf.OpeningComms, OpportunityType.GoodToKnow);
 }
 public static void CheckMeditationScheduleTeachOpportunity(Pawn pawn)
 {
     if (!pawn.Dead && pawn.Spawned && pawn.HasPsylink && pawn.Faction == Faction.OfPlayer && !pawn.IsQuestLodger())
     {
         LessonAutoActivator.TeachOpportunity(ConceptDefOf.MeditationSchedule, pawn, OpportunityType.GoodToKnow);
         LessonAutoActivator.TeachOpportunity(ConceptDefOf.MeditationDesiredPsyfocus, pawn, OpportunityType.GoodToKnow);
     }
 }
        internal IEnumerable <Gizmo> GetGizmos()
        {
            Command_Toggle draft = new Command_Toggle();

            draft.hotKey       = KeyBindingDefOf.Command_ColonistDraft;
            draft.isActive     = new Func <bool>(this.get_Drafted);
            draft.toggleAction = delegate()
            {
                this.Drafted = !this.Drafted;
                PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.Drafting, KnowledgeAmount.SpecificInteraction);
                if (this.Drafted)
                {
                    LessonAutoActivator.TeachOpportunity(ConceptDefOf.QueueOrders, OpportunityType.GoodToKnow);
                }
            };
            draft.defaultDesc  = "CommandToggleDraftDesc".Translate();
            draft.icon         = TexCommand.Draft;
            draft.turnOnSound  = SoundDefOf.DraftOn;
            draft.turnOffSound = SoundDefOf.DraftOff;
            if (!this.Drafted)
            {
                draft.defaultLabel = "CommandDraftLabel".Translate();
            }
            if (this.pawn.Downed)
            {
                draft.Disable("IsIncapped".Translate(new object[]
                {
                    this.pawn.LabelShort
                }));
            }
            if (!this.Drafted)
            {
                draft.tutorTag = "Draft";
            }
            else
            {
                draft.tutorTag = "Undraft";
            }
            yield return(draft);

            if (this.Drafted && this.pawn.equipment.Primary != null && this.pawn.equipment.Primary.def.IsRangedWeapon)
            {
                yield return(new Command_Toggle
                {
                    hotKey = KeyBindingDefOf.Misc6,
                    isActive = new Func <bool>(this.get_FireAtWill),
                    toggleAction = delegate()
                    {
                        this.FireAtWill = !this.FireAtWill;
                    },
                    icon = TexCommand.FireAtWill,
                    defaultLabel = "CommandFireAtWillLabel".Translate(),
                    defaultDesc = "CommandFireAtWillDesc".Translate(),
                    tutorTag = "FireAtWillToggle"
                });
            }
            yield break;
        }
Пример #19
0
        public override void PostPlace(Map map, BuildableDef def, IntVec3 loc, Rot4 rot)
        {
            Blueprint_Door blueprint_Door = (Blueprint_Door)loc.GetThingList(map).FirstOrDefault((Thing t) => t is Blueprint_Door);

            if (blueprint_Door != null && blueprint_Door.def.entityDefToBuild.GetStatValueAbstract(StatDefOf.DoorOpenSpeed, blueprint_Door.stuffToUse) < 0.64999997615814209)
            {
                LessonAutoActivator.TeachOpportunity(ConceptDefOf.DoorOpenSpeed, OpportunityType.Important);
            }
        }
Пример #20
0
 public override void TryOpenComms(Pawn negotiator)
 {
     if (CanTradeNow)
     {
         Find.WindowStack.Add(new Dialog_Trade(negotiator, this));
         LessonAutoActivator.TeachOpportunity(ConceptDefOf.BuildOrbitalTradeBeacon, OpportunityType.Critical);
         PawnRelationUtility.Notify_PawnsSeenByPlayer_Letter_Send(Goods.OfType <Pawn>(), "LetterRelatedPawnsTradeShip".Translate(Faction.OfPlayer.def.pawnsPlural), LetterDefOf.NeutralEvent);
         TutorUtility.DoModalDialogIfNotKnown(ConceptDefOf.TradeGoodsMustBeNearBeacon);
     }
 }
Пример #21
0
 public static void CheckInteractWithTradersTeachOpportunity(Pawn pawn)
 {
     if (!pawn.Dead)
     {
         Lord lord = pawn.GetLord();
         if (lord != null && lord.CurLordToil is LordToil_DefendTraderCaravan)
         {
             LessonAutoActivator.TeachOpportunity(ConceptDefOf.InteractingWithTraders, pawn, OpportunityType.Important);
         }
     }
 }
Пример #22
0
 public override void PostDeactivated()
 {
     SoundDefOf.CommsWindow_Close.PlayOneShotOnCamera(null);
     TutorSystem.Notify_Event("InstructionDeactivated-" + this.def.defName);
     if (this.def.endTutorial)
     {
         Find.ActiveLesson.Deactivate();
         Find.TutorialState.Notify_TutorialEnding();
         LessonAutoActivator.Notify_TutorialEnding();
     }
 }
Пример #23
0
        internal IEnumerable <Gizmo> GetGizmos()
        {
            Command_Toggle command_Toggle = new Command_Toggle();

            command_Toggle.hotKey       = KeyBindingDefOf.Command_ColonistDraft;
            command_Toggle.isActive     = (() => Drafted);
            command_Toggle.toggleAction = delegate
            {
                Drafted = !Drafted;
                PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.Drafting, KnowledgeAmount.SpecificInteraction);
                if (Drafted)
                {
                    LessonAutoActivator.TeachOpportunity(ConceptDefOf.QueueOrders, OpportunityType.GoodToKnow);
                }
            };
            command_Toggle.defaultDesc  = "CommandToggleDraftDesc".Translate();
            command_Toggle.icon         = TexCommand.Draft;
            command_Toggle.turnOnSound  = SoundDefOf.DraftOn;
            command_Toggle.turnOffSound = SoundDefOf.DraftOff;
            if (!Drafted)
            {
                command_Toggle.defaultLabel = "CommandDraftLabel".Translate();
            }
            if (pawn.Downed)
            {
                command_Toggle.Disable("IsIncapped".Translate(pawn.LabelShort, pawn));
            }
            if (!Drafted)
            {
                command_Toggle.tutorTag = "Draft";
            }
            else
            {
                command_Toggle.tutorTag = "Undraft";
            }
            yield return(command_Toggle);

            if (Drafted && pawn.equipment.Primary != null && pawn.equipment.Primary.def.IsRangedWeapon)
            {
                Command_Toggle command_Toggle2 = new Command_Toggle();
                command_Toggle2.hotKey       = KeyBindingDefOf.Misc6;
                command_Toggle2.isActive     = (() => FireAtWill);
                command_Toggle2.toggleAction = delegate
                {
                    FireAtWill = !FireAtWill;
                };
                command_Toggle2.icon         = TexCommand.FireAtWill;
                command_Toggle2.defaultLabel = "CommandFireAtWillLabel".Translate();
                command_Toggle2.defaultDesc  = "CommandFireAtWillDesc".Translate();
                command_Toggle2.tutorTag     = "FireAtWillToggle";
                yield return(command_Toggle2);
            }
        }
Пример #24
0
        public static void KnowledgeDemonstrated(ConceptDef conc, KnowledgeAmount know)
        {
            float num;

            switch (know)
            {
            case KnowledgeAmount.FrameDisplayed:
                num = ((Event.current.type != EventType.Repaint) ? 0f : 0.004f);
                break;

            case KnowledgeAmount.FrameInteraction:
                num = 0.008f;
                break;

            case KnowledgeAmount.TinyInteraction:
                num = 0.03f;
                break;

            case KnowledgeAmount.SmallInteraction:
                num = 0.1f;
                break;

            case KnowledgeAmount.SpecificInteraction:
                num = 0.4f;
                break;

            case KnowledgeAmount.Total:
                num = 1f;
                break;

            case KnowledgeAmount.NoteClosed:
                num = 0.5f;
                break;

            case KnowledgeAmount.NoteTaught:
                num = 1f;
                break;

            default:
                throw new NotImplementedException();
            }
            if (num <= 0f)
            {
                return;
            }
            PlayerKnowledgeDatabase.SetKnowledge(conc, PlayerKnowledgeDatabase.GetKnowledge(conc) + num);
            LessonAutoActivator.Notify_KnowledgeDemonstrated(conc);
            if (Find.ActiveLesson != null)
            {
                Find.ActiveLesson.Notify_KnowledgeDemonstrated(conc);
            }
        }
Пример #25
0
        // Token: 0x06002673 RID: 9843 RVA: 0x001240D8 File Offset: 0x001224D8
        public override void SpawnSetup(Map map, bool respawningAfterLoad)
        {
            if (!PlayerKnowledgeDatabase.IsComplete(XenomorphConceptDefOf.RRY_Concept_HiveLike) && this.def == XenomorphDefOf.RRY_Xenomorph_Hive)
            {
                LessonAutoActivator.TeachOpportunity(XenomorphConceptDefOf.RRY_Concept_HiveLike, OpportunityType.Important);
            }
            base.SpawnSetup(map, respawningAfterLoad);
            if (base.Faction == null)
            {
                this.SetFaction(OfFaction, null);
            }
            if (this.getsQueen && hiveNode)
            {
                Pawn newQueen = PawnGenerator.GeneratePawn(new PawnGenerationRequest(XenomorphDefOf.RRY_Xenomorph_Queen, factionInt));
                this.innerContainer.TryAdd(newQueen);
            }
            if (!respawningAfterLoad && this.active && canSpawnPawns)
            {
                this.SpawnInitialPawns();
            }
            else
            {
                spawnablePawnKinds = OfPawnKinds;
            }
            MapComponent_HiveGrid hiveGrid = map.HiveGrid();

            if (hiveGrid != null)
            {
                if (this.def == XenomorphDefOf.RRY_Xenomorph_Hive)
                {
                    if (!hiveGrid.Hivelist.Contains(this))
                    {
                        hiveGrid.Hivelist.Add(this);
                    }
                    if (!hiveGrid.HiveLoclist.Contains(this.Position))
                    {
                        hiveGrid.HiveLoclist.Add(this.Position);
                    }
                }
                if (this.def == XenomorphDefOf.RRY_Xenomorph_Hive_Child)
                {
                    if (!hiveGrid.Hivelist.Contains(this))
                    {
                        hiveGrid.Hivelist.Add(this);
                    }
                    if (!hiveGrid.HiveLoclist.Contains(this.Position))
                    {
                        hiveGrid.HiveLoclist.Add(this.Position);
                    }
                }
            }
        }
Пример #26
0
 public override void SpawnSetup(Map map, bool respawningAfterLoad)
 {
     base.SpawnSetup(map, respawningAfterLoad);
     this.RecalcPathsOnAndAroundMe(map);
     LessonAutoActivator.TeachOpportunity(ConceptDefOf.HomeArea, this, OpportunityType.Important);
     this.ticksSinceSpread = (int)(this.SpreadInterval * Rand.Value);
     LongEventHandler.ExecuteWhenFinished(delegate
     {
         SoundDef def   = SoundDef.Named("FireBurning");
         SoundInfo info = SoundInfo.InMap(new TargetInfo(this.Position, map, false), MaintenanceType.PerTick);
         this.sustainer = SustainerAggregatorUtility.AggregateOrSpawnSustainerFor(this, def, info);
     });
 }
Пример #27
0
 public override void TryOpenComms(Pawn negotiator)
 {
     if (this.CanTradeNow)
     {
         Find.WindowStack.Add(new Dialog_Trade(negotiator, this));
         LessonAutoActivator.TeachOpportunity(ConceptDefOf.BuildOrbitalTradeBeacon, OpportunityType.Critical);
         string empty  = string.Empty;
         string empty2 = string.Empty;
         PawnRelationUtility.Notify_PawnsSeenByPlayer_Letter(this.Goods.OfType <Pawn>(), ref empty, ref empty2, "LetterRelatedPawnsTradeShip".Translate(), false, true);
         if (!empty2.NullOrEmpty())
         {
             Find.LetterStack.ReceiveLetter(empty, empty2, LetterDefOf.PositiveEvent, (string)null);
         }
         TutorUtility.DoModalDialogIfNotKnown(ConceptDefOf.TradeGoodsMustBeNearBeacon);
     }
 }
Пример #28
0
 public override void UIRootUpdate()
 {
     base.UIRootUpdate();
     try
     {
         Find.World.UI.WorldInterfaceUpdate();
         this.mapUI.MapInterfaceUpdate();
         this.alerts.AlertsReadoutUpdate();
         LessonAutoActivator.LessonAutoActivatorUpdate();
         Find.Tutor.TutorUpdate();
     }
     catch (Exception ex)
     {
         Log.Error("Exception in UIRootUpdate: " + ex.ToString());
     }
 }
Пример #29
0
 public static void CheckDrugAddictionTeachOpportunity(Pawn pawn)
 {
     if (!pawn.RaceProps.IsFlesh || !pawn.Spawned)
     {
         return;
     }
     if (pawn.Faction != Faction.OfPlayer && pawn.HostFaction != Faction.OfPlayer)
     {
         return;
     }
     if (!AddictionUtility.AddictedToAnything(pawn))
     {
         return;
     }
     LessonAutoActivator.TeachOpportunity(ConceptDefOf.DrugAddiction, pawn, OpportunityType.Important);
 }
Пример #30
0
        private void CheckTeachOpportunity(Thing boughtThing, int boughtCount)
        {
            Building building = boughtThing as Building;

            if (building == null)
            {
                MinifiedThing minifiedThing = boughtThing as MinifiedThing;
                if (minifiedThing != null)
                {
                    building = (minifiedThing.InnerThing as Building);
                }
            }
            if (building != null && building.def.building != null && building.def.building.boughtConceptLearnOpportunity != null)
            {
                LessonAutoActivator.TeachOpportunity(building.def.building.boughtConceptLearnOpportunity, OpportunityType.GoodToKnow);
            }
        }