Details

Last Updated
2 months ago
First Uploaded
2 months ago
Downloads
21K
Likes
2
Size
115KB
Dependency string
Flazhik-UKEnemyIdentifier-1.0.2
Dependants

Categories

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.

Please note that despite that mod supports (almost) every enemy currently present in the game it only applies to spawnable enemies, i.e. those enemies you can spawn in the Sandbox. Therefore, as an example Earthmover's brain projectiles damage won't register.

Currently, Big Johninator is also unsupported.

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)

It's worth noticing though that EnemyId.enemyType field is often unreliable when it comes to necessity of figuring out enemy type (for instance, Mysterious Druid Knight has a Drone enemy type). In order to serialize enemy type properly, use GetEnemyName() function.

EnemyIdentifierManager.Instance.OnPlayerHurt += hurtEvent =>
{
    Debug.Log($"Player got hurt by {hurtEvent.EnemyId.GetEnemyName()}");
};

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

Full list of supported enemy types:

  • Filth
  • Stray
  • Schism
  • Soldier
  • Streetcleaner
  • Drone
  • Cerberus
  • Swordsmachine
  • Malicious Face
  • Hideous Mass
  • Mindflayer
  • Stalker
  • Sentry
  • Virtue
  • Sisyphean Insurrectionist
  • Ferryman
  • Gutterman
  • Guttertank
  • Mannequin
  • Minotaur
  • Gabriel (both types)
  • V2 (both types)
  • Minos Prime
  • Sisyphus Prime
  • Flesh Prison
  • Flesh Panopticon
  • Flesh Prison/Panopticon minions
  • Very Cancerous Rodent
  • Mysterious Druid Knight (& Owl)
  • Earthmover Defense System (rocket launcher, mortar & this tall thingy that shoots homing projectiles)
  • Puppet
Thunderstore development is made possible with ads. Please consider making an exception to your adblock.
Thunderstore development is made possible with ads. Please consider making an exception to your adblock.
Thunderstore development is made possible with ads. Please consider making an exception to your adblock.