Exemplo n.º 1
0
 private void OnAttemptOpen(EntityUid uid, CrematoriumComponent component, StorageOpenAttemptEvent args)
 {
     if (component.Cooking)
     {
         args.Cancel();
     }
 }
Exemplo n.º 2
0
    public void TryCremate(EntityUid uid, CrematoriumComponent component, EntityStorageComponent?storage = null)
    {
        if (!Resolve(uid, ref storage))
        {
            return;
        }

        if (component.Cooking || storage.Open || storage.Contents.ContainedEntities.Count < 1)
        {
            return;
        }

        SoundSystem.Play(component.CremateStartSound.GetSound(), Filter.Pvs(uid), uid);

        Cremate(uid, component, storage);
    }
Exemplo n.º 3
0
    private void OnExamine(EntityUid uid, CrematoriumComponent component, ExaminedEvent args)
    {
        if (!TryComp <AppearanceComponent>(uid, out var appearance))
        {
            return;
        }

        if (appearance.TryGetData(CrematoriumVisuals.Burning, out bool isBurning) && isBurning)
        {
            args.PushMarkup(Loc.GetString("crematorium-entity-storage-component-on-examine-details-is-burning", ("owner", uid)));
        }
        if (appearance.TryGetData(StorageVisuals.HasContents, out bool hasContents) && hasContents)
        {
            args.PushMarkup(Loc.GetString("crematorium-entity-storage-component-on-examine-details-has-contents"));
        }
        else
        {
            args.PushMarkup(Loc.GetString("crematorium-entity-storage-component-on-examine-details-empty"));
        }
    }
Exemplo n.º 4
0
    private void AddCremateVerb(EntityUid uid, CrematoriumComponent component, GetVerbsEvent <AlternativeVerb> args)
    {
        if (!TryComp <EntityStorageComponent>(uid, out var storage))
        {
            return;
        }

        if (!args.CanAccess || !args.CanInteract || args.Hands == null || component.Cooking || storage.Open)
        {
            return;
        }

        AlternativeVerb verb = new()
        {
            Text = Loc.GetString("cremate-verb-get-data-text"),
            // TODO VERB ICON add flame/burn symbol?
            Act    = () => TryCremate(uid, component, storage),
            Impact = LogImpact.Medium // could be a body? or evidence? I dunno.
        };

        args.Verbs.Add(verb);
    }
Exemplo n.º 5
0
    private void OnSuicide(EntityUid uid, CrematoriumComponent component, SuicideEvent args)
    {
        if (args.Handled)
        {
            return;
        }
        args.SetHandled(SuicideKind.Heat);

        var victim = args.Victim;

        if (TryComp(victim, out ActorComponent? actor) && actor.PlayerSession.ContentData()?.Mind is { } mind)
        {
            _ticker.OnGhostAttempt(mind, false);

            if (mind.OwnedEntity is { Valid : true } entity)
            {
                _popup.PopupEntity(Loc.GetString("crematorium-entity-storage-component-suicide-message"), entity, Filter.Pvs(entity));
            }
        }

        _popup.PopupEntity(Loc.GetString("crematorium-entity-storage-component-suicide-message-others",
                                         ("victim", Identity.Entity(victim, EntityManager))),
                           victim, Filter.PvsExcept(victim), PopupType.LargeCaution);

        if (_entityStorage.CanInsert(uid))
        {
            _entityStorage.CloseStorage(uid);
            _standing.Down(victim, false);
            _entityStorage.Insert(victim, uid);
        }
        else
        {
            EntityManager.DeleteEntity(victim);
        }
        _entityStorage.CloseStorage(uid);
        Cremate(uid, component);
    }