private void UpdateUnworkableStatusItems()
    {
        KSelectable component = GetComponent <KSelectable>();

        if (!base.smi.EnvironmentNeedsCooling())
        {
            if (!component.HasStatusItem(Db.Get().BuildingStatusItems.CannotCoolFurther))
            {
                component.AddStatusItem(Db.Get().BuildingStatusItems.CannotCoolFurther, null);
            }
        }
        else if (component.HasStatusItem(Db.Get().BuildingStatusItems.CannotCoolFurther))
        {
            component.RemoveStatusItem(Db.Get().BuildingStatusItems.CannotCoolFurther, false);
        }
        if (!base.smi.EnvironmentHighEnoughPressure())
        {
            if (!component.HasStatusItem(Db.Get().BuildingStatusItems.UnderPressure))
            {
                component.AddStatusItem(Db.Get().BuildingStatusItems.UnderPressure, null);
            }
        }
        else if (component.HasStatusItem(Db.Get().BuildingStatusItems.UnderPressure))
        {
            component.RemoveStatusItem(Db.Get().BuildingStatusItems.UnderPressure, false);
        }
    }
示例#2
0
        private void UpdateStatusItem(bool in_space = false)
        {
            // if it's in space, update status.
            if (in_space)
            {
                // Remove outdated status, if it exists
                handle_notinspace = selectable.RemoveStatusItem(handle_notinspace);
                // Update the existing callback
                _radiating_status = new StatusItem("RADIATESHEAT_RADIATING", "MISC", "", StatusItem.IconType.Info,
                                                   NotificationType.Neutral, false, OverlayModes.HeatFlow.ID);
                _radiating_status.resolveTooltipCallback = _FormatStatusCallback;
                _radiating_status.resolveStringCallback  = _FormatStatusCallback;
                if (handle_radiating == Guid.Empty)
                {
                    handle_radiating = selectable.AddStatusItem(_radiating_status, this);
                }
            }
            else
            {
                // Remove outdated status-
                handle_radiating = selectable.RemoveStatusItem(handle_radiating);

                _no_space_status = new StatusItem("RADIATESHEAT_NOTINSPACE", "MISC", "", StatusItem.IconType.Info,
                                                  NotificationType.Neutral, false, OverlayModes.HeatFlow.ID);
                // add the status item!
                if (handle_notinspace == Guid.Empty)
                {
                    handle_notinspace = selectable.AddStatusItem(_no_space_status, this);
                }
            }
        }
示例#3
0
            public void DisableStatusItems()
            {
                KSelectable component = GetComponent <KSelectable>();

                component.RemoveStatusItem(buildingTooHotHandle);
                component.RemoveStatusItem(insufficientGradientHandle);
                component.RemoveStatusItem(activeWattageHandle);
            }
    private void OnDeath(object data)
    {
        base.enabled = false;
        KSelectable component = GetComponent <KSelectable>();

        component.RemoveStatusItem(Db.Get().DuplicantStatusItems.BreathingO2, false);
        component.RemoveStatusItem(Db.Get().DuplicantStatusItems.EmittingCO2, false);
    }
示例#5
0
            public void DisableStatusItems()
            {
                KSelectable component = base.GetComponent <KSelectable>();

                component.RemoveStatusItem(this.buildingTooHotHandle, false);
                component.RemoveStatusItem(this.insufficientMassHandle, false);
                component.RemoveStatusItem(this.insufficientTemperatureHandle, false);
                component.RemoveStatusItem(this.activeWattageHandle, false);
            }
示例#6
0
 public static void Postfix(OxygenBreather __instance)
 {
     if (OxygenNotNeededConfigChecker.ForceLoad || CustomGameSettings.Instance.GetCurrentQualitySetting(OxygenNotNeededPatches.WorldRequiresOxygen).id == "Enabled")
     {
         KSelectable component = __instance.GetComponent <KSelectable>();
         component.RemoveStatusItem(Db.Get().DuplicantStatusItems.BreathingO2);
         component.RemoveStatusItem(Db.Get().DuplicantStatusItems.EmittingCO2);
     }
 }
    public void Harvest()
    {
        harvestDesignatable.MarkedForHarvest = false;
        chore = null;
        Trigger(1272413801, this);
        KSelectable component = GetComponent <KSelectable>();

        component.RemoveStatusItem(Db.Get().MiscStatusItems.PendingHarvest, false);
        component.RemoveStatusItem(Db.Get().MiscStatusItems.Operating, false);
        Game.Instance.userMenu.Refresh(base.gameObject);
    }
示例#8
0
        private void ApplyRequestedControlState()
        {
            if (changeStateChore != null)
            {
                changeStateChore.Cancel("");
            }

            changeStateChore = null;
            CurrentState     = RequestedState;
            UpdateState();
            kSelectable.RemoveStatusItem(ModAssets.CurtainStatus);
            Trigger((int)GameHashes.DoorStateChanged, this);
        }
