public void Refresh()
 {
     if (!isLoadingScene)
     {
         KSelectable selectable = GetComponent <KSelectable>();
         if (isConstructed)
         {
             statusItemGuid                      = selectable.RemoveStatusItem(statusItemGuid, false);
             requiredSkillPerk                   = null;
             shouldShowSkillPerkStatusItem       = false;
             deconstructable.allowDeconstruction = true;
         }
         else
         {
             if (studied)
             {
                 statusItemGuid                      = selectable.ReplaceStatusItem(statusItemGuid, Studied, null);
                 requiredSkillPerk                   = null;
                 shouldShowSkillPerkStatusItem       = false;
                 deconstructable.allowDeconstruction = true;
             }
             else
             {
                 if (markedForStudy)
                 {
                     CreateChore();
                     statusItemGuid = selectable.ReplaceStatusItem(statusItemGuid, Db.Get().MiscStatusItems.AwaitingStudy, null);
                     shouldShowSkillPerkStatusItem = true;
                 }
                 else
                 {
                     CancelChore();
                     statusItemGuid = selectable.RemoveStatusItem(statusItemGuid, false);
                     shouldShowSkillPerkStatusItem = true;
                 }
             }
         }
         UpdateStatusItem(null);
     }
 }
Example #2
0
        public void Refresh()
        {
            if (KMonoBehaviour.isLoadingScene)
            {
                return;
            }

            KSelectable component = this.GetComponent <KSelectable>();

            if (this.markedForDestruction)
            {
                if (this.chore == null)
                {
                    this.chore = new WorkChore <DestructibleWorkable>(
                        chore_type: Db.Get().ChoreTypes.Dig,
                        target: this,
                        chore_provider: null,
                        run_until_complete: true,
                        on_complete: null,
                        on_begin: null,
                        on_end: null,
                        allow_in_red_alert: true,
                        schedule_block: null,
                        ignore_schedule_block: false,
                        only_when_operational: false,
                        override_anims: null,
                        is_preemptable: false,
                        allow_in_context_menu: true,
                        allow_prioritization: true,
                        priority_class: PriorityScreen.PriorityClass.basic,
                        priority_class_value: 5,
                        ignore_building_assignment: false,
                        add_to_daily_report: true
                        );
                }

                if (component != null)
                {
                    this.statusItemGuid = component.ReplaceStatusItem(this.statusItemGuid, DestructibleStrings.AwaitingDeconstruct, null);
                }
            }
            else
            {
                this.CancelChore();
                if (component != null)
                {
                    this.statusItemGuid = component.RemoveStatusItem(this.statusItemGuid, false);
                }
            }
        }
Example #3
0
        private void UpdateStatusItem(bool no_more_space = false)
        {
            if (no_more_space && no_more_space != operational.IsOperational)
            {
                operational.SetFlag(spaceExposureFlag, false);
                // If there are no status items, just add a building disabled tooltip.
                _no_space_status = new StatusItem($"{RadiatorConfig.Id}_NOTINSPACE", "MISC", "",
                                                  StatusItem.IconType.Exclamation, NotificationType.BadMinor, false, OverlayModes.TileMode.ID);
                // if it's not empty we need to remove the radiating status
                if (statusHandle == Guid.Empty)
                {
                    statusHandle = selectable.AddStatusItem(_no_space_status, this);
                }
                else
                {
                    // no idea why this if statement is here but we're cargo culting it
                    if (!(statusHandle != Guid.Empty))
                    {
                        return;
                    }
                    selectable.ReplaceStatusItem(statusHandle, _no_space_status, this);
                }
            }
            else
            {
                operational.SetFlag(spaceExposureFlag, true);
                _radiating_status = new StatusItem($"{RadiatorConfig.Id}_RADIATING", "MISC", "",
                                                   StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.HeatFlow.ID);
                _radiating_status.resolveTooltipCallback = _FormatStatusCallback;
                _radiating_status.resolveStringCallback  = _FormatStatusCallback;

                if (statusHandle == Guid.Empty)
                {
                    statusHandle = selectable.AddStatusItem(_radiating_status, this);
                }
                else
                {
                    if (!(statusHandle != Guid.Empty))
                    {
                        return;
                    }
                    GetComponent <KSelectable>().ReplaceStatusItem(statusHandle, _radiating_status, this);
                }
            }
        }
Example #4
0
 private void UpdateStatus()
 {
     if (operational.IsActive)
     {
         if (statusHandle == Guid.Empty)
         {
             statusHandle = selectable.SetStatusItem(Db.Get().StatusItemCategories.Main,
                                                     Db.Get().BuildingStatusItems.Working);
         }
         else
         {
             selectable.ReplaceStatusItem(statusHandle, Db.Get().BuildingStatusItems.Working);
         }
     }
     else
     {
         if (statusHandle != Guid.Empty)
         {
             statusHandle = selectable.RemoveStatusItem(statusHandle);
         }
     }
 }