From aa81d98238b4b1bdd18c259aac9b9a48c5984c30 Mon Sep 17 00:00:00 2001 From: dvize Date: Thu, 29 Jun 2023 13:50:20 -0700 Subject: [PATCH] Remove Faceshield mask option since thats item template related anyways --- Component.cs | 63 +++++++++++++++++----------------------------------- Plugin.cs | 8 ------- 2 files changed, 20 insertions(+), 51 deletions(-) diff --git a/Component.cs b/Component.cs index f487497..27d9d99 100644 --- a/Component.cs +++ b/Component.cs @@ -1,11 +1,8 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; -using System.Threading.Tasks; using BepInEx.Logging; using Comfort.Common; using EFT; -using EFT.Interactive; using EFT.InventoryLogic; using HarmonyLib; using UnityEngine; @@ -85,47 +82,9 @@ namespace armorMod { RepairWeapon(); } - - if(AssPlugin.faceShieldNoMask.Value || AssPlugin.fixFaceShieldBullets.Value) - { - faceShieldCheck(); - } + } - private void faceShieldCheck() - { - var slot = EquipmentSlot.Headwear; - - Slot tempSlot = getEquipSlot(slot); - - if (tempSlot == null || tempSlot.ContainedItem == null) - { - return; - } - - foreach (var item in tempSlot.ContainedItem.GetAllItems()) - { - item.TryGetItemComponent(out faceShield); - - //if has faceshield repair bullet damage hits - if (faceShield != null) - { - //Logger.LogDebug("Item has a faceshield component, setting hits to 0"); - - //use access tools to set property of faceshield.mask to no mask - if (faceShield.Mask != FaceShieldComponent.EMask.NoMask && AssPlugin.faceShieldNoMask.Value) - { - AccessTools.Property(faceShield.GetType(), "Mask").SetValue(faceShield, FaceShieldComponent.EMask.NoMask); - } - - if (faceShield.Hits > 0 && AssPlugin.fixFaceShieldBullets.Value && timeSinceLastHit >= AssPlugin.TimeDelayRepairInSec.Value) - { - faceShield.Hits = 0; - faceShield.HitsChanged.Invoke(); - } - } - } - } private void RepairArmor() { @@ -156,6 +115,24 @@ namespace armorMod continue; } + if (slot == EquipmentSlot.Headwear) + { + + item.TryGetItemComponent(out faceShield); + + if (faceShield == null) + { + continue; + } + + if (faceShield.Hits > 0 && AssPlugin.fixFaceShieldBullets.Value) + { + faceShield.Hits = 0; + faceShield.HitsChanged.Invoke(); + } + } + + maxRepairableDurabilityBasedOnCap = ((AssPlugin.MaxDurabilityCap.Value / 100) * armor.MaxDurability); //check if it needs repair for the current item in loop of all items for the slot diff --git a/Plugin.cs b/Plugin.cs index 88756b3..b817f18 100644 --- a/Plugin.cs +++ b/Plugin.cs @@ -58,11 +58,6 @@ namespace armorMod } internal static ConfigEntry fixFaceShieldBullets - { - get; set; - } - - internal static ConfigEntry faceShieldNoMask { get; set; } @@ -97,9 +92,6 @@ namespace armorMod fixFaceShieldBullets = Config.Bind("Face Shield", "Fix Bullet Cracks", true, new ConfigDescription("Enables Repairing Bullet Cracks in FaceShield", null, new ConfigurationManagerAttributes { IsAdvanced = false, Order = 2 })); - faceShieldNoMask = Config.Bind("Face Shield", "Change Limited View to Full View", true, new ConfigDescription("Changes the Helmet Vision Mask if its blocking", - null, new ConfigurationManagerAttributes { IsAdvanced = false, Order = 1 })); - new NewGamePatch().Enable(); }