Example #1
0
    protected override void OnCompleteWork(Worker worker)
    {
        Status       artist_skill = Status.Ugly;
        MinionResume component    = worker.GetComponent <MinionResume>();

        if ((UnityEngine.Object)component != (UnityEngine.Object)null)
        {
            if (component.HasPerk(Db.Get().SkillPerks.CanArtGreat.Id))
            {
                artist_skill = Status.Great;
            }
            else if (component.HasPerk(Db.Get().SkillPerks.CanArtOkay.Id))
            {
                artist_skill = Status.Okay;
            }
        }
        List <Stage> potential_stages = new List <Stage>();

        stages.ForEach(delegate(Stage item)
        {
            potential_stages.Add(item);
        });
        potential_stages.RemoveAll((Stage x) => x.statusItem > artist_skill || x.id == "Default");
        potential_stages.Sort((Stage x, Stage y) => y.statusItem.CompareTo(x.statusItem));
        Status highest_status = potential_stages[0].statusItem;

        potential_stages.RemoveAll((Stage x) => x.statusItem < highest_status);
        potential_stages.Shuffle();
        SetStage(potential_stages[0].id, false);
        if (potential_stages[0].cheerOnComplete)
        {
            new EmoteChore(worker.GetComponent <ChoreProvider>(), Db.Get().ChoreTypes.EmoteHighPriority, "anim_cheer_kanim", new HashedString[3]
            {
                "cheer_pre",
                "cheer_loop",
                "cheer_pst"
            }, null);
        }
        else
        {
            new EmoteChore(worker.GetComponent <ChoreProvider>(), Db.Get().ChoreTypes.EmoteHighPriority, "anim_disappointed_kanim", new HashedString[3]
            {
                "disappointed_pre",
                "disappointed_loop",
                "disappointed_pst"
            }, null);
        }
        shouldShowSkillPerkStatusItem = false;
        UpdateStatusItem(null);
        Prioritizable.RemoveRef(base.gameObject);
    }
        protected override void OnCompleteWork(Worker worker)
        {
            Status       scientist_skill = Status.Ugly;
            MinionResume component       = worker.GetComponent <MinionResume>();

            if (component != null)
            {
                if (component.HasPerk(Db.Get().SkillPerks.AllowInterstellarResearch.Id))
                {
                    scientist_skill = Status.Great;
                }
                else if (component.HasPerk(Db.Get().SkillPerks.CanStudyWorldObjects.Id))
                {
                    scientist_skill = Status.Okay;
                }
            }

            List <Stage> potential_stages = new List <Stage>();

            potential_stages = stages.FindAll(s => s.statusItem.Equals(scientist_skill));
            potential_stages.Shuffle();
            SetStage(potential_stages[0].id, false);

            if (potential_stages[0].cheerOnComplete)
            {
                EmoteChore emoteChore1 = new EmoteChore(worker.GetComponent <ChoreProvider>(), Db.Get().ChoreTypes.EmoteHighPriority, "anim_cheer_kanim", new HashedString[3]
                {
                    "cheer_pre",
                    "cheer_loop",
                    "cheer_pst"
                }, null);
            }
            else
            {
                EmoteChore emoteChore2 = new EmoteChore(worker.GetComponent <ChoreProvider>(), Db.Get().ChoreTypes.EmoteHighPriority, "anim_disappointed_kanim", new HashedString[3]
                {
                    "disappointed_pre",
                    "disappointed_loop",
                    "disappointed_pst"
                }, null);
            }

            shouldShowSkillPerkStatusItem = false;
            UpdateStatusItem(null);
            Prioritizable.RemoveRef(gameObject);
        }
 public static float GetTrueDurability(this Durability @this, MinionResume resume = null)
 {
     if (isEquipped.Get(@this))
     {
         float delta = GameClock.Instance.GetTimeInCycles() - @this.TimeEquipped;
         delta *= @this.durabilityLossPerCycle * difficultySettingMod.Get(@this);
         if (resume != null && resume.HasPerk(Db.Get().SkillPerks.ExosuitDurability.Id))
         {
             delta *= 1f - EQUIPMENT.SUITS.SUIT_DURABILITY_SKILL_BONUS;
         }
         return(Mathf.Clamp01(durability.Get(@this) + delta));
     }
     return(durability.Get(@this));
 }
