Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update #15

Merged
merged 119 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
119 commits
Select commit Hold shift + click to select a range
00a2c6a
Made musket wieldable. (#29910)
jonathanargo Jul 12, 2024
cd90b41
Automatic changelog update
PJBot Jul 12, 2024
3a9b1ea
Allow notice boards to be built on walls (#29851)
themias Jul 12, 2024
f125dda
Make stun batons be thrown like a throwing weapon (#29883)
slarticodefast Jul 12, 2024
00ec83a
Automatic changelog update
PJBot Jul 12, 2024
65ccd6e
Update RCDSystem.cs to not use Component.Owner (#29940)
Plykiya Jul 12, 2024
b6672f0
Update MapScreen.xaml.cs to not use Component.Owner (#29938)
Plykiya Jul 12, 2024
160364e
Update BiomeSystem.cs to not use Component.Owner (#29939)
Plykiya Jul 12, 2024
a8cae6f
Fixes dropping item in container (#29900)
Plykiya Jul 12, 2024
f53d014
Localization of dungeon direction (#29911)
chavonadelal Jul 12, 2024
b5e49c9
Automatic changelog update
PJBot Jul 12, 2024
560df6e
Throwing system hotfix (#29935)
slarticodefast Jul 12, 2024
caf8776
Automatic changelog update
PJBot Jul 12, 2024
7ce3a1f
Fix supplybot movement state (#29944)
lzk228 Jul 12, 2024
3ee7d7b
Implement Health Consideration for NPCs (#29922)
osjarw Jul 12, 2024
a314a96
Fix timer deconstruction (#29917)
themias Jul 12, 2024
e3697c6
Automatic changelog update
PJBot Jul 12, 2024
c94c727
Updates GasTankSystem and InternalsSystem to not use Component.Owner …
Plykiya Jul 12, 2024
2e694f1
Centered hard hat sprites (#29953)
jonathanargo Jul 12, 2024
a100058
Automatic changelog update
PJBot Jul 12, 2024
5fa0844
Update UtensilSystem.cs to not use Component.Owner (#29971)
Plykiya Jul 13, 2024
8ed9ea1
Update TriggerSystem.TimedCollide.cs to not use Component.Owner (#29970)
Plykiya Jul 13, 2024
162348e
Change whitelist to pass when null (#29981)
ShadowCommander Jul 13, 2024
55a50d0
Use reinforced glass damage modifier for secure windoors (#29941)
lzk228 Jul 13, 2024
1b360ac
Automatic changelog update
PJBot Jul 13, 2024
b94b523
Add doc comments to target action components (#29982)
ShadowCommander Jul 13, 2024
3acc100
Update ShuttleDockControl.xaml.cs to not use Component.Owner (#29966)
Plykiya Jul 13, 2024
e11f1e6
Update ActionAlertTooltip.cs to use TryFromMarkup (#29975)
Winkarst-cpu Jul 13, 2024
de2ab29
Update SmokingSystem.SmokingPipe.cs to not use Component.Owner (#29967)
Plykiya Jul 13, 2024
3388c0d
Fix antag objectives always overshooting MaxDifficulty (and kill trie…
Tayrtahn Jul 13, 2024
87fa607
Automatic changelog update
PJBot Jul 13, 2024
7b59012
fire extinguisher using item toggle (#29906)
deltanedas Jul 13, 2024
cb98b65
Update SalvageSystem.Magnet to not use Component.Owner (#29961)
Plykiya Jul 13, 2024
f969fd2
Update submodule to 228.0.0 (#29947)
metalgearsloth Jul 13, 2024
361ec59
Dummy vox deserves a proper vox name (#29789)
Errant-4 Jul 13, 2024
49096cf
Watches (#29550)
EmoGarbage404 Jul 13, 2024
eb4ce85
Remove imagesharp and StatusEffectAddedEvent from FlashOverlay (#28930)
slarticodefast Jul 13, 2024
044d841
Automatic changelog update
PJBot Jul 13, 2024
87f7ea8
make cargo balance ui updating its own component (#28295)
deltanedas Jul 13, 2024
ac768fe
fix(SharedGunSystem): Return and debug log on CreateEffect. (#29656)
CaasGit Jul 13, 2024
6c1d105
Replace DetachParentToNull() with DetachEntity() (#29992)
Plykiya Jul 13, 2024
87c82ff
Update SpawnAfterInteractSystem.cs to not use Component.Owner (#29968)
Plykiya Jul 13, 2024
1b0c434
Shiny Diamonds (#25750)
TheShuEd Jul 13, 2024
22a9290
Automatic changelog update
PJBot Jul 13, 2024
dcb3443
Vgroid diamonds hotfix (#29999)
TheShuEd Jul 13, 2024
bf4ef62
Update RadiationPulseOverlay.cs to have 0 warnings (#30004)
Winkarst-cpu Jul 13, 2024
5e800e0
New CDN publish workflow (#30009)
PJB3005 Jul 13, 2024
c1915c9
Remove outdated steps from Test Packaging workflow (#30018)
PJB3005 Jul 13, 2024
a03b889
Replace obsolete xform.ToMap() with xformSystem.ToMapCoordinates() (#…
Plykiya Jul 13, 2024
b7aa97e
Replace obsolete EntityCoordiates.InRange() with TransformSystem.InRa…
Plykiya Jul 13, 2024
f687124
Update IdExaminableSystem.cs to use TryFromMarkup (#29957)
Winkarst-cpu Jul 13, 2024
85fba98
Update changelog RSS configuration (#30024)
PJB3005 Jul 13, 2024
a06309b
Update Credits (#30026)
github-actions[bot] Jul 14, 2024
87467a3
Fix lizards losing snouts when equipping a head bandana (#29979)
luizwritescode Jul 14, 2024
6898295
Automatic changelog update
PJBot Jul 14, 2024
5d1702d
Update MainMenu.cs to use ISawmill (#29988)
Winkarst-cpu Jul 14, 2024
922be64
NPC exits MeleeOperator on invalid EntityUid (#30005)
osjarw Jul 14, 2024
bdf7293
Clean itemmapper (#29983)
ShadowCommander Jul 14, 2024
960cc80
Update AccessLevelControl.xaml.cs to use ISawmill (#29987)
Winkarst-cpu Jul 14, 2024
011250f
Fix AGhostCommand naming (#29945)
lzk228 Jul 14, 2024
919b3ac
Change wristwatch meta description (#30036)
lzk228 Jul 14, 2024
4f479b6
Fix RGB toys color when worn/in-hand (#30023)
SlamBamActionman Jul 14, 2024
07535e8
Clumsy proof grappling gun (#29904)
Winkarst-cpu Jul 14, 2024
f90538c
Automatic changelog update
PJBot Jul 14, 2024
7d9653f
Fix HTN/NPC better plan selection (#30017)
osjarw Jul 14, 2024
1c74ffb
Ambient music rules refactor (#29921)
TheShuEd Jul 14, 2024
a0052c5
Prevent virtual item storage and popups (#30020)
themias Jul 14, 2024
b6115b6
Add petting cyborgs (#30037)
CookieMasterT Jul 14, 2024
f6d827f
Automatic changelog update
PJBot Jul 14, 2024
35cd013
make ninja shoes magboots (#28586)
deltanedas Jul 14, 2024
3b85b1e
make scarves eatable again (#29959)
lzk228 Jul 14, 2024
17c23f1
Automatic changelog update
PJBot Jul 14, 2024
b7d3964
Fix AccessLevelControl breaking (#30045)
PJB3005 Jul 14, 2024
eb3b2ae
Update host key for changelog RSS (#30068)
PJB3005 Jul 15, 2024
c0593fb
Fix invalid UI hover/click sounds breaking client (#30067)
PJB3005 Jul 15, 2024
b35539d
Fix some markup related obsolete warnings in research and anomaly rel…
Simyon264 Jul 15, 2024
33a3032
Make addgamerule command process only valid game rules (#29912)
Winkarst-cpu Jul 15, 2024
09a0595
Automatic changelog update
PJBot Jul 15, 2024
911a94d
Add missing command description to replay_toggleui (#30071)
Simyon264 Jul 16, 2024
927cf77
Remove uses of AllObjectives (#30077)
Cojoke-dot Jul 16, 2024
2e3d2db
Revert "Change wristwatch meta description" (#30070)
EmoGarbage404 Jul 16, 2024
db3f304
Replace EntityPrototype.NoSpawn with EntityPrototype.HideSpawnMenu (#…
Plykiya Jul 16, 2024
93e4bfc
Remove Geras from Slimes to address combat balance (#29731)
Jezithyr Jul 16, 2024
21d48ca
Automatic changelog update
PJBot Jul 16, 2024
8db252e
Nerf & standardised slip times (#27879)
K-Dynamic Jul 16, 2024
8d99961
Automatic changelog update
PJBot Jul 16, 2024
13bec7a
Sign Resprite (#29806)
EmoGarbage404 Jul 17, 2024
11320f4
Automatic changelog update
PJBot Jul 17, 2024
d8ab498
Character menu issuer localization (#29840)
TheShuEd Jul 17, 2024
1fd8369
Add examine for caustic and cold damage (#29989)
lzk228 Jul 17, 2024
1ac7739
Automatic changelog update
PJBot Jul 17, 2024
6443c53
Little saw debuff (#29995)
lzk228 Jul 17, 2024
0e02c50
Automatic changelog update
PJBot Jul 17, 2024
b20fd4f
Vox displacement updates (#29824)
Flareguy Jul 17, 2024
ba2c5fc
Make the super door remote to be able to control Syndicate doors (#30…
Winkarst-cpu Jul 17, 2024
be9acae
Automatic changelog update
PJBot Jul 17, 2024
6f50778
Fix formatting warnings (#30122)
slarticodefast Jul 17, 2024
ef02f8c
Temporarily remove Vox from space ninja and Unknown Shuttle ghostrole…
Errant-4 Jul 17, 2024
2d5bb92
Automatic changelog update
PJBot Jul 17, 2024
e1f429b
DungeonSystem.Rooms bugfix (#30125)
TheShuEd Jul 17, 2024
c7ea049
Updated slime storage capacity text in guidebook (#30121)
kbailey-git Jul 17, 2024
95b56ad
Prevent Quantum Spin Inverter from Teleporting Things into Microwaves…
Cojoke-dot Jul 18, 2024
3f014e8
minor SharedInteractionSystem cleanup (#30139)
slarticodefast Jul 18, 2024
d7b2e72
Automatic changelog update
PJBot Jul 18, 2024
961a553
Fix stun batons using excess charges when thrown (#30136)
Plykiya Jul 18, 2024
58a2a4c
Automatic changelog update
PJBot Jul 18, 2024
73111b5
fix(dev_map): resave dev map (#30098)
Brandon-Huu Jul 18, 2024
a94f1f0
Correct .editorconfig to use no space after casting (#30132)
slarticodefast Jul 18, 2024
437fc93
LatheSystem independently of energy (#30148)
TheShuEd Jul 18, 2024
2fb2cde
Add item checking for moth food (#30019)
Sh18RW Jul 18, 2024
0c2b569
Automatic changelog update
PJBot Jul 18, 2024
3ef5f52
fix: give reptilians species mask sprites in lobby (#30095)
portfiend Jul 18, 2024
d30b45f
Automatic changelog update
PJBot Jul 18, 2024
84fe6bc
Fix arrow pointing animation (#30134)
Plykiya Jul 19, 2024
b571740
Remove all Assigned Values that are Never Used (#30110)
Cojoke-dot Jul 19, 2024
6d18dff
Fix for thrown items dealing damage twice to first target (#30115)
Plykiya Jul 19, 2024
56ee4da
Automatic changelog update
PJBot Jul 19, 2024
6005a9f
Fix door access in mapping mode (#30030)
metalgearsloth Jul 19, 2024
50beaae
Merge remote-tracking branch 'upriver/master' into update
Truoizys Jul 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ csharp_indent_braces = false
csharp_indent_switch_labels = true

# Space preferences
csharp_space_after_cast = true
csharp_space_after_cast = false
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_after_comma = true
csharp_space_after_dot = false
Expand Down
42 changes: 19 additions & 23 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,31 +41,22 @@ jobs:
- name: Package client
run: dotnet run --project Content.Packaging client --no-wipe-release

- name: Update Build Info
run: Tools/gen_build_info.py

- name: Shuffle files around
run: |
mkdir "release/${{ github.sha }}"
mv release/*.zip "release/${{ github.sha }}"

- name: Upload files to centcomm
uses: appleboy/scp-action@master
- name: Upload build artifact
id: artifact-upload-step
uses: actions/upload-artifact@v4
with:
host: centcomm.spacestation14.io
username: wizards-build-push
key: ${{ secrets.CENTCOMM_WIZARDS_BUILDS_PUSH_KEY }}
source: "release/${{ github.sha }}"
target: "/home/wizards-build-push/builds_dir/builds/"
strip_components: 1
name: build
path: release/*.zip
compression-level: 0
retention-days: 0

- name: Update manifest JSON
uses: appleboy/ssh-action@master
with:
host: centcomm.spacestation14.io
username: wizards-build-push
key: ${{ secrets.CENTCOMM_WIZARDS_BUILDS_PUSH_KEY }}
script: /home/wizards-build-push/push.ps1 ${{ github.sha }}
- name: Publish version
run: Tools/publish_github_artifact.py
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
ARTIFACT_ID: ${{ steps.artifact-upload-step.outputs.artifact-id }}
GITHUB_REPOSITORY: ${{ vars.GITHUB_REPOSITORY }}

- name: Publish changelog (Discord)
run: Tools/actions_changelogs_since_last_run.py
Expand All @@ -77,3 +68,8 @@ jobs:
run: Tools/actions_changelog_rss.py
env:
CHANGELOG_RSS_KEY: ${{ secrets.CHANGELOG_RSS_KEY }}

- uses: geekyeggo/delete-artifact@v5
if: always()
with:
name: build
8 changes: 0 additions & 8 deletions .github/workflows/test-packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,3 @@ jobs:

- name: Package client
run: dotnet run --project Content.Packaging client --no-wipe-release

- name: Update Build Info
run: Tools/gen_build_info.py

- name: Shuffle files around
run: |
mkdir "release/${{ github.sha }}"
mv release/*.zip "release/${{ github.sha }}"
9 changes: 8 additions & 1 deletion Content.Client/Access/UI/AccessLevelControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,18 @@ namespace Content.Client.Access.UI;
[GenerateTypedNameReferences]
public sealed partial class AccessLevelControl : GridContainer
{
[Dependency] private readonly ILogManager _logManager = default!;

private ISawmill _sawmill = default!;

public readonly Dictionary<ProtoId<AccessLevelPrototype>, Button> ButtonsList = new();

public AccessLevelControl()
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);

_sawmill = _logManager.GetSawmill("accesslevelcontrol");
}

public void Populate(List<ProtoId<AccessLevelPrototype>> accessLevels, IPrototypeManager prototypeManager)
Expand All @@ -25,7 +32,7 @@ public void Populate(List<ProtoId<AccessLevelPrototype>> accessLevels, IPrototyp
{
if (!prototypeManager.TryIndex(access, out var accessLevel))
{
Logger.Error($"Unable to find accesslevel for {access}");
_sawmill.Error($"Unable to find accesslevel for {access}");
continue;
}

Expand Down
18 changes: 12 additions & 6 deletions Content.Client/Actions/UI/ActionAlertTooltip.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Content.Client.Stylesheets;
using Content.Client.Stylesheets;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
Expand Down Expand Up @@ -77,9 +77,12 @@ public ActionAlertTooltip(FormattedMessage name, FormattedMessage? desc, string?
MaxWidth = TooltipTextMaxWidth,
StyleClasses = {StyleNano.StyleClassTooltipActionRequirements}
};
requiresLabel.SetMessage(FormattedMessage.FromMarkup("[color=#635c5c]" +
requires +
"[/color]"));

if (!FormattedMessage.TryFromMarkup("[color=#635c5c]" + requires + "[/color]", out var markup))
return;

requiresLabel.SetMessage(markup);

vbox.AddChild(requiresLabel);
}
}
Expand All @@ -97,8 +100,11 @@ protected override void FrameUpdate(FrameEventArgs args)
if (timeLeft > TimeSpan.Zero)
{
var duration = Cooldown.Value.End - Cooldown.Value.Start;
_cooldownLabel.SetMessage(FormattedMessage.FromMarkup(
$"[color=#a10505]{(int) duration.TotalSeconds} sec cooldown ({(int) timeLeft.TotalSeconds + 1} sec remaining)[/color]"));

if (!FormattedMessage.TryFromMarkup($"[color=#a10505]{(int) duration.TotalSeconds} sec cooldown ({(int) timeLeft.TotalSeconds + 1} sec remaining)[/color]", out var markup))
return;

_cooldownLabel.SetMessage(markup);
_cooldownLabel.Visible = true;
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ namespace Content.Client.Administration.UI.Tabs.ObjectsTab;
public sealed partial class ObjectsTab : Control
{
[Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly IGameTiming _timing = default!;

private readonly Color _altColor = Color.FromHex("#292B38");
private readonly Color _defaultColor = Color.FromHex("#2F2F3B");
Expand Down
12 changes: 10 additions & 2 deletions Content.Client/Audio/AudioUIController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ private void SetClickSound(string value)
{
if (!string.IsNullOrEmpty(value))
{
var resource = _cache.GetResource<AudioResource>(value);
var resource = GetSoundOrFallback(value, CCVars.UIClickSound.DefaultValue);
var source =
_audioManager.CreateAudioSource(resource);

Expand All @@ -77,7 +77,7 @@ private void SetHoverSound(string value)
{
if (!string.IsNullOrEmpty(value))
{
var hoverResource = _cache.GetResource<AudioResource>(value);
var hoverResource = GetSoundOrFallback(value, CCVars.UIHoverSound.DefaultValue);
var hoverSource =
_audioManager.CreateAudioSource(hoverResource);

Expand All @@ -95,4 +95,12 @@ private void SetHoverSound(string value)
UIManager.SetHoverSound(null);
}
}

private AudioResource GetSoundOrFallback(string path, string fallback)
{
if (!_cache.TryGetResource(path, out AudioResource? resource))
return _cache.GetResource<AudioResource>(fallback);

return resource;
}
}
1 change: 1 addition & 0 deletions Content.Client/Audio/ContentAudioSystem.AmbientMusic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Content.Shared.CCVar;
using Content.Shared.GameTicking;
using Content.Shared.Random;
using Content.Shared.Random.Rules;
using Robust.Client.GameObjects;
using Robust.Client.Player;
using Robust.Client.ResourceManagement;
Expand Down
26 changes: 26 additions & 0 deletions Content.Client/Clock/ClockSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using Content.Shared.Clock;
using Robust.Client.GameObjects;

namespace Content.Client.Clock;

public sealed class ClockSystem : SharedClockSystem
{
public override void Update(float frameTime)
{
base.Update(frameTime);

var query = EntityQueryEnumerator<ClockComponent, SpriteComponent>();
while (query.MoveNext(out var uid, out var comp, out var sprite))
{
if (!sprite.LayerMapTryGet(ClockVisualLayers.HourHand, out var hourLayer) ||
!sprite.LayerMapTryGet(ClockVisualLayers.MinuteHand, out var minuteLayer))
continue;

var time = GetClockTime((uid, comp));
var hourState = $"{comp.HoursBase}{time.Hours % 12}";
var minuteState = $"{comp.MinutesBase}{time.Minutes / 5}";
sprite.LayerSetState(hourLayer, hourState);
sprite.LayerSetState(minuteLayer, minuteState);
}
}
}
7 changes: 3 additions & 4 deletions Content.Client/Construction/ConstructionSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public sealed class ConstructionSystem : SharedConstructionSystem
{
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
[Dependency] private readonly ExamineSystemShared _examineSystem = default!;
[Dependency] private readonly SharedTransformSystem _transformSystem = default!;
[Dependency] private readonly PopupSystem _popupSystem = default!;
Expand All @@ -48,11 +47,11 @@ public override void Initialize()

CommandBinds.Builder
.Bind(ContentKeyFunctions.OpenCraftingMenu,
new PointerInputCmdHandler(HandleOpenCraftingMenu, outsidePrediction:true))
new PointerInputCmdHandler(HandleOpenCraftingMenu, outsidePrediction: true))
.Bind(EngineKeyFunctions.Use,
new PointerInputCmdHandler(HandleUse, outsidePrediction: true))
.Bind(ContentKeyFunctions.EditorFlipObject,
new PointerInputCmdHandler(HandleFlip, outsidePrediction:true))
new PointerInputCmdHandler(HandleFlip, outsidePrediction: true))
.Register<ConstructionSystem>();

SubscribeLocalEvent<ConstructionGhostComponent, ExaminedEvent>(HandleConstructionGhostExamined);
Expand Down Expand Up @@ -196,7 +195,7 @@ public bool TrySpawnGhost(
if (GhostPresent(loc))
return false;

var predicate = GetPredicate(prototype.CanBuildInImpassable, loc.ToMap(EntityManager, _transformSystem));
var predicate = GetPredicate(prototype.CanBuildInImpassable, _transformSystem.ToMapCoordinates(loc));
if (!_examineSystem.InRangeUnOccluded(user, loc, 20f, predicate: predicate))
return false;

Expand Down
2 changes: 1 addition & 1 deletion Content.Client/ContextMenu/UI/EntityMenuUIController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ private bool HandleOpenEntityMenu(in PointerInputCmdHandler.PointerInputCmdArgs
if (_combatMode.IsInCombatMode(args.Session?.AttachedEntity))
return false;

var coords = args.Coordinates.ToMap(_entityManager, _xform);
var coords = _xform.ToMapCoordinates(args.Coordinates);

if (_verbSystem.TryGetEntityMenuEntities(coords, out var entities))
OpenRootMenu(entities);
Expand Down
7 changes: 0 additions & 7 deletions Content.Client/Extinguisher/FireExtinguisherComponent.cs

This file was deleted.

27 changes: 6 additions & 21 deletions Content.Client/Flash/FlashOverlay.cs
Original file line number Diff line number Diff line change
@@ -1,27 +1,22 @@
using Content.Shared.Flash;
using Content.Shared.Flash.Components;
using Content.Shared.StatusEffect;
using Content.Client.Viewport;
using Robust.Client.Graphics;
using Robust.Client.State;
using Robust.Client.Player;
using Robust.Shared.Enums;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
using SixLabors.ImageSharp.PixelFormats;

namespace Content.Client.Flash
{
public sealed class FlashOverlay : Overlay
{
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IClyde _displayManager = default!;
[Dependency] private readonly IStateManager _stateManager = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IGameTiming _timing = default!;

private readonly StatusEffectsSystem _statusSys;
private readonly StatusEffectsSystem _statusSys;

public override OverlaySpace Space => OverlaySpace.WorldSpace;
private readonly ShaderInstance _shader;
Expand Down Expand Up @@ -56,20 +51,6 @@ protected override void FrameUpdate(FrameEventArgs args)
PercentComplete = timeDone / lastsFor;
}

public void ReceiveFlash()
{
if (_stateManager.CurrentState is IMainViewportState state)
{
// take a screenshot
// note that the callback takes a while and ScreenshotTexture will be null the first few Draws
state.Viewport.Viewport.Screenshot(image =>
{
var rgba32Image = image.CloneAs<Rgba32>(SixLabors.ImageSharp.Configuration.Default);
ScreenshotTexture = _displayManager.LoadTextureFromImage(rgba32Image);
});
}
}

protected override bool BeforeDraw(in OverlayDrawArgs args)
{
if (!_entityManager.TryGetComponent(_playerManager.LocalEntity, out EyeComponent? eyeComp))
Expand All @@ -82,6 +63,11 @@ protected override bool BeforeDraw(in OverlayDrawArgs args)

protected override void Draw(in OverlayDrawArgs args)
{
if (RequestScreenTexture && ScreenTexture != null)
{
ScreenshotTexture = ScreenTexture;
RequestScreenTexture = false; // we only need the first frame, so we can stop the request now for performance reasons
}
if (ScreenshotTexture == null)
return;

Expand All @@ -96,7 +82,6 @@ protected override void DisposeBehavior()
{
base.DisposeBehavior();
ScreenshotTexture = null;
PercentComplete = 1.0f;
}
}
}
14 changes: 3 additions & 11 deletions Content.Client/Flash/FlashSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public override void Initialize()
SubscribeLocalEvent<FlashedComponent, ComponentShutdown>(OnShutdown);
SubscribeLocalEvent<FlashedComponent, LocalPlayerAttachedEvent>(OnPlayerAttached);
SubscribeLocalEvent<FlashedComponent, LocalPlayerDetachedEvent>(OnPlayerDetached);
SubscribeLocalEvent<FlashedComponent, StatusEffectAddedEvent>(OnStatusAdded);

_overlay = new();
}
Expand All @@ -34,15 +33,16 @@ private void OnPlayerAttached(EntityUid uid, FlashedComponent component, LocalPl

private void OnPlayerDetached(EntityUid uid, FlashedComponent component, LocalPlayerDetachedEvent args)
{
_overlay.PercentComplete = 1.0f;
_overlay.ScreenshotTexture = null;
_overlay.RequestScreenTexture = false;
_overlayMan.RemoveOverlay(_overlay);
}

private void OnInit(EntityUid uid, FlashedComponent component, ComponentInit args)
{
if (_player.LocalEntity == uid)
{
_overlay.RequestScreenTexture = true;
_overlayMan.AddOverlay(_overlay);
}
}
Expand All @@ -51,17 +51,9 @@ private void OnShutdown(EntityUid uid, FlashedComponent component, ComponentShut
{
if (_player.LocalEntity == uid)
{
_overlay.PercentComplete = 1.0f;
_overlay.ScreenshotTexture = null;
_overlay.RequestScreenTexture = false;
_overlayMan.RemoveOverlay(_overlay);
}
}

private void OnStatusAdded(EntityUid uid, FlashedComponent component, StatusEffectAddedEvent args)
{
if (_player.LocalEntity == uid && args.Key == FlashedKey)
{
_overlay.ReceiveFlash();
}
}
}
3 changes: 2 additions & 1 deletion Content.Client/Gameplay/GameplayStateBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ private bool HandleInspect(ICommonSession? session, EntityCoordinates coords, En

public IEnumerable<EntityUid> GetClickableEntities(EntityCoordinates coordinates)
{
return GetClickableEntities(coordinates.ToMap(_entityManager, _entitySystemManager.GetEntitySystem<SharedTransformSystem>()));
var transformSystem = _entitySystemManager.GetEntitySystem<SharedTransformSystem>();
return GetClickableEntities(transformSystem.ToMapCoordinates(coordinates));
}

public IEnumerable<EntityUid> GetClickableEntities(MapCoordinates coordinates)
Expand Down
1 change: 0 additions & 1 deletion Content.Client/Lathe/UI/LatheMenu.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ public sealed partial class LatheMenu : DefaultWindow
{
[Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IResourceCache _resources = default!;

private EntityUid _owner;
private readonly SpriteSystem _spriteSystem;
Expand Down
Loading
Loading