1. Hi all how to check for damage from the player? Ignore the metabolism, cold and radiation.
    Code:
            void OnEntityTakeDamage(BaseCombatEntity entity, HitInfo info)
            {
                if (!GetConfig<bool>("ShouldCancelOnDamage")) return;
                if (!(entity is BasePlayer)) return;
                BasePlayer player = entity as BasePlayer;            if (HasComponent<HomeTeleporter>(player))
                {
                    player.GetComponent<HomeTeleporter>().CancelTeleport();
                    SendReply(player, GetMessage("YouTookDamage"));
                }
            }
    
     
  2. note that BasePlayer can include NPC, specifically murders and scientist. So you might want the following check to ensure they are a player:
    void OnEntityTakeDamage(BaseCombatEntity entity, HitInfo hitInfo)
    {
    if (entity != null && hitInfo != null && entity is BasePlayer && !(entity is NPCMurderer) && !(entity is NPCPlayer) && hitinfo.damageTypes.Total() > 0) // then this is a player who has been hit
    {
    // your code here
    }
    }

    I believe N-Teleport has code similar to what you are looking for, you might want to look at lines 747 - 767.
     
  3. Here are all the hit types so you can filter on the one you want:
    "arrow"
    "bite"
    "bleeding"
    "blunt"
    "bullet"
    "cold"
    "coldexposure"
    "decay"
    "drowned"
    "electricshock"
    "explosion"
    "fall"
    "generic"
    "heat"
    "hunger"
    "poison"
    "radiation"
    "radiationexposure"
    "slash"
    "stab"
    "suicide"
    "thirst"

    My mod lets you adjust each of these per type, if you need an example: Damage Control for Rust | Oxide