Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
…rontier-14 into sh1ntra
  • Loading branch information
Sh1ntra committed Jun 4, 2024
2 parents 8c98e9c + 4dd2e2d commit e3baf9f
Show file tree
Hide file tree
Showing 920 changed files with 64,539 additions and 18,079 deletions.
5 changes: 4 additions & 1 deletion Content.Client/Administration/UI/AdminAnnounceWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public AdminAnnounceWindow()
AnnounceMethod.SetItemMetadata(0, AdminAnnounceType.Station);
AnnounceMethod.AddItem(_localization.GetString("admin-announce-type-server"));
AnnounceMethod.SetItemMetadata(1, AdminAnnounceType.Server);
AnnounceMethod.AddItem(_localization.GetString("admin-announce-type-antag")); // Frontier
AnnounceMethod.SetItemMetadata(2, AdminAnnounceType.Antag); // Frontier
AnnounceMethod.OnItemSelected += AnnounceMethodOnOnItemSelected;
Announcement.OnKeyBindUp += AnnouncementOnOnTextChanged;
}
Expand All @@ -35,7 +37,8 @@ private void AnnouncementOnOnTextChanged(GUIBoundKeyEventArgs args)
private void AnnounceMethodOnOnItemSelected(OptionButton.ItemSelectedEventArgs args)
{
AnnounceMethod.SelectId(args.Id);
Announcer.Editable = ((AdminAnnounceType?)args.Button.SelectedMetadata ?? AdminAnnounceType.Station) == AdminAnnounceType.Station;
Announcer.Editable = ((AdminAnnounceType?)args.Button.SelectedMetadata ?? AdminAnnounceType.Station) == AdminAnnounceType.Station
|| ((AdminAnnounceType?)args.Button.SelectedMetadata ?? AdminAnnounceType.Antag) == AdminAnnounceType.Antag; // Frontier
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Content.Client.Salvage;
using Content.Client.Station;
using Content.Server.Worldgen.Components.Debris;
using Content.Server._NF.Worldgen.Components.Debris;
using Content.Shared.Shipyard.Components;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
Expand Down
22 changes: 22 additions & 0 deletions Content.Client/Corvax/Respawn/RespawnSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using Content.Shared.Corvax.Respawn;

namespace Content.Server.Corvax.Respawn;

public sealed class RespawnSystem : EntitySystem
{
public TimeSpan? RespawnResetTime { get; private set; }

public event Action? RespawnReseted;

public override void Initialize()
{
SubscribeNetworkEvent<RespawnResetEvent>(OnRespawnReset);
}

private void OnRespawnReset(RespawnResetEvent e)
{
RespawnResetTime = e.Time;

RespawnReseted?.Invoke();
}
}
4 changes: 3 additions & 1 deletion Content.Client/Ghost/GhostSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using Robust.Shared.GameStates;
using Robust.Shared.Timing;
using Robust.Shared.Player;
using Content.Server.Corvax.Respawn;

namespace Content.Client.Ghost
{
Expand All @@ -23,14 +24,15 @@ public sealed class GhostSystem : SharedGhostSystem
[Dependency] private readonly EyeSystem _eye = default!;
[Dependency] private readonly IUserInterfaceManager _uiManager = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly RespawnSystem _respawn = default!;

public override void Update(float frameTime)
{
foreach (var ghost in EntityManager.EntityQuery<GhostComponent, MindComponent>(true))
{
var ui = _uiManager.GetActiveUIWidgetOrNull<GhostGui>();
if (ui != null && Player != null)
ui.UpdateRespawn(ghost.Item2.TimeOfDeath);
ui.UpdateRespawn(_respawn.RespawnResetTime);
}
}

Expand Down
3 changes: 3 additions & 0 deletions Content.Client/PDA/PdaMenu.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
<ContainerButton Name="StationTimeButton">
<RichTextLabel Name="StationTimeLabel" Access="Public"/>
</ContainerButton>
<ContainerButton Name="ShuttleLeftTimeButton">
<RichTextLabel Name="ShuttleLeftTimeLabel" Access="Public"/>
</ContainerButton>
<ContainerButton Name="StationAlertLevelInstructionsButton">
<RichTextLabel Name="StationAlertLevelInstructions" Access="Public"/>
</ContainerButton>
Expand Down
28 changes: 26 additions & 2 deletions Content.Client/PDA/PdaMenu.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ public sealed partial class PdaMenu : PdaWindow
public const int SettingsView = 2;
public const int ProgramContentView = 3;

private TimeSpan shuttleEvacTimeSpan;

private string _pdaOwner = Loc.GetString("comp-pda-ui-unknown");
private string _owner = Loc.GetString("comp-pda-ui-unknown");
private string _jobTitle = Loc.GetString("comp-pda-ui-unassigned");
private string _stationName = Loc.GetString("comp-pda-ui-unknown");
private string _alertLevel = Loc.GetString("comp-pda-ui-unknown");
private string _timeLeftShuttle = Loc.GetString("comp-pda-ui-unknown");
private string _instructions = Loc.GetString("comp-pda-ui-unknown");
private string _balance = Loc.GetString("comp-pda-ui-unknown");

Expand Down Expand Up @@ -116,6 +118,11 @@ public PdaMenu()
_clipboard.SetText(_alertLevel);
};

ShuttleLeftTimeButton.OnPressed += _ =>
{
_clipboard.SetText(_timeLeftShuttle);
};

BalanceButton.OnPressed += _ =>
{
_clipboard.SetText(_balance);
Expand Down Expand Up @@ -165,14 +172,25 @@ public void UpdateState(PdaUpdateState state)
StationNameLabel.SetMarkup(Loc.GetString("comp-pda-ui-station",
("station", _stationName)));

_balance = Loc.GetString("comp-pda-ui-balance", ("balance", state.Balance));
BalanceLabel.SetMarkup(_balance);
if (state.Balance is not null)
{
_balance = Loc.GetString("comp-pda-ui-balance", ("balance", state.Balance.Value));
BalanceLabel.SetMarkup(_balance);
}

var stationTime = _gameTiming.CurTime.Subtract(_gameTicker.RoundStartTimeSpan);

StationTimeLabel.SetMarkup(Loc.GetString("comp-pda-ui-station-time",
("time", stationTime.ToString("hh\\:mm\\:ss"))));

shuttleEvacTimeSpan = state.EvacShuttleTime ?? TimeSpan.Zero;
var shuttleEvacTime = shuttleEvacTimeSpan - _gameTiming.CurTime;
if (state.EvacShuttleTime is not null)
_timeLeftShuttle = Loc.GetString("comp-pda-ui-left-time",
("time", shuttleEvacTime.ToString("hh\\:mm\\:ss")));

ShuttleLeftTimeLabel.SetMarkup(_timeLeftShuttle);

var alertLevel = state.PdaOwnerInfo.StationAlertLevel;
var alertColor = state.PdaOwnerInfo.StationAlertColor;
var alertLevelKey = alertLevel != null ? $"alert-level-{alertLevel}" : "alert-level-unknown";
Expand Down Expand Up @@ -346,6 +364,12 @@ protected override void Draw(DrawingHandleScreen handle)

StationTimeLabel.SetMarkup(Loc.GetString("comp-pda-ui-station-time",
("time", stationTime.ToString("hh\\:mm\\:ss"))));

var shuttleEvacTime = shuttleEvacTimeSpan - _gameTiming.CurTime;
_timeLeftShuttle = Loc.GetString("comp-pda-ui-left-time",
("time", shuttleEvacTime.TotalSeconds <= 0 ? Loc.GetString("comp-pda-ui-unknown") : shuttleEvacTime.ToString("hh\\:mm\\:ss")));

ShuttleLeftTimeLabel.SetMarkup(_timeLeftShuttle);
}
}
}
23 changes: 20 additions & 3 deletions Content.Client/UserInterface/Systems/Ghost/GhostUIController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,19 @@
using Robust.Shared.Configuration;
using Robust.Shared.Console;
using Robust.Shared.Timing;
using Content.Server.Corvax.Respawn;

