private void OnMobStateChanged(EntityUid uid, PerishableComponent component, MobStateChangedEvent args)
 {
     if (args.Component.IsDead())
     {
         EnsureComp <RottingComponent>(uid);
     }
 }
 /// <summary>
 /// Kick the rider off the vehicle if they go into crit or die.
 /// </summary>
 private void OnMobStateChanged(EntityUid uid, RiderComponent rider, MobStateChangedEvent args)
 {
     if (args.Component.IsCritical() || args.Component.IsDead())
     {
         UnbuckleFromVehicle(uid);
     }
 }
Пример #3
0
        /// <summary>
        /// In crit, we wake up if we are not being forced to sleep.
        /// And, you can't sleep when dead...
        /// </summary>
        private void OnMobStateChanged(EntityUid uid, SleepingComponent component, MobStateChangedEvent args)
        {
            if (_mobStateSystem.IsCritical(uid) && !HasComp <ForcedSleepingComponent>(uid))
            {
                RemComp <SleepingComponent>(uid);
                return;
            }

            if (_mobStateSystem.IsDead(uid))
            {
                RemComp <SleepingComponent>(uid);
            }
        }
Пример #4
0
        private void OnMobStateChanged(EntityUid uid, DroneComponent drone, MobStateChangedEvent args)
        {
            if (args.Component.IsDead())
            {
                var body = Comp <SharedBodyComponent>(uid); //There's no way something can have a mobstate but not a body...

                foreach (var item in drone.ToolUids)
                {
                    EntityManager.DeleteEntity(item);
                }
                body.Gib();
                EntityManager.DeleteEntity(uid);
            }
        }
Пример #5
0
        private void OnMobStateChange(EntityUid uid, NPCComponent component, MobStateChangedEvent args)
        {
            switch (args.CurrentMobState)
            {
            case DamageState.Alive:
                WakeNPC(component);
                break;

            case DamageState.Critical:
            case DamageState.Dead:
                SleepNPC(component);
                break;
            }
        }
Пример #6
0
        private void OnMobStateChanged(EntityUid uid, DragonComponent component, MobStateChangedEvent args)
        {
            //Empties the stomach upon death
            //TODO: Do this when the dragon gets butchered instead
            if (args.CurrentMobState.IsDead())
            {
                if (component.SoundDeath != null)
                {
                    SoundSystem.Play(component.SoundDeath.GetSound(), Filter.Pvs(uid, entityManager: EntityManager), uid, component.SoundDeath.Params);
                }

                component.DragonStomach.EmptyContainer();
            }
        }
Пример #7
0
        private void OnMobStateChanged(EntityUid uid, DroneComponent drone, MobStateChangedEvent args)
        {
            if (args.Component.IsDead())
            {
                var body = Comp <SharedBodyComponent>(uid); //There's no way something can have a mobstate but not a body...

                foreach (var item in drone.ToolUids.Select((value, i) => (value, i)))
                {
                    if (_tagSystem.HasTag(item.value, "Drone"))
                    {
                        RemComp <UnremoveableComponent>(item.value);
                    }
                    else
                    {
                        EntityManager.DeleteEntity(item.value);
                    }
                }
                body.Gib();
                EntityManager.DeleteEntity(uid);
            }
        }
        /// <summary>
        /// Handles an entity turning into a zombie when they die or go into crit
        /// </summary>
        private void OnDamageChanged(EntityUid uid, ZombifyOnDeathComponent component, MobStateChangedEvent args)
        {
            if (!TryComp <MobStateComponent>(uid, out var mobstate))
            {
                return;
            }

            if (mobstate.IsDead() ||
                mobstate.IsCritical())
            {
                ZombifyEntity(uid);
            }
        }
Пример #9
0
 /// <summary>
 /// Handles an entity turning into a zombie when they die or go into crit
 /// </summary>
 private void OnDamageChanged(EntityUid uid, ZombifyOnDeathComponent component, MobStateChangedEvent args)
 {
     if (args.CurrentMobState == DamageState.Dead ||
         args.CurrentMobState == DamageState.Critical)
     {
         ZombifyEntity(uid);
     }
 }
        /// <summary>
        /// Triggers when the host receives damage which puts the host in either critical or killed state
        /// </summary>
        private void OnHostStateChange(EntityUid uid, GuardianHostComponent component, MobStateChangedEvent args)
        {
            if (component.HostedGuardian == null)
            {
                return;
            }

            if (args.CurrentMobState.IsCritical())
            {
                _popupSystem.PopupEntity(Loc.GetString("guardian-critical-warn"), component.HostedGuardian.Value, Filter.Entities(component.HostedGuardian.Value));
                SoundSystem.Play("/Audio/Effects/guardian_warn.ogg", Filter.Entities(component.HostedGuardian.Value), component.HostedGuardian.Value);
            }
            else if (args.CurrentMobState.IsDead())
            {
                SoundSystem.Play("/Audio/Voice/Human/malescream_guardian.ogg", Filter.Pvs(uid), uid, AudioHelpers.WithVariation(0.20f));
                EntityManager.RemoveComponent <GuardianHostComponent>(uid);
            }
        }
 private void OnStateChanged(MobStateChangedEvent ev)
 {
     _blocker.UpdateCanMove(ev.Entity);
 }