Flazhik-UKEnemyIdentifier icon

UKEnemyIdentifier

A library used by CybergrindDeathcam for tracking which entity damaged the player

Last updated a month ago
Total downloads 5043
Total rating 0 
Categories Libraries
Dependency string Flazhik-UKEnemyIdentifier-1.0.0
Dependants 1 other package depends on this package

This mod requires the following mods to function

BepInEx-BepInExPack-5.4.2100 icon
BepInEx-BepInExPack

BepInEx pack for Mono Unity games. Preconfigured and ready to use.

Preferred version: 5.4.2100

README

UKEnemyIdentifier

!!! Disclaimer: this library does ABSOLUTELY NOTHING on its own. Because, you know... it's just a library.

Initially developed as a part of CybergrindDeathcam, this library allows to track which enemy has dealt the damage once the player is hurt.

Currently, only enemies present in Cybergrind mode are supported (soon to be updated).

Usage:

Simply subscribe to OnPlayerHurt event of EnemyIdentifierManager instance in order to receive an info regarding who hurt the player, how many damage it inflicted and whether it's killed the player or not.

Like this:

EnemyIdentifierManager.Instance.OnPlayerHurt += hurtEvent =>
{
    if (hurtEvent.EnemyId != null)
        Debug.Log($"Player got hurt by {hurtEvent.EnemyId.GetEnemyName()}");
    
    Debug.Log($"Inflicted damage: {hurtEvent.Damage}");
    
    if (hurtEvent.PlayerIsKilled)
        Debug.Log("Player is killed");
};

example

Example output of a snippet above with player getting lynched by Stray, Swordsmachine and a Virtue

You can also retrieve all sorts of information regarding an enemy using EnemyId field (vanilla EnemyIdentifier type encapsulates lots of info, including enemy type, its GameObject, health etc)

Important!

Notice how EnemyId is a nullable value. When it's null, there are 3 possible options here:

  1. An enemy who inflicted the damage was dead by the moment event is fired (e.g. died before its projectile has reached the player)
  2. The damage was self-inflicted
  3. Enemy/damage type is currently unsupported by the library