Added cap for maximum armor durability

This commit is contained in:
MusicManiac
2023-06-21 21:21:56 +02:00
parent 530650fe6e
commit ff9fa9efbd
3 changed files with 27 additions and 19 deletions

View File

@@ -33,42 +33,42 @@
<ItemGroup>
<Reference Include="0Harmony, Version=2.9.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>BepInEx\core\0Harmony.dll</HintPath>
<HintPath>..\..\..\..\..\..\SPT-3.5.7\BepInEx\core\0Harmony.dll</HintPath>
</Reference>
<Reference Include="Aki.Build">
<HintPath>F:\SPT-AKI\EscapeFromTarkov_Data\Managed\Aki.Build.dll</HintPath>
<HintPath>..\..\..\..\..\..\SPT-3.5.7\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>..\..\..\..\..\..\SPT-3.5.7\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>..\..\..\..\..\..\SPT-3.5.7\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>..\..\..\..\..\..\SPT-3.5.7\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>..\..\..\..\..\..\SPT-3.5.7\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>..\..\..\..\..\..\SPT-3.5.7\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>..\..\..\..\..\..\SPT-3.5.7\EscapeFromTarkov_Data\Managed\Comfort.Unity.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>..\..\..\..\..\..\SPT-3.5.7\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>..\..\..\..\..\..\SPT-3.5.7\EscapeFromTarkov_Data\Managed\ItemTemplate.Types.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
@@ -80,17 +80,17 @@
<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>..\..\..\..\..\..\SPT-3.5.7\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>..\..\..\..\..\..\SPT-3.5.7\EscapeFromTarkov_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.IMGUIModule">
<HintPath>F:\SPT-AKI\EscapeFromTarkov_Data\Managed\UnityEngine.IMGUIModule.dll</HintPath>
<HintPath>..\..\..\..\..\..\SPT-3.5.7\EscapeFromTarkov_Data\Managed\UnityEngine.IMGUIModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.TextRenderingModule">
<HintPath>F:\SPT-AKI\EscapeFromTarkov_Data\Managed\UnityEngine.TextRenderingModule.dll</HintPath>
<HintPath>..\..\..\..\..\..\SPT-3.5.7\EscapeFromTarkov_Data\Managed\UnityEngine.TextRenderingModule.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
@@ -99,6 +99,6 @@
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>copy "$(TargetPath)" "F:\SPT-AKI\BepInEx\plugins\dvize.ASS.dll"</PostBuildEvent>
<PostBuildEvent>copy "$(TargetPath)" "C:\SPT-3.5.7\BepInEx\plugins\dvize.ASS.dll"</PostBuildEvent>
</PropertyGroup>
</Project>

View File

@@ -12,7 +12,7 @@ using UnityEngine;
namespace armorMod
{
[BepInPlugin("com.armorMod.ASS", "armorMod.ASS", "1.1.0")]
[BepInPlugin("com.armorMod.ASS", "armorMod.ASS", "1.2.0")]
public class ASS : BaseUnityPlugin
{
@@ -36,6 +36,10 @@ namespace armorMod
{
get; set;
}
private static ConfigEntry<float> MaxDurabilityCap
{
get; set;
}
private AbstractGame game;
private bool runOnceAlready = false;
@@ -43,6 +47,7 @@ namespace armorMod
private float newRepairRate;
private float newMaxDurabilityDrainRate;
private ArmorComponent armor;
private float currentArmorDurabilityPercentage;
private static float timeSinceLastHit = 0f;
/*private static InsuranceCompanyClass insurance;
private static List<InsuredItemClass> insuranceList;*/
@@ -63,6 +68,7 @@ namespace armorMod
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");
}
private void Update()
{
@@ -117,8 +123,10 @@ namespace armorMod
//get the armorcomponent of each item in items and check to see if all item componenets (even helmet side ears) are max durability
armor = item.GetItemComponent<ArmorComponent>();
currentArmorDurabilityPercentage = armor.Repairable.Durability / armor.Repairable.MaxDurability * 100;
//check if it needs repair for the current item in loop of all items for the slot
if (armor != null && (armor.Repairable.Durability < armor.Repairable.MaxDurability))
if (armor != null && (currentArmorDurabilityPercentage < MaxDurabilityCap.Value) && (armor.Repairable.Durability < armor.Repairable.MaxDurability))
{
//increase armor durability by newRepairRate until maximum then set as maximum durability
if (armor.Repairable.Durability + newRepairRate >= armor.Repairable.MaxDurability)

View File

@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]