コード例 #1
0
    public void DisconnectBreathTool(InternalsComponent component)
    {
        var old = component.BreathToolEntity;

        component.BreathToolEntity = null;

        if (TryComp(old, out BreathToolComponent? breathTool))
        {
            _atmos.DisconnectInternals(breathTool);
            DisconnectTank(component);
        }

        _alerts.ShowAlert(component.Owner, AlertType.Internals, GetSeverity(component));
    }
コード例 #2
0
        private void ToggleMaskComponents(EntityUid uid, MaskComponent mask, EntityUid wearer, bool isEquip = false)
        {
            //toggle visuals
            if (TryComp <ClothingComponent>(mask.Owner, out var clothing))
            {
                //TODO: sprites for 'pulled down' state. defaults to invisible due to no sprite with this prefix
                _clothing.SetEquippedPrefix(uid, mask.IsToggled ? "toggled" : null, clothing);
            }

            // toggle ingestion blocking
            if (TryComp <IngestionBlockerComponent>(uid, out var blocker))
            {
                blocker.Enabled = !mask.IsToggled;
            }

            // toggle disease protection
            if (TryComp <DiseaseProtectionComponent>(uid, out var diseaseProtection))
            {
                diseaseProtection.IsActive = !mask.IsToggled;
            }

            // toggle identity
            if (TryComp <IdentityBlockerComponent>(uid, out var identity))
            {
                identity.Enabled = !mask.IsToggled;
            }

            // toggle breath tool connection (skip during equip since that is handled in LungSystem)
            if (isEquip || !TryComp <BreathToolComponent>(uid, out var breathTool))
            {
                return;
            }

            if (mask.IsToggled)
            {
                _atmos.DisconnectInternals(breathTool);
            }
            else
            {
                breathTool.IsFunctional = true;

                if (TryComp(wearer, out InternalsComponent? internals))
                {
                    breathTool.ConnectedInternalsEntity = wearer;
                    _internals.ConnectBreathTool(internals, uid);
                }
            }
        }
コード例 #3
0
 private void OnGotUnequipped(EntityUid uid, BreathToolComponent component, GotUnequippedEvent args)
 {
     _atmosphereSystem.DisconnectInternals(component);
 }