コード例 #1
0
    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
ファイル: RadiateHeat.cs プロジェクト: ragzilla/sky-oni-mods
        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
    protected override void OnSpawn()
    {
        airConsumptionRate = Db.Get().Attributes.AirConsumptionRate.Lookup(this);
        o2Accumulator      = Game.Instance.accumulators.Add("O2", this);
        co2Accumulator     = Game.Instance.accumulators.Add("CO2", this);
        KSelectable component = GetComponent <KSelectable>();

        component.AddStatusItem(Db.Get().DuplicantStatusItems.BreathingO2, this);
        component.AddStatusItem(Db.Get().DuplicantStatusItems.EmittingCO2, this);
        temperature = Db.Get().Amounts.Temperature.Lookup(this);
        NameDisplayScreen.Instance.RegisterComponent(base.gameObject, this, false);
    }
コード例 #4
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);
        }
コード例 #5
0
    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);
            }
        }
    }
コード例 #6
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);
            }
        }
コード例 #7
0
    protected override void OnSpawn()
    {
        base.OnSpawn();
        KSelectable component = GetComponent <KSelectable>();

        component.AddStatusItem(Db.Get().MiscStatusItems.OreMass, base.gameObject);
    }
コード例 #8
0
    protected override void OnSpawn()
    {
        if ((UnityEngine.Object)Def == (UnityEngine.Object)null)
        {
            Debug.LogError("Missing building definition on object " + base.name);
        }
        KSelectable component = GetComponent <KSelectable>();

        if ((UnityEngine.Object)component != (UnityEngine.Object)null)
        {
            component.SetName(Def.Name);
            component.SetStatusIndicatorOffset(new Vector3(0f, -0.35f, 0f));
        }
        Prioritizable component2 = GetComponent <Prioritizable>();

        if ((UnityEngine.Object)component2 != (UnityEngine.Object)null)
        {
            component2.iconOffset.y = 0.3f;
        }
        KPrefabID component3 = GetComponent <KPrefabID>();

        if (component3.HasTag(RoomConstraints.ConstraintTags.IndustrialMachinery))
        {
            scenePartitionerEntry = GameScenePartitioner.Instance.Add(base.name, base.gameObject, GetExtents(), GameScenePartitioner.Instance.industrialBuildings, null);
        }
        if (Def.Deprecated && (UnityEngine.Object)GetComponent <KSelectable>() != (UnityEngine.Object)null)
        {
            KSelectable component4 = GetComponent <KSelectable>();
            deprecatedBuildingStatusItem = new StatusItem("BUILDING_DEPRECATED", "BUILDING", string.Empty, StatusItem.IconType.Info, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 129022);
            component4.AddStatusItem(deprecatedBuildingStatusItem, null);
        }
    }
コード例 #9
0
        public void QueueStateChange(ControlState state)
        {
            RequestedState = state;
            if (state == CurrentState)
            {
                if (changeStateChore != null)
                {
                    changeStateChore.Cancel("");
                    changeStateChore = null;
                }

                kSelectable.RemoveStatusItem(ModAssets.CurtainStatus, true);
                return;
            }
            ;

            if (DebugHandler.InstantBuildMode)
            {
                if (changeStateChore != null)
                {
                    changeStateChore.Cancel("Debug state change");
                }

                ApplyRequestedControlState();
                return;
            }

            kSelectable.AddStatusItem(ModAssets.CurtainStatus, this);

            changeStateChore = new WorkChore <Curtain>(
                chore_type: Db.Get().ChoreTypes.Toggle,
                target: this,
                only_when_operational: false);
        }
コード例 #10
0
    protected override void OnSpawn()
    {
        base.OnSpawn();
        conditionManager = FindLaunchConditionManager();
        Spacecraft spacecraftFromLaunchConditionManager = SpacecraftManager.instance.GetSpacecraftFromLaunchConditionManager(conditionManager);

        if (spacecraftFromLaunchConditionManager != null)
        {
            SetParentRocketName(spacecraftFromLaunchConditionManager.GetRocketName());
        }
        RegisterWithConditionManager();
        KSelectable component = GetComponent <KSelectable>();

        if ((UnityEngine.Object)component != (UnityEngine.Object)null)
        {
            component.AddStatusItem(Db.Get().BuildingStatusItems.RocketName, this);
        }
        if ((UnityEngine.Object)conditionManager != (UnityEngine.Object)null && conditionManager.GetComponent <KPrefabID>().HasTag(GameTags.RocketNotOnGround))
        {
            OnLaunch(null);
        }
        Subscribe(-1056989049, OnLaunchDelegate);
        Subscribe(238242047, OnLandDelegate);
        Subscribe(1502190696, DEBUG_OnDestroyDelegate);
        FixSorting();
        AttachableBuilding component2 = GetComponent <AttachableBuilding>();

        component2.onAttachmentNetworkChanged = (Action <AttachableBuilding>)Delegate.Combine(component2.onAttachmentNetworkChanged, new Action <AttachableBuilding>(OnAttachmentNetworkChanged));
        if ((UnityEngine.Object)bgAnimFile != (UnityEngine.Object)null)
        {
            AddBGGantry();
        }
    }
