/// <summary> /// Runs the script event with the given input. /// </summary> /// <param name="prio">The priority to run with.</param> /// <param name="oevt">The details of the script to be ran.</param> /// <returns>The event details after firing.</returns> public void Run(int prio, ZombieDamagedEventArgs oevt) { ZombieDamagedScriptEvent evt = (ZombieDamagedScriptEvent)Duplicate(); evt.Cancelled = oevt.Cancelled; evt.Zombie = oevt.Zombie; evt.Amount = oevt.Amount; evt.Call(prio); oevt.Amount = evt.Amount; oevt.Cancelled = evt.Cancelled; }
public static bool ZombieDamaged(Zombie zombie, ref byte amount, ref Vector3 ragdoll, ref uint xp) { // TODO: causes? ZombieTag zombieTag = new ZombieTag(zombie); if (amount >= zombie.health) { ZombieDeathEventArgs deathevt = new ZombieDeathEventArgs(); deathevt.Zombie = zombieTag; deathevt.Amount = new NumberTag(amount); UnturnedFreneticEvents.OnZombieDeath.Fire(deathevt); amount = (byte)deathevt.Amount.Internal; return deathevt.Cancelled || EntityDeath(zombieTag, ref amount); } ZombieDamagedEventArgs evt = new ZombieDamagedEventArgs(); evt.Zombie = zombieTag; evt.Amount = new NumberTag(amount); UnturnedFreneticEvents.OnZombieDamaged.Fire(evt); amount = (byte)evt.Amount.Internal; return evt.Cancelled || EntityDamaged(zombieTag, ref amount); }