Add faceshield bullet clearing and faceshield view change option.
This commit is contained in:
35
ASS.csproj
35
ASS.csproj
@@ -15,7 +15,7 @@
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<DebugType>portable</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
@@ -23,13 +23,14 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<DebugType>portable</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="0Harmony, Version=2.9.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
@@ -37,39 +38,42 @@
|
||||
<HintPath>BepInEx\core\0Harmony.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Aki.Build">
|
||||
<HintPath>F:\SPT-AKI\EscapeFromTarkov_Data\Managed\Aki.Build.dll</HintPath>
|
||||
<HintPath>F:\SPT-AKI-DEV\EscapeFromTarkov_Data\Managed\Aki.Build.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Aki.Common, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>F:\SPT-AKI\EscapeFromTarkov_Data\Managed\Aki.Common.dll</HintPath>
|
||||
<HintPath>F:\SPT-AKI-DEV\EscapeFromTarkov_Data\Managed\Aki.Common.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Aki.Reflection, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>F:\SPT-AKI\EscapeFromTarkov_Data\Managed\Aki.Reflection.dll</HintPath>
|
||||
<HintPath>F:\SPT-AKI-DEV\EscapeFromTarkov_Data\Managed\Aki.Reflection.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Assembly-CSharp, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>F:\SPT-AKI\EscapeFromTarkov_Data\Managed\Assembly-CSharp.dll</HintPath>
|
||||
<HintPath>F:\SPT-AKI-DEV\EscapeFromTarkov_Data\Managed\Assembly-CSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="BepInEx, Version=5.4.21.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>F:\SPT-AKI\BepInEx\core\BepInEx.dll</HintPath>
|
||||
<HintPath>F:\SPT-AKI-DEV\BepInEx\core\BepInEx.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Comfort, Version=1.0.0.4, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>F:\SPT-AKI\EscapeFromTarkov_Data\Managed\Comfort.dll</HintPath>
|
||||
<HintPath>F:\SPT-AKI-DEV\EscapeFromTarkov_Data\Managed\Comfort.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Comfort.Unity, Version=1.0.0.4, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>F:\SPT-AKI\EscapeFromTarkov_Data\Managed\Comfort.Unity.dll</HintPath>
|
||||
<HintPath>F:\SPT-AKI-DEV\EscapeFromTarkov_Data\Managed\Comfort.Unity.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ConfigurationManager">
|
||||
<HintPath>F:\SPT-AKI-DEV\BepInEx\plugins\ConfigurationManager.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ItemComponent.Types, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>F:\SPT-AKI\EscapeFromTarkov_Data\Managed\ItemComponent.Types.dll</HintPath>
|
||||
<HintPath>F:\SPT-AKI-DEV\EscapeFromTarkov_Data\Managed\ItemComponent.Types.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ItemTemplate.Types, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>F:\SPT-AKI\EscapeFromTarkov_Data\Managed\ItemTemplate.Types.dll</HintPath>
|
||||
<HintPath>F:\SPT-AKI-DEV\EscapeFromTarkov_Data\Managed\ItemTemplate.Types.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
@@ -81,21 +85,22 @@
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="UnityEngine, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>F:\SPT-AKI\EscapeFromTarkov_Data\Managed\UnityEngine.dll</HintPath>
|
||||
<HintPath>F:\SPT-AKI-DEV\EscapeFromTarkov_Data\Managed\UnityEngine.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>F:\SPT-AKI\EscapeFromTarkov_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
|
||||
<HintPath>F:\SPT-AKI-DEV\EscapeFromTarkov_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.IMGUIModule">
|
||||
<HintPath>F:\SPT-AKI\EscapeFromTarkov_Data\Managed\UnityEngine.IMGUIModule.dll</HintPath>
|
||||
<HintPath>F:\SPT-AKI-DEV\EscapeFromTarkov_Data\Managed\UnityEngine.IMGUIModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.TextRenderingModule">
|
||||
<HintPath>F:\SPT-AKI\EscapeFromTarkov_Data\Managed\UnityEngine.TextRenderingModule.dll</HintPath>
|
||||
<HintPath>F:\SPT-AKI-DEV\EscapeFromTarkov_Data\Managed\UnityEngine.TextRenderingModule.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Component.cs" />
|
||||
<Compile Include="ConfigurationManagerAttributes.cs" />
|
||||
<Compile Include="Plugin.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
|
146
Component.cs
146
Component.cs
@@ -1,9 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
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;
|
||||
@@ -17,9 +19,13 @@ namespace armorMod
|
||||
|
||||
private static float newRepairRate;
|
||||
private static float newMaxDurabilityDrainRate;
|
||||
private static float newWeaponRepairRate;
|
||||
private static float newWeaponMaxDurabilityDrainRate;
|
||||
private static RepairableComponent armor;
|
||||
private static FaceShieldComponent faceShield;
|
||||
private static RepairableComponent weapon;
|
||||
private static float maxRepairableDurabilityBasedOnCap;
|
||||
private static float maxWeaponRepairableDurabilityBasedOnCap;
|
||||
private static float timeSinceLastHit = 0f;
|
||||
|
||||
private static Dictionary<EquipmentSlot, List<Item>> equipmentSlotDictionary = new Dictionary<EquipmentSlot, List<Item>>
|
||||
@@ -31,6 +37,12 @@ namespace armorMod
|
||||
{ EquipmentSlot.Headwear, new List<Item>() },
|
||||
};
|
||||
|
||||
private static Dictionary<EquipmentSlot, List<Item>> weaponSlotDictionary = new Dictionary<EquipmentSlot, List<Item>>
|
||||
{
|
||||
{ EquipmentSlot.FirstPrimaryWeapon, new List<Item>() },
|
||||
{ EquipmentSlot.SecondPrimaryWeapon, new List<Item>() },
|
||||
{ EquipmentSlot.Holster, new List<Item>() },
|
||||
};
|
||||
protected static ManualLogSource Logger
|
||||
{
|
||||
get; private set;
|
||||
@@ -55,24 +67,67 @@ namespace armorMod
|
||||
gameWorld = Singleton<GameWorld>.Instance;
|
||||
gameWorld.GetOrAddComponent<AssComponent>();
|
||||
|
||||
Logger.LogDebug("ASS: AssComponent enabled");
|
||||
Logger.LogDebug("AssComponent enabled");
|
||||
}
|
||||
}
|
||||
|
||||
private async void Update()
|
||||
private void Update()
|
||||
{
|
||||
if (AssPlugin.ArmorServiceMode.Value)
|
||||
{
|
||||
timeSinceLastHit += Time.deltaTime;
|
||||
|
||||
if (timeSinceLastHit >= AssPlugin.TimeDelayRepairInSec.Value)
|
||||
timeSinceLastHit += Time.deltaTime;
|
||||
|
||||
if ((timeSinceLastHit >= AssPlugin.TimeDelayRepairInSec.Value) && AssPlugin.ArmorServiceMode.Value)
|
||||
{
|
||||
RepairArmor();
|
||||
}
|
||||
|
||||
if ((timeSinceLastHit >= AssPlugin.weaponTimeDelayRepairInSec.Value) && AssPlugin.WeaponServiceMode.Value)
|
||||
{
|
||||
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)
|
||||
{
|
||||
RepairArmor();
|
||||
//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 async Task RepairArmor()
|
||||
private void RepairArmor()
|
||||
{
|
||||
newRepairRate = AssPlugin.ArmorRepairRateOverTime.Value * Time.deltaTime;
|
||||
newMaxDurabilityDrainRate = AssPlugin.MaxDurabilityDegradationRateOverTime.Value * Time.deltaTime;
|
||||
@@ -97,33 +152,14 @@ namespace armorMod
|
||||
|
||||
if (armor == null)
|
||||
{
|
||||
//Logger.LogDebug("Item: " + item.Name.Localized() + " in slot: " + slot.ToString() + " does not have a repairable component");
|
||||
continue;
|
||||
//Logger.LogDebug("Item: " + item.Name.Localized() + " in slot: " + slot.ToString() + " does not have a repairable component");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (slot == EquipmentSlot.Headwear)
|
||||
{
|
||||
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");
|
||||
|
||||
if (faceShield.Hits > 0)
|
||||
{
|
||||
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
|
||||
if(armor.Durability < maxRepairableDurabilityBasedOnCap)
|
||||
if (armor.Durability < maxRepairableDurabilityBasedOnCap)
|
||||
{
|
||||
//increase armor durability by newRepairRate until maximum then set as maximum durability
|
||||
if (armor.Durability + newRepairRate >= armor.MaxDurability)
|
||||
@@ -136,14 +172,58 @@ namespace armorMod
|
||||
armor.MaxDurability -= newMaxDurabilityDrainRate;
|
||||
}
|
||||
}
|
||||
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void RepairWeapon()
|
||||
{
|
||||
|
||||
newWeaponRepairRate = AssPlugin.weaponRepairRateOverTime.Value * Time.deltaTime;
|
||||
newWeaponMaxDurabilityDrainRate = AssPlugin.weaponMaxDurabilityDegradationRateOverTime.Value * Time.deltaTime;
|
||||
|
||||
foreach (EquipmentSlot slot in weaponSlotDictionary.Keys.ToArray())
|
||||
{
|
||||
Slot tempSlot = getEquipSlot(slot);
|
||||
|
||||
if (tempSlot == null || tempSlot.ContainedItem == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach (var item in tempSlot.ContainedItem.GetAllItems())
|
||||
{
|
||||
item.TryGetItemComponent<RepairableComponent>(out weapon);
|
||||
|
||||
if (weapon == null)
|
||||
{
|
||||
//Logger.LogDebug("Item: " + item.Name.Localized() + " in slot: " + slot.ToString() + " does not have a repairable component");
|
||||
continue;
|
||||
}
|
||||
|
||||
//Logger.LogDebug("Item: " + item.Name.Localized() + " in slot: " + slot.ToString() + " has a repairable component");
|
||||
maxWeaponRepairableDurabilityBasedOnCap = ((AssPlugin.weaponMaxDurabilityCap.Value / 100) * weapon.MaxDurability);
|
||||
|
||||
//check if it needs repair for the current item in loop of all items for the slot
|
||||
if (weapon.Durability < maxWeaponRepairableDurabilityBasedOnCap)
|
||||
{
|
||||
//increase weapon durability by newWeaponRepairRate until maximum then set as maximum durability
|
||||
if (weapon.Durability + newWeaponRepairRate >= weapon.MaxDurability)
|
||||
{
|
||||
weapon.Durability = weapon.MaxDurability;
|
||||
}
|
||||
else
|
||||
{
|
||||
weapon.Durability += newWeaponRepairRate;
|
||||
weapon.MaxDurability -= newWeaponMaxDurabilityDrainRate;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
private void Player_BeingHitAction(DamageInfo dmgInfo, EBodyPart bodyPart, float hitEffectId) => timeSinceLastHit = 0f;
|
||||
|
||||
|
||||
|
149
ConfigurationManagerAttributes.cs
Normal file
149
ConfigurationManagerAttributes.cs
Normal file
@@ -0,0 +1,149 @@
|
||||
/// <summary>
|
||||
/// Class that specifies how a setting should be displayed inside the ConfigurationManager settings window.
|
||||
///
|
||||
/// Usage:
|
||||
/// This class template has to be copied inside the plugin's project and referenced by its code directly.
|
||||
/// make a new instance, assign any fields that you want to override, and pass it as a tag for your setting.
|
||||
///
|
||||
/// If a field is null (default), it will be ignored and won't change how the setting is displayed.
|
||||
/// If a field is non-null (you assigned a value to it), it will override default behavior.
|
||||
/// </summary>
|
||||
///
|
||||
/// <example>
|
||||
/// Here's an example of overriding order of settings and marking one of the settings as advanced:
|
||||
/// <code>
|
||||
/// // Override IsAdvanced and Order
|
||||
/// Config.Bind("X", "1", 1, new ConfigDescription("", null, new ConfigurationManagerAttributes { IsAdvanced = true, Order = 3 }));
|
||||
/// // Override only Order, IsAdvanced stays as the default value assigned by ConfigManager
|
||||
/// Config.Bind("X", "2", 2, new ConfigDescription("", null, new ConfigurationManagerAttributes { Order = 1 }));
|
||||
/// Config.Bind("X", "3", 3, new ConfigDescription("", null, new ConfigurationManagerAttributes { Order = 2 }));
|
||||
/// </code>
|
||||
/// </example>
|
||||
///
|
||||
/// <remarks>
|
||||
/// You can read more and see examples in the readme at https://github.com/BepInEx/BepInEx.ConfigurationManager
|
||||
/// You can optionally remove fields that you won't use from this class, it's the same as leaving them null.
|
||||
/// </remarks>
|
||||
#pragma warning disable 0169, 0414, 0649
|
||||
internal sealed class ConfigurationManagerAttributes
|
||||
{
|
||||
/// <summary>
|
||||
/// Should the setting be shown as a percentage (only use with value range settings).
|
||||
/// </summary>
|
||||
public bool? ShowRangeAsPercent;
|
||||
|
||||
/// <summary>
|
||||
/// Custom setting editor (OnGUI code that replaces the default editor provided by ConfigurationManager).
|
||||
/// See below for a deeper explanation. Using a custom drawer will cause many of the other fields to do nothing.
|
||||
/// </summary>
|
||||
public System.Action<BepInEx.Configuration.ConfigEntryBase> CustomDrawer;
|
||||
|
||||
/// <summary>
|
||||
/// Custom setting editor that allows polling keyboard input with the Input (or UnityInput) class.
|
||||
/// Use either CustomDrawer or CustomHotkeyDrawer, using both at the same time leads to undefined behaviour.
|
||||
/// </summary>
|
||||
public CustomHotkeyDrawerFunc CustomHotkeyDrawer;
|
||||
|
||||
/// <summary>
|
||||
/// Custom setting draw action that allows polling keyboard input with the Input class.
|
||||
/// Note: Make sure to focus on your UI control when you are accepting input so user doesn't type in the search box or in another setting (best to do this on every frame).
|
||||
/// If you don't draw any selectable UI controls You can use `GUIUtility.keyboardControl = -1;` on every frame to make sure that nothing is selected.
|
||||
/// </summary>
|
||||
/// <example>
|
||||
/// CustomHotkeyDrawer = (ConfigEntryBase setting, ref bool isEditing) =>
|
||||
/// {
|
||||
/// if (isEditing)
|
||||
/// {
|
||||
/// // Make sure nothing else is selected since we aren't focusing on a text box with GUI.FocusControl.
|
||||
/// GUIUtility.keyboardControl = -1;
|
||||
///
|
||||
/// // Use Input.GetKeyDown and others here, remember to set isEditing to false after you're done!
|
||||
/// // It's best to check Input.anyKeyDown and set isEditing to false immediately if it's true,
|
||||
/// // so that the input doesn't have a chance to propagate to the game itself.
|
||||
///
|
||||
/// if (GUILayout.Button("Stop"))
|
||||
/// isEditing = false;
|
||||
/// }
|
||||
/// else
|
||||
/// {
|
||||
/// if (GUILayout.Button("Start"))
|
||||
/// isEditing = true;
|
||||
/// }
|
||||
///
|
||||
/// // This will only be true when isEditing is true and you hold any key
|
||||
/// GUILayout.Label("Any key pressed: " + Input.anyKey);
|
||||
/// }
|
||||
/// </example>
|
||||
/// <param name="setting">
|
||||
/// Setting currently being set (if available).
|
||||
/// </param>
|
||||
/// <param name="isCurrentlyAcceptingInput">
|
||||
/// Set this ref parameter to true when you want the current setting drawer to receive Input events.
|
||||
/// The value will persist after being set, use it to see if the current instance is being edited.
|
||||
/// Remember to set it to false after you are done!
|
||||
/// </param>
|
||||
public delegate void CustomHotkeyDrawerFunc(BepInEx.Configuration.ConfigEntryBase setting, ref bool isCurrentlyAcceptingInput);
|
||||
|
||||
/// <summary>
|
||||
/// Show this setting in the settings screen at all? If false, don't show.
|
||||
/// </summary>
|
||||
public bool? Browsable;
|
||||
|
||||
/// <summary>
|
||||
/// Category the setting is under. Null to be directly under the plugin.
|
||||
/// </summary>
|
||||
public string Category;
|
||||
|
||||
/// <summary>
|
||||
/// If set, a "Normal" button will be shown next to the setting to allow resetting to default.
|
||||
/// </summary>
|
||||
public object DefaultValue;
|
||||
|
||||
/// <summary>
|
||||
/// Force the "Reset" button to not be displayed, even if a valid DefaultValue is available.
|
||||
/// </summary>
|
||||
public bool? HideDefaultButton;
|
||||
|
||||
/// <summary>
|
||||
/// Force the setting name to not be displayed. Should only be used with a <see cref="CustomDrawer"/> to get more space.
|
||||
/// Can be used together with <see cref="HideDefaultButton"/> to gain even more space.
|
||||
/// </summary>
|
||||
public bool? HideSettingName;
|
||||
|
||||
/// <summary>
|
||||
/// Optional description shown when hovering over the setting.
|
||||
/// Not recommended, provide the description when creating the setting instead.
|
||||
/// </summary>
|
||||
public string Description;
|
||||
|
||||
/// <summary>
|
||||
/// Name of the setting.
|
||||
/// </summary>
|
||||
public string DispName;
|
||||
|
||||
/// <summary>
|
||||
/// Order of the setting on the settings list relative to other settings in a category.
|
||||
/// 0 by default, higher number is higher on the list.
|
||||
/// </summary>
|
||||
public int? Order;
|
||||
|
||||
/// <summary>
|
||||
/// Only show the value, don't allow editing it.
|
||||
/// </summary>
|
||||
public bool? ReadOnly;
|
||||
|
||||
/// <summary>
|
||||
/// If true, don't show the setting by default. User has to turn on showing advanced settings or search for it.
|
||||
/// </summary>
|
||||
public bool? IsAdvanced;
|
||||
|
||||
/// <summary>
|
||||
/// Custom converter from setting type to string for the built-in editor textboxes.
|
||||
/// </summary>
|
||||
public System.Func<object, string> ObjToStr;
|
||||
|
||||
/// <summary>
|
||||
/// Custom converter from string to setting type for the built-in editor textboxes.
|
||||
/// </summary>
|
||||
public System.Func<string, object> StrToObj;
|
||||
}
|
72
Plugin.cs
72
Plugin.cs
@@ -1,13 +1,13 @@
|
||||
using System;
|
||||
using Aki.Reflection.Patching;
|
||||
using System.Reflection;
|
||||
using Aki.Reflection.Patching;
|
||||
using BepInEx;
|
||||
using BepInEx.Configuration;
|
||||
using EFT;
|
||||
|
||||
namespace armorMod
|
||||
{
|
||||
[BepInPlugin("com.armorMod.ASS", "armorMod.ASS", "1.3.0")]
|
||||
[BepInPlugin("com.dvize.ASS", "dvize.ASS", "1.3.0")]
|
||||
|
||||
public class AssPlugin : BaseUnityPlugin
|
||||
{
|
||||
@@ -15,6 +15,10 @@ namespace armorMod
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
internal static ConfigEntry<Boolean> WeaponServiceMode
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
/*private ConfigEntry<Boolean> LoseInsuranceOnRepair
|
||||
{
|
||||
get; set;
|
||||
@@ -35,15 +39,67 @@ namespace armorMod
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
internal static ConfigEntry<float> weaponTimeDelayRepairInSec
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
internal static ConfigEntry<float> weaponRepairRateOverTime
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
internal static ConfigEntry<float> weaponMaxDurabilityDegradationRateOverTime
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
internal static ConfigEntry<float> weaponMaxDurabilityCap
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
internal static ConfigEntry<Boolean> fixFaceShieldBullets
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
internal static ConfigEntry<Boolean> faceShieldNoMask
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
internal void Awake()
|
||||
{
|
||||
ArmorServiceMode = Config.Bind("Armor Repair Settings", "Enable/Disable Mod", true, "Enables the Armor Repairing Options Below");
|
||||
ArmorServiceMode = Config.Bind("Main Settings", "Enable/Disable Armor Repair", true, new ConfigDescription("Enables the Armor Repairing Options Below",
|
||||
null, new ConfigurationManagerAttributes { IsAdvanced = false, Order = 2 }));
|
||||
WeaponServiceMode = Config.Bind("Main Settings", "Enable/Disable Weapon Repair", true, new ConfigDescription("Enables the Weapon Repairing Options Below",
|
||||
null, new ConfigurationManagerAttributes { IsAdvanced = false, Order = 1 }));
|
||||
|
||||
/*LoseInsuranceOnRepair = Config.Bind("Armor Repair Settings", "Lose Insurance On Repair", true, "If Enabled, you will lose insurance on whenever the armor is repaired in-raid");*/
|
||||
TimeDelayRepairInSec = Config.Bind("Armor Repair Settings", "Time Delay Repair in Sec", 60f, "How Long Before you were last hit that it repairs armor");
|
||||
ArmorRepairRateOverTime = Config.Bind("Armor Repair Settings", "Armor Repair Rate", 0.5f, "How much durability per second is repaired");
|
||||
MaxDurabilityDegradationRateOverTime = Config.Bind("Armor Repair Settings", "Max Durability Drain Rate", 0.025f, "How much max durability per second of repairs is drained");
|
||||
MaxDurabilityCap = Config.Bind("Armor Repair Settings", "Max Durability Cap", 100f, "Maximum durability percentage to which armor will be able to repair to. For example, setting to 80 would repair your armor to maximum of 80% of it's max durability");
|
||||
|
||||
TimeDelayRepairInSec = Config.Bind("Armor Repair Settings", "Time Delay Repair in Sec", 60f, new ConfigDescription("How Long Before you were last hit that it repairs armor",
|
||||
new AcceptableValueRange<float>(0f, 1200f), new ConfigurationManagerAttributes { IsAdvanced = false, Order = 5 }));
|
||||
ArmorRepairRateOverTime = Config.Bind("Armor Repair Settings", "Armor Repair Rate", 0.5f, new ConfigDescription("How much durability per second is repaired",
|
||||
new AcceptableValueRange<float>(0f, 10f), new ConfigurationManagerAttributes { IsAdvanced = false, Order = 4 }));
|
||||
MaxDurabilityDegradationRateOverTime = Config.Bind("Armor Repair Settings", "Max Durability Drain Rate", 0.025f, new ConfigDescription("How much max durability per second of repairs is drained",
|
||||
new AcceptableValueRange<float>(0f, 1f), new ConfigurationManagerAttributes { IsAdvanced = false, Order = 3 }));
|
||||
MaxDurabilityCap = Config.Bind("Armor Repair Settings", "Max Durability Cap", 100f, new ConfigDescription("Maximum durability percentage to which armor will be able to repair to. For example, setting to 80 would repair your armor to maximum of 80% of it's max durability",
|
||||
new AcceptableValueRange<float>(0f, 100f), new ConfigurationManagerAttributes { IsAdvanced = false, Order = 2 }));
|
||||
|
||||
weaponTimeDelayRepairInSec = Config.Bind("Weapon Repair Settings", "Time Delay Repair in Sec", 60f, new ConfigDescription("How Long Before you were last hit that it repairs weapon. Doesn't Make sense but i'm too lazy to change.",
|
||||
new AcceptableValueRange<float>(0f, 1200f), new ConfigurationManagerAttributes { IsAdvanced = false, Order = 5 }));
|
||||
weaponRepairRateOverTime = Config.Bind("Weapon Repair Settings", "Weapon Repair Rate", 0.5f, new ConfigDescription("How much durability per second is repaired",
|
||||
new AcceptableValueRange<float>(0f, 10f), new ConfigurationManagerAttributes { IsAdvanced = false, Order = 4 }));
|
||||
weaponMaxDurabilityDegradationRateOverTime = Config.Bind("Weapon Repair Settings", "Max Durability Drain Rate", 0f, new ConfigDescription("How much max durability per second of repairs is drained (set really low if using)",
|
||||
new AcceptableValueRange<float>(0f, 1f), new ConfigurationManagerAttributes { IsAdvanced = false, Order = 3 }));
|
||||
weaponMaxDurabilityCap = Config.Bind("Weapon Repair Settings", "Max Durability Cap", 100f, new ConfigDescription("Maximum durability percentage to which weapon will be able to repair to. For example, setting to 80 would repair your armor to maximum of 80% of it's max durability",
|
||||
new AcceptableValueRange<float>(0f, 100f), new ConfigurationManagerAttributes { IsAdvanced = false, Order = 2 }));
|
||||
|
||||
|
||||
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