HDeDeDe.Mods.RiskOfRain2.HealthComponentAPI 1.1.0

dotnet add package HDeDeDe.Mods.RiskOfRain2.HealthComponentAPI --version 1.1.0                
NuGet\Install-Package HDeDeDe.Mods.RiskOfRain2.HealthComponentAPI -Version 1.1.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="HDeDeDe.Mods.RiskOfRain2.HealthComponentAPI" Version="1.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add HDeDeDe.Mods.RiskOfRain2.HealthComponentAPI --version 1.1.0                
#r "nuget: HDeDeDe.Mods.RiskOfRain2.HealthComponentAPI, 1.1.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install HDeDeDe.Mods.RiskOfRain2.HealthComponentAPI as a Cake Addin
#addin nuget:?package=HDeDeDe.Mods.RiskOfRain2.HealthComponentAPI&version=1.1.0

// Install HDeDeDe.Mods.RiskOfRain2.HealthComponentAPI as a Cake Tool
#tool nuget:?package=HDeDeDe.Mods.RiskOfRain2.HealthComponentAPI&version=1.1.0                

HealthComponentAPI

icon

Thunderstore Version GitHub last commit NuGet Version

is api for healthcomponent. designed to be like RecalculateStatsAPI.

For Developers

To set up the api, either download the latest ThunderStore release then add a reference to the dll to your project or install the nuget package to your project.

Before you do anything else, be sure to add the API as a dependency for your mod.

[BepInDependency(HDeMods.HealthComponentAPI.PluginGUID)]

If you want to make it easier, you can add this whenever you access the API

using HDeMods;

And that's it. All you have to do is reference the section below and use it as if it were RecalculateStatsAPI.

How it works

There are 3 Events you can subscribe to, HDeMods.HealthComponentAPI.GetHealthStats, HDeMods.HealthComponentAPI.GetHealStats and HDeMods.HealthComponentAPI.GetTakeDamageStats.

GetHealthStats fires every fixed update on the server and provides the following values to change:

  • Final Regen: Regen value after all regen related calculations but before it's applied as healing.
  • Barrier Decay Rate: The amount of time it takes for barrier to decay. This is exposed in CharacterBody.RecalculateStats but RecalculateStatsAPI doesn't provide any bindings for it.
  • Shield Recharge Rate: The amount of time it takes for shields to recharge once you are out of danger.
  • Adaptive Armor Decay Rate: The amount of time it takes for adaptive armor stacks to decay.
  • Instated like this:
HDeMods.HealthComponentAPI.GetHealthStats += MyDelegate;
    
MyDelegate(HealthComponent sender, UpdateHealthEventArgs args)

GetHealStats runs every time HealthComponent.Heal and HealthComponent.TakeDamageProcess are ran and provides the following values to change:

  • Enable Eclipse Heal Reduction: Cuts healing in half as if you were on Eclipse 5 or higher. Does not count the run as Eclipse 5 or higher on its own. Applies regardless of team.
  • Damage Coyote Timer: The grace period in between damage frames. This value is read by HealthComponent.TakeDamageProcess.
  • Crit Heal: Unused in the base game, the multiplier for critical heals.
  • Final Heal Amount: The final healing value after all healing calculations but before it's applied.
  • Instated like this:
HDeMods.HealthComponentAPI.GetHealStats += MyDelegate;
    
MyDelegate(HealthComponent sender, HealEventArgs args)

GetTakeDamageStats Is not intended to be a replacement for IOnIncomingDamageServerReceiver, as its scope is much greater than IOnIncomingDamageServerReceiver. Due to this, DamageInfo is readonly, and you should not try to modify it from GetTakeDamageStats. That being said, GetTakeDamageStats runs every time HealthComponent.TakeDamageProcess is ran and provides the following values to change:

  • Reject Damage: Forces damage to be rejected. This should only be used if IOnIncomingDamageServerReceiver is not practical for your use case.
  • Reject Force: Prevent damage forces from being applied. Note that this sets DamageInfo.canRejectForce to false.
  • Damage Force: The push force attacks apply. The multiplier is provided as a float while the flat addition is provided as a Vector3
  • Adaptive Armor Build Rate: The rate at which adaptive armor is built up.
  • Adaptive Armor Max: The maximum amount of Adaptive Armor that can be built.
  • Final Damage Amount: The final damage number after all item calculations (including things like warped echo), but before it is applied.
  • Instated like this:
HDeMods.HealthComponentAPI.GetTakeDamageStats += MyDelegate;
    
MyDelegate(HealthComponent sender, DamageInfo damageInfo, TakeDamageArgs args)

That's it.

Plans for the future

  • Might add an actual OnHeal event that lets you modify the value before any other values apply to it, who knows.

Feedback

Any and all feedback is appreciated, if you want to let me know anything please feel free to open an issue on the GitHub Page or @ me on the modding discord (hdedede).

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.0 39 11/13/2024
1.0.0 38 11/12/2024