Example #1
0
            public void UpdateInsideOutside()
            {
                Sim createdSim = mSimID.CreatedSim;

                if (createdSim == null)
                {
                    return;
                }
                bool inRabbitHole = createdSim.SimInRabbitHolePosture;

                if (!inRabbitHole)
                {
                    inRabbitHole = (createdSim.RoomId != 0);
                    if (inRabbitHole && createdSim.IsSelectable)
                    {
                        Vector3     position           = createdSim.Position;
                        LotLocation invalid            = LotLocation.Invalid;
                        ulong       lotLocationAtFloor = World.GetLotLocationAtFloor(position, ref invalid);
                        if (World.HasPool(lotLocationAtFloor, invalid) && !World.HasAnyRoofAtPos(position))
                        {
                            inRabbitHole = false;
                        }
                    }
                }
                BuffGermy.BuffInstanceGermy buffInstanceGermy = createdSim.BuffManager.GetElement(BuffNames.Germy) as BuffGermy.BuffInstanceGermy;
                if (buffInstanceGermy != null)
                {
                    buffInstanceGermy.IsIndoors = inRabbitHole;
                }
            }
Example #2
0
        public bool Process(SimDescription sim)
        {
            if (!mNonPersistableData.IsEnabled)
            {
                return(false);
            }

            if (mProtected > 0)
            {
                mProtected--;
            }
            else if (mProtected <= 0)
            {
                mVirulence = 1f;
            }

            if ((RawStrength <= 0) || (SimTypes.IsDead(sim)))
            {
                mStageType = VectorControl.StageType.Resisted;
                return(false);
            }

            if ((IsInoculated) || (IsResisted))
            {
                return(false);
            }

            bool noticeShown = false;

            if (mNextCheck > 0)
            {
                mNextCheck--;
            }
            else
            {
                if (InRemission)
                {
                    mResistance = 0;
                    mNotices   &= ~Notices.FirstSign;
                }

                mStageType = mNonPersistableData.AdjustStage(this, sim, out mStage, out mNextCheck);

                mNextCheck = (int)(mNextCheck * (Vector.Settings.mStageRatio / 100f));

                string key = mNonPersistableData.GetStory(mStage, IsIdentified);

                if (!string.IsNullOrEmpty(key))
                {
                    if ((SimTypes.IsSelectable(sim)) || (!IsIgnored))
                    {
                        Common.Notify(sim.CreatedSim, Common.Localize("Story:" + key, sim.IsFemale, new object[] { sim, GetLocalizedName(sim.IsFemale) }));
                        noticeShown = true;
                    }
                }
                else if ((!ShowingSigns) && (HadFirstSign))
                {
                    if (SimTypes.IsSelectable(sim))
                    {
                        if (IsIdentified)
                        {
                            Common.Notify(sim.CreatedSim, Common.Localize("Vector:Better", sim.IsFemale, new object[] { sim, GetLocalizedName(sim.IsFemale) }));
                        }
                        else
                        {
                            Common.Notify(sim.CreatedSim, Common.Localize("Vector:BetterUnknown", sim.IsFemale, new object[] { sim }));
                        }
                    }

                    mNotices &= ~Notices.FirstSign;
                }

                if (IsResisted)
                {
                    return(false);
                }
            }

            if (ShowingSigns)
            {
                if (!HadFirstSign)
                {
                    mNotices |= Notices.FirstSign;

                    if (!noticeShown)
                    {
                        if (SimTypes.IsSelectable(sim))
                        {
                            Common.Notify(sim.CreatedSim, Common.Localize("Vector:FirstSign", sim.IsFemale, new object[] { sim }));
                        }
                        else if (!IsIgnored)
                        {
                            OutbreakControl.ShowNotice(sim, this, Common.kDebugging ? "Showing: " : "");
                        }
                    }
                }

                if (sim.CreatedSim != null)
                {
                    BuffGermy.BuffInstanceGermy germy = sim.CreatedSim.BuffManager.GetElement(BuffNames.Germy) as BuffGermy.BuffInstanceGermy;
                    if (germy == null)
                    {
                        OccultTypes currentOccultTypes = sim.OccultManager.mCurrentOccultTypes;

                        try
                        {
                            sim.OccultManager.mCurrentOccultTypes = OccultTypes.None;

                            if (sim.CreatedSim.BuffManager.AddElement(BuffNames.Germy, sFromInfectionOrigin))
                            {
                                germy = sim.CreatedSim.BuffManager.GetElement(BuffNames.Germy) as BuffGermy.BuffInstanceGermy;
                            }
                        }
                        finally
                        {
                            sim.OccultManager.mCurrentOccultTypes = currentOccultTypes;
                        }
                    }

                    if (germy != null)
                    {
                        if (germy.GermyContagionBroadcaster != null)
                        {
                            germy.GermyContagionBroadcaster.Dispose();
                            germy.GermyContagionBroadcaster = null;
                        }

                        germy.mCurrentTotalDurationIncrease = 0;
                        germy.ModifyDuration(30);
                    }
                }

                mNonPersistableData.Symptomize(sim.CreatedSim, this);
            }

            if (IsMutating)
            {
                Mutate();
            }

            PurchaseControl.AddCheck(sim.Household);

            return(true);
        }