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

Mergrdsl #92

Merged
merged 83 commits into from
Feb 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
df97ba5
Automatic Changelog Update (#1776)
SimpleStation14 Feb 14, 2025
ed593f0
Sedin (#27110) (#1786)
sleepyyapril Feb 14, 2025
969b527
Automatic Changelog Update (#1786)
SimpleStation14 Feb 14, 2025
20dc60d
Remove Nonlethal Ammo Research (#1784)
VMSolidus Feb 14, 2025
ef8e0dd
Automatic Changelog Update (#1784)
SimpleStation14 Feb 14, 2025
7d8c047
Telecrystal Rebalance (#1785)
VMSolidus Feb 14, 2025
72d55a7
Re-Add Missing Recipes To Industrial Ore Processor (#1777)
angelofallars Feb 14, 2025
07fb22b
Automatic Changelog Update (#1785)
SimpleStation14 Feb 14, 2025
a0c062e
Automatic Changelog Update (#1777)
SimpleStation14 Feb 14, 2025
7ca8b2f
Fix Silly Test Fail (#1787)
sleepyyapril Feb 14, 2025
605cb3e
Hotfix Shuttles FTL. (#1783)
VMSolidus Feb 14, 2025
411c58e
Adds Justice Channel To AI (#1782)
Sornarok Feb 14, 2025
d749234
Fixes Rejuvenation Rune to Heal Specific Damage Types Instead of Grou…
Sornarok Feb 14, 2025
21500f3
Automatic Changelog Update (#1778)
SimpleStation14 Feb 14, 2025
5516dda
Disposable Syringes (#1775)
Timfa2112 Feb 14, 2025
77b7a4d
Automatic Changelog Update (#1775)
SimpleStation14 Feb 14, 2025
76c53af
IPCs Can Take High Capacity Batteries with Loadout (#1793)
EctoplasmIsGood Feb 15, 2025
4109f0b
Automatic Changelog Update (#1793)
SimpleStation14 Feb 15, 2025
b0d278b
BSO Paramed Gaming (#1795)
EctoplasmIsGood Feb 15, 2025
bc8d2ba
Automatic Changelog Update (#1795)
SimpleStation14 Feb 15, 2025
13331f5
Remove Antag Advantage (#1796)
VMSolidus Feb 15, 2025
f6d0296
Two New Traits. (#1792)
Diggy0 Feb 15, 2025
6b9917e
Automatic Changelog Update (#1792)
SimpleStation14 Feb 15, 2025
6647eca
Two New .25 Caseless Guns (#1794)
VMSolidus Feb 15, 2025
21567ac
Automatic Changelog Update (#1794)
SimpleStation14 Feb 15, 2025
3c37ff1
v245.0.0 (and Storage UI V2) (#1799)
sleepyyapril Feb 15, 2025
8c65f88
Automatic Changelog Update (#1799)
SimpleStation14 Feb 15, 2025
6a63c87
Fix Every Debug Test Fail (#1803)
VMSolidus Feb 16, 2025
4efb0b3
v246.0.0 + Planet Lighting (#1802)
sleepyyapril Feb 16, 2025
f8c5a81
Automatic Changelog Update (#1802)
SimpleStation14 Feb 16, 2025
69b8b29
Update TraitorRuleComponent.cs (#1808)
VMSolidus Feb 16, 2025
3898c65
Make Footstep Entity Better (#1809)
lzk228 Feb 17, 2025
d5d071a
Prevent SecretRule From Picking Invalid Presets (#27456) (#1805)
sleepyyapril Feb 17, 2025
b1dcba8
Lambda Station: Minor Fixes (#1800)
Ichaie Feb 17, 2025
f850450
Automatic Changelog Update (#1800)
SimpleStation14 Feb 17, 2025
e6e77bc
Katayusha's Director's Cut: Pebble [Part 1] (#1779)
Plyushsune Feb 17, 2025
697c988
Automatic Changelog Update (#1779)
SimpleStation14 Feb 17, 2025
2772114
Scroll to Bottom when Selecting a New Chat (#1814)
sleepyyapril Feb 17, 2025
b286bec
Automatic Changelog Update (#1814)
SimpleStation14 Feb 17, 2025
623b11c
IPCs Now Have Access to Cyber Eye Traits without Having to Pick the I…
Diggy0 Feb 17, 2025
fff98c1
Automatic Changelog Update (#1813)
SimpleStation14 Feb 17, 2025
831a44d
Fix Surplus Bundles (#1811)
VMSolidus Feb 17, 2025
16fed47
Automatic Changelog Update (#1811)
SimpleStation14 Feb 17, 2025
6172305
Corpsman Crew Monitor (#1817)
EctoplasmIsGood Feb 17, 2025
55065b4
Automatic Changelog Update (#1817)
SimpleStation14 Feb 17, 2025
2a91289
Disable Unecessary Roundstart Variations (#1815)
VMSolidus Feb 17, 2025
e094dde
Automatic Changelog Update (#1815)
SimpleStation14 Feb 17, 2025
541f169
Port Supermatter Updates From Impstation (#1719)
VMSolidus Feb 17, 2025
38b5906
Automatic Changelog Update (#1719)
SimpleStation14 Feb 17, 2025
7c4953a
Lighthouse Update (SiN Mapping Team) (#1806)
VMSolidus Feb 18, 2025
6119ba2
Automatic Changelog Update (#1806)
SimpleStation14 Feb 18, 2025
53d1648
Update Credits (#1801)
github-actions[bot] Feb 18, 2025
241def5
BSO Lifeline Port (#1730)
Sarahon Feb 18, 2025
6c0c9ad
Automatic Changelog Update (#1730)
SimpleStation14 Feb 18, 2025
93eba08
Port And Update Cybersun Stealth Hardsuit (#866) (#1807)
VMSolidus Feb 20, 2025
52654a2
Automatic Changelog Update (#1807)
SimpleStation14 Feb 20, 2025
eca4197
Cherrypick Wizden Pr 29151 (#1825)
VMSolidus Feb 20, 2025
f3679f4
Muted Tweaks and Fixes (#1823)
GNUtopia Feb 20, 2025
36a4390
Automatic Changelog Update (#1823)
SimpleStation14 Feb 20, 2025
778ee23
Update pebble.yml (#1826)
VMSolidus Feb 20, 2025
18db872
Apply RoofOverlay Per-Grid Not Per-Map + Fix Lighting Quality (#35207…
sleepyyapril Feb 21, 2025
d2ac137
Automatic Changelog Update (#1829)
SimpleStation14 Feb 21, 2025
45905b2
Fix Singulo (#1830)
VMSolidus Feb 21, 2025
77159c2
Automatic Changelog Update (#1830)
SimpleStation14 Feb 21, 2025
88ed6c3
Let Humans Have Long Ears! (#1818)
Sarahon Feb 21, 2025
8134953
Automatic Changelog Update (#1818)
SimpleStation14 Feb 21, 2025
4b1cc70
Some More BSO Options (#1816)
VMSolidus Feb 21, 2025
d46cc6a
Automatic Changelog Update (#1816)
SimpleStation14 Feb 21, 2025
719f837
More Gunsmithing (#1810)
VMSolidus Feb 21, 2025
16c6959
Automatic Changelog Update (#1810)
SimpleStation14 Feb 21, 2025
3014a0d
Renamable Component (#1821)
Timfa2112 Feb 21, 2025
be2fa99
Automatic Changelog Update (#1821)
SimpleStation14 Feb 21, 2025
5602211
Plantbot (#1831)
Timfa2112 Feb 21, 2025
2063b01
Automatic Changelog Update (#1831)
SimpleStation14 Feb 21, 2025
4bb15a1
Experimental Welder Rework (#1832)
EctoplasmIsGood Feb 22, 2025
b104fe5
Automatic Changelog Update (#1832)
SimpleStation14 Feb 22, 2025
a7760a6
Allow Weldbot to Fix Specific Structures (#1838)
Timfa2112 Feb 22, 2025
321243e
Automatic Changelog Update (#1838)
SimpleStation14 Feb 22, 2025
482d4ac
Update Credits (#1839)
github-actions[bot] Feb 23, 2025
23e332e
Allow Tricordrazine to Heal Minor Accidental Exposures (#1840)
Timfa2112 Feb 24, 2025
8f5f699
Automatic Changelog Update (#1840)
SimpleStation14 Feb 24, 2025
a1b622a
Merge branch 'master' of https://github.com/Simple-Station/Einstein-E…
Aidenkrz Feb 24, 2025
dcdf606
update rt
Aidenkrz Feb 24, 2025
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
  •  
  •  
  •  
21 changes: 11 additions & 10 deletions Content.Client/Cargo/Systems/CargoSystem.Telepad.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,33 +64,34 @@ private void OnCargoAnimComplete(EntityUid uid, CargoTelepadComponent component,

private void OnChangeData(EntityUid uid, SpriteComponent? sprite = null)
{
if (!Resolve(uid, ref sprite))
if (!Resolve(uid, ref sprite)
|| !EntityManager.TryGetComponent(uid, out AnimationPlayerComponent? animation))
return;

var entity = new Entity<AnimationPlayerComponent>(uid, animation);
_appearance.TryGetData<CargoTelepadState?>(uid, CargoTelepadVisuals.State, out var state);
AnimationPlayerComponent? player = null;

switch (state)
{
case CargoTelepadState.Teleporting:
if (_player.HasRunningAnimation(uid, TelepadBeamKey))
if (_player.HasRunningAnimation(uid, animation, TelepadBeamKey))
return;
_player.Stop(uid, player, TelepadIdleKey);
_player.Play(uid, player, CargoTelepadBeamAnimation, TelepadBeamKey);
_player.Stop(entity, animation, TelepadIdleKey);
_player.Play(entity, CargoTelepadBeamAnimation, TelepadBeamKey);
break;
case CargoTelepadState.Unpowered:
sprite.LayerSetVisible(CargoTelepadLayers.Beam, false);
_player.Stop(uid, player, TelepadBeamKey);
_player.Stop(uid, player, TelepadIdleKey);
_player.Stop(uid, animation, TelepadBeamKey);
_player.Stop(uid, animation, TelepadIdleKey);
break;
default:
sprite.LayerSetVisible(CargoTelepadLayers.Beam, true);

if (_player.HasRunningAnimation(uid, player, TelepadIdleKey) ||
_player.HasRunningAnimation(uid, player, TelepadBeamKey))
if (_player.HasRunningAnimation(uid, animation, TelepadIdleKey) ||
_player.HasRunningAnimation(uid, animation, TelepadBeamKey))
return;

_player.Play(uid, player, CargoTelepadIdleAnimation, TelepadIdleKey);
_player.Play(entity, CargoTelepadIdleAnimation, TelepadIdleKey);
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Content.Client.Chemistry.UI;
using Content.Client.Items;
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.EntitySystems;
using Robust.Shared.GameStates;

namespace Content.Client.Chemistry.EntitySystems;

public sealed class FillableOneTimeInjectorSystem : SharedFillableOneTimeInjectorSystem
{
public override void Initialize()
{
base.Initialize();
Subs.ItemStatus<FillableOneTimeInjectorComponent>(ent => new FillableOneTimeInjectorStatusControl(ent, SolutionContainers));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
using Content.Client.Message;
using Content.Client.Stylesheets;
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.FixedPoint;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.Timing;

namespace Content.Client.Chemistry.UI;

public sealed class FillableOneTimeInjectorStatusControl : Control
{
private readonly Entity<FillableOneTimeInjectorComponent> _parent;
private readonly SharedSolutionContainerSystem _solutionContainers;
private readonly RichTextLabel _label;

private FixedPoint2 PrevVolume;
private FixedPoint2 PrevMaxVolume;
private FixedPoint2 PrevTransferAmount;
private FillableOneTimeInjectorToggleMode PrevToggleStateIndex;

public FillableOneTimeInjectorStatusControl(Entity<FillableOneTimeInjectorComponent> parent, SharedSolutionContainerSystem solutionContainers)
{
_parent = parent;
_solutionContainers = solutionContainers;
_label = new RichTextLabel { StyleClasses = { StyleNano.StyleClassItemStatus } };
AddChild(_label);
}

protected override void FrameUpdate(FrameEventArgs args)
{
base.FrameUpdate(args);

if (!_solutionContainers.TryGetSolution(_parent.Owner, _parent.Comp.SolutionName, out _, out var solution))
return;

// only updates the UI if any of the details are different than they previously were
if (PrevVolume == solution.Volume
&& PrevMaxVolume == solution.MaxVolume
&& PrevTransferAmount == _parent.Comp.TransferAmount)
return;

PrevVolume = solution.Volume;
PrevMaxVolume = solution.MaxVolume;
PrevTransferAmount = _parent.Comp.TransferAmount;
var modeStringLocalized = "";

// only updates the UI if any of the details are different than they previously were
if(PrevToggleStateIndex == _parent.Comp.ToggleState)
return;

PrevToggleStateIndex = _parent.Comp.ToggleState;

// Update current volume and injector state
modeStringLocalized = Loc.GetString(
_parent.Comp.ToggleState switch
{
FillableOneTimeInjectorToggleMode.Draw => "injector-draw-text",
FillableOneTimeInjectorToggleMode.Inject => "injector-inject-text",
FillableOneTimeInjectorToggleMode.Spent => "injector-spent-text",
_ => "injector-invalid-injector-toggle-mode"
});

if (_parent.Comp.ToggleState != FillableOneTimeInjectorToggleMode.Draw)
{
_label.SetMarkup(
Loc.GetString(
"onetime-injector-simple-volume-label",
("currentVolume", solution.Volume),
("modeString", modeStringLocalized)));
}
else
{
_label.SetMarkup(
Loc.GetString(
"injector-volume-label",
("currentVolume", solution.Volume),
("totalVolume", solution.MaxVolume),
("modeString", modeStringLocalized),
("transferVolume", _parent.Comp.TransferAmount)));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ private void SelectChat(uint number)
UpdateChatList(_recipients);
}

if (MessageList.Parent is ScrollContainer scroll)
scroll.SetScrollValue(new Vector2(0, float.MaxValue));

ActionSendUiMessage?.Invoke(NanoChatUiMessageType.SelectChat, number, null, null);
UpdateCurrentChat();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public override void UpdateState(BoundUserInterfaceState state)
}
}

private static void SendStockTradingUiMessage(StockTradingUiAction action, int company, float amount, BoundUserInterface userInterface)
private static void SendStockTradingUiMessage(StockTradingUiAction action, int company, int amount, BoundUserInterface userInterface)
{
var newsMessage = new StockTradingUiMessageEvent(action, company, amount);
var message = new CartridgeUiMessage(newsMessage);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ public sealed partial class StockTradingUiFragment : BoxContainer
private readonly Dictionary<int, CompanyEntry> _companyEntries = new();

// Event handlers for the parent UI
public event Action<int, float>? OnBuyButtonPressed;
public event Action<int, float>? OnSellButtonPressed;
public event Action<int, int>? OnBuyButtonPressed;
public event Action<int, int>? OnSellButtonPressed;

// Define colors
public static readonly Color PositiveColor = Color.FromHex("#00ff00"); // Green
Expand Down Expand Up @@ -70,8 +70,8 @@ private sealed class CompanyEntry

public CompanyEntry(int companyIndex,
string displayName,
Action<int, float>? onBuyPressed,
Action<int, float>? onSellPressed)
Action<int, int>? onBuyPressed,
Action<int, int>? onSellPressed)
{
Container = new BoxContainer
{
Expand Down Expand Up @@ -216,13 +216,13 @@ public CompanyEntry(int companyIndex,
// Button click events
_buyButton.OnPressed += _ =>
{
if (float.TryParse(_amountEdit.Text, out var amount) && amount > 0)
if (int.TryParse(_amountEdit.Text, out var amount) && amount > 0)
onBuyPressed?.Invoke(companyIndex, amount);
};

_sellButton.OnPressed += _ =>
{
if (float.TryParse(_amountEdit.Text, out var amount) && amount > 0)
if (int.TryParse(_amountEdit.Text, out var amount) && amount > 0)
onSellPressed?.Invoke(companyIndex, amount);
};

Expand All @@ -235,7 +235,7 @@ public CompanyEntry(int companyIndex,
};
}

public void Update(StockCompanyStruct company, int ownedStocks)
public void Update(StockCompany company, int ownedStocks)
{
_nameLabel.Text = company.LocalizedDisplayName;
_priceLabel.Text = $"${company.CurrentPrice:F2}";
Expand Down
8 changes: 6 additions & 2 deletions Content.Client/Guidebook/Controls/GuidebookWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
xmlns:cc="clr-namespace:Content.Client.Administration.UI.CustomControls"
xmlns:fancyTree="clr-namespace:Content.Client.UserInterface.Controls.FancyTree"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
SetSize="900 700"
SetSize="850 700"
MinSize="100 200"
Resizable="True"
Title="{Loc 'guidebook-window-title'}">
Expand All @@ -21,9 +21,13 @@
Margin="0 5 10 5">
</LineEdit>
</BoxContainer>
<BoxContainer Access="Internal" Name="ReturnContainer" Orientation="Horizontal" HorizontalAlignment="Right" Visible="False">
<Button Name="HomeButton" Text="{Loc 'ui-rules-button-home'}" Margin="0 0 10 0"/>
</BoxContainer>
<ScrollContainer Name="Scroll" HScrollEnabled="False" HorizontalExpand="True" VerticalExpand="True">
<Control>
<BoxContainer Orientation="Vertical" Name="EntryContainer" Margin="5 5 5 5" Visible="False"/>
<BoxContainer Orientation="Vertical" Name="EntryContainer" Margin="5 5 5 5" Visible="False">
</BoxContainer>
<BoxContainer Orientation="Vertical" Name="Placeholder" Margin="5 5 5 5">
<Label HorizontalAlignment="Center" VerticalAlignment="Center" Text="{Loc 'guidebook-placeholder-text'}"/>
<Label HorizontalAlignment="Center" VerticalAlignment="Center" Text="{Loc 'guidebook-placeholder-text-2'}"/>
Expand Down
16 changes: 12 additions & 4 deletions Content.Client/Guidebook/Controls/GuidebookWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
using Content.Client.UserInterface.Systems.Info; /// For the RuleEntry Check
using Content.Client.Guidebook; /// For the RuleEntry Check
using JetBrains.Annotations;
using Content.Client.UserInterface.Systems.Info;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.ContentPack;
using Robust.Shared.Prototypes;

namespace Content.Client.Guidebook.Controls;

Expand All @@ -23,6 +25,8 @@ public sealed partial class GuidebookWindow : FancyWindow, ILinkClickHandler

private Dictionary<string, GuideEntry> _entries = new();

public ProtoId<GuideEntryPrototype> LastEntry;

public GuidebookWindow()
{
RobustXamlLoader.Load(this);
Expand All @@ -39,7 +43,13 @@ public GuidebookWindow()
private void OnSelectionChanged(TreeItem? item)
{
if (item != null && item.Metadata is GuideEntry entry)
{
ShowGuide(entry);

var isRulesEntry = entry.RuleEntry;
ReturnContainer.Visible = isRulesEntry;
HomeButton.OnPressed += _ => ShowGuide(entry);
}
else
ClearSelectedGuide();
}
Expand Down Expand Up @@ -68,6 +78,8 @@ private void ShowGuide(GuideEntry entry)
EntryContainer.AddChild(new Label() { Text = "ERROR: Failed to parse document." });
Logger.Error($"Failed to parse contents of guide document {entry.Id}.");
}

LastEntry = entry.Id;
}

public void UpdateGuides(
Expand Down Expand Up @@ -154,10 +166,6 @@ private void RepopulateTree(List<string>? roots = null, string? forcedRoot = nul
return null;
}

/// <summary>
/// This is set for removing guideentries from the guidebook that are rule entries.
/// Check above.
/// </summary>
var rulesProto = UserInterfaceManager.GetUIController<InfoUIController>().GetCoreRuleEntry();
if (entry.RuleEntry && entry.Id != rulesProto.Id)
return null;
Expand Down
2 changes: 2 additions & 0 deletions Content.Client/Guidebook/GuideEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@
/// </summary>
[DataField("filterEnabled")] public bool FilterEnabled = default!;

[DataField] public bool RuleEntry;

/// <summary>
/// This enables the ability to remove a rule entry from the guidebook.
/// When enabled in the yml guide entry, it will remove the guide entry from the guidebook.
/// </summary>
[DataField] public bool RuleEntry;

Check failure on line 43 in Content.Client/Guidebook/GuideEntry.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

The type 'GuideEntry' already contains a definition for 'RuleEntry'

Check failure on line 43 in Content.Client/Guidebook/GuideEntry.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

The type 'GuideEntry' already contains a definition for 'RuleEntry'

Check failure on line 43 in Content.Client/Guidebook/GuideEntry.cs

View workflow job for this annotation

GitHub Actions / YAML Linter

The type 'GuideEntry' already contains a definition for 'RuleEntry'

Check failure on line 43 in Content.Client/Guidebook/GuideEntry.cs

View workflow job for this annotation

GitHub Actions / YAML Linter

The type 'GuideEntry' already contains a definition for 'RuleEntry'

Check failure on line 43 in Content.Client/Guidebook/GuideEntry.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

The type 'GuideEntry' already contains a definition for 'RuleEntry'

Check failure on line 43 in Content.Client/Guidebook/GuideEntry.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

The type 'GuideEntry' already contains a definition for 'RuleEntry'

Check failure on line 43 in Content.Client/Guidebook/GuideEntry.cs

View workflow job for this annotation

GitHub Actions / Test Packaging

The type 'GuideEntry' already contains a definition for 'RuleEntry'

Check failure on line 43 in Content.Client/Guidebook/GuideEntry.cs

View workflow job for this annotation

GitHub Actions / Test Packaging

The type 'GuideEntry' already contains a definition for 'RuleEntry'

/// <summary>
/// Priority for sorting top-level guides when shown in a tree / table of contents.
Expand Down
59 changes: 59 additions & 0 deletions Content.Client/Light/AfterLightTargetOverlay.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
using System.Numerics;
using Robust.Client.Graphics;
using Robust.Shared.Enums;

namespace Content.Client.Light;

/// <summary>
/// This exists just to copy <see cref="BeforeLightTargetOverlay"/> to the light render target
/// </summary>
public sealed class AfterLightTargetOverlay : Overlay
{
public override OverlaySpace Space => OverlaySpace.BeforeLighting;

[Dependency] private readonly IOverlayManager _overlay = default!;

public const int ContentZIndex = LightBlurOverlay.ContentZIndex + 1;

public AfterLightTargetOverlay()
{
IoCManager.InjectDependencies(this);
ZIndex = ContentZIndex;
}

protected override void Draw(in OverlayDrawArgs args)
{
var viewport = args.Viewport;
var worldHandle = args.WorldHandle;

if (viewport.Eye == null)
return;

var lightOverlay = _overlay.GetOverlay<BeforeLightTargetOverlay>();
var bounds = args.WorldBounds;

// at 1-1 render scale it's mostly fine but at 4x4 it's way too fkn big
var lightScale = viewport.LightRenderTarget.Size / (Vector2) viewport.Size;
var newScale = viewport.RenderScale / (Vector2.One / lightScale);

var localMatrix =
viewport.LightRenderTarget.GetWorldToLocalMatrix(viewport.Eye, newScale);
var diff = (lightOverlay.EnlargedLightTarget.Size - viewport.LightRenderTarget.Size);
var halfDiff = diff / 2;

// Pixels -> Metres -> Half distance.
// If we're zoomed in need to enlarge the bounds further.
args.WorldHandle.RenderInRenderTarget(viewport.LightRenderTarget,
() =>
{
// We essentially need to draw the cropped version onto the lightrendertarget.
var subRegion = new UIBox2i(halfDiff.X,
halfDiff.Y,
viewport.LightRenderTarget.Size.X + halfDiff.X,
viewport.LightRenderTarget.Size.Y + halfDiff.Y);

worldHandle.SetTransform(localMatrix);
worldHandle.DrawTextureRectRegion(lightOverlay.EnlargedLightTarget.Texture, bounds, subRegion: subRegion);
}, null);
}
}
Loading
Loading