public override void Execute(FreneticScript.CommandSystem.CommandQueue queue, CommandEntry entry)
 {
     try
     {
         IntegerTag num = IntegerTag.TryFor(entry.GetArgumentObject(queue, 1));
         if (num.Internal < 0)
         {
             queue.HandleError(entry, "Must provide a non-negative number!");
             return;
         }
         EntityTag entity = EntityTag.For(entry.GetArgumentObject(queue, 0));
         if (entity == null)
         {
             queue.HandleError(entry, "Invalid entity!");
             return;
         }
         EPlayerKill kill; // for use with "out EPlayerKill" parameters
         PlayerTag   player;
         if (entity.TryGetPlayer(out player))
         {
             PlayerLife          life             = player.Internal.player.life;
             UFMHealthController healthController = player.Internal.player.GetComponent <UFMHealthController>();
             uint health = healthController != null ? healthController.health : life.health;
             if (num.Internal >= health)
             {
                 uint amount = (uint)num.Internal;
                 if (healthController != null)
                 {
                     healthController.health = 0;
                 }
                 if (amount >= byte.MaxValue) // TODO: better handling
                 {
                     life._health = 0;
                     amount       = 1;
                 }
                 life.askDamage((byte)amount, Vector3.zero, EDeathCause.KILL, ELimb.SPINE, CSteamID.Nil, out kill, null);
             }
             else
             {
                 uint amount = (uint)num.Internal;
                 if (healthController != null)
                 {
                     healthController.Damage((uint)num.Internal);
                 }
                 life._health = healthController.Translate();
                 life.channel.send("tellHealth", ESteamCall.OWNER, ESteamPacket.UPDATE_RELIABLE_BUFFER, new object[]
                 {
                     life.health
                 });
             }
             if (entry.ShouldShowGood(queue))
             {
                 entry.Good(queue, "Successfully damaged a player by " + TagParser.Escape(num.ToString()) + "!");
             }
             return;
         }
         ZombieTag zombie;
         if (entity.TryGetZombie(out zombie))
         {
             uint xp;
             zombie.Internal.askDamage((byte)num.Internal, Vector3.zero, out kill, out xp);
             if (entry.ShouldShowGood(queue))
             {
                 entry.Good(queue, "Successfully damaged a zombie by " + TagParser.Escape(num.ToString()) + "!");
             }
             return;
         }
         AnimalTag animal;
         if (entity.TryGetAnimal(out animal))
         {
             uint xp;
             animal.Internal.askDamage((byte)num.Internal, Vector3.zero, out kill, out xp);
             if (entry.ShouldShowGood(queue))
             {
                 entry.Good(queue, "Successfully damaged an animal by " + TagParser.Escape(num.ToString()) + "!");
             }
             return;
         }
         BarricadeTag barricade;
         if (entity.TryGetBarricade(out barricade))
         {
             // TODO: Use BarricadeManager?
             barricade.InternalData.barricade.askDamage((ushort)num.Internal);
             if (entry.ShouldShowGood(queue))
             {
                 entry.Good(queue, "Successfully damaged a barricade by " + TagParser.Escape(num.ToString()) + "!");
             }
             return;
         }
         ResourceTag resource;
         if (entity.TryGetResource(out resource))
         {
             // TODO: Use ResourceManager?
             resource.Internal.askDamage((ushort)num.Internal);
             if (entry.ShouldShowGood(queue))
             {
                 entry.Good(queue, "Successfully damaged a resource by " + TagParser.Escape(num.ToString()) + "!");
             }
             return;
         }
         StructureTag structure;
         if (entity.TryGetStructure(out structure))
         {
             // TODO: Use StructureManager?
             structure.InternalData.structure.askDamage((ushort)num.Internal);
             if (entry.ShouldShowGood(queue))
             {
                 entry.Good(queue, "Successfully damaged a structure by " + TagParser.Escape(num.ToString()) + "!");
             }
             return;
         }
         VehicleTag vehicle;
         if (entity.TryGetVehicle(out vehicle))
         {
             vehicle.Internal.askDamage((ushort)num.Internal, false);
             if (entry.ShouldShowGood(queue))
             {
                 entry.Good(queue, "Successfully damaged a vehicle by " + TagParser.Escape(num.ToString()) + "!");
             }
             return;
         }
         queue.HandleError(entry, "That entity can't be damaged!");
     }
     catch (Exception ex) // TODO: Necessity?
     {
         queue.HandleError(entry, "Failed to damage entity: " + ex.ToString());
     }
 }
        public override void Execute(FreneticScript.CommandSystem.CommandQueue queue, CommandEntry entry)
        {
            EntityTag entity = EntityTag.For(entry.GetArgumentObject(queue, 0));

            if (entity == null)
            {
                queue.HandleError(entry, "Invalid entity!");
                return;
            }
            EPlayerKill kill; // for use with "out EPlayerKill" parameters
            PlayerTag   player;

            if (entity.TryGetPlayer(out player))
            {
                PlayerLife life = player.Internal.player.life;
                life.askDamage(life.health, Vector3.zero, EDeathCause.KILL, ELimb.SPINE, CSteamID.Nil, out kill, null);
                if (entry.ShouldShowGood(queue))
                {
                    entry.Good(queue, "Successfully killed a player!");
                }
                return;
            }
            ZombieTag zombie;

            if (entity.TryGetZombie(out zombie))
            {
                while (!zombie.Internal.isDead)
                {
                    uint xp;
                    zombie.Internal.askDamage((byte)zombie.Internal.health, Vector3.zero, out kill, out xp);
                }
                if (entry.ShouldShowGood(queue))
                {
                    entry.Good(queue, "Successfully killed a zombie!");
                }
                return;
            }
            AnimalTag animal;

            if (entity.TryGetAnimal(out animal))
            {
                while (!animal.Internal.isDead)
                {
                    uint xp;
                    animal.Internal.askDamage((byte)animal.Internal.health, Vector3.zero, out kill, out xp);
                }
                if (entry.ShouldShowGood(queue))
                {
                    entry.Good(queue, "Successfully killed an animal!");
                }
                return;
            }
            BarricadeTag barricade;

            if (entity.TryGetBarricade(out barricade))
            {
                // TODO: Use BarricadeManager?
                barricade.InternalData.barricade.askDamage(barricade.InternalData.barricade.health);
                if (entry.ShouldShowGood(queue))
                {
                    entry.Good(queue, "Successfully destroyed a barricade!");
                }
                return;
            }
            ResourceTag resource;

            if (entity.TryGetResource(out resource))
            {
                // TODO: Use ResourceManager?
                resource.Internal.askDamage(resource.Internal.health);
                if (entry.ShouldShowGood(queue))
                {
                    entry.Good(queue, "Successfully destroyed a resource!");
                }
                return;
            }
            StructureTag structure;

            if (entity.TryGetStructure(out structure))
            {
                // TODO: Use StructureManager?
                structure.InternalData.structure.askDamage(structure.InternalData.structure.health);
                if (entry.ShouldShowGood(queue))
                {
                    entry.Good(queue, "Successfully destroyed a structure!");
                }
                return;
            }
            VehicleTag vehicle;

            if (entity.TryGetVehicle(out vehicle))
            {
                vehicle.Internal.askDamage(vehicle.Internal.health, false);
                if (entry.ShouldShowGood(queue))
                {
                    entry.Good(queue, "Successfully destroyed a vehicle!");
                }
                return;
            }
            queue.HandleError(entry, "That entity can't be damaged!");
        }