Exemplo n.º 1
0
        private void InitializeAndStart()
        {
            Sickness disease = modifier;
            Func <List <Notification>, object, string> tooltip = delegate(List <Notification> notificationList, object data)
            {
                string text = string.Empty;
                for (int i = 0; i < notificationList.Count; i++)
                {
                    Notification notification = notificationList[i];
                    string       arg          = (string)notification.tooltipData;
                    text += string.Format(DUPLICANTS.DISEASES.NOTIFICATION_TOOLTIP, notification.NotifierName, disease.Name, arg);
                    if (i < notificationList.Count - 1)
                    {
                        text += "\n";
                    }
                }
                return(text);
            };
            string           name       = disease.Name;
            string           title      = name;
            NotificationType type       = (disease.severity > Sickness.Severity.Minor) ? NotificationType.Bad : NotificationType.BadMinor;
            HashedString     invalid    = HashedString.Invalid;
            string           sourceInfo = exposureInfo.sourceInfo;

            notification = new Notification(title, type, invalid, tooltip, sourceInfo, true, 0f, null, null, null);
            statusItem   = new StatusItem(disease.Id, disease.Name, DUPLICANTS.DISEASES.STATUS_ITEM_TOOLTIP.TEMPLATE, string.Empty, (disease.severity > Sickness.Severity.Minor) ? StatusItem.IconType.Exclamation : StatusItem.IconType.Info, (disease.severity > Sickness.Severity.Minor) ? NotificationType.Bad : NotificationType.BadMinor, false, OverlayModes.None.ID, 129022);
            statusItem.resolveTooltipCallback = ResolveString;
            if (smi != null)
            {
                smi.StopSM("refresh");
            }
            smi = new StatesInstance(this);
            smi.StartSM();
        }
Exemplo n.º 2
0
    protected override void OnSpawn()
    {
        base.OnSpawn();
        base.workable.requiredSkillPerk = Db.Get().SkillPerks.CanElectricGrill.Id;
        base.workable.WorkerStatusItem  = Db.Get().DuplicantStatusItems.Cooking;
        base.workable.overrideAnims     = new KAnimFile[1]
        {
            Assets.GetAnim("anim_interacts_cookstation_gourtmet_kanim")
        };
        base.workable.AttributeConverter            = Db.Get().AttributeConverters.CookingSpeed;
        base.workable.AttributeExperienceMultiplier = DUPLICANTSTATS.ATTRIBUTE_LEVELING.MOST_DAY_EXPERIENCE;
        base.workable.SkillExperienceSkillGroup     = Db.Get().SkillGroups.Cooking.Id;
        base.workable.SkillExperienceMultiplier     = SKILLS.MOST_DAY_EXPERIENCE;
        ComplexFabricatorWorkable workable = base.workable;

        workable.OnWorkTickActions = (Action <Worker, float>) Delegate.Combine(workable.OnWorkTickActions, (Action <Worker, float>) delegate(Worker worker, float dt)
        {
            Debug.Assert((UnityEngine.Object)worker != (UnityEngine.Object)null, "How did we get a null worker?");
            if (diseaseCountKillRate > 0)
            {
                PrimaryElement component = GetComponent <PrimaryElement>();
                int num = Math.Max(1, (int)((float)diseaseCountKillRate * dt));
                component.ModifyDiseaseCount(-num, "GourmetCookingStation");
            }
        });
        smi = new StatesInstance(this);
        smi.StartSM();
    }
Exemplo n.º 3
0
        public override object OnInfect(GameObject go, SicknessInstance diseaseInstance)
        {
            var statesInstance = new StatesInstance(diseaseInstance);

            statesInstance.StartSM();
            return(statesInstance);
        }
