Skip to content

Commit

Permalink
Apply DeltaV modifications across the changes
Browse files Browse the repository at this point in the history
  • Loading branch information
BarryNorfolk committed Dec 18, 2024
1 parent 3bb6da3 commit 3e69a82
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ protected override void UpdateState(BoundUserInterfaceState message)
if (message is not CargoBountyConsoleState state)
return;

_menu?.UpdateEntries(state.Bounties, state.History, state.UntilNextSkip);
_menu?.UpdateEntries(state.Bounties, state.History, state.UntilNextSkip); // DeltaV
}
}
2 changes: 2 additions & 0 deletions Content.Client/Cargo/UI/CargoBountyMenu.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BackgroundColor="#1B1B1E" />
</PanelContainer.PanelOverride>
<!-- DeltaV - Start of bounty history changes -->
<TabContainer Name="MasterTabContainer" VerticalExpand="True" HorizontalExpand="True">
<ScrollContainer HScrollEnabled="False"
HorizontalExpand="True"
Expand All @@ -31,6 +32,7 @@
</BoxContainer>
</ScrollContainer>
</TabContainer>
<!-- DeltaV - End of bounty history changes -->
</PanelContainer>
<!-- Footer -->
<BoxContainer Orientation="Vertical">
Expand Down
7 changes: 6 additions & 1 deletion Content.Client/Cargo/UI/CargoBountyMenu.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Content.Client.UserInterface.Controls;
using Content.Client.DeltaV.Cargo.UI; // DeltaV
using Content.Shared.Cargo;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
Expand All @@ -17,10 +18,12 @@ public CargoBountyMenu()
RobustXamlLoader.Load(this);
}

public void UpdateEntries(List<CargoBountyData> bounties, List<CargoBountyHistoryData> history, TimeSpan untilNextSkip)
public void UpdateEntries(List<CargoBountyData> bounties, List<CargoBountyHistoryData> history, TimeSpan untilNextSkip) // DeltaV
{
// DeltaV - Start of bounty history changes
MasterTabContainer.SetTabTitle(0, Loc.GetString("bounty-console-tab-available-label"));
MasterTabContainer.SetTabTitle(1, Loc.GetString("bounty-console-tab-history-label"));
// DeltaV - End of bounty history changes

BountyEntriesContainer.Children.Clear();
foreach (var b in bounties)
Expand All @@ -36,11 +39,13 @@ public void UpdateEntries(List<CargoBountyData> bounties, List<CargoBountyHistor
MinHeight = 10
});

// DeltaV - Start of bounty history changes
BountyHistoryContainer.Children.Clear();
foreach (var h in history)
{
var entry = new BountyHistoryEntry(h);
BountyHistoryContainer.AddChild(entry);
}
// DeltaV - End of bounty history changes
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;

namespace Content.Client.Cargo.UI;
namespace Content.Client.DeltaV.Cargo.UI;

[GenerateTypedNameReferences]
public sealed partial class BountyHistoryEntry : BoxContainer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ public sealed partial class StationCargoBountyDatabaseComponent : Component
[DataField, ViewVariables(VVAccess.ReadWrite)]
public List<CargoBountyData> Bounties = new();

// DeltaV - Start of bounty history changes
/// <summary>
/// A list of all the bounties that have been completed or
/// skipped for a station.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public List<CargoBountyHistoryData> History = new();
// DeltaV - End of bounty history changes

/// <summary>
/// Used to determine unique order IDs
Expand Down
20 changes: 11 additions & 9 deletions Content.Server/Cargo/Systems/CargoSystem.Bounty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
using Content.Shared.Cargo.Components;
using Content.Shared.Cargo.Prototypes;
using Content.Shared.Database;
using Content.Shared.IdentityManagement;
using Content.Shared.IdentityManagement; // DeltaV
using Content.Shared.NameIdentifier;
using Content.Shared.Paper;
using Content.Shared.Stacks;
Expand All @@ -17,7 +17,7 @@
using Robust.Server.Containers;
using Robust.Shared.Containers;
using Robust.Shared.Random;
using Robust.Shared.Timing;
using Robust.Shared.Timing; // DeltaV
using Robust.Shared.Utility;

namespace Content.Server.Cargo.Systems;
Expand All @@ -27,7 +27,7 @@ public sealed partial class CargoSystem
[Dependency] private readonly ContainerSystem _container = default!;
[Dependency] private readonly NameIdentifierSystem _nameIdentifier = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelistSys = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!; // DeltaV

[ValidatePrototypeId<NameIdentifierGroupPrototype>]
private const string BountyNameIdentifierGroup = "Bounty";
Expand Down Expand Up @@ -57,7 +57,7 @@ private void OnBountyConsoleOpened(EntityUid uid, CargoBountyConsoleComponent co
return;

var untilNextSkip = bountyDb.NextSkipTime - _timing.CurTime;
_uiSystem.SetUiState(uid, CargoConsoleUiKey.Bounty, new CargoBountyConsoleState(bountyDb.Bounties, bountyDb.History, untilNextSkip));
_uiSystem.SetUiState(uid, CargoConsoleUiKey.Bounty, new CargoBountyConsoleState(bountyDb.Bounties, bountyDb.History, untilNextSkip)); // DeltaV
}

