[Fix] Some fixes (#484)
* fix mood not resolved * fixed cpr sound stream * fix welded airlock not showing lights * update rep weights * tweak player reputation weights * fix for mood fix
This commit is contained in:
@@ -102,6 +102,7 @@ public sealed class AirlockSystem : SharedAirlockSystem
|
|||||||
(state == DoorState.Closing
|
(state == DoorState.Closing
|
||||||
|| state == DoorState.Opening
|
|| state == DoorState.Opening
|
||||||
|| state == DoorState.Denying
|
|| state == DoorState.Denying
|
||||||
|
|| state == DoorState.Welded
|
||||||
|| (state == DoorState.Open && comp.OpenUnlitVisible)
|
|| (state == DoorState.Open && comp.OpenUnlitVisible)
|
||||||
|| (_appearanceSystem.TryGetData<bool>(uid, DoorVisuals.ClosedLights, out var closedLights, args.Component) && closedLights))
|
|| (_appearanceSystem.TryGetData<bool>(uid, DoorVisuals.ClosedLights, out var closedLights, args.Component) && closedLights))
|
||||||
&& !boltedVisible && !emergencyLightsVisible; ;
|
&& !boltedVisible && !emergencyLightsVisible; ;
|
||||||
|
|||||||
@@ -344,7 +344,10 @@ namespace Content.Server.Body.Systems
|
|||||||
if (args.Target != null && CanCPR(args.Target.Value, component, args.User))
|
if (args.Target != null && CanCPR(args.Target.Value, component, args.User))
|
||||||
args.Repeat = true;
|
args.Repeat = true;
|
||||||
else
|
else
|
||||||
|
{
|
||||||
component.CPRPerformedBy = null;
|
component.CPRPerformedBy = null;
|
||||||
|
component.CPRPlayingStream?.Stop();
|
||||||
|
}
|
||||||
|
|
||||||
RaiseLocalEvent(args.User, new MoodEffectEvent("SavedLife"));
|
RaiseLocalEvent(args.User, new MoodEffectEvent("SavedLife"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,14 +40,14 @@ public sealed class MoodSystem : EntitySystem
|
|||||||
private void OnRemoveEffect(EntityUid uid, MoodComponent component, MoodRemoveEffectEvent args)
|
private void OnRemoveEffect(EntityUid uid, MoodComponent component, MoodRemoveEffectEvent args)
|
||||||
{
|
{
|
||||||
if (component.UncategorisedEffects.TryGetValue(args.EffectId, out _))
|
if (component.UncategorisedEffects.TryGetValue(args.EffectId, out _))
|
||||||
RemoveTimedOutEffect(uid, component, args.EffectId);
|
RemoveTimedOutEffect(uid, args.EffectId);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foreach (var (category, id) in component.CategorisedEffects)
|
foreach (var (category, id) in component.CategorisedEffects)
|
||||||
{
|
{
|
||||||
if (id == args.EffectId)
|
if (id == args.EffectId)
|
||||||
{
|
{
|
||||||
RemoveTimedOutEffect(uid, component, args.EffectId, category);
|
RemoveTimedOutEffect(uid, args.EffectId, category);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -111,7 +111,7 @@ public sealed class MoodSystem : EntitySystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (prototype.Timeout != 0)
|
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
|
//Apply uncategorised effect
|
||||||
else
|
else
|
||||||
@@ -125,14 +125,17 @@ public sealed class MoodSystem : EntitySystem
|
|||||||
amount += effectValue;
|
amount += effectValue;
|
||||||
|
|
||||||
if (prototype.Timeout != 0)
|
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);
|
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<MoodComponent>(uid, out var comp))
|
||||||
|
return;
|
||||||
|
|
||||||
var amount = comp.CurrentMoodLevel;
|
var amount = comp.CurrentMoodLevel;
|
||||||
|
|
||||||
if (category == null)
|
if (category == null)
|
||||||
|
|||||||
@@ -129,20 +129,25 @@ public sealed class ReputationManager : EntitySystem
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetPlayerWeight(float reputation)
|
public int GetPlayerWeight(float rep)
|
||||||
{
|
{
|
||||||
return reputation switch
|
// Min-max return values
|
||||||
{
|
const int minValue = 30;
|
||||||
> 1000 => 9,
|
const int maxValue = 50;
|
||||||
> 700 => 8,
|
|
||||||
> 500 => 7,
|
// Min-max reputation values
|
||||||
> 300 => 6,
|
const float minReputation = 0f;
|
||||||
> 100 => 5,
|
const float maxReputation = 1000f;
|
||||||
> 50 => 4,
|
|
||||||
> 15 => 3,
|
if (rep < minReputation)
|
||||||
< 0 => 1,
|
return 20;
|
||||||
_ => 2
|
|
||||||
};
|
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<ICommonSession> prefList)
|
public ICommonSession PickPlayerBasedOnReputation(List<ICommonSession> prefList)
|
||||||
|
|||||||
Reference in New Issue
Block a user