Added cap for maximum armor durability
This commit is contained in:
30
ASS.csproj
30
ASS.csproj
@@ -33,42 +33,42 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="0Harmony, Version=2.9.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="0Harmony, Version=2.9.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>BepInEx\core\0Harmony.dll</HintPath>
|
<HintPath>..\..\..\..\..\..\SPT-3.5.7\BepInEx\core\0Harmony.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Aki.Build">
|
<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>
|
||||||
<Reference Include="Aki.Common, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="Aki.Common, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<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>
|
||||||
<Reference Include="Aki.Reflection, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="Aki.Reflection, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<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>
|
||||||
<Reference Include="Assembly-CSharp, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="Assembly-CSharp, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<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>
|
||||||
<Reference Include="BepInEx, Version=5.4.21.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="BepInEx, Version=5.4.21.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>F:\SPT-AKI\BepInEx\core\BepInEx.dll</HintPath>
|
<HintPath>..\..\..\..\..\..\SPT-3.5.7\BepInEx\core\BepInEx.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Comfort, Version=1.0.0.4, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="Comfort, Version=1.0.0.4, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<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>
|
||||||
<Reference Include="Comfort.Unity, Version=1.0.0.4, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="Comfort.Unity, Version=1.0.0.4, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<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>
|
||||||
<Reference Include="ItemComponent.Types, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="ItemComponent.Types, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<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>
|
||||||
<Reference Include="ItemTemplate.Types, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="ItemTemplate.Types, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<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>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
@@ -80,17 +80,17 @@
|
|||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
<Reference Include="UnityEngine, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="UnityEngine, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<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>
|
||||||
<Reference Include="UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<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>
|
||||||
<Reference Include="UnityEngine.IMGUIModule">
|
<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>
|
||||||
<Reference Include="UnityEngine.TextRenderingModule">
|
<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>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -99,6 +99,6 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<PropertyGroup>
|
<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>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
12
Plugin.cs
12
Plugin.cs
@@ -12,7 +12,7 @@ using UnityEngine;
|
|||||||
|
|
||||||
namespace armorMod
|
namespace armorMod
|
||||||
{
|
{
|
||||||
[BepInPlugin("com.armorMod.ASS", "armorMod.ASS", "1.1.0")]
|
[BepInPlugin("com.armorMod.ASS", "armorMod.ASS", "1.2.0")]
|
||||||
|
|
||||||
public class ASS : BaseUnityPlugin
|
public class ASS : BaseUnityPlugin
|
||||||
{
|
{
|
||||||
@@ -36,6 +36,10 @@ namespace armorMod
|
|||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
private static ConfigEntry<float> MaxDurabilityCap
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
|
||||||
private AbstractGame game;
|
private AbstractGame game;
|
||||||
private bool runOnceAlready = false;
|
private bool runOnceAlready = false;
|
||||||
@@ -43,6 +47,7 @@ namespace armorMod
|
|||||||
private float newRepairRate;
|
private float newRepairRate;
|
||||||
private float newMaxDurabilityDrainRate;
|
private float newMaxDurabilityDrainRate;
|
||||||
private ArmorComponent armor;
|
private ArmorComponent armor;
|
||||||
|
private float currentArmorDurabilityPercentage;
|
||||||
private static float timeSinceLastHit = 0f;
|
private static float timeSinceLastHit = 0f;
|
||||||
/*private static InsuranceCompanyClass insurance;
|
/*private static InsuranceCompanyClass insurance;
|
||||||
private static List<InsuredItemClass> insuranceList;*/
|
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");
|
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");
|
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");
|
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()
|
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
|
//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>();
|
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
|
//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
|
//increase armor durability by newRepairRate until maximum then set as maximum durability
|
||||||
if (armor.Repairable.Durability + newRepairRate >= armor.Repairable.MaxDurability)
|
if (armor.Repairable.Durability + newRepairRate >= armor.Repairable.MaxDurability)
|
||||||
|
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("1.1.0.0")]
|
[assembly: AssemblyVersion("1.2.0.0")]
|
||||||
[assembly: AssemblyFileVersion("1.1.0.0")]
|
[assembly: AssemblyFileVersion("1.2.0.0")]
|
||||||
|
Reference in New Issue
Block a user