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

Up060824 #2

Merged
merged 125 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
125 commits
Select commit Hold shift + click to select a range
307762c
base (#1718)
AF-Buyrcsp2 Jul 22, 2024
4a655c3
Prospector (Update) (#1714)
ErhardSteinhauer Jul 22, 2024
81cbe39
Automatic Changelog (#1714)
FrontierATC Jul 22, 2024
314b7e5
Investigator (Update) (#1671)
ErhardSteinhauer Jul 22, 2024
94ec542
Automatic Changelog (#1671)
FrontierATC Jul 22, 2024
72fd6d2
Add FuelVend vendor. (#1601)
whatston3 Jul 22, 2024
4d55384
Automatic Changelog (#1601)
FrontierATC Jul 22, 2024
646e637
Added FuelVend to The Lodge and Grifty's (#1722)
ErhardSteinhauer Jul 23, 2024
4ca556e
Automatic Changelog (#1722)
FrontierATC Jul 23, 2024
afe328e
SR paperwork templates (#1727)
ErhardSteinhauer Jul 24, 2024
7dbdf08
Automatic Changelog (#1727)
FrontierATC Jul 24, 2024
1a7f753
Computer YAML cleanup (#1723)
whatston3 Jul 24, 2024
d68faca
STC Hat and free laceup shoes (#1721)
MagnusCrowe Jul 24, 2024
df926f8
Automatic Changelog (#1721)
FrontierATC Jul 24, 2024
b468f25
Pirate Bounties (#1513)
Salvantrix Jul 24, 2024
ee2f863
Spawned random human corpses drop rotten meat if butchered (#1730)
ErhardSteinhauer Jul 25, 2024
30b7d5d
Automatic Changelog (#1730)
FrontierATC Jul 25, 2024
f30ea57
Adds author info to SBB and ships built by Tych0/Arimah (#1734)
Tych0theSynth Jul 26, 2024
5324187
ATM rotation fixes (#1731)
whatston3 Jul 26, 2024
2d27d83
Fix Hauler death trap closet (#1739)
arimah Jul 27, 2024
35d4afa
Automatic Changelog (#1739)
FrontierATC Jul 27, 2024
30065ef
ShipyardSystem: restore ping (currently per-user) (#1736)
whatston3 Jul 27, 2024
fbcdc7a
Save old bank balance on randomized characters (#1738)
whatston3 Jul 27, 2024
3ef40ff
Automatic Changelog (#1738)
FrontierATC Jul 27, 2024
6645a76
Late join lobby UI fixes (#1716)
whatston3 Jul 27, 2024
552ee48
Automatic Changelog (#1716)
FrontierATC Jul 27, 2024
bd25cf4
Minor fixes and tweaks for blood moon and syndie vessel (#1709)
ErhardSteinhauer Jul 27, 2024
0ae5a13
Automatic Changelog (#1709)
FrontierATC Jul 27, 2024
f27b86a
Gestio Re-balance (#1729)
ErhardSteinhauer Jul 27, 2024
4d55829
Automatic Changelog (#1729)
FrontierATC Jul 27, 2024
17fd087
No (#1743)
dvir001 Jul 27, 2024
d16f155
Automatic Changelog (#1743)
FrontierATC Jul 27, 2024
cb1ee06
Loadouts: Fallbacks as defaults, less redundancy, harpy/diona fixes (…
whatston3 Jul 27, 2024
8bcb929
Automatic Changelog (#1717)
FrontierATC Jul 27, 2024
849756f
Empty Welders (#1744)
dvir001 Jul 27, 2024
31b03e5
Automatic Changelog (#1744)
FrontierATC Jul 27, 2024
8ccea75
Add a few recipes to the engineering techfab (#1720)
arimah Jul 27, 2024
a345994
Automatic Changelog (#1720)
FrontierATC Jul 27, 2024
5956783
Before Gib Fixup (#1735)
dvir001 Jul 27, 2024
54e265a
Radioactive HyperPacman Generator (#1712)
dvir001 Jul 27, 2024
8a1b933
Automatic Changelog (#1712)
FrontierATC Jul 27, 2024
24a76fe
NFSD Badges, Loadout Decency (#1745)
whatston3 Jul 27, 2024
9bbe3f2
mobs (#1746)
ErhardSteinhauer Jul 27, 2024
d727ba1
Automatic Changelog (#1746)
FrontierATC Jul 27, 2024
1c236cb
Adds the CiviMed Vending Machine (#1637)
dustylens Jul 27, 2024
9986396
Vulp Cannon (#1706)
whatston3 Jul 27, 2024
c1afbf7
Automatic Changelog (#1706)
FrontierATC Jul 27, 2024
81747ab
Turrets: updated sprites and new entities (#1692)
ErhardSteinhauer Jul 27, 2024
b7e4ca3
Automatic Changelog (#1692)
FrontierATC Jul 27, 2024
502c7c1
Loadout Hotfix: RoleLoadout checks subgroups in EnsureValid (#1753)
whatston3 Jul 28, 2024
b824de7
Sprinter (Update) (#1752)
dvir001 Jul 28, 2024
1cdd6d3
Automatic Changelog (#1752)
FrontierATC Jul 28, 2024
2a6a3df
Update Maint Loot (#1751)
dvir001 Jul 28, 2024
f08508a
Apothecary Post Launch Update (#1733)
dustylens Jul 28, 2024
07db37c
Update BiomassReclaimerSystem.cs (#1750)
dvir001 Jul 28, 2024
fe55805
30% markup for expedition shuttles (#1747)
ErhardSteinhauer Jul 29, 2024
78a134f
Automatic Changelog (#1747)
FrontierATC Jul 29, 2024
87f5560
Pirate hotfix: PirateFrontierVessel->Standard... (#1757)
whatston3 Jul 30, 2024
c1364e7
Minor bug fixes (#1758)
ErhardSteinhauer Jul 30, 2024
ac03ce3
Automatic Changelog (#1758)
FrontierATC Jul 30, 2024
ee1db38
Loadouts: make masks mandatory (#1754)
whatston3 Jul 30, 2024
7db7cd3
Automatic Changelog (#1754)
FrontierATC Jul 30, 2024
c4bf24d
Jerry Cans (#1759)
whatston3 Aug 1, 2024
c01ef19
Automatic Changelog (#1759)
FrontierATC Aug 1, 2024
c5a1b08
Brigand (Update) (#1715)
ErhardSteinhauer Aug 1, 2024
b9d591d
Automatic Changelog (#1715)
FrontierATC Aug 1, 2024
ae070fe
Remove DC Cleithro (#1767)
arimah Aug 1, 2024
2937608
Automatic Changelog (#1767)
FrontierATC Aug 1, 2024
061dd40
Dev Map (#1755)
dvir001 Aug 2, 2024
4f6e106
Construct attributions (#1769)
GreaseMonk Aug 2, 2024
b942702
Automatic Changelog (#1769)
FrontierATC Aug 2, 2024
b08044b
Fix client crash when accessing some shuttle consoles (#1772)
ArkiveDev Aug 2, 2024
baf67cd
Automatic Changelog (#1772)
FrontierATC Aug 2, 2024
3f333a2
Fixed faction on experimental nfsd hardsuit (#1775)
ErhardSteinhauer Aug 2, 2024
1287faa
Automatic Changelog (#1775)
FrontierATC Aug 2, 2024
d858260
Update dev_map.yml (#1777)
dvir001 Aug 2, 2024
1f23689
first localisation
Vonsant Aug 3, 2024
6aeabd7
Corvax Localisation
Vonsant Aug 3, 2024
7c25ff0
Remove microwave from SV Orange (#1779)
arimah Aug 3, 2024
af64678
Automatic Changelog (#1779)
FrontierATC Aug 3, 2024
ea52358
Fix selective dropper (#1771)
arimah Aug 3, 2024
3ae6e1c
Kegs + Urn Update (#1774)
dvir001 Aug 3, 2024
12e8e22
Napkins (#1770)
dvir001 Aug 3, 2024
8074d15
Automatic Changelog (#1774)
FrontierATC Aug 3, 2024
c4da3de
Automatic Changelog (#1770)
FrontierATC Aug 3, 2024
7f35cfe
Medical paperwork templates (#1728)
ErhardSteinhauer Aug 3, 2024
08c2e2d
Automatic Changelog (#1728)
FrontierATC Aug 3, 2024
1860993
Fixes
Vonsant Aug 3, 2024
56014f7
Trade Station Tweaks (#1786)
ErhardSteinhauer Aug 3, 2024
2260105
Automatic Changelog (#1786)
FrontierATC Aug 3, 2024
efb10f2
Fixes2
Vonsant Aug 3, 2024
bc8cb42
Update gravity_generator.yml (#1783)
dvir001 Aug 3, 2024
67d2f32
Shuttles and POI
Vonsant Aug 4, 2024
0dad75e
le fix (#1785)
ErhardSteinhauer Aug 4, 2024
ee8af6f
Automatic Changelog (#1785)
FrontierATC Aug 4, 2024
9c0bf1a
Removed whitelists from belts (#1773)
ErhardSteinhauer Aug 4, 2024
7879fd8
Automatic Changelog (#1773)
FrontierATC Aug 4, 2024
55c1103
Frontier Market / Trading console v0.1 (#1765)
GreaseMonk Aug 4, 2024
9bc12ed
Automatic Changelog (#1765)
FrontierATC Aug 4, 2024
7e0663e
Ceres (tiny fix): Passive vent into space, not scrubber (#1764)
arimah Aug 4, 2024
1d462cf
Automatic Changelog (#1764)
FrontierATC Aug 4, 2024
71a213f
Adds SR Shipyard Console to Frontier Outpost (#1725)
Tych0theSynth Aug 4, 2024
0a74b39
Automatic Changelog (#1725)
FrontierATC Aug 4, 2024
47dcca7
Allow reapplying approved and denied stamps (#1695)
whatston3 Aug 4, 2024
3cc5b5a
Automatic Changelog (#1695)
FrontierATC Aug 4, 2024
fc9841f
LVHI branding for some shuttles (#1781)
ErhardSteinhauer Aug 4, 2024
fee0826
Automatic Changelog (#1781)
FrontierATC Aug 4, 2024
b11ba3b
Fix Broken Grid Names (#1789)
dvir001 Aug 4, 2024
a59d457
Revert "Fix Broken Grid Names (#1789)" (#1790)
dvir001 Aug 4, 2024
85b6d66
Revert "Adds SR Shipyard Console to Frontier Outpost (#1725)" (#1791)
dvir001 Aug 4, 2024
69f63ea
Fix Grid Names (#1793)
dvir001 Aug 4, 2024
f6b5a34
Resprites
Vonsant Aug 4, 2024
1ecb3a1
Add SR shipyard console to Frontier Outpost (#1792)
arimah Aug 4, 2024
f67556b
Fix two minor POI bugs (Tinnia's, Trade) (#1794)
arimah Aug 4, 2024
2eb6cc5
SharedVehicleSystem: fix user arg on honk (#1788)
whatston3 Aug 4, 2024
e3e5c68
Automatic Changelog (#1788)
FrontierATC Aug 4, 2024
b3e9786
Removed Missed Food (#1795)
dvir001 Aug 5, 2024
9adad40
Trade depot: add cargo market data component (#1797)
whatston3 Aug 5, 2024
75bf745
Automatic Changelog (#1797)
FrontierATC Aug 5, 2024
0a2e4ca
Airlocks
Vonsant Aug 5, 2024
24c047e
Rules
Vonsant Aug 5, 2024
3b202fe
RCD: add vend prices (#1800)
whatston3 Aug 5, 2024
229ef48
2024 08 05 advanced magboots (#1802)
whatston3 Aug 5, 2024
9fb0075
FixMerge
Vonsant Aug 6, 2024
4b1a2da
Merge branch 'master' into Up060824
Vonsant Aug 6, 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
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1496,7 +1496,8 @@ private void SetPreviewRotation(Direction direction)

private void RandomizeEverything()
{
Profile = HumanoidCharacterProfile.Random();
var oldBank = Profile?.BankBalance ?? HumanoidCharacterProfile.DefaultBalance; // Frontier
Profile = HumanoidCharacterProfile.Random().WithBankBalance(oldBank); // Frontier: add WithBankBalance(oldBank)
SetProfile(Profile, CharacterSlot);
SetDirty();
}
Expand Down
40 changes: 40 additions & 0 deletions Content.Client/Lobby/UI/Loadouts/LoadoutGroupContainer.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ public void RefreshLoadouts(HumanoidCharacterProfile profile, RoleLoadout loadou
if (!protoMan.TryIndex(loadoutProto, out var loadProto))
continue;

// Frontier: hide loadout effects
if (loadout.IsHidden(profile, session, loadoutProto, collection))
continue;
// End Frontier: hide loadout effects

var matchingLoadout = selected.FirstOrDefault(e => e.Prototype == loadoutProto);
var pressed = matchingLoadout != null;

Expand All @@ -90,5 +95,40 @@ public void RefreshLoadouts(HumanoidCharacterProfile profile, RoleLoadout loadou

LoadoutsContainer.AddChild(loadoutContainer);
}

// Frontier: loadoutGroup subgroups
foreach (var subgroupProto in _groupProto.Subgroups)
{
if (!protoMan.TryIndex(subgroupProto, out var loadoutGroupProto))
continue;

foreach (var loadoutProto in loadoutGroupProto.Loadouts)
{
if (!protoMan.TryIndex(loadoutProto, out var loadProto))
continue;

if (loadout.IsHidden(profile, session, loadoutProto, collection))
continue;

var matchingLoadout = selected.FirstOrDefault(e => e.Prototype == loadoutProto);
var pressed = matchingLoadout != null;

var enabled = loadout.IsValid(profile, session, loadoutProto, collection, out var reason);
var loadoutContainer = new LoadoutContainer(loadoutProto, !enabled, reason);
loadoutContainer.Select.Pressed = pressed;
loadoutContainer.Text = string.IsNullOrEmpty(loadProto.Name) ? loadoutSystem.GetName(loadProto) : loadProto.Name; // Frontier: allow overriding loadout names

loadoutContainer.Select.OnPressed += args =>
{
if (args.Button.Pressed)
OnLoadoutPressed?.Invoke(loadoutProto);
else
OnLoadoutUnpressed?.Invoke(loadoutProto);
};

LoadoutsContainer.AddChild(loadoutContainer);
}
}
// End Frontier
}
}
13 changes: 11 additions & 2 deletions Content.Client/Paper/UI/PaperWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,19 @@ public void Populate(SharedPaperComponent.PaperBoundUserInterfaceState state)
Input.InsertAtCursor(state.Text);
}

for (var i = 0; i <= state.StampedBy.Count * 3 + 1; i++)
// for (var i = 0; i <= state.StampedBy.Count * 3 + 1; i++) // Frontier
// { // Frontier
// msg.AddMarkupPermissive("\r\n"); // Frontier
// } // Frontier

// Frontier: signatures shouldn't walk off the page
if (state.StampedBy.Count > 0)
{
msg.AddMarkupPermissive("\r\n");
for (int i = 0; i < 6; i++)
msg.AddMarkupPermissive("\r\n");
}
// End Frontier

WrittenTextLabel.SetMessage(msg, _allowedTags, DefaultTextColor);

WrittenTextLabel.Visible = !isEditing && state.Text.Length > 0;
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Shuttles/UI/NavScreen.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public void SetShuttle(EntityUid? shuttle)
{
var shipNameParts = metadata.EntityName.Split(' ');
var designation = shipNameParts[^1];
if (designation[2] == '-')
if (designation.Length > 2 && designation[2] == '-')
{
NavDisplayLabel.Text = string.Join(' ', shipNameParts[..^1]);
ShuttleDesignation.Text = designation;
Expand Down
4 changes: 4 additions & 0 deletions Content.Client/Stylesheets/StyleNano.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1423,6 +1423,10 @@ public StyleNano(IResourceCache resCache) : base(resCache)
.Prop(TextureRect.StylePropertyTexture, resCache.GetTexture("/Textures/Interface/Nano/ntlogo.svg.png"))
.Prop(Control.StylePropertyModulateSelf, Color.FromHex("#757575")),

Element<TextureRect>().Class("PirateLogoDark") // Frontier
.Prop(TextureRect.StylePropertyTexture, resCache.GetTexture("/Textures/_NF/Interface/Pirate/piratelogo.png")) // Frontier
.Prop(Control.StylePropertyModulateSelf, Color.FromHex("#757575")), // Frontier

Element<Label>().Class("WindowFooterText")
.Prop(Label.StylePropertyFont, notoSans8)
.Prop(Label.StylePropertyFontColor, Color.FromHex("#757575")),
Expand Down
31 changes: 25 additions & 6 deletions Content.Client/VendingMachines/UI/VendingMachineMenu.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,34 @@ public void Populate(List<VendingMachineInventoryEntry> inventory, float priceMo
}
}

// This block exists to allow the VendPrice flag to set a vending machine item price.
if (prototype != null && prototype.TryGetComponent<StaticPriceComponent>(out var vendPriceComponent) && vendPriceComponent.VendPrice != 0 && cost <= (float) vendPriceComponent.VendPrice)
// Frontier: calculate vending price (this duplicates Content.Server.PricingSystem.GetVendPrice - this should be moved to Content.Shared if possible)
if (prototype != null)
{
var price = (float) vendPriceComponent.VendPrice;
cost = (int) price;
var price = 0.0;

if (prototype.TryGetComponent<StaticPriceComponent>(out var staticComp) && staticComp.VendPrice > 0.0)
{
price += staticComp.VendPrice;
}
else if (prototype.TryGetComponent<StackPriceComponent>(out var stackComp) && stackComp.VendPrice > 0.0)
{
price += stackComp.VendPrice;
}

// If there is anything that explicitly sets vending price - higher OR lower, override the base.
if (price > 0.0) {
cost = (int) price;
}
}
// This block exists to allow the VendPrice flag to set a vending machine item price.
// End Frontier

vendingItem.Text = $"[${cost}] {itemName} [{entry.Amount}]";
// New Frontiers - Unlimited vending - support items with unlimited vending stock.
// This code is licensed under AGPLv3. See AGPLv3.txt
if (entry.Amount != uint.MaxValue)
vendingItem.Text = $"[${cost}] {itemName} [{entry.Amount}]";
else
vendingItem.Text = $"[${cost}] {itemName}";
// End of modified code
vendingItem.Icon = icon;
filteredInventory.Add(i);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using Content.Client._NF.Contraband.UI;
using Content.Shared._NF.Contraband.BUI;
using Content.Shared._NF.Contraband.Components;
using Content.Shared._NF.Contraband.Events;
using Robust.Shared.GameObjects;
using Robust.Shared.Utility;

namespace Content.Client._NF.Contraband.BUI;
Expand All @@ -10,16 +12,21 @@ public sealed class ContrabandPalletConsoleBoundUserInterface : BoundUserInterfa
[ViewVariables]
private ContrabandPalletMenu? _menu;

[ViewVariables]
private string _locPrefix = string.Empty;

public ContrabandPalletConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
if (EntMan.TryGetComponent<ContrabandPalletConsoleComponent>(owner, out var console))
_locPrefix = console.LocStringPrefix ?? string.Empty;
}

protected override void Open()
{
base.Open();
var disclaimer = new FormattedMessage();
disclaimer.AddText(Loc.GetString($"contraband-pallet-disclaimer"));
_menu = new ContrabandPalletMenu();
disclaimer.AddText(Loc.GetString($"{_locPrefix}contraband-pallet-disclaimer"));
_menu = new ContrabandPalletMenu(_locPrefix);
_menu.AppraiseRequested += OnAppraisal;
_menu.SellRequested += OnSell;
_menu.OnClose += Close;
Expand Down
4 changes: 2 additions & 2 deletions Content.Client/_NF/Contraband/UI/ContrabandPalletMenu.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
MinSize="300 196">
<BoxContainer Orientation="Vertical">
<BoxContainer Orientation="Horizontal" SetHeight="24">
<Label Text="{Loc 'contraband-pallet-menu-appraisal-label'}"
<Label Name="AppraisalLabelLeft" Text="{Loc 'contraband-pallet-menu-appraisal-label'}"
StyleClasses="LabelKeyText" />
<Label Name="AppraisalLabel"
Text="{Loc 'contraband-pallet-menu-no-goods-text'}" />
</BoxContainer>
<BoxContainer Orientation="Horizontal" SetHeight="24">
<Label Text="{Loc 'contraband-pallet-menu-count-label'}"
<Label Name="CountLabelLeft" Text="{Loc 'contraband-pallet-menu-count-label'}"
StyleClasses="LabelKeyText" />
<Label Name="CountLabel"
Text="{Loc 'contraband-pallet-menu-no-goods-text'}" />
Expand Down
21 changes: 18 additions & 3 deletions Content.Client/_NF/Contraband/UI/ContrabandPalletMenu.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,32 @@ public sealed partial class ContrabandPalletMenu : FancyWindow
public Action? SellRequested;
public Action? AppraiseRequested;

public ContrabandPalletMenu()
private string _locPrefix = string.Empty;

public ContrabandPalletMenu(string locPrefix)
{
RobustXamlLoader.Load(this);
SellButton.OnPressed += OnSellPressed;
AppraiseButton.OnPressed += OnAppraisePressed;
Title = Loc.GetString("contraband-pallet-console-menu-title");

_locPrefix = locPrefix ?? string.Empty;

Title = Loc.GetString($"{_locPrefix}contraband-pallet-console-menu-title");

if (!string.IsNullOrEmpty(_locPrefix))
{
AppraisalLabelLeft.Text = Loc.GetString($"{_locPrefix}contraband-pallet-menu-appraisal-label");
AppraisalLabel.Text = Loc.GetString($"{_locPrefix}contraband-pallet-menu-no-goods-text");
CountLabelLeft.Text = Loc.GetString($"{_locPrefix}contraband-pallet-menu-count-label");
CountLabel.Text = Loc.GetString($"{_locPrefix}contraband-pallet-menu-no-goods-text");
AppraiseButton.Text = Loc.GetString($"{_locPrefix}contraband-pallet-appraise-button");
SellButton.Text = Loc.GetString($"{_locPrefix}contraband-pallet-sell-button");
}
}

public void SetAppraisal(int amount)
{
AppraisalLabel.Text = Loc.GetString("contraband-console-menu-points-amount", ("amount", amount.ToString()));
AppraisalLabel.Text = Loc.GetString($"{_locPrefix}contraband-console-menu-points-amount", ("amount", amount.ToString()));
}

public void SetCount(int count)
Expand Down
6 changes: 3 additions & 3 deletions Content.Client/_NF/Latejoin/NFLateJoinGui.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public sealed partial class NFLateJoinGui : FancyWindow
{
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IConsoleHost _consoleHost = default!;
[Dependency] private readonly JobRequirementsManager _playManager = default!;
[Dependency] private readonly JobRequirementsManager _jobReqs = default!;

private ClientGameTicker _gameTicker;

Expand Down Expand Up @@ -85,15 +85,15 @@ public void UpdateUi(IReadOnlyDictionary<NetEntity, Dictionary<ProtoId<JobProtot



var newButton = new NewFrontierLateJoinJobButton(station, jobId, _gameTicker, _prototypeManager);
var newButton = new NewFrontierLateJoinJobButton(station, jobId, _gameTicker, _prototypeManager, _jobReqs);
newButton.OnPressed += args =>
{
Logger.InfoS("latejoin", $"Late joining as ID: {jobId}");
_consoleHost.ExecuteCommand($"joingame {CommandParsing.Escape(jobId)} {station}");
Close();
};

if (!_playManager.IsAllowed(job, out var denyReason))
if (!_jobReqs.IsAllowed(job, out var denyReason))
{
newButton.Disabled = true;
newButton.ToolTip = denyReason.ToString();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Content.Client.GameTicking.Managers;
using Content.Client.Players.PlayTimeTracking;
using Content.Shared.Roles;
using Content.Shared.StatusIcon;
using Robust.Client.AutoGenerated;
Expand All @@ -16,15 +17,17 @@ public sealed partial class NewFrontierLateJoinJobButton : Button
private readonly IPrototypeManager _prototypeManager;
private readonly ClientGameTicker _gameTicker;
private readonly NetEntity _station;
private readonly JobRequirementsManager _jobReqs;
private readonly string _jobId;

public NewFrontierLateJoinJobButton(NetEntity station, string jobId, ClientGameTicker gameTicker, IPrototypeManager prototypeManager)
public NewFrontierLateJoinJobButton(NetEntity station, string jobId, ClientGameTicker gameTicker, IPrototypeManager prototypeManager, JobRequirementsManager jobReqs)
{
RobustXamlLoader.Load(this);
_prototypeManager = prototypeManager;
_gameTicker = gameTicker;
_station = station;
_jobId = jobId;
_jobReqs = jobReqs;

_gameTicker.LobbyJobsAvailableUpdated += UpdateButton;
UpdateButton(_gameTicker.JobsAvailable);
Expand Down Expand Up @@ -53,6 +56,6 @@ private void UpdateButton(IReadOnlyDictionary<NetEntity, Dictionary<ProtoId<JobP

JobText.Text = $"{prototype.LocalizedName} ({obj[_station][_jobId]?.ToString() ?? "Unlimited"})";

Disabled = obj[_station][_jobId] == 0;
Disabled = obj[_station][_jobId] == 0 || !_jobReqs.IsAllowed(prototype, out var _);
}
}
29 changes: 26 additions & 3 deletions Content.Client/_NF/Latejoin/VesselListControl.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Linq;
using Content.Client.GameTicking.Managers;
using Content.Client.UserInterface.Systems.Chat.Controls;
using Content.Shared.Roles;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
Expand All @@ -21,6 +22,9 @@ public NetEntity? Selected
{
get
{
if (_selected is not null)
return _selected;

var i = VesselItemList.GetSelected().FirstOrDefault();
if (i is null)
return null;
Expand All @@ -31,13 +35,16 @@ public NetEntity? Selected

private IReadOnlyDictionary<NetEntity, Dictionary<ProtoId<JobPrototype>, int?>>? _lastJobState;

private NetEntity? _selected = null;

public VesselListControl()
{
_gameTicker = EntitySystem.Get<ClientGameTicker>();
IoCManager.InjectDependencies(this);
RobustXamlLoader.Load(this);
_gameTicker.LobbyJobsAvailableUpdated += UpdateUi;
Comparison = DefaultComparison;
VesselItemList.OnItemSelected += OnItemSelected;

UpdateUi(_gameTicker.JobsAvailable);

Expand Down Expand Up @@ -107,13 +114,19 @@ private void Sort()
VesselItemList.Sort((a, b) => Comparison((NetEntity) a.Metadata!, (NetEntity) b.Metadata!));
}

private void OnItemSelected(ItemList.ItemListSelectedEventArgs args)
{
_selected = (NetEntity?) args.ItemList[args.ItemIndex].Metadata;
}

private void UpdateUi(IReadOnlyDictionary<NetEntity, Dictionary<ProtoId<JobPrototype>, int?>> obj)
{
VesselItemList.Clear();

bool selectedFound = false;
foreach (var (key, name) in _gameTicker.StationNames)
{
if (VesselItemList.Any(x => ((NetEntity) x.Metadata!) == key))
if (VesselItemList.Any(x => (NetEntity) x.Metadata! == key))
continue;

var jobsAvailable = _gameTicker.JobsAvailable[key].Values.Sum(a => a ?? 0);
Expand All @@ -122,6 +135,11 @@ private void UpdateUi(IReadOnlyDictionary<NetEntity, Dictionary<ProtoId<JobProto
Metadata = key,
Text = name + $" ({jobsAvailable})"
};
if (_selected == key)
{
selectedFound = true;
item.Selected = true;
}
if (!string.IsNullOrEmpty(FilterLineEdit.Text) &&
!name.ToLowerInvariant().Contains(FilterLineEdit.Text.Trim().ToLowerInvariant()))
{
Expand All @@ -134,9 +152,14 @@ private void UpdateUi(IReadOnlyDictionary<NetEntity, Dictionary<ProtoId<JobProto
_lastJobState = obj;
Sort();

if (Selected == null && VesselItemList.Count > 0)
if (!selectedFound)
{
VesselItemList.First().Selected = true;
_selected = null;
if (VesselItemList.Count > 0)
{
VesselItemList.First().Selected = true;
_selected = (NetEntity) VesselItemList.First().Metadata!;
}
}
}
}
Loading
Loading