namespace Content.Client.UserInterface.Systems.Ghost;

// TODO hud refactor BEFORE MERGE fix ghost gui being too far up
public sealed class GhostUIController : UIController, IOnSystemChanged<GhostSystem>
public sealed class GhostUIController : UIController, IOnSystemChanged<GhostSystem>, IOnSystemChanged<RespawnSystem>
{
[Dependency] private readonly IEntityNetworkManager _net = default!;
[Dependency] private readonly IConsoleHost _consoleHost = default!;
[Dependency] private readonly IConfigurationManager _cfg = default!;

[UISystemDependency] private readonly GhostSystem? _system = default;
[UISystemDependency] private readonly RespawnSystem? _respawn = default;

private GhostGui? Gui => UIManager.GetActiveUIWidgetOrNull<GhostGui>();
private bool _canUncryo = true; // Frontier. TODO: find a reliable way to update this, for now it just stays active all the time
Expand Down Expand Up @@ -66,6 +68,21 @@ public void OnSystemUnloaded(GhostSystem system)
system.GhostRoleCountUpdated -= OnRoleCountUpdated;
}

public void OnSystemLoaded(RespawnSystem system)
{
system.RespawnReseted += OnRespawnReseted;
}

public void OnSystemUnloaded(RespawnSystem system)
{
system.RespawnReseted -= OnRespawnReseted;
}

