Remove Faceshield mask option since thats item template related anyways
This commit is contained in:
61
Component.cs
61
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;
|
||||
@@ -86,46 +83,8 @@ 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<FaceShieldComponent>(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<FaceShieldComponent>(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
|
||||
|
@@ -58,11 +58,6 @@ namespace armorMod
|
||||
}
|
||||
|
||||
internal static ConfigEntry<Boolean> fixFaceShieldBullets
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
internal static ConfigEntry<Boolean> 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();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user