示例#9
0
            public void CancelToggleChore()
            {
                Debug.Log("Cancel toggle chore!");

                parent.isMarkedForToggle = false;
                if (chore != null)
                {
                    chore.Cancel("User cancelled");
                }
                chore = null;
                selectable.RemoveStatusItem(ToggleStatusItem);
                Game.Instance.userMenu.Refresh(gameObject);
            }
示例#10
0
 private void ClearStatus()
 {
     if ((UnityEngine.Object)Destination != (UnityEngine.Object)null)
     {
         KSelectable component = Destination.GetComponent <KSelectable>();
         if ((UnityEngine.Object)component != (UnityEngine.Object)null)
         {
             waitingForMaterialsHandle           = component.RemoveStatusItem(waitingForMaterialsHandle, false);
             materialsUnavailableHandle          = component.RemoveStatusItem(materialsUnavailableHandle, false);
             materialsUnavailableForRefillHandle = component.RemoveStatusItem(materialsUnavailableForRefillHandle, false);
         }
     }
 }
 private void OnReachableChanged(object data)
 {
     if ((UnityEngine.Object)childRenderer != (UnityEngine.Object)null)
     {
         Material             material = childRenderer.material;
         bool                 flag     = (bool)data;
         Color                color    = material.color;
         Game.LocationColours dig      = Game.Instance.uiColours.Dig;
         if (!(color == dig.invalidLocation))
         {
             KSelectable component = GetComponent <KSelectable>();
             if (flag)
             {
                 Material             material2 = material;
                 Game.LocationColours dig2      = Game.Instance.uiColours.Dig;
                 material2.color = dig2.validLocation;
                 component.RemoveStatusItem(Db.Get().BuildingStatusItems.MopUnreachable, false);
             }
             else
             {
                 component.AddStatusItem(Db.Get().BuildingStatusItems.MopUnreachable, this);
                 GameScheduler.Instance.Schedule("Locomotion Tutorial", 2f, delegate
                 {
                     Tutorial.Instance.TutorialMessage(Tutorial.TutorialMessages.TM_Locomotion, true);
                 }, null, null);
                 Material             material3 = material;
                 Game.LocationColours dig3      = Game.Instance.uiColours.Dig;
                 material3.color = dig3.unreachable;
             }
         }
     }
 }
示例#12
0
        public void Sim200ms(float dt)
        {
            var roomOfGameObject = Game.Instance.roomProber.GetRoomOfGameObject(gameObject);

            if (roomOfGameObject != null)
            {
                _currentCritters = roomOfGameObject.cavity.creatures.Count;

                var newState = ActivateAboveThreshold ? _currentCritters > Threshold : _currentCritters < Threshold;

                SetState(newState);

                if (!_selectable.HasStatusItem(Db.Get().BuildingStatusItems.NotInAnyRoom))
                {
                    return;
                }
                _selectable.RemoveStatusItem(_roomStatusGuid);
            }
            else
            {
                if (!_selectable.HasStatusItem(Db.Get().BuildingStatusItems.NotInAnyRoom))
                {
                    _roomStatusGuid = _selectable.AddStatusItem(Db.Get().BuildingStatusItems.NotInAnyRoom);
                }

                SetState(false);
            }
        }
示例#13
0
    public void Sim200ms(float dt)
    {
        Room roomOfGameObject = Game.Instance.roomProber.GetRoomOfGameObject(base.gameObject);

        if (roomOfGameObject != null)
        {
            currentCount = roomOfGameObject.cavity.creatures.Count;
            if (countEggs)
            {
                currentCount += roomOfGameObject.cavity.eggs.Count;
            }
            bool state = (!activateOnGreaterThan) ? (currentCount < countThreshold) : (currentCount > countThreshold);
            SetState(state);
            if (selectable.HasStatusItem(Db.Get().BuildingStatusItems.NotInAnyRoom))
            {
                selectable.RemoveStatusItem(roomStatusGUID, false);
            }
        }
        else
        {
            if (!selectable.HasStatusItem(Db.Get().BuildingStatusItems.NotInAnyRoom))
            {
                roomStatusGUID = selectable.AddStatusItem(Db.Get().BuildingStatusItems.NotInAnyRoom, null);
            }
            SetState(false);
        }
    }
