/// <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, ResourceDestroyedEventArgs oevt)
        {
            ResourceDestroyedScriptEvent evt = (ResourceDestroyedScriptEvent)Duplicate();

            evt.Cancelled = oevt.Cancelled;
            evt.Resource  = oevt.Resource;
            evt.Amount    = oevt.Amount;
            evt.Call(prio);
            oevt.Amount    = evt.Amount;
            oevt.Cancelled = evt.Cancelled;
        }
 /// <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, ResourceDestroyedEventArgs oevt)
 {
     ResourceDestroyedScriptEvent evt = (ResourceDestroyedScriptEvent)Duplicate();
     evt.Cancelled = oevt.Cancelled;
     evt.Resource = oevt.Resource;
     evt.Amount = oevt.Amount;
     evt.Call(prio);
     oevt.Amount = evt.Amount;
     oevt.Cancelled = evt.Cancelled;
 }
 public static bool ResourceDamaged(ResourceSpawnpoint resource, ref ushort amount)
 {
     // TODO: causes?
     ResourceTag resourceTag = new ResourceTag(resource);
     if (amount >= resource.health)
     {
         ResourceDestroyedEventArgs deathevt = new ResourceDestroyedEventArgs();
         deathevt.Resource = resourceTag;
         deathevt.Amount = new NumberTag(amount);
         UnturnedFreneticEvents.OnResourceDestroyed.Fire(deathevt);
         amount = (ushort)deathevt.Amount.Internal;
         return deathevt.Cancelled || EntityDestroyed(resourceTag, ref amount);
     }
     ResourceDamagedEventArgs evt = new ResourceDamagedEventArgs();
     evt.Resource = resourceTag;
     evt.Amount = new NumberTag(amount);
     UnturnedFreneticEvents.OnResourceDamaged.Fire(evt);
     amount = (ushort)evt.Amount.Internal;
     return evt.Cancelled || EntityDamaged(resourceTag, ref amount);
 }