diff --git a/Content.Client/Doors/AirlockSystem.cs b/Content.Client/Doors/AirlockSystem.cs index 112d828b5e..4fb5d61b49 100644 --- a/Content.Client/Doors/AirlockSystem.cs +++ b/Content.Client/Doors/AirlockSystem.cs @@ -102,6 +102,7 @@ public sealed class AirlockSystem : SharedAirlockSystem (state == DoorState.Closing || state == DoorState.Opening || state == DoorState.Denying + || state == DoorState.Welded || (state == DoorState.Open && comp.OpenUnlitVisible) || (_appearanceSystem.TryGetData(uid, DoorVisuals.ClosedLights, out var closedLights, args.Component) && closedLights)) && !boltedVisible && !emergencyLightsVisible; ; diff --git a/Content.Server/Body/Systems/RespiratorSystem.cs b/Content.Server/Body/Systems/RespiratorSystem.cs index cbaa93ba86..89a2d74971 100644 --- a/Content.Server/Body/Systems/RespiratorSystem.cs +++ b/Content.Server/Body/Systems/RespiratorSystem.cs @@ -344,7 +344,10 @@ namespace Content.Server.Body.Systems if (args.Target != null && CanCPR(args.Target.Value, component, args.User)) args.Repeat = true; else + { component.CPRPerformedBy = null; + component.CPRPlayingStream?.Stop(); + } RaiseLocalEvent(args.User, new MoodEffectEvent("SavedLife")); } diff --git a/Content.Server/White/Mood/MoodSystem.cs b/Content.Server/White/Mood/MoodSystem.cs index b9c43d1e80..230127e0e4 100644 --- a/Content.Server/White/Mood/MoodSystem.cs +++ b/Content.Server/White/Mood/MoodSystem.cs @@ -40,14 +40,14 @@ public sealed class MoodSystem : EntitySystem private void OnRemoveEffect(EntityUid uid, MoodComponent component, MoodRemoveEffectEvent args) { if (component.UncategorisedEffects.TryGetValue(args.EffectId, out _)) - RemoveTimedOutEffect(uid, component, args.EffectId); + RemoveTimedOutEffect(uid, args.EffectId); else { foreach (var (category, id) in component.CategorisedEffects) { if (id == args.EffectId) { - RemoveTimedOutEffect(uid, component, args.EffectId, category); + RemoveTimedOutEffect(uid, args.EffectId, category); return; } } @@ -111,7 +111,7 @@ public sealed class MoodSystem : EntitySystem } if (prototype.Timeout != 0) - Timer.Spawn(TimeSpan.FromMinutes(prototype.Timeout), () => RemoveTimedOutEffect(uid, component, prototype.ID, prototype.Category)); + Timer.Spawn(TimeSpan.FromMinutes(prototype.Timeout), () => RemoveTimedOutEffect(uid, prototype.ID, prototype.Category)); } //Apply uncategorised effect else @@ -125,14 +125,17 @@ public sealed class MoodSystem : EntitySystem amount += effectValue; if (prototype.Timeout != 0) - Timer.Spawn(TimeSpan.FromMinutes(prototype.Timeout), () => RemoveTimedOutEffect(uid, component, prototype.ID)); + Timer.Spawn(TimeSpan.FromMinutes(prototype.Timeout), () => RemoveTimedOutEffect(uid, prototype.ID)); } SetMood(uid, amount, component); } - private void RemoveTimedOutEffect(EntityUid uid, MoodComponent comp, string prototypeId, string? category = null) + private void RemoveTimedOutEffect(EntityUid uid, string prototypeId, string? category = null) { + if (!TryComp(uid, out var comp)) + return; + var amount = comp.CurrentMoodLevel; if (category == null) diff --git a/Content.Server/White/Reputation/ReputationManager.cs b/Content.Server/White/Reputation/ReputationManager.cs index 0d709c0842..3f9a14472b 100644 --- a/Content.Server/White/Reputation/ReputationManager.cs +++ b/Content.Server/White/Reputation/ReputationManager.cs @@ -129,20 +129,25 @@ public sealed class ReputationManager : EntitySystem return success; } - public int GetPlayerWeight(float reputation) + public int GetPlayerWeight(float rep) { - return reputation switch - { - > 1000 => 9, - > 700 => 8, - > 500 => 7, - > 300 => 6, - > 100 => 5, - > 50 => 4, - > 15 => 3, - < 0 => 1, - _ => 2 - }; + // Min-max return values + const int minValue = 30; + const int maxValue = 50; + + // Min-max reputation values + const float minReputation = 0f; + const float maxReputation = 1000f; + + if (rep < minReputation) + return 20; + + var normalizedReputation = (rep - minReputation) / (maxReputation - minReputation); + var result = (int)(minValue + (normalizedReputation * (maxValue - minValue))); + + result = Math.Max(minValue, Math.Min(maxValue, result)); + + return result; } public ICommonSession PickPlayerBasedOnReputation(List prefList)