-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0e34a29
commit f017052
Showing
22 changed files
with
2,951 additions
and
986 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
{ | ||
"name": "Coroner", | ||
"version_number": "1.6.2", | ||
"version_number": "2.0.0", | ||
"website_url": "https://github.com/EliteMasterEric/Coroner", | ||
"description": "Rework the Performance Report with new info, including cause of death.", | ||
"description": "Add Cause of Death to the performance report, rebuilt and better than ever.", | ||
"dependencies": [ | ||
"BepInEx-BepInExPack-5.4.2100" | ||
"BepInEx-BepInExPack-5.4.2100", | ||
"xilophor-StaticNetcodeLib-1.1.1" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
using System; | ||
using GameNetcodeStuff; | ||
|
||
#nullable enable | ||
|
||
namespace Coroner | ||
{ | ||
public class API | ||
{ | ||
/// <summary> | ||
/// Sets the cause of death for a player object. | ||
/// You can set this to a default one (see `Coroner.AdvancedCauseOfDeath`) or a custom one (see `Register()`). | ||
/// </summary> | ||
/// <param name="player">The player to set the cause of death for.</param> | ||
/// <param name="causeOfDeath">The cause of death to use. Set to `null` to clear.</param> | ||
/// <example> SetCauseOfDeath(player, AdvancedCauseOfDeath.Enemy_ForestGiant); </example> | ||
public static void SetCauseOfDeath(PlayerControllerB player, AdvancedCauseOfDeath? causeOfDeath) | ||
{ | ||
// Call the proper internal method. | ||
AdvancedDeathTracker.SetCauseOfDeath(player, causeOfDeath); | ||
} | ||
|
||
/// <summary> | ||
/// Sets the cause of death for a player with the given ID. | ||
/// You can set this to a default one (see `Coroner.AdvancedCauseOfDeath`) or a custom one (see `Register()`). | ||
/// </summary> | ||
/// <param name="playerId">The ID of the player.</param> | ||
/// <param name="causeOfDeath">The cause of death to use. Set to `null` to clear.</param> | ||
/// <example> SetCauseOfDeath(0, AdvancedCauseOfDeath.Enemy_ForestGiant); </example> | ||
public static void SetCauseOfDeath(int playerId, AdvancedCauseOfDeath? causeOfDeath) | ||
{ | ||
// Call the proper internal method. | ||
AdvancedDeathTracker.SetCauseOfDeath(playerId, causeOfDeath); | ||
} | ||
|
||
/// <summary> | ||
/// Gets the cause of death for a player object. | ||
/// </summary> | ||
/// <param name="player">The player to get the cause of death for.</param> | ||
/// <returns>The cause of death for the player. May be null if none is set, or a custom value provided by a mod.</returns> | ||
/// <example> GetCauseOfDeath(player); </example> | ||
public static AdvancedCauseOfDeath? GetCauseOfDeath(PlayerControllerB player) | ||
{ | ||
// Call the proper internal method. | ||
return AdvancedDeathTracker.GetCauseOfDeath(player); | ||
} | ||
|
||
/// <summary> | ||
/// Gets the cause of death for a player with the given ID. | ||
/// </summary> | ||
/// <param name="playerId">The ID of the player.</param> | ||
/// <returns>The cause of death for the player.</returns> | ||
/// <example> GetCauseOfDeath(0); </example> | ||
public static AdvancedCauseOfDeath? GetCauseOfDeath(int playerId) | ||
{ | ||
// Call the proper internal method. | ||
return AdvancedDeathTracker.GetCauseOfDeath(playerId); | ||
} | ||
|
||
/// <summary> | ||
/// Register a new cause of death. Useful for mods. | ||
/// Choose one that is unique to your mod, and store the value statically for reuse. | ||
/// Then, call SetCauseOfDeath(player, customCauseOfDeath) to use it. | ||
/// </summary> | ||
/// <param name="key">The language key to use for the cause of death.</param> | ||
/// <returns>The newly registered cause of death.</returns> | ||
public static AdvancedCauseOfDeath Register(string key) | ||
{ | ||
// Call the proper internal method. | ||
return AdvancedCauseOfDeath.Build(key); | ||
} | ||
|
||
// <summary> | ||
// Determine whether a cause of death is registered. | ||
// </summary> | ||
// <param name="key">The language key to use for the cause of death.</param> | ||
// <returns>Whether that cause of death is already registered.</returns> | ||
public static bool IsRegistered(string key) | ||
{ | ||
return AdvancedCauseOfDeath.IsTagRegistered(key); | ||
} | ||
|
||
/// <summary> | ||
/// Convert a cause of death to a language string as used in-game. | ||
/// </summary> | ||
/// <param name="causeOfDeath">The cause of death to convert.</param> | ||
/// <param name="random">Optionally specify a random number generator to use. If you seed this the same between clients, they'll produce the same value.</param> | ||
/// <returns>One of the available language strings for that cause of death.</returns> | ||
public static string StringifyCauseOfDeath(AdvancedCauseOfDeath causeOfDeath, Random? random) | ||
{ | ||
// Call the proper internal method. | ||
return AdvancedDeathTracker.StringifyCauseOfDeath(causeOfDeath, random != null ? random : Plugin.RANDOM); | ||
} | ||
} | ||
} |
Oops, something went wrong.