Ejemplo n.º 1
0
        internal static void Init()
        {
            var db = Db.Get();
            // воспользуемся неиспользуемой ChoreType, но подкрутим приоритеты
            var ReturnSuitUrgent = db.ChoreTypes.ReturnSuitUrgent;
            var Recharge         = db.ChoreTypes.Recharge;
            var RechargeTraverse = Traverse.Create(Recharge);

            RechargeTraverse.Property <int>(nameof(ChoreType.priority)).Value         = ReturnSuitUrgent.priority;
            RechargeTraverse.Property <int>(nameof(ChoreType.explicitPriority)).Value = ReturnSuitUrgent.explicitPriority;
            Recharge.interruptPriority = ReturnSuitUrgent.interruptPriority;
            // собственная ChoreType для суперсрочной подзарядки
            var RecoverBreath = db.ChoreTypes.RecoverBreath;

            RecoverBreathRecharge = new ChoreType(
                id: nameof(RecoverBreathRecharge),
                parent: db.ChoreTypes,
                chore_groups: new string[0],
                urge: RecoverBreath.urge.Id,
                name: RECOVERBREATH.NAME,
                status_message: RECOVERBREATH.STATUS,
                tooltip: RECHARGE.TOOLTIP,
                interrupt_exclusion: RecoverBreath.interruptExclusion,
                implicit_priority: RecoverBreath.priority,
                explicit_priority: RecoverBreath.explicitPriority)
            {
                interruptPriority = RecoverBreath.interruptPriority
            };
        }
    private void RebalanceFetches()
    {
        TreeFilterable component = GetComponent <TreeFilterable>();

        Tag[]     tags          = component.GetTags();
        ChoreType creatureFetch = Db.Get().ChoreTypes.CreatureFetch;
        Storage   component2    = GetComponent <Storage>();
        int       num           = creatureLimit - storedCreatureCount;
        int       count         = fetches.Count;
        int       num2          = 0;
        int       num3          = 0;
        int       num4          = 0;
        int       num5          = 0;

        for (int num6 = fetches.Count - 1; num6 >= 0; num6--)
        {
            if (fetches[num6].IsComplete())
            {
                fetches.RemoveAt(num6);
                num2++;
            }
        }
        int num7 = 0;

        for (int i = 0; i < fetches.Count; i++)
        {
            if (!fetches[i].InProgress)
            {
                num7++;
            }
        }
        if (num7 == 0 && fetches.Count < num)
        {
            FetchOrder2 fetchOrder = new FetchOrder2(creatureFetch, tags, requiredFetchTags, null, component2, 1f, FetchOrder2.OperationalRequirement.Operational, 0);
            fetchOrder.Submit(OnFetchComplete, false, OnFetchBegun);
            fetches.Add(fetchOrder);
            num3++;
        }
        int num8 = fetches.Count - num;
        int num9 = fetches.Count - 1;

        while (num9 >= 0 && num8 > 0)
        {
            if (!fetches[num9].InProgress)
            {
                fetches[num9].Cancel("fewer creatures in room");
                fetches.RemoveAt(num9);
                num8--;
                num4++;
            }
            num9--;
        }
        while (num8 > 0 && fetches.Count > 0)
        {
            fetches[fetches.Count - 1].Cancel("fewer creatures in room");
            fetches.RemoveAt(fetches.Count - 1);
            num8--;
            num5++;
        }
    }
    private Chore CreateWorkChore()
    {
        ChoreType learnSkill = Db.Get().ChoreTypes.LearnSkill;
        KAnimFile anim       = Assets.GetAnim("anim_hat_kanim");

        return(new WorkChore <RoleStation>(learnSkill, this, null, true, null, null, null, false, null, false, true, anim, false, true, false, PriorityScreen.PriorityClass.personalNeeds, 5, false, false));
    }