Exemplo n.º 4
0
 public override void OnCleanUp()
 {
     if (smi != null)
     {
         smi.StopSM("DiseaseInstance.OnCleanUp");
         smi = null;
     }
 }
 protected override void OnCleanUp()
 {
     Prioritizable.RemoveRef(base.gameObject);
     if (smi != null)
     {
         smi.StopSM("OnCleanUp");
         smi = null;
     }
     base.OnCleanUp();
 }
 protected override void OnSpawn()
 {
     base.OnSpawn();
     Prioritizable.AddRef(base.gameObject);
     doctor_workable = GetComponent <DoctorStationDoctorWorkable>();
     SetWorkTime(float.PositiveInfinity);
     smi = new StatesInstance(this);
     smi.StartSM();
     OnStorageChange(null);
     Subscribe(-1697596308, OnStorageChangeDelegate);
 }
Exemplo n.º 7
0
 public DirtyVomitChore(
     ChoreType chore_type,
     IStateMachineTarget target,
     StatusItem status_item,
     Notification notification,
     SimUtil.DiseaseInfo diseaseInfo,
     Action <Chore> on_complete = null)
     : base(Db.Get().ChoreTypes.Vomit, target, target.GetComponent <ChoreProvider>(), true, on_complete,
            null, null, PriorityScreen.PriorityClass.compulsory)
 {
     smi = new StatesInstance(this, target.gameObject, status_item, notification, diseaseInfo);
 }
Exemplo n.º 8
0
 // Idle Priority 9 puts it above Idle task but below the task the Dupe is finishing
 public FinishMingleChore(IStateMachineTarget target) : base(Db.Get().ChoreTypes.Relax,
                                                             target, target.GetComponent <ChoreProvider>(), false, null, null, null,
                                                             PriorityScreen.PriorityClass.idle, 9, false, true, 0, false,
                                                             ReportManager.ReportType.PersonalTime)
 {
     showAvailabilityInHoverText = false;
     smi = new StatesInstance(this, target.gameObject);
     AddPrecondition(HAS_MINGLE_CELL, this);
     AddPrecondition(ChorePreconditions.instance.IsNotRedAlert, null);
     AddPrecondition(ChorePreconditions.instance.IsScheduledTime, FinishTasksPatches.
                     FinishBlock);
     AddPrecondition(ChorePreconditions.instance.CanDoWorkerPrioritizable, this);
 }
Exemplo n.º 9
0
        private static bool ShouldConvertAtAll(StatesInstance smi)
        {
            bool canConvert = smi.master.converter.CanConvertAtAll();

            return(canConvert);
            //Storage storage = smi.master.storage;
            //List<GameObject> items = storage.items;
            //foreach(GameObject item in items)
            //{
            //    PrimaryElement element = item.GetComponent<PrimaryElement>();
            //    if(element != null && element.Mass > 1f)
            //    {
            //        if (element.ElementID == SimHashes.Oxygen || element.ElementID == SimHashes.ChlorineGas)
            //        {
            //            return false;
            //        }
            //    }
            //}
            //return true;
        }
    private void MakeIce(StatesInstance smi, float dt)
    {
        float num = heatRemovalRate * dt / (float)waterStorage.items.Count;

        foreach (GameObject item in waterStorage.items)
        {
            PrimaryElement component = item.GetComponent <PrimaryElement>();
            GameUtil.DeltaThermalEnergy(component, 0f - num, smi.master.targetTemperature);
        }
        for (int num2 = waterStorage.items.Count; num2 > 0; num2--)
        {
            GameObject gameObject = waterStorage.items[num2 - 1];
            if ((bool)gameObject && gameObject.GetComponent <PrimaryElement>().Temperature < gameObject.GetComponent <PrimaryElement>().Element.lowTemp)
            {
                PrimaryElement component2 = gameObject.GetComponent <PrimaryElement>();
                waterStorage.AddOre(component2.Element.lowTempTransitionTarget, component2.Mass, component2.Temperature, component2.DiseaseIdx, component2.DiseaseCount, false, true);
                waterStorage.ConsumeIgnoringDisease(gameObject);
            }
        }
        smi.UpdateIceState();
    }
    protected override void OnSpawn()
    {
        base.OnSpawn();
        KBatchedAnimController component = GetComponent <KBatchedAnimController>();

        meter_coolant = new MeterController((KAnimControllerBase)component, "meter_target", "meter_coolant", Meter.Offset.Infront, Grid.SceneLayer.NoLayer, Vector3.zero, (string[])null);
        meter_metal   = new MeterController((KAnimControllerBase)component, "meter_target_metal", "meter_metal", Meter.Offset.Infront, Grid.SceneLayer.NoLayer, Vector3.zero, (string[])null);
        meter_metal.SetPositionPercent(1f);
        smi = new StatesInstance(this);
        smi.StartSM();
        ConduitFlow liquidConduitFlow = Game.Instance.liquidConduitFlow;

        liquidConduitFlow.AddConduitUpdater(OnConduitUpdate, ConduitFlowPriority.Default);
        Building component2 = GetComponent <Building>();

        outputCell = component2.GetUtilityOutputCell();
        workable.OnWorkTickActions = delegate
        {
            float percentComplete = workable.GetPercentComplete();
            meter_metal.SetPositionPercent(percentComplete);
        };
    }