private void OnPrintLabelMessage(EntityUid uid, CargoBountyConsoleComponent component, BountyPrintLabelMessage args)
Expand Down Expand Up @@ -98,13 +98,13 @@ private void OnSkipBountyMessage(EntityUid uid, CargoBountyConsoleComponent comp
return;
}

if (!TryRemoveBounty(station, bounty.Value, null, args.Actor))
if (!TryRemoveBounty(station, bounty.Value, null, args.Actor)) // DeltaV
return;

FillBountyDatabase(station);
db.NextSkipTime = _timing.CurTime + db.SkipDelay;
var untilNextSkip = db.NextSkipTime - _timing.CurTime;
_uiSystem.SetUiState(uid, CargoConsoleUiKey.Bounty, new CargoBountyConsoleState(db.Bounties, db.History, untilNextSkip));
_uiSystem.SetUiState(uid, CargoConsoleUiKey.Bounty, new CargoBountyConsoleState(db.Bounties, db.History, untilNextSkip)); // DeltaV
_audio.PlayPvs(component.SkipSound, uid);
}

Expand Down Expand Up @@ -437,15 +437,15 @@ public bool TryAddBounty(EntityUid uid, CargoBountyPrototype bounty, StationCarg
}

[PublicAPI]
public bool TryRemoveBounty(EntityUid uid, string dataId, StationCargoBountyDatabaseComponent? component = null, EntityUid? actor = null)
public bool TryRemoveBounty(EntityUid uid, string dataId, StationCargoBountyDatabaseComponent? component = null, EntityUid? actor = null) // DeltaV
{
if (!TryGetBountyFromId(uid, dataId, out var data, component))
return false;

return TryRemoveBounty(uid, data.Value, component, actor);
return TryRemoveBounty(uid, data.Value, component, actor); // DeltaV
}

public bool TryRemoveBounty(EntityUid uid, CargoBountyData data, StationCargoBountyDatabaseComponent? component = null, EntityUid? actor = null)
public bool TryRemoveBounty(EntityUid uid, CargoBountyData data, StationCargoBountyDatabaseComponent? component = null, EntityUid? actor = null) // DeltaV
{
if (!Resolve(uid, ref component))
return false;
Expand All @@ -454,6 +454,7 @@ public bool TryRemoveBounty(EntityUid uid, CargoBountyData data, StationCargoBou
{
if (component.Bounties[i].Id == data.Id)
{
// DeltaV - Start of bounty history changes
string? actorName = default;
if (actor != null)
{
Expand All @@ -463,6 +464,7 @@ public bool TryRemoveBounty(EntityUid uid, CargoBountyData data, StationCargoBou
}

component.History.Add(new CargoBountyHistoryData(data, _gameTiming.CurTime, actorName));
// DeltaV - End of bounty history changes
component.Bounties.RemoveAt(i);
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ public sealed partial class CargoBountyConsoleComponent : Component
public sealed class CargoBountyConsoleState : BoundUserInterfaceState
{
public List<CargoBountyData> Bounties;
public List<CargoBountyHistoryData> History;
public List<CargoBountyHistoryData> History; // DeltaV
public TimeSpan UntilNextSkip;

public CargoBountyConsoleState(List<CargoBountyData> bounties, List<CargoBountyHistoryData> history, TimeSpan untilNextSkip)
public CargoBountyConsoleState(List<CargoBountyData> bounties, List<CargoBountyHistoryData> history, TimeSpan untilNextSkip) // DeltaV
{
Bounties = bounties;
History = history;
History = history; // DeltaV
UntilNextSkip = untilNextSkip;
}
}
Expand Down
7 changes: 0 additions & 7 deletions Resources/Locale/en-US/cargo/cargo-bounty-console.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,3 @@ bounty-console-flavor-right = v1.4
bounty-manifest-header = [font size=14][bold]Official cargo bounty manifest[/bold] (ID#{$id})[/font]
bounty-manifest-list-start = Item manifest:
bounty-console-tab-available-label = Available
bounty-console-tab-history-label = History
bounty-console-history-notice-completed-label = {$time} - Completed
bounty-console-history-notice-skipped-label = {$time} - Skipped by {$id}
bounty-console-history-completed-label = [color=limegreen]Completed[/color]
bounty-console-history-skipped-label = [color=red]Skipped[/color]
6 changes: 6 additions & 0 deletions Resources/Locale/en-US/deltav/cargo/cargo-bounty-console.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
bounty-console-tab-available-label = Available
bounty-console-tab-history-label = History
bounty-console-history-notice-completed-label = {$time} - Completed
bounty-console-history-notice-skipped-label = {$time} - Skipped by {$id}
bounty-console-history-completed-label = [color=limegreen]Completed[/color]
bounty-console-history-skipped-label = [color=red]Skipped[/color]

0 comments on commit 3e69a82

Please sign in to comment.