Ejemplo n.º 4
0
 public Chore(ChoreType chore_type, ChoreProvider chore_provider, bool run_until_complete, Action <Chore> on_complete, Action <Chore> on_begin, Action <Chore> on_end, PriorityScreen.PriorityClass priority_class, int priority_value, bool is_preemptable, bool allow_in_context_menu, int priority_mod, bool add_to_daily_report, ReportManager.ReportType report_type)
 {
     if (priority_value == 2147483647)
     {
         priority_class = PriorityScreen.PriorityClass.topPriority;
         priority_value = 2;
     }
     if (priority_value < 1 || priority_value > 9)
     {
         Debug.LogErrorFormat("Priority Value Out Of Range: {0}", priority_value);
     }
     masterPriority = new PrioritySetting(priority_class, priority_value);
     priorityMod    = priority_mod;
     id             = ++nextId;
     if ((UnityEngine.Object)chore_provider == (UnityEngine.Object)null)
     {
         chore_provider = GlobalChoreProvider.Instance;
         DebugUtil.Assert((UnityEngine.Object)chore_provider != (UnityEngine.Object)null);
     }
     choreType        = chore_type;
     runUntilComplete = run_until_complete;
     onComplete       = on_complete;
     onEnd            = on_end;
     onBegin          = on_begin;
     IsPreemptable    = is_preemptable;
     AddPrecondition(ChorePreconditions.instance.IsValid, null);
     AddPrecondition(ChorePreconditions.instance.IsPermitted, null);
     AddPrecondition(ChorePreconditions.instance.IsPreemptable, null);
     AddPrecondition(ChorePreconditions.instance.HasUrge, null);
     AddPrecondition(ChorePreconditions.instance.IsMoreSatisfyingEarly, null);
     AddPrecondition(ChorePreconditions.instance.IsMoreSatisfyingLate, null);
     AddPrecondition(ChorePreconditions.instance.IsOverrideTargetNullOrMe, null);
     chore_provider.AddChore(this);
 }
        public void CreateChore()
        {
            KBatchedAnimController component = GetComponent <KBatchedAnimController>();

            Tag[] tags = GetComponent <TreeFilterable>().GetTags();
            if (tags == null || tags.Length == 0)
            {
                component.TintColour = base.master.noFilterTint;
            }
            else
            {
                component.TintColour = base.master.filterTint;
                Tag[] array = base.master.allowManualPumpingStationFetching ? new Tag[0] : new Tag[1]
                {
                    GameTags.LiquidSource
                };
                Storage   component2     = GetComponent <Storage>();
                ChoreType storageFetch   = Db.Get().ChoreTypes.StorageFetch;
                Storage   destination    = component2;
                float     amount         = component2.Capacity();
                Tag[]     tags2          = GetComponent <TreeFilterable>().GetTags();
                Tag[]     forbidden_tags = array;
                chore = new FetchChore(storageFetch, destination, amount, tags2, null, forbidden_tags, null, true, null, null, null, FetchOrder2.OperationalRequirement.Operational, 0);
            }
        }
    protected override void OnSpawn()
    {
        base.OnSpawn();
        int num = Grid.PosToCell(this);

        originalDigElement = Grid.Element[num];
        KSelectable component = GetComponent <KSelectable>();

        component.SetStatusItem(Db.Get().StatusItemCategories.Main, Db.Get().MiscStatusItems.WaitingForDig, null);
        UpdateColor(isReachable);
        Grid.Objects[num, 7] = base.gameObject;
        ChoreType chore_type = Db.Get().ChoreTypes.Dig;

        if (choreTypeIdHash.IsValid)
        {
            chore_type = Db.Get().ChoreTypes.GetByHash(choreTypeIdHash);
        }
        chore = new WorkChore <Diggable>(chore_type, this, null, true, null, null, null, true, null, false, true, null, true, true, true, PriorityScreen.PriorityClass.basic, 5, false, true);
        SetWorkTime(float.PositiveInfinity);
        partitionerEntry = GameScenePartitioner.Instance.Add("Diggable.OnSpawn", base.gameObject, Grid.PosToCell(this), GameScenePartitioner.Instance.solidChangedLayer, OnSolidChanged);
        OnSolidChanged(null);
        ReachabilityMonitor.Instance instance = new ReachabilityMonitor.Instance(this);
        instance.StartSM();
        Subscribe(493375141, OnRefreshUserMenuDelegate);
        handle = Game.Instance.Subscribe(-1523247426, UpdateStatusItem);
        Components.Diggables.Add(this);
    }