Exemplo n.º 12
0
    protected override void OnSpawn()
    {
        base.OnSpawn();
        Subscribe(824508782, OnActiveChangedDelegate);
        smi = new StatesInstance(this);
        smi.StartSM();
        accumulator = Game.Instance.accumulators.Add("Element", this);
        BuildingDef def  = GetComponent <BuildingComplete>().Def;
        int         cell = Grid.PosToCell(this);

        for (int i = 0; i < def.WidthInCells; i++)
        {
            int x   = i - (def.WidthInCells - 1) / 2;
            int num = Grid.OffsetCell(cell, new CellOffset(x, 0));
            SimMessages.SetCellProperties(num, 39);
            Grid.Foundation[num] = true;
            Grid.SetSolid(num, true, CellEventLogger.Instance.SimCellOccupierForceSolid);
            World.Instance.OnSolidChanged(num);
            GameScenePartitioner.Instance.TriggerEvent(num, GameScenePartitioner.Instance.solidChangedLayer, null);
            Grid.RenderedByWorld[num] = false;
        }
        meter = new MeterController(GetComponent <KBatchedAnimController>(), "meter_target", "meter", Meter.Offset.Infront, Grid.SceneLayer.NoLayer, "meter_target", "meter_fill", "meter_frame", "meter_OL");
    }
Exemplo n.º 13
0
    protected override void OnSpawn()
    {
        base.OnSpawn();
        Prioritizable.AddRef(base.gameObject);
        accumulator     = Game.Instance.accumulators.Add("pressuregas", this);
        showProgressBar = false;
        SetWorkTime(float.PositiveInfinity);
        overrideAnims = new KAnimFile[1]
        {
            Assets.GetAnim("anim_interacts_oil_cap_kanim")
        };
        workingStatusItem             = Db.Get().BuildingStatusItems.ReleasingPressure;
        attributeConverter            = Db.Get().AttributeConverters.MachinerySpeed;
        attributeExperienceMultiplier = DUPLICANTSTATS.ATTRIBUTE_LEVELING.PART_DAY_EXPERIENCE;
        skillExperienceSkillGroup     = Db.Get().SkillGroups.Technicals.Id;
        skillExperienceMultiplier     = SKILLS.PART_DAY_EXPERIENCE;
        KBatchedAnimController component = GetComponent <KBatchedAnimController>();

        pressureMeter = new MeterController((KAnimControllerBase)component, "meter_target", "meter", Meter.Offset.Infront, Grid.SceneLayer.NoLayer, new Vector3(0f, 0f, 0f), (string[])null);
        smi           = new StatesInstance(this);
        smi.StartSM();
        UpdatePressurePercent();
    }
Exemplo n.º 14
0
        private static bool ShouldConvertAtAll(StatesInstance smi)
        {
            bool canConvert = smi.master.converter.CanConvertAtAll();

            return(canConvert);
        }
Exemplo n.º 15
0
        public override void OnCure(GameObject go, object instance_data)
        {
            StatesInstance statesInstance = (StatesInstance)instance_data;

            statesInstance.StopSM("Cured");
        }