mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-17 05:27:38 +03:00
This PR significantly reworks some parts of the mood system, namely by completely restoring and reworking the saturation scale shader so that its not completely terrible. Additionally, I've added numerous new instances and locations where Moodlets can be found in the game, particularly when it comes to food and drugs, as well as a new Mood interaction with the Deep Fryer. Chef gameplay is significantly expanded via the introduction of flavor related moodlets, as well as the almighty deep fryer giving a unique, moderately strong, and long lasting moodlet to anyone who eats whatever you deep fry. Go ahead, give someone a deep fried stick of salted butter coated in chocolate. You'll make their day. The big differences with the Saturation Scale are that its now variable, with smooth transitions, with the scale scaling with your character's mood. The more depressed you are, the more desaturated the world becomes. Whereas if you have entirely too many positive mood bonuses, the world becomes incredibly vibrant. <details><summary><h1>Media</h1></summary> <p> Shoukou's Bar as seen by someone with the Sanguine trait(and no other moodlets)  Max mood  Saturnine trait:  Minimum mood(dead)  Smooth transitions for shader tone. https://github.com/user-attachments/assets/3ab55da1-eca6-4cc5-9489-f4ad13ed0f27 </p> </details> 🆑 - add: Re-enabled the "Mood shader" after significantly reworking it. Mood visual effects now scale with your character's mood, instead of only ever being near-greyscale. Being high life now makes the world more colorful and saturated. - add: A huge variety of medicines, drugs, and even food items(based on flavor!) now have mood effects. Reaching for the packet of salt now actually makes food provide a better mood buff. - add: Being Tear-gassed causes a massive mood penalty. - add: Deep frying food provides a strong mood bonus. - add: Added new Manic, Mercurial, and Dead Emotions traits. Signed-off-by: VMSolidus <evilexecutive@gmail.com>
98 lines
4.4 KiB
C#
98 lines
4.4 KiB
C#
using Content.Shared.Contests;
|
|
using Content.Shared.Mobs.Components;
|
|
using Content.Shared.Mobs.Systems;
|
|
using Content.Shared.Traits.Assorted.Components;
|
|
using Content.Shared.Damage.Events;
|
|
using Content.Shared.Weapons.Melee.Events;
|
|
using Content.Shared.Damage.Components;
|
|
using Content.Shared.Mood;
|
|
using Robust.Shared.Random;
|
|
|
|
namespace Content.Shared.Traits.Assorted.Systems;
|
|
|
|
public sealed partial class TraitStatModifierSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly ContestsSystem _contests = default!;
|
|
[Dependency] private readonly MobThresholdSystem _threshold = default!;
|
|
[Dependency] private readonly IRobustRandom _random = default!;
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
SubscribeLocalEvent<CritModifierComponent, ComponentStartup>(OnCritStartup);
|
|
SubscribeLocalEvent<DeadModifierComponent, ComponentStartup>(OnDeadStartup);
|
|
SubscribeLocalEvent<StaminaCritModifierComponent, ComponentStartup>(OnStaminaCritStartup);
|
|
SubscribeLocalEvent<AdrenalineComponent, GetMeleeDamageEvent>(OnAdrenalineGetMeleeDamage);
|
|
SubscribeLocalEvent<AdrenalineComponent, GetThrowingDamageEvent>(OnAdrenalineGetThrowingDamage);
|
|
SubscribeLocalEvent<PainToleranceComponent, GetMeleeDamageEvent>(OnPainToleranceGetMeleeDamage);
|
|
SubscribeLocalEvent<PainToleranceComponent, GetThrowingDamageEvent>(OnPainToleranceGetThrowingDamage);
|
|
SubscribeLocalEvent<ManicComponent, OnSetMoodEvent>(OnManicMood);
|
|
SubscribeLocalEvent<MercurialComponent, OnSetMoodEvent>(OnMercurialMood);
|
|
}
|
|
|
|
private void OnCritStartup(EntityUid uid, CritModifierComponent component, ComponentStartup args)
|
|
{
|
|
if (!TryComp<MobThresholdsComponent>(uid, out var threshold))
|
|
return;
|
|
|
|
var critThreshold = _threshold.GetThresholdForState(uid, Mobs.MobState.Critical, threshold);
|
|
if (critThreshold != 0)
|
|
_threshold.SetMobStateThreshold(uid, critThreshold + component.CritThresholdModifier, Mobs.MobState.Critical);
|
|
}
|
|
|
|
private void OnDeadStartup(EntityUid uid, DeadModifierComponent component, ComponentStartup args)
|
|
{
|
|
if (!TryComp<MobThresholdsComponent>(uid, out var threshold))
|
|
return;
|
|
|
|
var deadThreshold = _threshold.GetThresholdForState(uid, Mobs.MobState.Dead, threshold);
|
|
if (deadThreshold != 0)
|
|
_threshold.SetMobStateThreshold(uid, deadThreshold + component.DeadThresholdModifier, Mobs.MobState.Dead);
|
|
}
|
|
|
|
private void OnStaminaCritStartup(EntityUid uid, StaminaCritModifierComponent component, ComponentStartup args)
|
|
{
|
|
if (!TryComp<StaminaComponent>(uid, out var stamina))
|
|
return;
|
|
|
|
stamina.CritThreshold += component.CritThresholdModifier;
|
|
}
|
|
|
|
private void OnAdrenalineGetMeleeDamage(EntityUid uid, AdrenalineComponent component, ref GetMeleeDamageEvent args)
|
|
{
|
|
args.Damage *= GetAdrenalineMultiplier(uid, component);
|
|
}
|
|
|
|
private void OnAdrenalineGetThrowingDamage(EntityUid uid, AdrenalineComponent component, ref GetThrowingDamageEvent args)
|
|
{
|
|
args.Damage *= GetAdrenalineMultiplier(uid, component);
|
|
}
|
|
|
|
private float GetAdrenalineMultiplier(EntityUid uid, AdrenalineComponent component)
|
|
{
|
|
var modifier = _contests.HealthContest(uid, component.BypassClamp, component.RangeModifier);
|
|
return component.Inverse ? 1 / modifier : modifier;
|
|
}
|
|
|
|
private void OnPainToleranceGetMeleeDamage(EntityUid uid, PainToleranceComponent component, ref GetMeleeDamageEvent args)
|
|
{
|
|
args.Damage *= GetPainToleranceMultiplier(uid, component);
|
|
}
|
|
|
|
private void OnPainToleranceGetThrowingDamage(EntityUid uid, PainToleranceComponent component, ref GetThrowingDamageEvent args)
|
|
{
|
|
args.Damage *= GetPainToleranceMultiplier(uid, component);
|
|
}
|
|
|
|
private float GetPainToleranceMultiplier(EntityUid uid, PainToleranceComponent component)
|
|
{
|
|
var modifier = _contests.StaminaContest(uid, component.BypassClamp, component.RangeModifier);
|
|
return component.Inverse ? 1 / modifier : modifier;
|
|
}
|
|
|
|
private void OnManicMood(EntityUid uid, ManicComponent component, ref OnSetMoodEvent args) =>
|
|
args.MoodChangedAmount *= _random.NextFloat(component.LowerMultiplier, component.UpperMultiplier);
|
|
|
|
private void OnMercurialMood(EntityUid uid, MercurialComponent component, ref OnSetMoodEvent args) =>
|
|
args.MoodOffset += _random.NextFloat(component.LowerMood, component.UpperMood);
|
|
}
|