示例#14
0
    private void CheckEntombed()
    {
        int cell = Grid.PosToCell(base.gameObject.transform.GetPosition());

        if (Grid.IsValidCell(cell))
        {
            if (!IsCellSafe(cell))
            {
                if (!isEntombed)
                {
                    isEntombed = true;
                    selectable.AddStatusItem(Db.Get().CreatureStatusItems.Entombed, base.gameObject);
                    GetComponent <KPrefabID>().AddTag(GameTags.Entombed, false);
                    Trigger(-1089732772, true);
                }
            }
            else if (isEntombed)
            {
                isEntombed = false;
                selectable.RemoveStatusItem(Db.Get().CreatureStatusItems.Entombed, false);
                GetComponent <KPrefabID>().RemoveTag(GameTags.Entombed);
                Trigger(-1089732772, false);
            }
        }
    }
    protected override void OnStartWork(Worker worker)
    {
        base.OnStartWork(worker);
        KSelectable component = GetComponent <KSelectable>();

        component.RemoveStatusItem(Db.Get().MiscStatusItems.PendingHarvest, false);
    }
示例#16
0
        public static bool Prefix(
            LogicCritterCountSensor __instance,
            bool ___activateOnGreaterThan,
            int ___countThreshold,
            KSelectable ___selectable,
            float dt)
        {
            var roomOfGameObject = Game.Instance.roomProber.GetRoomOfGameObject(__instance.gameObject);

            if (roomOfGameObject != null)
            {
//                Debug.Log("房间系统" + roomOfGameObject);
                var currentCount = 0;

                var context = __instance.FindOrAddComponent <LogicCritterCountSensorContext>();

                if (context.CountCreatures)
                {
                    var count = roomOfGameObject.cavity.creatures.Count;
//                    Debug.Log("小动物:" + count);
                    currentCount += count;
                }

                if (context.CountEggs)
                {
                    var count = roomOfGameObject.cavity.eggs.Count;
//                    Debug.Log("蛋:" + count);
                    currentCount += count;
                }

                __instance.SetCurrentCount(currentCount);

                Traverse.Create(__instance).Method("SetState", new[] { typeof(bool) }, new object[]
                {
                    !___activateOnGreaterThan
                            ? currentCount <___countThreshold
                                            : currentCount> ___countThreshold
                })
                .GetValue();
                if (!___selectable.HasStatusItem(Db.Get().BuildingStatusItems.NotInAnyRoom))
                {
                    return(false);
                }
                ___selectable.RemoveStatusItem(Traverse.Create(__instance).Field("roomStatusGUID").GetValue <Guid>());
            }
            else
            {
//                Debug.Log("没有房间");

                if (!___selectable.HasStatusItem(Db.Get().BuildingStatusItems.NotInAnyRoom))
                {
                    Traverse.Create(__instance).Field("roomStatusGUID")
                    .SetValue(___selectable.AddStatusItem(Db.Get().BuildingStatusItems.NotInAnyRoom));
                }
                Traverse.Create(__instance).Method("SetState", new[] { typeof(bool) }, new object[] { false })
                .GetValue();
            }

            return(false);
        }
    private void OnReachableChanged(object data)
    {
        if ((UnityEngine.Object)childRenderer == (UnityEngine.Object)null)
        {
            childRenderer = GetComponentInChildren <MeshRenderer>();
        }
        Material material = childRenderer.material;

        isReachable = (bool)data;
        Color color = material.color;

        Game.LocationColours dig = Game.Instance.uiColours.Dig;
        if (!(color == dig.invalidLocation))
        {
            UpdateColor(isReachable);
            KSelectable component = GetComponent <KSelectable>();
            if (isReachable)
            {
                component.RemoveStatusItem(Db.Get().BuildingStatusItems.DigUnreachable, false);
            }
            else
            {
                component.AddStatusItem(Db.Get().BuildingStatusItems.DigUnreachable, this);
                GameScheduler.Instance.Schedule("Locomotion Tutorial", 2f, delegate
                {
                    Tutorial.Instance.TutorialMessage(Tutorial.TutorialMessages.TM_Locomotion, true);
                }, null, null);
            }
        }
    }
    public virtual void ForceCancelHarvest(object data = null)
    {
        OnCancel(null);
        KSelectable component = GetComponent <KSelectable>();

        component.RemoveStatusItem(Db.Get().MiscStatusItems.PendingHarvest, false);
        Game.Instance.userMenu.Refresh(base.gameObject);
    }
 private static void Prefix(ElementConsumer __instance, ref System.Guid ___statusHandle, KSelectable ___selectable)
 {
     if (__instance.showInStatusPanel && ___statusHandle != System.Guid.Empty)
     {
         ___selectable.RemoveStatusItem(___statusHandle);
         ___statusHandle = System.Guid.Empty;
     }
 }
