コード例 #1
0
        /// <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, AnimalDeathEventArgs oevt)
        {
            AnimalDeathScriptEvent evt = (AnimalDeathScriptEvent)Duplicate();

            evt.Cancelled = oevt.Cancelled;
            evt.Animal    = oevt.Animal;
            evt.Amount    = oevt.Amount;
            evt.Call(prio);
            oevt.Amount    = evt.Amount;
            oevt.Cancelled = evt.Cancelled;
        }
コード例 #2
0
 public static bool AnimalDamaged(Animal animal, ref byte amount, ref Vector3 ragdoll, ref uint xp)
 {
     // TODO: causes?
     AnimalTag animalTag = new AnimalTag(animal);
     if (amount >= animal.health)
     {
         AnimalDeathEventArgs deathevt = new AnimalDeathEventArgs();
         deathevt.Animal = animalTag;
         deathevt.Amount = new NumberTag(amount);
         UnturnedFreneticEvents.OnAnimalDeath.Fire(deathevt);
         amount = (byte)deathevt.Amount.Internal;
         return deathevt.Cancelled || EntityDeath(animalTag, ref amount);
     }
     AnimalDamagedEventArgs evt = new AnimalDamagedEventArgs();
     evt.Animal = animalTag;
     evt.Amount = new NumberTag(amount);
     UnturnedFreneticEvents.OnAnimalDamaged.Fire(evt);
     amount = (byte)evt.Amount.Internal;
     return evt.Cancelled || EntityDamaged(animalTag, ref amount);
 }
コード例 #3
0
 /// <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, AnimalDeathEventArgs oevt)
 {
     AnimalDeathScriptEvent evt = (AnimalDeathScriptEvent)Duplicate();
     evt.Cancelled = oevt.Cancelled;
     evt.Animal = oevt.Animal;
     evt.Amount = oevt.Amount;
     evt.Call(prio);
     oevt.Amount = evt.Amount;
     oevt.Cancelled = evt.Cancelled;
 }