Ejemplo n.º 7
0
        public ChoreType Update(ChoreType updatedChoreType)
        {
            // update the todo and save
            var ChoreType = _choreTypeRepo.Update(updatedChoreType);

            return(ChoreType);
        }
Ejemplo n.º 8
0
            public Chore CreateUseChore(StatesInstance smi, ChoreType choreType, PriorityScreen.PriorityClass priorityClass)
            {
                var chore = new WorkChore <SuitRechargerWorkable>(
                    chore_type: choreType,
                    target: smi.master.workable,
                    ignore_schedule_block: true,
                    only_when_operational: false,
                    allow_prioritization: false,
                    priority_class: priorityClass,
                    priority_class_value: Chore.DEFAULT_BASIC_PRIORITY,
                    add_to_daily_report: false);

                smi.activeUseChores.Add(chore);
                chore.onExit += (exiting_chore) => smi.activeUseChores.Remove(exiting_chore);
                chore.AddPrecondition(IsSuitEquipped, null);
                if (durabilityEnabled)  // не проверять если износ отключен в настройках сложности
                {
                    chore.AddPrecondition(IsSuitHasEnoughDurability, smi.master);
                }
                chore.AddPrecondition(DoesSuitNeedRecharging, null);
                chore.AddPrecondition(IsEnoughOxygen, smi.master);
                chore.AddPrecondition(IsEnoughFuel, smi.master);
                chore.AddPrecondition(ChorePreconditions.instance.IsExclusivelyAvailableWithOtherChores, smi.activeUseChores);
                return(chore);
            }
Ejemplo n.º 9
0
 public async Task <ActionResult <ChoreType> > PostChoreType(ChoreType choreType)
 {
     return(await Task.Run(() =>
     {
         var output = _choreTypesService.Add(choreType);
         return new ActionResult <ChoreType>(output);
     }));
 }
Ejemplo n.º 10
0
        private Chore CreateShowerChore(Instance smi)
        {
            ChoreType         shower  = Db.Get().ChoreTypes.Shower;
            Shower            master  = smi.master;
            ScheduleBlockType hygiene = Db.Get().ScheduleBlockTypes.Hygiene;

            return(new WorkChore <Shower>(shower, master, null, true, null, null, null, false, hygiene, false, true, null, false, true, false, PriorityScreen.PriorityClass.high, 5, false, true));
        }
 public static ChoreTypeModel ToApiModel(this ChoreType choreType)
 {
     return(new ChoreTypeModel
     {
         Id = choreType.Id,
         Title = choreType.Title,
     });
 }
    private Chore CreateWorkChore(ChoreType chore_type, bool allow_prioritization, bool allow_in_red_alert, PriorityScreen.PriorityClass priority_class, bool ignore_schedule_block = false)
    {
        bool allow_prioritization2  = allow_prioritization;
        bool allow_in_red_alert2    = allow_in_red_alert;
        bool ignore_schedule_block2 = ignore_schedule_block;

        return(new WorkChore <Clinic>(chore_type, this, null, true, null, null, null, allow_in_red_alert2, null, ignore_schedule_block2, true, null, false, true, allow_prioritization2, priority_class, 5, false, false));
    }
 public int GetPersonalPriority(ChoreType chore_type)
 {
     if (!choreTypePriorities.TryGetValue(chore_type.IdHash, out int value))
     {
         value = 3;
     }
     value = Mathf.Clamp(value, 0, 5);
     return(value);
 }
