mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-17 21:48:58 +03:00
# Description Adds the Ghost Bar from Goob LRP. Upon spawn, the character's loadouts and traits will also be applied as if their job was their Ghost Bar job. Adjusts the weights for kill objectives, re-enabling the kill objective and reducing the weight of Teach a Lesson now that there's more things to do after getting round removed. Goobstation cherry-picked PRs: - https://github.com/Goob-Station/Goob-Station/pull/454 - https://github.com/Goob-Station/Goob-Station/pull/464 - https://github.com/Goob-Station/Goob-Station/pull/689 (partially applied to Ghost bar files only) - https://github.com/Goob-Station/Goob-Station/pull/963 - https://github.com/Goob-Station/Goob-Station/pull/974 - https://github.com/Goob-Station/Goob-Station/pull/982 (partially applied to Ghost bar files only) - https://github.com/Goob-Station/Goob-Station/pull/1288 (partially applied to Ghost bar files only) Wizden cherry-picked PRs: - https://github.com/space-wizards/space-station-14/pull/29103 (for the foam force rifle that spawns in the Ghost bar) ## Media **Ghost Bar UI**  **Ghost Bar In-Game**  Notice how the Ghost Bar character has loadout items in the backpack and the Skeleton Accent trait. ## Changelog <!-- You can add an author after the `🆑` to change the name that appears in the changelog (ex: `🆑 Death`) Leaving it blank will default to your GitHub display name This includes all available types for the changelog --> 🆑 Skubman - add: Ghost Bar! When you die, you can now go to the Ghost Bar to chill and talk about the round with other ghosts. (by Aidenkrz) - add: Foam Force rifle to cargo lottery! (by IProduceWidgets) - add: Re-enabled the Kill objective for traitors. - tweak: Reduced the chances of traitors getting the "Teach a Lesson" objective. --------- Co-authored-by: Aiden <aiden@djkraz.com> Co-authored-by: Rank #1 Jonestown partygoer <mary@thughunt.ing> Co-authored-by: IProduceWidgets <107586145+IProduceWidgets@users.noreply.github.com> Co-authored-by: Aviu00 <93730715+Aviu00@users.noreply.github.com> (cherry picked from commit 0b4ceb21cc406cd39b894afe79decf40c2366369)
185 lines
4.8 KiB
C#
185 lines
4.8 KiB
C#
using Content.Client.Gameplay;
|
|
using Content.Client.Ghost;
|
|
using Content.Client.UserInterface.Systems.Gameplay;
|
|
using Content.Client.UserInterface.Systems.Ghost.Widgets;
|
|
using Content.Shared.Ghost;
|
|
using Robust.Client.UserInterface;
|
|
using Robust.Client.UserInterface.Controllers;
|
|
|
|
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>
|
|
{
|
|
[Dependency] private readonly IEntityNetworkManager _net = default!;
|
|
[UISystemDependency] private readonly GhostSystem? _system = default;
|
|
|
|
private GhostGui? Gui => UIManager.GetActiveUIWidgetOrNull<GhostGui>();
|
|
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
var gameplayStateLoad = UIManager.GetUIController<GameplayStateLoadController>();
|
|
gameplayStateLoad.OnScreenLoad += OnScreenLoad;
|
|
gameplayStateLoad.OnScreenUnload += OnScreenUnload;
|
|
}
|
|
|
|
private void OnScreenLoad()
|
|
{
|
|
LoadGui();
|
|
}
|
|
|
|
private void OnScreenUnload()
|
|
{
|
|
UnloadGui();
|
|
}
|
|
|
|
public void OnSystemLoaded(GhostSystem system)
|
|
{
|
|
system.PlayerRemoved += OnPlayerRemoved;
|
|
system.PlayerUpdated += OnPlayerUpdated;
|
|
system.PlayerAttached += OnPlayerAttached;
|
|
system.PlayerDetached += OnPlayerDetached;
|
|
system.GhostWarpsResponse += OnWarpsResponse;
|
|
system.GhostRoleCountUpdated += OnRoleCountUpdated;
|
|
}
|
|
|
|
public void OnSystemUnloaded(GhostSystem system)
|
|
{
|
|
system.PlayerRemoved -= OnPlayerRemoved;
|
|
system.PlayerUpdated -= OnPlayerUpdated;
|
|
system.PlayerAttached -= OnPlayerAttached;
|
|
system.PlayerDetached -= OnPlayerDetached;
|
|
system.GhostWarpsResponse -= OnWarpsResponse;
|
|
system.GhostRoleCountUpdated -= OnRoleCountUpdated;
|
|
}
|
|
|
|
public void UpdateGui()
|
|
{
|
|
if (Gui == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
Gui.Visible = _system?.IsGhost ?? false;
|
|
Gui.Update(_system?.AvailableGhostRoleCount, _system?.Player?.CanReturnToBody);
|
|
}
|
|
|
|
private void OnPlayerRemoved(GhostComponent component)
|
|
{
|
|
Gui?.Hide();
|
|
}
|
|
|
|
private void OnPlayerUpdated(GhostComponent component)
|
|
{
|
|
UpdateGui();
|
|
}
|
|
|
|
private void OnPlayerAttached(GhostComponent component)
|
|
{
|
|
if (Gui == null)
|
|
return;
|
|
|
|
Gui.Visible = true;
|
|
UpdateGui();
|
|
}
|
|
|
|
private void OnPlayerDetached()
|
|
{
|
|
Gui?.Hide();
|
|
}
|
|
|
|
private void OnWarpsResponse(GhostWarpsResponseEvent msg)
|
|
{
|
|
if (Gui?.TargetWindow is not { } window)
|
|
return;
|
|
|
|
window.UpdateWarps(msg.Warps);
|
|
window.Populate();
|
|
}
|
|
|
|
private void OnRoleCountUpdated(GhostUpdateGhostRoleCountEvent msg)
|
|
{
|
|
UpdateGui();
|
|
}
|
|
|
|
private void OnWarpClicked(NetEntity player)
|
|
{
|
|
var msg = new GhostWarpToTargetRequestEvent(player);
|
|
_net.SendSystemNetworkMessage(msg);
|
|
}
|
|
|
|
private void OnGhostnadoClicked()
|
|
{
|
|
var msg = new GhostnadoRequestEvent();
|
|
_net.SendSystemNetworkMessage(msg);
|
|
}
|
|
|
|
public void LoadGui()
|
|
{
|
|
if (Gui == null)
|
|
return;
|
|
|
|
Gui.RequestWarpsPressed += RequestWarps;
|
|
Gui.ReturnToBodyPressed += ReturnToBody;
|
|
Gui.GhostRolesPressed += GhostRolesPressed;
|
|
Gui.GhostBarPressed += GhostBarPressed; // Goobstation - Ghost Bar
|
|
Gui.GhostBarWindow.SpawnButtonPressed += GhostBarSpawnPressed; // Goobstation - Ghost Bar
|
|
Gui.TargetWindow.WarpClicked += OnWarpClicked;
|
|
Gui.TargetWindow.OnGhostnadoClicked += OnGhostnadoClicked;
|
|
Gui.ReturnToRoundPressed += ReturnToRound;
|
|
|
|
UpdateGui();
|
|
}
|
|
|
|
public void UnloadGui()
|
|
{
|
|
if (Gui == null)
|
|
return;
|
|
|
|
Gui.RequestWarpsPressed -= RequestWarps;
|
|
Gui.ReturnToBodyPressed -= ReturnToBody;
|
|
Gui.GhostRolesPressed -= GhostRolesPressed;
|
|
Gui.GhostBarPressed -= GhostBarPressed; // Goobstation - Ghost Bar
|
|
Gui.GhostBarWindow.SpawnButtonPressed -= GhostBarSpawnPressed; // Goobstation - Ghost Bar
|
|
Gui.TargetWindow.WarpClicked -= OnWarpClicked;
|
|
Gui.ReturnToRoundPressed -= ReturnToRound;
|
|
|
|
Gui.Hide();
|
|
}
|
|
|
|
private void ReturnToBody()
|
|
{
|
|
_system?.ReturnToBody();
|
|
}
|
|
|
|
private void ReturnToRound()
|
|
{
|
|
_system?.ReturnToRound();
|
|
}
|
|
|
|
private void RequestWarps()
|
|
{
|
|
_system?.RequestWarps();
|
|
Gui?.TargetWindow.Populate();
|
|
Gui?.TargetWindow.OpenCentered();
|
|
}
|
|
|
|
private void GhostRolesPressed()
|
|
{
|
|
_system?.OpenGhostRoles();
|
|
}
|
|
|
|
private void GhostBarPressed() // Goobstation - Ghost Bar
|
|
{
|
|
Gui?.GhostBarWindow.OpenCentered();
|
|
}
|
|
|
|
private void GhostBarSpawnPressed() // Goobstation - Ghost Bar
|
|
{
|
|
_system?.GhostBarSpawn();
|
|
}
|
|
}
|