示例#1
0
        public float GetFeltHighPressure(BarotraumaComponent baro, float environmentPressure)
        {
            var modifier   = float.MinValue;
            var multiplier = float.MinValue;

            TryComp(baro.Owner, out InventoryComponent? inv);
            TryComp(baro.Owner, out ContainerManagerComponent? contMan);

            // TODO: cache this & update when equipment changes?
            // Not as import and as low-pressure, but probably still useful.

            // First, check if for protective equipment
            foreach (var slot in baro.ProtectionSlots)
            {
                if (!_inventorySystem.TryGetSlotEntity(baro.Owner, slot, out var equipment, inv, contMan) ||
                    !TryComp(equipment, out PressureProtectionComponent? protection))
                {
                    // Missing protection, skin is exposed.
                    modifier   = 0;
                    multiplier = 1;
                    break;
                }

                modifier   = Math.Max(protection.LowPressureModifier, modifier);
                multiplier = Math.Max(protection.LowPressureMultiplier, multiplier);
            }

            // Then apply any generic, non-clothing related modifiers.
            var highPressureEvent = new HighPressureEvent(environmentPressure);

            RaiseLocalEvent(baro.Owner, highPressureEvent, false);

            return((environmentPressure + modifier + highPressureEvent.Modifier) * (multiplier * highPressureEvent.Multiplier));
        }
        public float GetFeltHighPressure(EntityUid uid, float environmentPressure)
        {
            var highPressureEvent = new HighPressureEvent(environmentPressure);

            RaiseLocalEvent(uid, highPressureEvent, false);

            return(CalculateFeltPressure(environmentPressure, highPressureEvent));
        }
示例#3
0
 /// <summary>
 /// Completely prevent high pressure damage
 /// </summary>
 private void OnHighPressureImmuneEvent(EntityUid uid, PressureImmunityComponent component, HighPressureEvent args)
 {
     args.Multiplier = 0;
 }
示例#4
0
 private void OnHighPressureEvent(EntityUid uid, PressureProtectionComponent component, HighPressureEvent args)
 {
     args.Modifier   += component.HighPressureModifier;
     args.Multiplier *= component.HighPressureMultiplier;
 }
 private void OnHighPressureEvent(EntityUid uid, InventoryComponent component, HighPressureEvent args)
 {
     RelayInventoryEvent(component, args);
 }