private void OnRespawnReseted()
{
UpdateGui();
}

public void UpdateGui()
{
if (Gui == null)
Expand All @@ -75,7 +92,7 @@ public void UpdateGui()

Gui.Visible = _system?.IsGhost ?? false;
Gui.Update(_system?.AvailableGhostRoleCount, _system?.Player?.CanReturnToBody,
_system?.Player?.TimeOfDeath,
_respawn?.RespawnResetTime,
_cfg.GetCVar(NF14CVars.RespawnTime),
_canUncryo && _cfg.GetCVar(NF14CVars.CryoReturnEnabled));
}
Expand Down Expand Up @@ -103,7 +120,7 @@ private void OnPlayerAttached(GhostComponent component)
return;

Gui.Visible = true;
UpdateRespawn(component.TimeOfDeath);
UpdateRespawn(_respawn?.RespawnResetTime);
UpdateGui();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,8 @@ public void Hide()

public void UpdateRespawn(TimeSpan? todd)
{
if (todd != null)
{
_timeOfDeath = todd;
_minTimeToRespawn = _configurationManager.GetCVar(NF14CVars.RespawnTime);
}
_timeOfDeath = todd;
_minTimeToRespawn = _configurationManager.GetCVar(NF14CVars.RespawnTime);
}

public void Update(int? roles, bool? canReturnToBody, TimeSpan? timeOfDeath, float minTimeToRespawn, bool canUncryo)
Expand Down Expand Up @@ -90,8 +87,8 @@ protected override void FrameUpdate(FrameEventArgs args)
{
if (_timeOfDeath is null)
{
GhostRespawnButton.Text = Loc.GetString("ghost-gui-respawn-button-denied", ("time", "disabled"));
GhostRespawnButton.Disabled = true;
GhostRespawnButton.Text = Loc.GetString("ghost-gui-respawn-button-allowed");
GhostRespawnButton.Disabled = false;
return;
}

Expand Down
26 changes: 23 additions & 3 deletions Content.Client/Weapons/Melee/MeleeWeaponSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Content.Shared.Weapons.Melee;
using Content.Shared.Weapons.Melee.Events;
using Content.Shared.Weapons.Ranged.Components;
using Content.Shared.Wieldable.Components;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.Input;
Expand Down Expand Up @@ -95,10 +96,29 @@ public override void Update(float frameTime)
// it's kinda tricky.
// I think as long as we make secondaries their own component it's probably fine
// as long as guncomp has an alt-use key then it shouldn't be too much of a PITA to deal with.
if (TryComp<GunComponent>(weaponUid, out var gun) && gun.UseKey)

//Frontier: better support melee vs. ranged checks
/*if (TryComp<GunComponent>(weaponUid, out var gun) && gun.UseKey)
{
return;
}*/

// Ranged component has priority over melee if both are supported.
bool gunBoundToUse = false;
bool gunBoundToAlt = false;
if (TryComp<GunComponent>(weaponUid, out var gun)) {
gunBoundToUse = gun.UseKey;
gunBoundToAlt = !gun.UseKey; //Bound to alt-use when false

// If ranged mode only works when wielded, do not block melee attacks when unwielded
// (e.g. crusher & crusher glaive)
if (TryComp<GunRequiresWieldComponent>(weaponUid, out var _) &&
TryComp<WieldableComponent>(weaponUid, out var wield)) {
gunBoundToUse &= wield.Wielded;
gunBoundToAlt &= wield.Wielded;
}
}
//End Frontier

var mousePos = _eyeManager.PixelToMap(_inputManager.MouseScreenPosition);

Expand All @@ -119,7 +139,7 @@ public override void Update(float frameTime)
}

