1. With the changes made to the OnPlayerLoot(...) hooks it doesn't seem possible to get the looting player anymore. Might I be missing something?
     
  2. Wulf

    Wulf Community Admin

    OnLootPlayer(BaseEntity source, BasePlayer target)

    You'd need to cast target as BasePlayer for that hook, but you could try with BasePlayer for the target/victim as that may work directly. We may handle this in a future update automatically. For the others, you wouldn't need the cast.
     
  3. I can currently only test OnLootEntity(BaseEntity entitySource, BaseEntity targetEntity).
    Code:
    public void StartLootingEntity(BaseEntity targetEntity, bool doPositionChecks = true)
        {
            this.Clear();
            if (!targetEntity)
            {
                return;
            }
            if (!targetEntity.OnStartBeingLooted(base.baseEntity))
            {
                return;
            }
            Assert.Test(targetEntity.isServer, "Assure is server", null);
            this.PositionChecks = doPositionChecks;
            this.entitySource = targetEntity;
            this.itemSource = null;
            this.MarkDirty();
            object[] objArray = new object[] { this.entitySource, targetEntity };
            Interface.CallHook("OnLootEntity", objArray);
        }
    Looking at the object array it seems like both the entitySource and the targetEntity are referencing the same object. Is there any particular reason for this? Same goes for the OnPlayerLoot hook.
    Besides that, isn't the target you are referencing and the targetEntity in the object array the entity that is being looted, not the entity (player) that is looting?
    I had no luck casting the entitySource provided by the OnLootEntity hook, either.
     
  4. Wulf

    Wulf Community Admin

    OnLootEntity(BaseEntity source, BaseEntity target) is what you'd want I believe, those are the correct arguments.
     
  5. This still doesn't seem to return the player who is looting. At least source.ToPlayer() does return null and casting doesn't work either. :(
     
  6. Wulf

    Wulf Community Admin

    Mmmm, might have to do another update for them, as it looks like it may not be the right argument.