Example #4
0
    public EquipmentDef CreateEquipmentDef()
    {
        Dictionary <string, float> dictionary = new Dictionary <string, float>();

        dictionary.Add((-899253461).ToString(), 200f);
        dictionary.Add((-486269331).ToString(), 25f);
        List <AttributeModifier> list = new List <AttributeModifier>();

        list.Add(new AttributeModifier(TUNING.EQUIPMENT.ATTRIBUTE_MOD_IDS.INSULATION, (float)TUNING.EQUIPMENT.SUITS.ATMOSUIT_INSULATION, STRINGS.EQUIPMENT.PREFABS.ATMO_SUIT.NAME, false, false, true));
        list.Add(new AttributeModifier(TUNING.EQUIPMENT.ATTRIBUTE_MOD_IDS.ATHLETICS, (float)TUNING.EQUIPMENT.SUITS.ATMOSUIT_ATHLETICS, STRINGS.EQUIPMENT.PREFABS.ATMO_SUIT.NAME, false, false, true));
        list.Add(new AttributeModifier(TUNING.EQUIPMENT.ATTRIBUTE_MOD_IDS.THERMAL_CONDUCTIVITY_BARRIER, TUNING.EQUIPMENT.SUITS.ATMOSUIT_THERMAL_CONDUCTIVITY_BARRIER, STRINGS.EQUIPMENT.PREFABS.ATMO_SUIT.NAME, false, false, true));
        list.Add(new AttributeModifier(Db.Get().Attributes.Digging.Id, (float)TUNING.EQUIPMENT.SUITS.ATMOSUIT_DIGGING, STRINGS.EQUIPMENT.PREFABS.ATMO_SUIT.NAME, false, false, true));
        list.Add(new AttributeModifier(Db.Get().Attributes.ScaldingThreshold.Id, (float)TUNING.EQUIPMENT.SUITS.ATMOSUIT_SCALDING, STRINGS.EQUIPMENT.PREFABS.ATMO_SUIT.NAME, false, false, true));
        expertAthleticsModifier = new AttributeModifier(TUNING.EQUIPMENT.ATTRIBUTE_MOD_IDS.ATHLETICS, (float)(-TUNING.EQUIPMENT.SUITS.ATMOSUIT_ATHLETICS), Db.Get().Skills.Suits1.Name, false, false, true);
        string    id            = "Jet_Suit";
        string    sLOT          = TUNING.EQUIPMENT.SUITS.SLOT;
        SimHashes outputElement = SimHashes.Steel;
        float     mass          = (float)TUNING.EQUIPMENT.SUITS.ATMOSUIT_MASS;
        List <AttributeModifier> attributeModifiers = list;

        Tag[] additional_tags = new Tag[1]
        {
            GameTags.Suit
        };
        EquipmentDef equipmentDef = EquipmentTemplates.CreateEquipmentDef(id,sLOT,outputElement,mass,"suit_jetpack_kanim",string.Empty,"body_jetpack_kanim",6,attributeModifiers,null,true,EntityTemplates.CollisionShape.CIRCLE,0.325f,0.325f,additional_tags,"JetSuit");

        equipmentDef.RecipeDescription = STRINGS.EQUIPMENT.PREFABS.JET_SUIT.RECIPE_DESC;
        equipmentDef.EffectImmunites.Add(Db.Get().effects.Get("SoakingWet"));
        equipmentDef.EffectImmunites.Add(Db.Get().effects.Get("WetFeet"));
        equipmentDef.EffectImmunites.Add(Db.Get().effects.Get("PoppedEarDrums"));
        equipmentDef.OnEquipCallBack = delegate(Equippable eq)
        {
            Ownables soleOwner2 = eq.assignee.GetSoleOwner();
            if ((Object)soleOwner2 != (Object)null)
            {
                GameObject targetGameObject2 = soleOwner2.GetComponent <MinionAssignablesProxy>().GetTargetGameObject();
                Navigator  component4        = targetGameObject2.GetComponent <Navigator>();
                if ((Object)component4 != (Object)null)
                {
                    component4.SetFlags(PathFinder.PotentialPath.Flags.HasJetPack);
                }
                MinionResume component5 = targetGameObject2.GetComponent <MinionResume>();
                if ((Object)component5 != (Object)null && component5.HasPerk(Db.Get().SkillPerks.ExosuitExpertise.Id))
                {
                    targetGameObject2.GetAttributes().Get(Db.Get().Attributes.Athletics).Add(expertAthleticsModifier);
                }
                KAnimControllerBase component6 = targetGameObject2.GetComponent <KAnimControllerBase>();
                if ((bool)component6)
                {
                    component6.AddAnimOverrides(Assets.GetAnim("anim_loco_hover_kanim"), 0f);
                }
            }
        };
        equipmentDef.OnUnequipCallBack = delegate(Equippable eq)
        {
            if (eq.assignee != null)
            {
                Ownables soleOwner = eq.assignee.GetSoleOwner();
                if ((bool)soleOwner)
                {
                    GameObject targetGameObject = soleOwner.GetComponent <MinionAssignablesProxy>().GetTargetGameObject();
                    if ((bool)targetGameObject)
                    {
                        targetGameObject.GetAttributes()?.Get(Db.Get().Attributes.Athletics).Remove(expertAthleticsModifier);
                        Navigator component = targetGameObject.GetComponent <Navigator>();
                        if ((Object)component != (Object)null)
                        {
                            component.ClearFlags(PathFinder.PotentialPath.Flags.HasJetPack);
                        }
                        KAnimControllerBase component2 = targetGameObject.GetComponent <KAnimControllerBase>();
                        if ((bool)component2)
                        {
                            component2.RemoveAnimOverrides(Assets.GetAnim("anim_loco_hover_kanim"));
                        }
                        Effects component3 = targetGameObject.GetComponent <Effects>();
                        if (component3.HasEffect("SoiledSuit"))
                        {
                            component3.Remove("SoiledSuit");
                        }
                    }
                    eq.GetComponent <Storage>().DropAll(eq.transform.GetPosition(), true, true, default(Vector3), false);
                }
            }
        };
        GeneratedBuildings.RegisterWithOverlay(OverlayScreen.SuitIDs, "Jet_Suit");
        GeneratedBuildings.RegisterWithOverlay(OverlayScreen.SuitIDs, "Helmet");
        return(equipmentDef);
    }
