Added Gear Degradation Option

This commit is contained in:
MusicManiac
2023-05-26 21:58:52 +02:00
parent d664db95ff
commit a7dd119c01
3 changed files with 30 additions and 16 deletions

View File

@@ -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>F:\SPT-AKI\BepInEx\core\0Harmony.dll</HintPath> <HintPath>..\..\..\..\..\SPT\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\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\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\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\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\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\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\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\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\EscapeFromTarkov_Data\Managed\ItemTemplate.Types.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
@@ -80,11 +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\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\EscapeFromTarkov_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.IMGUIModule">
<HintPath>..\..\..\..\..\SPT\EscapeFromTarkov_Data\Managed\UnityEngine.IMGUIModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.TextRenderingModule">
<HintPath>..\..\..\..\..\SPT\EscapeFromTarkov_Data\Managed\UnityEngine.TextRenderingModule.dll</HintPath>
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@@ -93,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\BepInEx\plugins\dvize.ASS.dll"</PostBuildEvent>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View File

@@ -29,11 +29,16 @@ namespace armorMod
{ {
get; set; get; set;
} }
private static ConfigEntry<float> MaxDurabilityDegradationRateOverTime
{
get; set;
}
private AbstractGame game; private AbstractGame game;
private bool runOnceAlready = false; private bool runOnceAlready = false;
private bool newGame = true; private bool newGame = true;
private float newRepairRate; private float newRepairRate;
private float newMaxDurabilityDrainRate;
private ArmorComponent armor; private ArmorComponent armor;
private static float timeSinceLastHit = 0f; private static float timeSinceLastHit = 0f;
@@ -51,6 +56,7 @@ namespace armorMod
ArmorServiceMode = Config.Bind("Armor Repair Settings", "Enable/Disable Mod", true, "Enables the Armor Repairing Options Below"); ArmorServiceMode = Config.Bind("Armor Repair Settings", "Enable/Disable Mod", true, "Enables the Armor Repairing Options Below");
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");
} }
private void Update() private void Update()
{ {
@@ -85,6 +91,7 @@ namespace armorMod
//Logger.LogInfo($"Repairing Armor Block Reached Because TimeSinceLastHitReached: " + timeSinceLastHit); //Logger.LogInfo($"Repairing Armor Block Reached Because TimeSinceLastHitReached: " + timeSinceLastHit);
//repair the armor divided by the time.unfixed rate //repair the armor divided by the time.unfixed rate
newRepairRate = ArmorRepairRateOverTime.Value * Time.deltaTime; newRepairRate = ArmorRepairRateOverTime.Value * Time.deltaTime;
newMaxDurabilityDrainRate = MaxDurabilityDegradationRateOverTime.Value * Time.deltaTime;
foreach (EquipmentSlot slot in equipmentSlotDictionary.Keys.ToArray()) foreach (EquipmentSlot slot in equipmentSlotDictionary.Keys.ToArray())
{ {
@@ -113,7 +120,8 @@ namespace armorMod
else else
{ {
armor.Repairable.Durability += newRepairRate; armor.Repairable.Durability += newRepairRate;
//Logger.LogInfo("ASS: Repairing " + item.LocalizedName() + " : " + armor.Repairable.Durability + "/" + armor.Repairable.MaxDurability); armor.Repairable.MaxDurability -= newMaxDurabilityDrainRate;
Logger.LogInfo("ASS: Repairing " + item.LocalizedName() + " : " + armor.Repairable.Durability + "/" + 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 // 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.0.0.0")] [assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.1.0.0")]