Skip to content

Commit

Permalink
Merge branch 'master' into garbagecannon
Browse files Browse the repository at this point in the history
  • Loading branch information
Lyndomen authored Nov 20, 2024
2 parents acb0b63 + 4d4b403 commit daaf70c
Show file tree
Hide file tree
Showing 132 changed files with 1,945 additions and 332 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/conflict-labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ jobs:
- name: Check for Merge Conflicts
uses: eps1lon/[email protected]
with:
dirtyLabel: "Status: Merge Conflict"
dirtyLabel: "S: Merge Conflict"
repoToken: "${{ secrets.GITHUB_TOKEN }}"
commentOnDirty: "This pull request has conflicts, please resolve those before we can evaluate the pull request."
4 changes: 2 additions & 2 deletions .github/workflows/labeler-needsreview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
steps:
- uses: actions-ecosystem/action-add-labels@v1
with:
labels: "Status: Needs Review"
labels: "S: Needs Review"
- uses: actions-ecosystem/action-remove-labels@v1
with:
labels: "Status: Awaiting Changes"
labels: "S: Awaiting Changes"
2 changes: 1 addition & 1 deletion .github/workflows/labeler-untriaged.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ jobs:
- uses: actions-ecosystem/action-add-labels@v1
if: join(github.event.issue.labels) == ''
with:
labels: "Status: Untriaged"
labels: "S: Untriaged"
52 changes: 52 additions & 0 deletions Content.Client/DeltaV/Overlays/PainOverlay.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using System.Numerics;
using Content.Shared.DeltaV.Pain;
using Robust.Client.Graphics;
using Robust.Client.Player;
using Robust.Shared.Enums;
using Robust.Shared.Prototypes;

namespace Content.Client.DeltaV.Overlays;

public sealed partial class PainOverlay : Overlay
{
[Dependency] private readonly IPrototypeManager _prototype = default!;
[Dependency] private readonly IPlayerManager _player = default!;
[Dependency] private readonly IEntityManager _entity = default!;

public override bool RequestScreenTexture => true;
public override OverlaySpace Space => OverlaySpace.WorldSpace;
private readonly ShaderInstance _painShader;
private readonly ProtoId<ShaderPrototype> _shaderProto = "ChromaticAberration";

public PainOverlay()
{
IoCManager.InjectDependencies(this);
_painShader = _prototype.Index(_shaderProto).Instance().Duplicate();
}

protected override bool BeforeDraw(in OverlayDrawArgs args)
{
if (_player.LocalEntity is not { Valid: true } player
|| !_entity.HasComponent<PainComponent>(player))
{
return false;
}

return base.BeforeDraw(in args);
}

protected override void Draw(in OverlayDrawArgs args)
{
if (ScreenTexture is null)
return;

_painShader.SetParameter("SCREEN_TEXTURE", ScreenTexture);

var worldHandle = args.WorldHandle;
var viewport = args.WorldBounds;
worldHandle.SetTransform(Matrix3x2.Identity);
worldHandle.UseShader(_painShader);
worldHandle.DrawRect(viewport, Color.White);
worldHandle.UseShader(null);
}
}
65 changes: 65 additions & 0 deletions Content.Client/DeltaV/Overlays/PainSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
using Content.Shared.DeltaV.Pain;
using Robust.Client.Graphics;
using Robust.Shared.Player;

namespace Content.Client.DeltaV.Overlays;

public sealed partial class PainSystem : EntitySystem
{
[Dependency] private readonly IOverlayManager _overlayMan = default!;
[Dependency] private readonly ISharedPlayerManager _playerMan = default!;

private PainOverlay _overlay = default!;

public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<PainComponent, ComponentInit>(OnPainInit);
SubscribeLocalEvent<PainComponent, ComponentShutdown>(OnPainShutdown);
SubscribeLocalEvent<PainComponent, LocalPlayerAttachedEvent>(OnPlayerAttached);
SubscribeLocalEvent<PainComponent, LocalPlayerDetachedEvent>(OnPlayerDetached);

_overlay = new();
}

private void OnPainInit(Entity<PainComponent> ent, ref ComponentInit args)
{
if (ent.Owner == _playerMan.LocalEntity && !ent.Comp.Suppressed)
_overlayMan.AddOverlay(_overlay);
}

private void OnPainShutdown(Entity<PainComponent> ent, ref ComponentShutdown args)
{
if (ent.Owner == _playerMan.LocalEntity)
_overlayMan.RemoveOverlay(_overlay);
}

