Esempio n. 1
0
        private void DamageTool_damageZombieRequested(ref DamageZombieParameters parameters, ref bool shouldAllow)
        {
            UnturnedZombie zombie = new UnturnedZombie(parameters.zombie);
            var            player = GetUnturnedPlayer(parameters.instigator as Player);

            UnturnedZombieDamagingEvent @event;
            var damageAmount = (ushort)Math.Min(65535, Math.Floor(parameters.damage * parameters.times));

            if (damageAmount >= zombie.Health)
            {
                @event = new UnturnedZombieDyingEvent(zombie, player, damageAmount, parameters.direction,
                                                      parameters.ragdollEffect, parameters.zombieStunOverride);
            }
            else
            {
                @event = new UnturnedZombieDamagingEvent(zombie, player, damageAmount, parameters.direction,
                                                         parameters.ragdollEffect, parameters.zombieStunOverride);
            }

            Emit(@event);

            parameters.damage             = @event.DamageAmount;
            parameters.direction          = @event.Ragdoll;
            parameters.ragdollEffect      = @event.RagdollEffect;
            parameters.instigator         = @event.Instigator.Player;
            parameters.zombieStunOverride = @event.StunOverride;
            shouldAllow = [email protected];
        }
Esempio n. 2
0
        private void Events_OnZombieDamaging(Zombie nativeZombie, ref ushort damageAmount, ref Vector3 ragdoll,
                                             ref ERagdollEffect ragdollEffect, ref bool trackKill,
                                             ref bool dropLoot, ref EZombieStunOverride stunOverride, out bool cancel)
        {
            UnturnedZombie zombie = new UnturnedZombie(nativeZombie);

            UnturnedZombieDamagingEvent @event;

            if (damageAmount >= zombie.Health)
            {
                @event = new UnturnedZombieDyingEvent(zombie, damageAmount, ragdoll, ragdollEffect, trackKill, dropLoot,
                                                      stunOverride);
            }
            else
            {
                @event = new UnturnedZombieDamagingEvent(zombie, damageAmount, ragdoll, ragdollEffect, trackKill,
                                                         dropLoot, stunOverride);
            }

            Emit(@event);

            damageAmount  = @event.DamageAmount;
            ragdoll       = @event.Ragdoll;
            ragdollEffect = @event.RagdollEffect;
            trackKill     = @event.TrackKill;
            dropLoot      = @event.DropLoot;
            stunOverride  = @event.StunOverride;
            cancel        = @event.IsCancelled;
        }