-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Morale System (Port From White Dream) (#620)
# Description This Feature has been graciously provided for Einstein Engines to port from the White Dream codebase. Mood is a system for tracking a character's current Mental State, which fluctuates throughout the round as a result of various events that can modify it. Each consisting of a single line event that can be trivially inserted into any other system, and a yml configured "Moodlet", which is applied to said character. Moodlets can be temporary or permanent, and can also modify a characters mood in either positive or negative directions. Things like, "Being Hungry", "Being Injured", "Petting a cute animal", "Being Hugged", all create a Moodlet. Mood can provide buffs or debuffs, primarily to movement speed. In fact Mood's movement speed modifier actually completely replaces the movement speed modifiers from Hunger & Thirst. Instead Hunger & Thirst create a negative moodlet that persists until you eat and drink, which _can_ give you a speed penalty. But you might for instance diminish the negative effects by seeking out other positive sources. Or they might just get worse, who knows what could happen? # Media Mood takes the form of a series of Moodlets, which modify your character's internal Mood stat. It's kinda like a healthbar, but for your mental state. Whenever you gain a moodlet, it appears in a popup. White text for standard moodlets, red text for negative moodlets. By clicking on your mood icon, text will show up displaying all of your currently active Moodlets. https://github.com/user-attachments/assets/3e9420bb-3a43-4d97-9127-31d704c15287 New traits!  Permission from Codeowners:  # TODO - [x] Refactor the Crit Threshold modification, and Movement Speed Modification to make it more granular. # Changelog :cl: VMSolidus & Skubman - add: The Mood System has been ported from White Dream. Mood acts as a 3rd healthbar, alongside Health and Stamina, representing your character's current mental state. Having either high or low mood can modify certain physical attributes. - add: Mood modifies your Critical Threshold. Your critical threshold can be increased or decreased depending on how high or low your character's mood is. - add: Mood modifies your Movement Speed. Characters move faster when they have an overall high mood, and move slower when they have a lower mood. - add: Saturnine and Sanguine have been added to the list of Mental traits, both providing innate modifiers to a character's Morale. --------- Signed-off-by: VMSolidus <[email protected]> Co-authored-by: Danger Revolution! <[email protected]> Co-authored-by: Angelo Fallaria <[email protected]> Co-authored-by: DEATHB4DEFEAT <[email protected]>
- Loading branch information
1 parent
255793d
commit f8e382b
Showing
56 changed files
with
1,456 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using Robust.Client.Graphics; | ||
using Robust.Shared.Enums; | ||
using Robust.Shared.Prototypes; | ||
|
||
namespace Content.Client.Overlays; | ||
|
||
public sealed class SaturationScaleOverlay : Overlay | ||
{ | ||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!; | ||
|
||
public override bool RequestScreenTexture => true; | ||
public override OverlaySpace Space => OverlaySpace.WorldSpace; | ||
private readonly ShaderInstance _shader; | ||
private const float Saturation = 0.5f; | ||
|
||
|
||
public SaturationScaleOverlay() | ||
{ | ||
IoCManager.InjectDependencies(this); | ||
|
||
_shader = _prototypeManager.Index<ShaderPrototype>("SaturationScale").InstanceUnique(); | ||
} | ||
|
||
|
||
protected override void Draw(in OverlayDrawArgs args) | ||
{ | ||
if (ScreenTexture == null) | ||
return; | ||
|
||
_shader.SetParameter("SCREEN_TEXTURE", ScreenTexture); | ||
_shader.SetParameter("saturation", Saturation); | ||
|
||
var handle = args.WorldHandle; | ||
|
||
handle.UseShader(_shader); | ||
handle.DrawRect(args.WorldBounds, Color.White); | ||
handle.UseShader(null); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
using Content.Shared.GameTicking; | ||
using Content.Shared.Overlays; | ||
using Robust.Client.Graphics; | ||
using Robust.Client.Player; | ||
using Robust.Shared.Player; | ||
|
||
namespace Content.Client.Overlays; | ||
|
||
public sealed class SaturationScaleSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly IPlayerManager _player = default!; | ||
[Dependency] private readonly IOverlayManager _overlayMan = default!; | ||
|
||
private SaturationScaleOverlay _overlay = default!; | ||
|
||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
_overlay = new(); | ||
|
||
SubscribeLocalEvent<SaturationScaleOverlayComponent, ComponentInit>(OnInit); | ||
SubscribeLocalEvent<SaturationScaleOverlayComponent, ComponentShutdown>(OnShutdown); | ||
|
||
SubscribeLocalEvent<SaturationScaleOverlayComponent, PlayerAttachedEvent>(OnPlayerAttached); | ||
SubscribeLocalEvent<SaturationScaleOverlayComponent, PlayerDetachedEvent>(OnPlayerDetached); | ||
|
||
SubscribeNetworkEvent<RoundRestartCleanupEvent>(RoundRestartCleanup); | ||
} | ||
|
||
|
||
private void RoundRestartCleanup(RoundRestartCleanupEvent ev) | ||
{ | ||
_overlayMan.RemoveOverlay(_overlay); | ||
} | ||
|
||
private void OnPlayerDetached(EntityUid uid, SaturationScaleOverlayComponent component, PlayerDetachedEvent args) | ||
{ | ||
_overlayMan.RemoveOverlay(_overlay); | ||
} | ||
|
||
private void OnPlayerAttached(EntityUid uid, SaturationScaleOverlayComponent component, PlayerAttachedEvent args) | ||
{ | ||
_overlayMan.AddOverlay(_overlay); | ||
} | ||
|
||
private void OnShutdown(EntityUid uid, SaturationScaleOverlayComponent component, ComponentShutdown args) | ||
{ | ||
if (_player.LocalSession?.AttachedEntity != uid) | ||
return; | ||
|
||
_overlayMan.RemoveOverlay(_overlay); | ||
} | ||
|
||
private void OnInit(EntityUid uid, SaturationScaleOverlayComponent component, ComponentInit args) | ||
{ | ||
if (_player.LocalSession?.AttachedEntity != uid) | ||
return; | ||
|
||
_overlayMan.AddOverlay(_overlay); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.