// Heavy attack.
if (altDown == BoundKeyState.Down)
if (altDown == BoundKeyState.Down && !gunBoundToAlt) //Frontier: add !gunBoundToAlt condition
{
// If it's an unarmed attack then do a disarm
if (weapon.AltDisarm && weaponUid == entity)
Expand All @@ -140,7 +160,7 @@ public override void Update(float frameTime)
}

// Light attack
if (useDown == BoundKeyState.Down)
if (useDown == BoundKeyState.Down && !gunBoundToUse) //Frontier: add !gunBoundToUse condition
{
var attackerPos = Transform(entity).MapPosition;

Expand Down
2 changes: 1 addition & 1 deletion Content.IntegrationTests/Tests/Fluids/FluidSpillTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ await server.WaitPost(() =>
await server.WaitAssertion(() =>
{
var grid = entityManager.GetComponent<MapGridComponent>(gridId);
var solution = new Solution("Blood", FixedPoint2.New(100));
var solution = new Solution("Wine", FixedPoint2.New(100)); // Frontier - Blood to wine so test pass
var tileRef = grid.GetTileRef(puddleOrigin);
#pragma warning disable NUnit2045 // Interdependent tests
Assert.That(puddleSystem.TrySpillAt(tileRef, solution, out _), Is.True);
Expand Down
4 changes: 4 additions & 0 deletions Content.Server/Administration/UI/AdminAnnounceEui.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Content.Server.EUI;
using Content.Shared.Administration;
using Content.Shared.Eui;
using Robust.Shared.Audio; // Frontier

namespace Content.Server.Administration.UI
{
Expand Down Expand Up @@ -52,6 +53,9 @@ public override void HandleMessage(EuiMessageBase msg)
case AdminAnnounceType.Station:
_chatSystem.DispatchGlobalAnnouncement(doAnnounce.Announcement, doAnnounce.Announcer, colorOverride: Color.Gold);
break;
case AdminAnnounceType.Antag: // Frontier
_chatSystem.DispatchGlobalAnnouncement(doAnnounce.Announcement, doAnnounce.Announcer, true, new SoundPathSpecifier("/Audio/Announcements/war.ogg"), colorOverride: Color.Red);
break;
}

StateDirty();
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Cargo/Systems/CargoSystem.Orders.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ private void OnApproveOrderMessage(EntityUid uid, CargoOrderConsoleComponent com
("approverName", approverName),
("approverJob", approverJob),
("cost", cost));
_radio.SendRadioMessage(uid, message, component.AnnouncementChannel, uid, escapeMarkup: false);
//_radio.SendRadioMessage(uid, message, component.AnnouncementChannel, uid, escapeMarkup: false); # Frontier
ConsolePopup(args.Actor, Loc.GetString("cargo-console-trade-station", ("destination", MetaData(uid).EntityName)));

// Log order approval
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Content.Server.Corvax.Language.Components;

[RegisterComponent]
public sealed partial class LanguageUnderstandComponent : Component { }
public sealed partial class LanguageUnderstandComponent : Component;
4 changes: 4 additions & 0 deletions Content.Server/Corvax/Respawn/RespawnResetComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
namespace Content.Server.Corvax.Respawn;

[RegisterComponent]
public sealed partial class RespawnResetComponent : Component;
Loading

0 comments on commit e3baf9f

Please sign in to comment.