Ejemplo n.º 14
0
        internal static void MakeChoreType()
        {
            ListPool <Tag, ChoreTypes> .PooledList pooledList = ListPool <Tag, ChoreTypes> .Allocate();

            ToggleCurtainChoreType =
                new ChoreType("ToggleCurtain", Db.Get().ChoreTypes, new string[0], "",
                              DUPLICANTS.CHORES.TOGGLE.NAME, DUPLICANTS.CHORES.TOGGLE.STATUS,
                              DUPLICANTS.CHORES.TOGGLE.TOOLTIP, pooledList, 10000, 5000);
        }
    private Chore CreateWorkChore()
    {
        ChoreType astronaut = Db.Get().ChoreTypes.Astronaut;
        KAnimFile anim      = Assets.GetAnim("anim_hat_kanim");
        WorkChore <CommandModuleWorkable> workChore = new WorkChore <CommandModuleWorkable>(astronaut, this, null, true, null, null, null, false, null, false, true, anim, false, true, false, PriorityScreen.PriorityClass.personalNeeds, 5, false, true);

        workChore.AddPrecondition(ChorePreconditions.instance.HasSkillPerk, Db.Get().SkillPerks.CanUseRockets);
        workChore.AddPrecondition(ChorePreconditions.instance.IsAssignedtoMe, assignable);
        return(workChore);
    }
Ejemplo n.º 16
0
 public ReactEmoteChore(IStateMachineTarget target, ChoreType chore_type, EmoteReactable reactable, HashedString emote_kanim, HashedString[] emote_anims, KAnim.PlayMode play_mode, Func <StatusItem> get_status_item)
     : base(chore_type, target, target.GetComponent <ChoreProvider>(), false, (Action <Chore>)null, (Action <Chore>)null, (Action <Chore>)null, PriorityScreen.PriorityClass.basic, 5, false, true, 0, false, ReportManager.ReportType.WorkTime)
 {
     AddPrecondition(ChorePreconditions.instance.IsMoving, null);
     AddPrecondition(ChorePreconditions.instance.IsOffLadder, null);
     AddPrecondition(ChorePreconditions.instance.NotInTube, null);
     AddPrecondition(ChorePreconditions.instance.IsAwake, null);
     getStatusItem = get_status_item;
     base.smi      = new StatesInstance(this, target.gameObject, reactable, emote_kanim, emote_anims, play_mode);
 }
Ejemplo n.º 17
0
        private Chore CreateChore(StatesInstance smi)
        {
            Workable          component  = smi.master.GetComponent <EspressoMachineWorkable>();
            ChoreType         relax      = Db.Get().ChoreTypes.Relax;
            Workable          target     = component;
            ScheduleBlockType recreation = Db.Get().ScheduleBlockTypes.Recreation;
            Chore             chore      = new WorkChore <EspressoMachineWorkable>(relax, target, null, true, null, null, null, false, recreation, false, true, null, false, true, false, PriorityScreen.PriorityClass.high, 5, false, true);

            chore.AddPrecondition(ChorePreconditions.instance.CanDoWorkerPrioritizable, component);
            return(chore);
        }
    private Chore CreateChore(int i)
    {
        Workable          workable   = workables[i];
        ChoreType         relax      = Db.Get().ChoreTypes.Relax;
        Workable          target     = workable;
        ScheduleBlockType recreation = Db.Get().ScheduleBlockTypes.Recreation;
        Chore             chore      = new WorkChore <PhonoboxWorkable>(relax, target, null, true, null, null, OnSocialChoreEnd, false, recreation, false, true, null, false, true, false, PriorityScreen.PriorityClass.high, 5, false, true);

        chore.AddPrecondition(ChorePreconditions.instance.CanDoWorkerPrioritizable, workable);
        return(chore);
    }
Ejemplo n.º 19
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);
 }
Ejemplo n.º 20
0
 protected override void OnPrefabInit()
 {
     base.OnPrefabInit();
     GetRecipes();
     simRenderLoadBalance = true;
     choreType            = Db.Get().ChoreTypes.Fabricate;
     Subscribe(-1957399615, OnDroppedAllDelegate);
     Subscribe(-592767678, OnOperationalChangedDelegate);
     Subscribe(-905833192, OnCopySettingsDelegate);
     Subscribe(-1697596308, OnStorageChangeDelegate);
     workable = GetComponent <ComplexFabricatorWorkable>();
     Components.ComplexFabricators.Add(this);
 }
        private Chore CreateUseChore(SMInstance smi, ChoreType choreType)
        {
            WorkChore <ToiletWorkableUse> workChore = new WorkChore <ToiletWorkableUse>(choreType, smi.master, null, true, null, null, null, false, null, true, true, null, false, true, false, PriorityScreen.PriorityClass.personalNeeds, 5, false, false);

            smi.activeUseChores.Add(workChore);
            WorkChore <ToiletWorkableUse> workChore2 = workChore;

            workChore2.onExit = (Action <Chore>) Delegate.Combine(workChore2.onExit, (Action <Chore>) delegate(Chore exiting_chore)
            {
                smi.activeUseChores.Remove(exiting_chore);
            });
            workChore.AddPrecondition(ChorePreconditions.instance.IsPreferredAssignableOrUrgentBladder, smi.master.GetComponent <Assignable>());
            workChore.AddPrecondition(ChorePreconditions.instance.IsExclusivelyAvailableWithOtherChores, smi.activeUseChores);
            return(workChore);
        }
