Remove Faceshield mask option since thats item template related anyways
This commit is contained in:
63
Component.cs
63
Component.cs
@@ -1,11 +1,8 @@
|
|||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using BepInEx.Logging;
|
using BepInEx.Logging;
|
||||||
using Comfort.Common;
|
using Comfort.Common;
|
||||||
using EFT;
|
using EFT;
|
||||||
using EFT.Interactive;
|
|
||||||
using EFT.InventoryLogic;
|
using EFT.InventoryLogic;
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
@@ -85,47 +82,9 @@ namespace armorMod
|
|||||||
{
|
{
|
||||||
RepairWeapon();
|
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()
|
private void RepairArmor()
|
||||||
{
|
{
|
||||||
@@ -156,6 +115,24 @@ namespace armorMod
|
|||||||
continue;
|
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);
|
maxRepairableDurabilityBasedOnCap = ((AssPlugin.MaxDurabilityCap.Value / 100) * armor.MaxDurability);
|
||||||
|
|
||||||
//check if it needs repair for the current item in loop of all items for the slot
|
//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
|
internal static ConfigEntry<Boolean> fixFaceShieldBullets
|
||||||
{
|
|
||||||
get; set;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static ConfigEntry<Boolean> faceShieldNoMask
|
|
||||||
{
|
{
|
||||||
get; set;
|
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",
|
fixFaceShieldBullets = Config.Bind("Face Shield", "Fix Bullet Cracks", true, new ConfigDescription("Enables Repairing Bullet Cracks in FaceShield",
|
||||||
null, new ConfigurationManagerAttributes { IsAdvanced = false, Order = 2 }));
|
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();
|
new NewGamePatch().Enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user