1. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    That looks a bit excessive and doesn't really need to be split into a separate hook for each damage type.
     
  2. SouZa

    SouZa Master Researcher Plugin Developer

    Yhep I know. I separated to make it easier for developers to use the hook they want for their plugins. But sure the hook could be more generic and each developer would have to find the type of damage and filter the victim | attacker themselves.

    But what I want to ask is if you think using reflection to retrieve the Victim | Attacker will have any performance impact, since the hook should be fired a lot in a medium-full size server? I tested on my server with a custom Deathmatch plugin, but the max players I got online at same time was only 6. I know nothing about Reflection really >>
     
  3. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    I'm just not sure we really want that many hooks for a damage hook, if we did that, we'd end up with upwards of 30+ hooks just for damage in some games.

    Reflection should be avoided if there is another way, but sometimes it may be needed.
     
  4. SouZa

    SouZa Master Researcher Plugin Developer

    Yeah sure, so only one hook for all damage. So there's no need to modify the HurtworldCore itself. Just use the OxidePatcher to insert the hook on the EntityFluidEffectProxy class that will be saved on the Assembly, and the oxide plugins catch it and handle the damage themselves.

    Ok I understand. I belive in this case is needed, if plugin using it needs to know the attacker|victim : S
     
  5. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    That would likely be the best for now. I'll see if I can figure out any alternative way.
     
  6. Sanlerus

    Sanlerus Scavenger

    Dear Wulf.
    Could you add a new hook for hurtworld, I would like to create a plugin friendlyfire.

    Code (Text):
    public class PlayerStatManager : RefTrackedBehavior<PlayerStatManager>
    {
      private void StatsOnEventPublished(EntityEventData eventData, EntityEffectSourceData sourceData)
      {
        bool isServer = uLink.Network.isServer;
        bool isClient = uLink.Network.isClient;
      }
    }
    =>
    Code (Text):
    public class PlayerStatManager : RefTrackedBehavior<PlayerStatManager>
    {
      private void StatsOnEventPublished(EntityEventData eventData, EntityEffectSourceData sourceData)
      {
        if (Interface.CallHook("OnHurtPlayer", (object) this.AttachedIdentity.ConnectedSession, (object) eventData, (object) sourceData) != null)
          return;
        bool isServer = uLink.Network.isServer;
        bool isClient = uLink.Network.isClient;
      }
    }
     
  7. 不是很会玩

    不是很会玩 Scavenger

    good idea,i want too.
     
    Sanlerus likes this.
  8. sjsoft

    sjsoft Scavenger

  9. Mughisi

    Mughisi Grenade Master Community Mod Oxide Developer

    Implemented OnPlayerTakeDamage(PlayerSession session, EntityEffectSourceData source) and will be included in the next build.