Ejemplo n.º 22
0
    public SleepChore(ChoreType choreType, IStateMachineTarget target, GameObject bed, bool bedIsLocator, bool isInterruptable)
        : base(choreType, target, target.GetComponent <ChoreProvider>(), false, (Action <Chore>)null, (Action <Chore>)null, (Action <Chore>)null, PriorityScreen.PriorityClass.personalNeeds, 5, false, true, 0, false, ReportManager.ReportType.PersonalTime)
    {
        base.smi = new StatesInstance(this, target.gameObject, bed, bedIsLocator, isInterruptable);
        if (isInterruptable)
        {
            AddPrecondition(ChorePreconditions.instance.IsNotRedAlert, null);
        }
        AddPrecondition(IsOkayTimeToSleep, null);
        Operational component = bed.GetComponent <Operational>();

        if ((UnityEngine.Object)component != (UnityEngine.Object)null)
        {
            AddPrecondition(ChorePreconditions.instance.IsOperational, component);
        }
    }
Ejemplo n.º 23
0
 public FetchOrder2(ChoreType chore_type, Tag[] tags, Tag[] required_tags, Tag[] forbidden_tags, Storage destination, float amount, OperationalRequirement operationalRequirementDEPRECATED = OperationalRequirement.None, int priorityMod = 0)
 {
     if (amount <= PICKUPABLETUNING.MINIMUM_PICKABLE_AMOUNT)
     {
         DebugUtil.LogWarningArgs(string.Format("FetchOrder2 {0} is requesting {1} {2} to {3}", chore_type.Id, tags[0], amount, (!((UnityEngine.Object)destination != (UnityEngine.Object)null)) ? "to nowhere" : destination.name));
     }
     choreType              = chore_type;
     Tags                   = tags;
     RequiredTags           = required_tags;
     ForbiddenTags          = forbidden_tags;
     Destination            = destination;
     TotalAmount            = amount;
     UnfetchedAmount        = amount;
     PriorityMod            = priorityMod;
     operationalRequirement = operationalRequirementDEPRECATED;
 }