Example #5
0
    public EquipmentDef CreateEquipmentDef()
    {
        List <AttributeModifier> list = new List <AttributeModifier>();

        list.Add(new AttributeModifier(TUNING.EQUIPMENT.ATTRIBUTE_MOD_IDS.INSULATION, (float)TUNING.EQUIPMENT.SUITS.ATMOSUIT_INSULATION, STRINGS.EQUIPMENT.PREFABS.ATMO_SUIT.NAME, false, false, true));
        list.Add(new AttributeModifier(TUNING.EQUIPMENT.ATTRIBUTE_MOD_IDS.ATHLETICS, (float)TUNING.EQUIPMENT.SUITS.ATMOSUIT_ATHLETICS, STRINGS.EQUIPMENT.PREFABS.ATMO_SUIT.NAME, false, false, true));
        list.Add(new AttributeModifier(TUNING.EQUIPMENT.ATTRIBUTE_MOD_IDS.THERMAL_CONDUCTIVITY_BARRIER, TUNING.EQUIPMENT.SUITS.ATMOSUIT_THERMAL_CONDUCTIVITY_BARRIER, STRINGS.EQUIPMENT.PREFABS.ATMO_SUIT.NAME, false, false, true));
        list.Add(new AttributeModifier(Db.Get().Attributes.Digging.Id, (float)TUNING.EQUIPMENT.SUITS.ATMOSUIT_DIGGING, STRINGS.EQUIPMENT.PREFABS.ATMO_SUIT.NAME, false, false, true));
        list.Add(new AttributeModifier(Db.Get().Attributes.ScaldingThreshold.Id, (float)TUNING.EQUIPMENT.SUITS.ATMOSUIT_SCALDING, STRINGS.EQUIPMENT.PREFABS.ATMO_SUIT.NAME, false, false, true));
        expertAthleticsModifier = new AttributeModifier(TUNING.EQUIPMENT.ATTRIBUTE_MOD_IDS.ATHLETICS, (float)(-TUNING.EQUIPMENT.SUITS.ATMOSUIT_ATHLETICS), Db.Get().Skills.Suits1.Name, false, false, true);
        string    id                                = "Atmo_Suit";
        string    sLOT                              = TUNING.EQUIPMENT.SUITS.SLOT;
        SimHashes outputElement                     = SimHashes.Dirt;
        float     mass                              = (float)TUNING.EQUIPMENT.SUITS.ATMOSUIT_MASS;
        string    anim                              = "suit_oxygen_kanim";
        string    empty                             = string.Empty;
        string    buildOverride                     = "body_oxygen_kanim";
        int       buildOverridePriority             = 6;
        List <AttributeModifier> attributeModifiers = list;

        Tag[] additional_tags = new Tag[1]
        {
            GameTags.Suit
        };
        EquipmentDef equipmentDef = EquipmentTemplates.CreateEquipmentDef(id,sLOT,outputElement,mass,anim,empty,buildOverride,buildOverridePriority,attributeModifiers,null,true,EntityTemplates.CollisionShape.CIRCLE,0.325f,0.325f,additional_tags,null);

        equipmentDef.RecipeDescription = STRINGS.EQUIPMENT.PREFABS.ATMO_SUIT.RECIPE_DESC;
        equipmentDef.EffectImmunites.Add(Db.Get().effects.Get("SoakingWet"));
        equipmentDef.EffectImmunites.Add(Db.Get().effects.Get("WetFeet"));
        equipmentDef.EffectImmunites.Add(Db.Get().effects.Get("PoppedEarDrums"));
        equipmentDef.OnEquipCallBack = delegate(Equippable eq)
        {
            Ownables soleOwner2 = eq.assignee.GetSoleOwner();
            if ((Object)soleOwner2 != (Object)null)
            {
                GameObject targetGameObject2 = soleOwner2.GetComponent <MinionAssignablesProxy>().GetTargetGameObject();
                Navigator  component3        = targetGameObject2.GetComponent <Navigator>();
                if ((Object)component3 != (Object)null)
                {
                    component3.SetFlags(PathFinder.PotentialPath.Flags.HasAtmoSuit);
                }
                MinionResume component4 = targetGameObject2.GetComponent <MinionResume>();
                if ((Object)component4 != (Object)null && component4.HasPerk(Db.Get().SkillPerks.ExosuitExpertise.Id))
                {
                    targetGameObject2.GetAttributes().Get(Db.Get().Attributes.Athletics).Add(expertAthleticsModifier);
                }
            }
        };
        equipmentDef.OnUnequipCallBack = delegate(Equippable eq)
        {
            if (eq.assignee != null)
            {
                Ownables soleOwner = eq.assignee.GetSoleOwner();
                if ((Object)soleOwner != (Object)null)
                {
                    GameObject targetGameObject = soleOwner.GetComponent <MinionAssignablesProxy>().GetTargetGameObject();
                    if ((bool)targetGameObject)
                    {
                        targetGameObject.GetAttributes()?.Get(Db.Get().Attributes.Athletics).Remove(expertAthleticsModifier);
                        Navigator component = targetGameObject.GetComponent <Navigator>();
                        if ((Object)component != (Object)null)
                        {
                            component.ClearFlags(PathFinder.PotentialPath.Flags.HasAtmoSuit);
                        }
                        Effects component2 = targetGameObject.GetComponent <Effects>();
                        if ((Object)component2 != (Object)null && component2.HasEffect("SoiledSuit"))
                        {
                            component2.Remove("SoiledSuit");
                        }
                    }
                    eq.GetComponent <Storage>().DropAll(eq.transform.GetPosition(), true, true, default(Vector3), false);
                }
            }
        };
        GeneratedBuildings.RegisterWithOverlay(OverlayScreen.SuitIDs, "Atmo_Suit");
        GeneratedBuildings.RegisterWithOverlay(OverlayScreen.SuitIDs, "Helmet");
        return(equipmentDef);
    }