コード例 #11
0
    protected override void OnSpawn()
    {
        base.OnSpawn();
        Vector3 position = base.transform.GetPosition();

        position.z = Grid.GetLayerZ(Grid.SceneLayer.Ore);
        base.transform.SetPosition(position);
        PrimaryElement component  = GetComponent <PrimaryElement>();
        Element        element    = component.Element;
        KSelectable    component2 = GetComponent <KSelectable>();
        Func <Element> data       = () => element;

        component2.AddStatusItem(Db.Get().MiscStatusItems.ElementalCategory, data);
        component2.AddStatusItem(Db.Get().MiscStatusItems.OreMass, base.gameObject);
        component2.AddStatusItem(Db.Get().MiscStatusItems.OreTemp, base.gameObject);
    }
コード例 #12
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);
            }
        }
    }
コード例 #13
0
 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;
             }
         }
     }
 }
コード例 #14
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);
        }
    }
コード例 #15
0
ファイル: TogglableValve.cs プロジェクト: SuperCorgi/ONI-Mods
 public void StartToggleChore()
 {
     Debug.Log("Start toggle chore!");
     parent.isMarkedForToggle = true;
     selectable.AddStatusItem(ToggleStatusItem);
     chore = new WorkChore <ToggleJob>(Db.Get().ChoreTypes.Toggle, this);
     Game.Instance.userMenu.Refresh(gameObject);
 }
コード例 #16
0
ファイル: Radiator.cs プロジェクト: ragzilla/sky-oni-mods
        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);
                }
            }
        }
コード例 #17
0
 public EffectInstance(GameObject game_object, Effect effect, bool should_save)
     : base(game_object, effect)
 {
     this.effect = effect;
     shouldSave  = should_save;
     ConfigureStatusItem();
     if (effect.showInUI)
     {
         KSelectable component = base.gameObject.GetComponent <KSelectable>();
         if (!component.GetStatusItemGroup().HasStatusItemID(statusItem))
         {
             component.AddStatusItem(statusItem, this);
         }
     }
     if (effect.triggerFloatingText && (Object)PopFXManager.Instance != (Object)null)
     {
         PopFXManager.Instance.SpawnFX(PopFXManager.Instance.sprite_Plus, effect.Name, game_object.transform, 1.5f, false);
     }
     if (!string.IsNullOrEmpty(effect.emoteAnim))
     {
         ReactionMonitor.Instance sMI = base.gameObject.GetSMI <ReactionMonitor.Instance>();
         if (sMI != null)
         {
             if (effect.emoteCooldown < 0f)
             {
                 SelfEmoteReactable selfEmoteReactable = (SelfEmoteReactable) new SelfEmoteReactable(game_object, effect.Name + "_Emote", Db.Get().ChoreTypes.Emote, effect.emoteAnim, 100000f, 20f, float.PositiveInfinity).AddStep(new EmoteReactable.EmoteStep
                 {
                     anim = (HashedString)"react"
                 });
                 selfEmoteReactable.AddPrecondition(NotInATube);
                 if (effect.emotePreconditions != null)
                 {
                     foreach (Reactable.ReactablePrecondition emotePrecondition in effect.emotePreconditions)
                     {
                         selfEmoteReactable.AddPrecondition(emotePrecondition);
                     }
                 }
                 sMI.AddOneshotReactable(selfEmoteReactable);
             }
             else
             {
                 reactable = new SelfEmoteReactable(game_object, effect.Name + "_Emote", Db.Get().ChoreTypes.Emote, effect.emoteAnim, effect.emoteCooldown, 20f, float.PositiveInfinity).AddStep(new EmoteReactable.EmoteStep
                 {
                     anim = (HashedString)"react"
                 });
                 reactable.AddPrecondition(NotInATube);
                 if (effect.emotePreconditions != null)
                 {
                     foreach (Reactable.ReactablePrecondition emotePrecondition2 in effect.emotePreconditions)
                     {
                         reactable.AddPrecondition(emotePrecondition2);
                     }
                 }
             }
         }
     }
 }
コード例 #18
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);
            }
        }
    }
コード例 #19
0
 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);
     }
 }
コード例 #20
0
ファイル: StirlingEngine.cs プロジェクト: romen-h/ONI-Mods
            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);
            }
コード例 #21
0
    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);
    }
コード例 #22
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;
 }
コード例 #23
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);
		}
	}