Ejemplo n.º 24
0
 public void Set(Chore chore, ChoreConsumerState consumer_state, bool is_attempting_override, object data = null)
 {
     masterPriority    = chore.masterPriority;
     priority          = 0;
     priorityMod       = chore.priorityMod;
     consumerPriority  = 0;
     interruptPriority = 0;
     cost                   = 0;
     this.chore             = chore;
     consumerState          = consumer_state;
     failedPreconditionId   = -1;
     isAttemptingOverride   = is_attempting_override;
     this.data              = data;
     choreTypeForPermission = chore.choreType;
     SetPriority(chore);
 }
 public Reactable(GameObject gameObject, HashedString id, ChoreType chore_type, int range_width = 15, int range_height = 8, bool follow_transform = false, float min_reactable_time = 0f, float min_reactor_time = 0f, float max_trigger_time = float.PositiveInfinity)
 {
     rangeHeight      = range_height;
     rangeWidth       = range_width;
     this.id          = id;
     this.gameObject  = gameObject;
     choreType        = chore_type;
     minReactableTime = min_reactable_time;
     minReactorTime   = min_reactor_time;
     maxTriggerTime   = max_trigger_time;
     creationTime     = GameClock.Instance.GetTime();
     UpdateLocation();
     if (follow_transform)
     {
         transformId = Singleton <CellChangeMonitor> .Instance.RegisterCellChangedHandler(gameObject.transform, UpdateLocation, "Reactable follow transform");
     }
 }
        public UncategorizedFilteredStorage(
            KMonoBehaviour root,
            Tag[] required_tags,
            Tag[] forbidden_tags,
            IUserControlledCapacity capacity_control,
            bool use_logic_meter,
            ChoreType fetch_chore_type)
        {
            this.root            = root;
            this.requiredTags    = required_tags;
            this.forbiddenTags   = forbidden_tags;
            this.capacityControl = capacity_control;
            this.useLogicMeter   = use_logic_meter;
            this.choreType       = fetch_chore_type;
            root.Subscribe(-1697596308, new Action <object>(OnStorageChanged));
            root.Subscribe(-543130682, new Action <object>(OnUserSettingsChanged));
            this.filterable             = root.FindOrAdd <UncategorizedFilterable>();
            filterable.OnFilterChanged += new Action <Tag[]>(OnFilterChanged);
            this.storage = root.GetComponent <Storage>();
            storage.Subscribe(644822890, new Action <object>(OnOnlyFetchMarkedItemsSettingChanged));
            if (capacityStatusItem == null)
            {
                capacityStatusItem = new StatusItem("StorageLocker", "BUILDING", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 129022);
                capacityStatusItem.resolveStringCallback = (str, data) =>
                {
                    UncategorizedFilteredStorage filteredStorage = (UncategorizedFilteredStorage)data;
                    float  amountStored = filteredStorage.GetAmountStored();
                    float  b            = filteredStorage.storage.capacityKg;
                    string newValue1    = Util.FormatWholeNumber(amountStored <= b - filteredStorage.storage.storageFullMargin || amountStored >= b ? Mathf.Floor(amountStored) : b);
                    IUserControlledCapacity component = filteredStorage.root.GetComponent <IUserControlledCapacity>();
                    if (component != null)
                    {
                        b = Mathf.Min(component.UserMaxCapacity, b);
                    }
                    string newValue2 = Util.FormatWholeNumber(b);
                    str = str.Replace("{Stored}", newValue1);
                    str = str.Replace("{Capacity}", newValue2);
                    str = component == null?str.Replace("{Units}", (string)GameUtil.GetCurrentMassUnit(false)) : str.Replace("{Units}", (string)component.CapacityUnits);

                    return(str);
                };
                noFilterStatusItem = new StatusItem("NoStorageFilterSet", "BUILDING", "status_item_no_filter_set", StatusItem.IconType.Custom, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 129022);
            }
            root.GetComponent <KSelectable>().SetStatusItem(Db.Get().StatusItemCategories.Main, capacityStatusItem, this);
        }
    private HierarchyReferences GetChoreEntry(string label, ChoreType choreType, RectTransform parent)
    {
        HierarchyReferences hierarchyReferences;

        if (activeChoreEntries >= choreEntries.Count)
        {
            hierarchyReferences = Util.KInstantiateUI <HierarchyReferences>(chorePrefab, parent.gameObject, false);
            choreEntries.Add(hierarchyReferences);
        }
        else
        {
            hierarchyReferences = choreEntries[activeChoreEntries];
            hierarchyReferences.transform.SetParent(parent);
            hierarchyReferences.transform.SetAsLastSibling();
        }
        activeChoreEntries++;
        hierarchyReferences.GetReference <LocText>("ChoreLabel").text    = label;
        hierarchyReferences.GetReference <LocText>("ChoreSubLabel").text = GameUtil.ChoreGroupsForChoreType(choreType);
        Image reference = hierarchyReferences.GetReference <Image>("Icon");

        if (choreType.groups.Length > 0)
        {
            Sprite sprite2 = reference.sprite = Assets.GetSprite(choreType.groups[0].sprite);
            reference.gameObject.SetActive(true);
            reference.GetComponent <ToolTip>().toolTip = string.Format(UI.DETAILTABS.BUILDING_CHORES.CHORE_TYPE_TOOLTIP, choreType.groups[0].Name);
        }
        else
        {
            reference.gameObject.SetActive(false);
        }
        Image reference2 = hierarchyReferences.GetReference <Image>("Icon2");

        if (choreType.groups.Length > 1)
        {
            Sprite sprite4 = reference2.sprite = Assets.GetSprite(choreType.groups[1].sprite);
            reference2.gameObject.SetActive(true);
            reference2.GetComponent <ToolTip>().toolTip = string.Format(UI.DETAILTABS.BUILDING_CHORES.CHORE_TYPE_TOOLTIP, choreType.groups[1].Name);
        }
        else
        {
            reference2.gameObject.SetActive(false);
        }
        hierarchyReferences.gameObject.SetActive(true);
        return(hierarchyReferences);
    }
