Ejemplo n.º 1
0
        private void OnBeingMicrowaved(EntityUid uid, BodyComponent component, BeingMicrowavedEvent args)
        {
            if (args.Handled)
            {
                return;
            }

            // Don't microwave animals, kids
            Transform(uid).AttachToGridOrMap();
            component.Gib();

            args.Handled = true;
        }
Ejemplo n.º 2
0
        private void OnMicrowaved(EntityUid uid, IdCardComponent component, BeingMicrowavedEvent args)
        {
            if (TryComp <AccessComponent>(uid, out var access))
            {
                float randomPick = _random.NextFloat();
                // if really unlucky, burn card
                if (randomPick <= 0.15f)
                {
                    TryComp <TransformComponent>(uid, out TransformComponent? transformComponent);
                    if (transformComponent != null)
                    {
                        _popupSystem.PopupCoordinates(Loc.GetString("id-card-component-microwave-burnt", ("id", uid)),
                                                      transformComponent.Coordinates, Filter.Pvs(uid));
                        EntityManager.SpawnEntity("FoodBadRecipe",
                                                  transformComponent.Coordinates);
                    }
                    EntityManager.QueueDeleteEntity(uid);
                    return;
                }
                // If they're unlucky, brick their ID
                if (randomPick <= 0.25f)
                {
                    _popupSystem.PopupEntity(Loc.GetString("id-card-component-microwave-bricked", ("id", uid)),
                                             uid, Filter.Pvs(uid));
                    access.Tags.Clear();
                }
                else
                {
                    _popupSystem.PopupEntity(Loc.GetString("id-card-component-microwave-safe", ("id", uid)),
                                             uid, Filter.Pvs(uid));
                }

                // Give them a wonderful new access to compensate for everything
                var random = _random.Pick(_prototypeManager.EnumeratePrototypes <AccessLevelPrototype>().ToArray());
                access.Tags.Add(random.ID);
            }
        }