コード例 #24
0
        protected override void OnSpawn()
        {
            KBatchedAnimController component = GetComponent <KBatchedAnimController>();

            component.TintColour = new Color(0.5f, 0.5f, 1.0f, 1.0f);
            string name = component.name + ".gun";

            arm_go = new GameObject(name);
            arm_go.SetActive(value: false);
            arm_go.transform.parent = component.transform;
            looping_sounds          = arm_go.AddComponent <LoopingSounds>();
            rotateSound             = GlobalAssets.GetSound(rotateSound);
            KPrefabID kPrefabID = arm_go.AddComponent <KPrefabID>();

            kPrefabID.PrefabTag     = new Tag(name);
            arm_anim_ctrl           = arm_go.AddComponent <KBatchedAnimController>();
            arm_anim_ctrl.AnimFiles = new KAnimFile[1] {
                component.AnimFiles[0]
            };
            arm_anim_ctrl.initialAnim = "gun";
            arm_anim_ctrl.isMovable   = true;
            arm_anim_ctrl.sceneLayer  = Grid.SceneLayer.TransferArm;
            arm_anim_ctrl.TintColour  = new Color(0.5f, 0.5f, 1.0f, 1.0f);
            component.SetSymbolVisiblity("gun_target", is_visible: false);
            bool    symbolVisible;
            Vector4 column   = component.GetSymbolTransform(new HashedString("gun_target"), out symbolVisible).GetColumn(3);
            Vector3 position = column;

            position.z = Grid.GetLayerZ(Grid.SceneLayer.TransferArm);
            arm_go.transform.SetPosition(position);
            arm_go.SetActive(value: true);
            link = new KAnimLink(component, arm_anim_ctrl);
            SetupBeam();
            RotateArm(rotatable.GetRotatedOffset(Quaternion.Euler(0f, 0f, -arm_rot) * Vector3.up), warp: true, 0f);
            energyConsumer.UpdatePoweredStatus();
            operational.SetActive(true);
            selectable.AddStatusItem(charge_status, this);
            selectable.AddStatusItem(kills_status, this);
        }
コード例 #25
0
    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);
        }
    }
コード例 #26
0
 private void UpdateStatusItem()
 {
     if (showInStatusPanel)
     {
         if (statusHandle == Guid.Empty && IsActive() && consumptionEnabled)
         {
             statusHandle = selectable.AddStatusItem(Db.Get().BuildingStatusItems.ElementConsumer, this);
         }
         else if (statusHandle != Guid.Empty)
         {
             GetComponent <KSelectable>().RemoveStatusItem(statusHandle, false);
         }
     }
 }
コード例 #27
0
    public void SetCanBeHarvested(bool state)
    {
        canBeHarvested = state;
        KSelectable component = GetComponent <KSelectable>();

        if (canBeHarvested)
        {
            component.AddStatusItem(Db.Get().CreatureStatusItems.ReadyForHarvest, null);
            if (harvestDesignatable.HarvestWhenReady)
            {
                harvestDesignatable.MarkForHarvest();
            }
            else if (harvestDesignatable.InPlanterBox)
            {
                component.AddStatusItem(Db.Get().MiscStatusItems.NotMarkedForHarvest, this);
            }
        }
        else
        {
            component.RemoveStatusItem(Db.Get().CreatureStatusItems.ReadyForHarvest, false);
            component.RemoveStatusItem(Db.Get().MiscStatusItems.NotMarkedForHarvest, false);
        }
        Game.Instance.userMenu.Refresh(base.gameObject);
    }
コード例 #28
0
 private void ApplyModifier(ModifierType modifier)
 {
     if (modifier.modifier != null)
     {
         Attributes attributes = this.GetAttributes();
         attributes.Add(modifier.modifier);
     }
     if (modifier.statusItem != null)
     {
         KSelectable component = GetComponent <KSelectable>();
         component.AddStatusItem(modifier.statusItem, null);
     }
     if (modifier.thought != null)
     {
         ThoughtGraph.Instance sMI = this.GetSMI <ThoughtGraph.Instance>();
         sMI.AddThought(modifier.thought);
     }
 }
コード例 #29
0
    protected virtual void UpdateStatusItem(object data = null)
    {
        KSelectable component = GetComponent <KSelectable>();

        if (!((UnityEngine.Object)component == (UnityEngine.Object)null) && !string.IsNullOrEmpty(requiredSkillPerk))
        {
            bool flag = MinionResume.AnyMinionHasPerk(requiredSkillPerk);
            if (!flag && workStatusItemHandle == Guid.Empty)
            {
                workStatusItemHandle = component.AddStatusItem(Db.Get().BuildingStatusItems.ColonyLacksRequiredSkillPerk, requiredSkillPerk);
            }
            else if (flag && workStatusItemHandle != Guid.Empty)
            {
                component.RemoveStatusItem(workStatusItemHandle, false);
                workStatusItemHandle = Guid.Empty;
            }
        }
    }
コード例 #30
0
 public void SetHarvestWhenReady(bool state)
 {
     harvestWhenReady = state;
     if (harvestWhenReady && CanBeHarvested() && !isMarkedForHarvest)
     {
         MarkForHarvest();
     }
     if (isMarkedForHarvest && !harvestWhenReady)
     {
         OnCancel(null);
         if (CanBeHarvested() && isInPlanterBox)
         {
             KSelectable component = GetComponent <KSelectable>();
             component.AddStatusItem(Db.Get().MiscStatusItems.NotMarkedForHarvest, this);
         }
     }
     Trigger(-266953818, null);
     RefreshOverlayIcon(null);
 }