public override void Assign(IAssignableIdentity new_assignee)
 {
     if (new_assignee != assignee)
     {
         if (base.slot != null && new_assignee is MinionIdentity)
         {
             new_assignee = (new_assignee as MinionIdentity).assignableProxy.Get();
         }
         if (base.slot != null && new_assignee is StoredMinionIdentity)
         {
             new_assignee = (new_assignee as StoredMinionIdentity).assignableProxy.Get();
         }
         if (new_assignee is MinionAssignablesProxy)
         {
             Ownables soleOwner          = new_assignee.GetSoleOwner();
             Ownables component          = soleOwner.GetComponent <Ownables>();
             AssignableSlotInstance slot = component.GetSlot(base.slot);
             if (slot != null)
             {
                 Assignable assignable = slot.assignable;
                 if ((Object)assignable != (Object)null)
                 {
                     assignable.Unassign();
                 }
             }
         }
         base.Assign(new_assignee);
     }
 }
예제 #2
0
 public virtual void Unassign()
 {
     if (assignee != null)
     {
         GetComponent <KPrefabID>().RemoveTag(GameTags.Assigned);
         if (slot != null)
         {
             Ownables soleOwner = assignee.GetSoleOwner();
             if ((bool)soleOwner)
             {
                 soleOwner.GetSlot(slot)?.Unassign(true);
                 Equipment component = soleOwner.GetComponent <Equipment>();
                 if ((UnityEngine.Object)component != (UnityEngine.Object)null)
                 {
                     component.GetSlot(slot)?.Unassign(true);
                 }
             }
         }
         assignee = null;
         if (canBePublic)
         {
             Assign(Game.Instance.assignmentManager.assignment_groups["public"]);
         }
         assignee_identityRef.Set(null);
         assignee_groupID = string.Empty;
         if (this.OnAssign != null)
         {
             this.OnAssign(null);
         }
         Trigger(684616645, null);
     }
 }
예제 #3
0
 public void OnUnequip()
 {
     isEquipped = false;
     if (!destroyed)
     {
         GetComponent <KPrefabID>().RemoveTag(GameTags.Equipped);
         GetComponent <KBatchedAnimController>().enabled = true;
         GetComponent <KSelectable>().IsSelectable       = true;
         if (assignee != null)
         {
             Ownables soleOwner = assignee.GetSoleOwner();
             if ((bool)soleOwner)
             {
                 GameObject targetGameObject = soleOwner.GetComponent <MinionAssignablesProxy>().GetTargetGameObject();
                 if ((bool)targetGameObject)
                 {
                     Effects component = targetGameObject.GetComponent <Effects>();
                     if ((Object)component != (Object)null)
                     {
                         foreach (Effect effectImmunite in def.EffectImmunites)
                         {
                             component.RemoveImmunity(effectImmunite);
                         }
                     }
                 }
             }
         }
         if (def.OnUnequipCallBack != null)
         {
             def.OnUnequipCallBack(this);
         }
     }
 }
예제 #4
0
 protected override void OnCompleteWork(Worker worker)
 {
     if (equippable.assignee != null)
     {
         Ownables soleOwner = equippable.assignee.GetSoleOwner();
         if ((bool)soleOwner)
         {
             soleOwner.GetComponent <Equipment>().Equip(equippable);
         }
     }
 }
 public static void OnUnequipVest(Equippable eq)
 {
     if ((UnityEngine.Object)eq != (UnityEngine.Object)null && eq.assignee != null)
     {
         Ownables soleOwner = eq.assignee.GetSoleOwner();
         if ((UnityEngine.Object)soleOwner != (UnityEngine.Object)null)
         {
             ClothingWearer component = soleOwner.GetComponent <ClothingWearer>();
             if ((UnityEngine.Object)component != (UnityEngine.Object)null)
             {
                 component.ChangeToDefaultClothes();
             }
         }
     }
 }
예제 #6
0
 private void RefreshChore(IAssignableIdentity target)
 {
     if (chore != null)
     {
         chore.Cancel("Equipment Reassigned");
         chore = null;
     }
     if (target != null)
     {
         Ownables  soleOwner = target.GetSoleOwner();
         Equipment component = soleOwner.GetComponent <Equipment>();
         if (!component.IsEquipped(equippable))
         {
             CreateChore();
         }
     }
 }
 public static void OnEquipVest(Equippable eq,ClothingWearer.ClothingInfo clothingInfo)
 {
     if (!((UnityEngine.Object)eq == (UnityEngine.Object)null) && eq.assignee != null)
     {
         Ownables soleOwner = eq.assignee.GetSoleOwner();
         if (!((UnityEngine.Object)soleOwner == (UnityEngine.Object)null))
         {
             MinionAssignablesProxy component  = soleOwner.GetComponent <MinionAssignablesProxy>();
             ClothingWearer         component2 = (component.target as KMonoBehaviour).GetComponent <ClothingWearer>();
             if ((UnityEngine.Object)component2 != (UnityEngine.Object)null)
             {
                 component2.ChangeClothes(clothingInfo);
             }
             else
             {
                 Debug.LogWarning("Clothing item cannot be equipped to assignee because they lack ClothingWearer component");
             }
         }
     }
 }
예제 #8
0
 public virtual void Assign(IAssignableIdentity new_assignee)
 {
     if (new_assignee != assignee)
     {
         if (new_assignee is KMonoBehaviour)
         {
             if (!CanAssignTo(new_assignee))
             {
                 return;
             }
             assignee_identityRef.Set((KMonoBehaviour)new_assignee);
             assignee_groupID = string.Empty;
         }
         else if (new_assignee is AssignmentGroup)
         {
             assignee_identityRef.Set(null);
             assignee_groupID = ((AssignmentGroup)new_assignee).id;
         }
         GetComponent <KPrefabID>().AddTag(GameTags.Assigned, false);
         assignee = new_assignee;
         if (slot != null && (new_assignee is MinionIdentity || new_assignee is StoredMinionIdentity || new_assignee is MinionAssignablesProxy))
         {
             Ownables soleOwner = new_assignee.GetSoleOwner();
             if ((UnityEngine.Object)soleOwner != (UnityEngine.Object)null)
             {
                 soleOwner.GetSlot(slot)?.Assign(this);
             }
             Equipment component = soleOwner.GetComponent <Equipment>();
             if ((UnityEngine.Object)component != (UnityEngine.Object)null)
             {
                 component.GetSlot(slot)?.Assign(this);
             }
         }
         if (this.OnAssign != null)
         {
             this.OnAssign(new_assignee);
         }
         Trigger(684616645, new_assignee);
     }
 }
    private void RefreshStatusEffects(object data)
    {
        Equippable component  = GetComponent <Equippable>();
        Storage    component2 = GetComponent <Storage>();
        bool       flag       = component2.Has(GameTags.AnyWater);

        if (component.assignee != null && flag)
        {
            Ownables soleOwner = component.assignee.GetSoleOwner();
            if ((Object)soleOwner != (Object)null)
            {
                GameObject targetGameObject = soleOwner.GetComponent <MinionAssignablesProxy>().GetTargetGameObject();
                if ((bool)targetGameObject)
                {
                    Effects component3 = targetGameObject.GetComponent <Effects>();
                    if (!component3.HasEffect("SoiledSuit"))
                    {
                        component3.Add("SoiledSuit", true);
                    }
                }
            }
        }
    }
예제 #10
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);
    }
예제 #11
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);
    }