private void OnPlayerAttached(Entity<PainComponent> ent, ref LocalPlayerAttachedEvent args)
{
if (!ent.Comp.Suppressed)
_overlayMan.AddOverlay(_overlay);
}

private void OnPlayerDetached(Entity<PainComponent> ent, ref LocalPlayerDetachedEvent args)
{
_overlayMan.RemoveOverlay(_overlay);
}

public override void Update(float frameTime)
{
base.Update(frameTime);

// Handle showing/hiding overlay based on suppression status
if (_playerMan.LocalEntity is not { } player)
return;

if (!TryComp<PainComponent>(player, out var comp))
return;

if (comp.Suppressed && _overlayMan.HasOverlay<PainOverlay>())
_overlayMan.RemoveOverlay(_overlay);
else if (!comp.Suppressed && !_overlayMan.HasOverlay<PainOverlay>())
_overlayMan.AddOverlay(_overlay);
}
}
65 changes: 65 additions & 0 deletions Content.Client/_EE/FootPrint/FootPrintsVisualizerSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
using Content.Shared._EE.FootPrint;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Shared.Random;

namespace Content.Client._EE.FootPrint;

public sealed class FootPrintsVisualizerSystem : VisualizerSystem<FootPrintComponent>
{
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
[Dependency] private readonly IRobustRandom _random = default!;

public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<FootPrintComponent, ComponentInit>(OnInitialized);
SubscribeLocalEvent<FootPrintComponent, ComponentShutdown>(OnShutdown);
}

private void OnInitialized(EntityUid uid, FootPrintComponent comp, ComponentInit args)
{
if (!TryComp<SpriteComponent>(uid, out var sprite))
return;

sprite.LayerMapReserveBlank(FootPrintVisualLayers.Print);
UpdateAppearance(uid, comp, sprite);
}

private void OnShutdown(EntityUid uid, FootPrintComponent comp, ComponentShutdown args)
{
if (TryComp<SpriteComponent>(uid, out var sprite)
&& sprite.LayerMapTryGet(FootPrintVisualLayers.Print, out var layer))
sprite.RemoveLayer(layer);
}

private void UpdateAppearance(EntityUid uid, FootPrintComponent component, SpriteComponent sprite)
{
if (!sprite.LayerMapTryGet(FootPrintVisualLayers.Print, out var layer)
|| !TryComp<FootPrintsComponent>(component.PrintOwner, out var printsComponent)
|| !TryComp<AppearanceComponent>(uid, out var appearance)
|| !_appearance.TryGetData<FootPrintVisuals>(uid, FootPrintVisualState.State, out var printVisuals, appearance))
return;

sprite.LayerSetState(layer, new RSI.StateId(printVisuals switch
{
FootPrintVisuals.BareFootPrint => printsComponent.RightStep ? printsComponent.RightBarePrint : printsComponent.LeftBarePrint,
FootPrintVisuals.ShoesPrint => printsComponent.ShoesPrint,
FootPrintVisuals.SuitPrint => printsComponent.SuitPrint,
FootPrintVisuals.Dragging => _random.Pick(printsComponent.DraggingPrint),
_ => throw new ArgumentOutOfRangeException($"Unknown {printVisuals} parameter.")
}), printsComponent.RsiPath);

if (_appearance.TryGetData<Color>(uid, FootPrintVisualState.Color, out var printColor, appearance))
sprite.LayerSetColor(layer, printColor);
}

protected override void OnAppearanceChange (EntityUid uid, FootPrintComponent component, ref AppearanceChangeEvent args)
{
if (args.Sprite is not { } sprite)
return;

UpdateAppearance(uid, component, sprite);
}
}
13 changes: 13 additions & 0 deletions Content.Server/DeltaV/Addictions/AddictionSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,19 @@ public override void Initialize()
SubscribeLocalEvent<AddictedComponent, ComponentStartup>(OnInit);
}

protected override void UpdateAddictionSuppression(Entity<AddictedComponent> ent, float duration)
{
var curTime = _timing.CurTime;
var newEndTime = curTime + TimeSpan.FromSeconds(duration);

// Only update if this would extend the suppression
if (newEndTime <= ent.Comp.SuppressionEndTime)
return;

ent.Comp.SuppressionEndTime = newEndTime;
UpdateSuppressed(ent.Comp);
}