示例#20
0
    private void RefreshStatusItem()
    {
        KSelectable component = GetComponent <KSelectable>();

        component.RemoveStatusItem(Db.Get().MiscStatusItems.MarkedForCompost, false);
        component.RemoveStatusItem(Db.Get().MiscStatusItems.MarkedForCompostInStorage, false);
        if (isMarkedForCompost)
        {
            if ((UnityEngine.Object)GetComponent <Pickupable>() != (UnityEngine.Object)null && (UnityEngine.Object)GetComponent <Pickupable>().storage == (UnityEngine.Object)null)
            {
                component.AddStatusItem(Db.Get().MiscStatusItems.MarkedForCompost, null);
            }
            else
            {
                component.AddStatusItem(Db.Get().MiscStatusItems.MarkedForCompostInStorage, null);
            }
        }
    }
 private void OnGantryChanged(object data)
 {
     if ((Object)base.gameObject != (Object)null)
     {
         KSelectable component = GetComponent <KSelectable>();
         component.RemoveStatusItem(Db.Get().BuildingStatusItems.HasGantry, false);
         component.RemoveStatusItem(Db.Get().BuildingStatusItems.MissingGantry, false);
         if (HasValidGantry(base.smi.master.gameObject))
         {
             component.AddStatusItem(Db.Get().BuildingStatusItems.HasGantry, null);
         }
         else
         {
             component.AddStatusItem(Db.Get().BuildingStatusItems.MissingGantry, null);
         }
         base.smi.sm.gantryChanged.Trigger(base.smi);
     }
 }
示例#22
0
    private void ClearFlightStatuses()
    {
        KSelectable component = GetComponent <KSelectable>();

        foreach (KeyValuePair <RocketFlightCondition, Guid> conditionStatus in conditionStatuses)
        {
            component.RemoveStatusItem(conditionStatus.Value, false);
        }
        conditionStatuses.Clear();
    }
示例#23
0
            private Guid UpdateStatusItem(StatusItem item, bool show, Guid current_handle, KSelectable ksel)
            {
                Guid result = current_handle;

                if (show != (current_handle != Guid.Empty))
                {
                    result = ((!show) ? ksel.RemoveStatusItem(current_handle) : ksel.AddStatusItem(item, base.master));
                }
                return(result);
            }
    public void OnMarkedForHarvest()
    {
        KSelectable component = GetComponent <KSelectable>();

        if (chore == null)
        {
            chore = new WorkChore <Harvestable>(Db.Get().ChoreTypes.Harvest, this, null, true, null, null, null, true, null, false, true, null, true, true, true, PriorityScreen.PriorityClass.basic, 5, false, true);
            component.AddStatusItem(Db.Get().MiscStatusItems.PendingHarvest, this);
        }
        component.RemoveStatusItem(Db.Get().MiscStatusItems.NotMarkedForHarvest, false);
    }
示例#25
0
 private void SetStatusItem(StatusItem status_item)
 {
     if (status_item != currentStatusItem && currentStatusItem != null)
     {
         statusItemID = selectable.RemoveStatusItem(statusItemID, false);
     }
     if (status_item != null && statusItemID == Guid.Empty)
     {
         statusItemID = selectable.AddStatusItem(status_item, this);
     }
     currentStatusItem = status_item;
 }
示例#26
0
 public override void StopSM(string reason)
 {
     GameClock.Instance.Unsubscribe(-722330267, OnNightTime);
     ExposureType[] tYPES = GERM_EXPOSURE.TYPES;
     foreach (ExposureType exposureType in tYPES)
     {
         statusItemHandles.TryGetValue(exposureType.germ_id, out Guid value);
         KSelectable component = GetComponent <KSelectable>();
         value = component.RemoveStatusItem(value, false);
     }
     base.StopSM(reason);
 }
 protected virtual void OnCancel(object data)
 {
     if (chore != null)
     {
         chore.Cancel("Cancel harvest");
         chore = null;
         KSelectable component = GetComponent <KSelectable>();
         component.RemoveStatusItem(Db.Get().MiscStatusItems.PendingHarvest, false);
         harvestDesignatable.SetHarvestWhenReady(false);
     }
     harvestDesignatable.MarkedForHarvest = false;
 }
 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);
     }
 }
示例#29
0
	private void OnReachableChanged(object data)
	{
		isReachable = (bool)data;
		KSelectable component = GetComponent<KSelectable>();
		if (isReachable)
		{
			component.RemoveStatusItem(Db.Get().MiscStatusItems.PickupableUnreachable, false);
		}
		else
		{
			component.AddStatusItem(Db.Get().MiscStatusItems.PickupableUnreachable, this);
		}
	}
    private static void UpdateOldStatusItem(Instance smi, float dt)
    {
        KSelectable component = smi.GetComponent <KSelectable>();

        if (smi.age.value > smi.age.GetMax() - 5f)
        {
            component.AddStatusItem(Db.Get().CreatureStatusItems.Old, smi);
        }
        else
        {
            component.RemoveStatusItem(Db.Get().CreatureStatusItems.Old, false);
        }
    }