public void ScanSky()
        {
            float     detectTime = GetDetectTime();
            KPrefabID component  = GetComponent <KPrefabID>();

            if ((Object)targetCraft.Get() == (Object)null)
            {
                if (SaveGame.Instance.GetComponent <SeasonManager>().TimeUntilNextBombardment() <= detectTime)
                {
                    component.AddTag(GameTags.Detecting, false);
                }
                else
                {
                    component.RemoveTag(GameTags.Detecting);
                }
            }
            else
            {
                Spacecraft spacecraftFromLaunchConditionManager = SpacecraftManager.instance.GetSpacecraftFromLaunchConditionManager(targetCraft.Get());
                if (spacecraftFromLaunchConditionManager.state == Spacecraft.MissionState.Destroyed)
                {
                    targetCraft.Set(null);
                    component.RemoveTag(GameTags.Detecting);
                }
                else if (spacecraftFromLaunchConditionManager.state == Spacecraft.MissionState.Launching || spacecraftFromLaunchConditionManager.state == Spacecraft.MissionState.WaitingToLand || spacecraftFromLaunchConditionManager.state == Spacecraft.MissionState.Landing || (spacecraftFromLaunchConditionManager.state == Spacecraft.MissionState.Underway && spacecraftFromLaunchConditionManager.GetTimeLeft() <= detectTime))
                {
                    component.AddTag(GameTags.Detecting, false);
                }
                else
                {
                    component.RemoveTag(GameTags.Detecting);
                }
            }
        }
            public void ScanSky()
            {
                float     detectTime = this.GetDetectTime();
                KPrefabID component  = this.GetComponent <KPrefabID>();

                if ((UnityEngine.Object) this.targetCraft.Get() == (UnityEngine.Object)null)
                {
                    if ((double)SaveGame.Instance.GetComponent <SeasonManager>().TimeUntilNextBombardment() <= (double)detectTime)
                    {
                        component.AddTag(GameTags.Detecting);
                    }
                    else
                    {
                        component.RemoveTag(GameTags.Detecting);
                    }
                }
                else
                {
                    Spacecraft conditionManager = SpacecraftManager.instance.GetSpacecraftFromLaunchConditionManager(this.targetCraft.Get());
                    if (conditionManager.state == Spacecraft.MissionState.Destroyed)
                    {
                        this.targetCraft.Set((LaunchConditionManager)null);
                        component.RemoveTag(GameTags.Detecting);
                    }
                    else if (conditionManager.state == Spacecraft.MissionState.Launching || conditionManager.state == Spacecraft.MissionState.WaitingToLand || conditionManager.state == Spacecraft.MissionState.Landing || conditionManager.state == Spacecraft.MissionState.Underway && (double)conditionManager.GetTimeLeft() <= (double)detectTime)
                    {
                        component.AddTag(GameTags.Detecting);
                    }
                    else
                    {
                        component.RemoveTag(GameTags.Detecting);
                    }
                }
            }
Пример #3
0
        /// <summary>
        /// Replaces the Refresh method of DecorProvider to handle the decor ourselves.
        /// </summary>
        internal void RefreshDecor()
        {
            // Get status of the object
            var happiness = glumStatus?.attributes?.Get(DecorCellManager.Instance.
                                                        HappinessAttribute);
            // Entombed/disabled = 0 decor, broken = use value in DecorTuning for broken
            bool disabled = (entombStatus != null && entombStatus.IsEntombed()) ||
                            (disableStatus != null && !disableStatus.IsEnabled) || (happiness != null &&
                                                                                    happiness.GetTotalValue() < 0.0f);
            bool broken = breakStatus != null && breakStatus.IsBroken;

            RefreshCells(broken, disabled);
            // Handle rooms which require an item with 20 decor: has to actually be functional
            bool hasTag   = prefabID.HasTag(RoomConstraints.ConstraintTags.Decor20);
            bool needsTag = provider.decor.GetTotalValue() >= 20f && !broken && !disabled;

            if (hasTag != needsTag)
            {
                // Tag needs to be added/removed
                if (needsTag)
                {
                    prefabID.AddTag(RoomConstraints.ConstraintTags.Decor20, false);
                }
                else
                {
                    prefabID.RemoveTag(RoomConstraints.ConstraintTags.Decor20);
                }
                // Force room recalculation
                Game.Instance.roomProber.SolidChangedEvent(Grid.PosToCell(gameObject), true);
            }
        }
Пример #4
0
    protected override void OnStopWork(Worker worker)
    {
        worker.GetAttributes().Remove(caloriesModifier);
        KPrefabID component = worker.GetComponent <KPrefabID>();

        component.RemoveTag(GameTags.AlwaysConverse);
        StopConsuming(worker);
    }
Пример #5
0
    protected override void OnStopWork(Worker worker)
    {
        base.OnStopWork(worker);
        KPrefabID component = worker.GetComponent <KPrefabID>();

        component.RemoveTag(GameTags.AlwaysConverse);
        worker.Unsubscribe(-594200555, OnStartedTalking);
        worker.Unsubscribe(25860745, OnStoppedTalking);
    }
Пример #6
0
	private void RefreshStorageTags(object data = null)
	{
		if (data is Storage || (data != null && (bool)data))
		{
			KPrefabID.AddTag(GameTags.Stored, false);
			if ((object)storage == null || !storage.allowItemRemoval)
			{
				KPrefabID.AddTag(GameTags.StoredPrivate, false);
			}
			else
			{
				KPrefabID.RemoveTag(GameTags.StoredPrivate);
			}
		}
		else
		{
			KPrefabID.RemoveTag(GameTags.Stored);
			KPrefabID.RemoveTag(GameTags.StoredPrivate);
		}
	}
Пример #7
0
 public static void ProcessTags(this KPrefabID prefab, string[] tags, bool serialize = false)
 {
     for (int i = 0; i < tags.Length; i++)
     {
         if (tags[i] == "C:")
         {
             prefab.Tags.Clear();
         }
         else if (tags[i].StartsWith("R:", StringComparison.Ordinal))
         {
             prefab.RemoveTag(tags[i].Substring(2));
         }
         else
         {
             prefab.AddTag(tags[i], serialize);
         }
     }
 }
Пример #8
0
    public void Refresh()
    {
        splat.Clear();
        splat = new Splat(this);
        KPrefabID component = GetComponent <KPrefabID>();
        bool      flag      = component.HasTag(RoomConstraints.ConstraintTags.Decor20);
        bool      flag2     = decor.GetTotalValue() >= 20f;

        if (flag != flag2)
        {
            if (flag2)
            {
                component.AddTag(RoomConstraints.ConstraintTags.Decor20, false);
            }
            else
            {
                component.RemoveTag(RoomConstraints.ConstraintTags.Decor20);
            }
            Game.Instance.roomProber.SolidChangedEvent(Grid.PosToCell(this), true);
        }
    }
    protected override void OnStopWork(Worker worker)
    {
        KPrefabID component = GetComponent <KPrefabID>();

        component.RemoveTag(GameTags.Creatures.Stunned);
    }