public override void Update(float frameTime)
{
base.Update(frameTime);
Expand Down
9 changes: 5 additions & 4 deletions Content.Server/DeltaV/EntityEffects/Effects/Addicted.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,20 @@ namespace Content.Server.EntityEffects.Effects;
public sealed partial class Addicted : EntityEffect
{
/// <summary>
/// How long should each metabolism cycle make the effect last for.
/// How long should each metabolism cycle make the effect last for.
/// </summary>
[DataField]
public float AddictionTime = 3f;
public float AddictionTime = 5f;

protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
protected override string ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
=> Loc.GetString("reagent-effect-guidebook-addicted", ("chance", Probability));

public override void Effect(EntityEffectBaseArgs args)
{
var addictionTime = AddictionTime;

if (args is EntityEffectReagentArgs reagentArgs) {
if (args is EntityEffectReagentArgs reagentArgs)
{
addictionTime *= reagentArgs.Scale.Float();
}

Expand Down
30 changes: 30 additions & 0 deletions Content.Server/DeltaV/EntityEffects/Effects/InPain.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using Content.Shared.DeltaV.Pain;
using Content.Shared.EntityEffects;
using Robust.Shared.Prototypes;

namespace Content.Server.EntityEffects.Effects;

public sealed partial class InPain : EntityEffect
{
/// <summary>
/// How long should each metabolism cycle make the effect last for.
/// </summary>
[DataField]
public float PainTime = 5f;

protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
=> Loc.GetString("reagent-effect-guidebook-addicted", ("chance", Probability));

public override void Effect(EntityEffectBaseArgs args)
{
var painTime = PainTime;

if (args is EntityEffectReagentArgs reagentArgs)
{
painTime *= reagentArgs.Scale.Float();
}

var painSystem = args.EntityManager.System<SharedPainSystem>();
painSystem.TryApplyPain(args.TargetEntity, painTime);
}
}
31 changes: 31 additions & 0 deletions Content.Server/DeltaV/EntityEffects/Effects/SuppressAddiction.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using Content.Shared.DeltaV.Addictions;
using Content.Shared.EntityEffects;
using Robust.Shared.Prototypes;

namespace Content.Server.EntityEffects.Effects;

public sealed partial class SuppressAddiction : EntityEffect
{
/// <summary>
/// How long should the addiction suppression last for each metabolism cycle
/// </summary>
[DataField]
public float SuppressionTime = 30f;

protected override string ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
=> Loc.GetString("reagent-effect-guidebook-addiction-suppression",
("chance", Probability));

public override void Effect(EntityEffectBaseArgs args)
{
var suppressionTime = SuppressionTime;

if (args is EntityEffectReagentArgs reagentArgs)
{
suppressionTime *= reagentArgs.Scale.Float();
}

var addictionSystem = args.EntityManager.System<SharedAddictionSystem>();
addictionSystem.TrySuppressAddiction(args.TargetEntity, suppressionTime);
}
}
38 changes: 38 additions & 0 deletions Content.Server/DeltaV/EntityEffects/Effects/SuppressPain.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using Content.Shared.DeltaV.Pain;
using Content.Shared.EntityEffects;
using Robust.Shared.Prototypes;

namespace Content.Server.EntityEffects.Effects;

public sealed partial class SuppressPain : EntityEffect
{
/// <summary>
/// How long should the pain suppression last for each metabolism cycle
/// </summary>
[DataField]
public float SuppressionTime = 30f;

/// <summary>
/// The strength level of the pain suppression
/// </summary>
[DataField]
public PainSuppressionLevel SuppressionLevel = PainSuppressionLevel.Normal;

protected override string ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
=> Loc.GetString("reagent-effect-guidebook-pain-suppression",
("chance", Probability),
("level", SuppressionLevel.ToString().ToLowerInvariant()));

public override void Effect(EntityEffectBaseArgs args)
{
var suppressionTime = SuppressionTime;

if (args is EntityEffectReagentArgs reagentArgs)
{
suppressionTime *= reagentArgs.Scale.Float();
}

var painSystem = args.EntityManager.System<SharedPainSystem>();
painSystem.TrySuppressPain(args.TargetEntity, suppressionTime, SuppressionLevel);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Content.Server.Objectives.Systems;

namespace Content.Server.Objectives.Components;

/// <summary>
/// Requires that a target dies once and only once.
/// Depends on <see cref="TargetObjectiveComponent"/> to function.
/// </summary>
[RegisterComponent, Access(typeof(TeachLessonConditionSystem))]
public sealed partial class TeachLessonConditionComponent : Component;
Loading

0 comments on commit daaf70c

Please sign in to comment.