Ejemplo n.º 28
0
    private void UpdateStorageFetchableBits()
    {
        ChoreType storageFetch = Db.Get().ChoreTypes.StorageFetch;
        ChoreType foodFetch    = Db.Get().ChoreTypes.FoodFetch;

        storageFetchableBits.ClearAll();
        foreach (FetchChore fetchChore in fetchChores)
        {
            if ((fetchChore.choreType == storageFetch || fetchChore.choreType == foodFetch) && (bool)fetchChore.destination)
            {
                int cell = Grid.PosToCell(fetchChore.destination);
                if (MinionGroupProber.Get().IsReachable(cell, fetchChore.destination.GetOffsets(cell)))
                {
                    storageFetchableBits.Or(ref fetchChore.tagBits);
                }
            }
        }
    }
Ejemplo n.º 29
0
 public Context(Chore chore, ChoreConsumerState consumer_state, bool is_attempting_override, object data = null)
 {
     masterPriority    = chore.masterPriority;
     personalPriority  = consumer_state.consumer.GetPersonalPriority(chore.choreType);
     priority          = 0;
     priorityMod       = chore.priorityMod;
     consumerPriority  = 0;
     interruptPriority = 0;
     cost                   = 0;
     this.chore             = chore;
     consumerState          = consumer_state;
     failedPreconditionId   = -1;
     isAttemptingOverride   = is_attempting_override;
     this.data              = data;
     choreTypeForPermission = chore.choreType;
     skipMoreSatisfyingEarlyPrecondition = ((UnityEngine.Object)RootMenu.Instance != (UnityEngine.Object)null && RootMenu.Instance.IsBuildingChorePanelActive());
     SetPriority(chore);
 }
    public void CollectChores(ChoreConsumerState consumer_state, List <Chore.Precondition.Context> succeeded, List <Chore.Precondition.Context> failed_contexts)
    {
        ChoreType transport        = Db.Get().ChoreTypes.Transport;
        int       personalPriority = consumer_state.consumer.GetPersonalPriority(transport);
        int       priority         = (!Game.Instance.advancedPersonalPriorities) ? transport.priority : transport.explicitPriority;

        CollectSortedClearables(consumer_state.navigator, markedClearables, sortedClearables);
        bool flag = false;

        foreach (SortedClearable sortedClearable in sortedClearables)
        {
            SortedClearable            current        = sortedClearable;
            Pickupable                 pickupable     = current.pickupable;
            PrioritySetting            masterPriority = current.masterPriority;
            Chore.Precondition.Context item           = default(Chore.Precondition.Context);
            item.personalPriority = personalPriority;
            KPrefabID kPrefabID = pickupable.KPrefabID;
            kPrefabID.UpdateTagBits();
            foreach (GlobalChoreProvider.Fetch fetch in GlobalChoreProvider.Instance.fetches)
            {
                GlobalChoreProvider.Fetch current2 = fetch;
                if (kPrefabID.HasAnyTags_AssumeLaundered(ref current2.chore.tagBits))
                {
                    item.Set(current2.chore, consumer_state, false, pickupable);
                    item.choreTypeForPermission = transport;
                    item.RunPreconditions();
                    if (item.IsSuccess())
                    {
                        item.masterPriority    = masterPriority;
                        item.priority          = priority;
                        item.interruptPriority = transport.interruptPriority;
                        succeeded.Add(item);
                        flag = true;
                        break;
                    }
                }
            }
            if (flag)
            {
                break;
            }
        }
    }