mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-09-30 08:07:28 +00:00
Add the ability to spawn in as a vent critter at will (#6187)
* Add the ability to spawn in as a vent critter at will * cooldown
This commit is contained in:
@@ -2,10 +2,12 @@
|
||||
using Content.Client.Ghost;
|
||||
using Content.Client.UserInterface.Systems.Gameplay;
|
||||
using Content.Client.UserInterface.Systems.Ghost.Widgets;
|
||||
using Content.Shared._DV.Ghost.Roles; // DeltaV - freeform ghosties
|
||||
using Content.Shared.Ghost;
|
||||
using Robust.Shared.Console; // Frontier
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controllers;
|
||||
using Robust.Shared.Prototypes; // DeltaV - freeform ghosties
|
||||
using Content.Shared._Corvax.Respawn; // Frontier
|
||||
|
||||
namespace Content.Client.UserInterface.Systems.Ghost;
|
||||
@@ -33,6 +35,7 @@ public sealed class GhostUIController : UIController, IOnSystemChanged<GhostSyst
|
||||
|
||||
// DeltaV
|
||||
SubscribeNetworkEvent<RespawnResetEvent>(OnRespawnReseted);
|
||||
SubscribeNetworkEvent<DVSpawnableGhostRoleCooldownUpdateEvent>(OnVentCritterCooldownUpdate); // DeltaV - freeform ghosties
|
||||
}
|
||||
|
||||
private void OnScreenLoad()
|
||||
@@ -151,6 +154,8 @@ public sealed class GhostUIController : UIController, IOnSystemChanged<GhostSyst
|
||||
Gui.RequestWarpsPressed += RequestWarps;
|
||||
Gui.ReturnToBodyPressed += ReturnToBody;
|
||||
Gui.GhostRolesPressed += GhostRolesPressed;
|
||||
Gui.VentCritterPressed += OnVentCritterPressed; // DeltaV - freeform ghosties
|
||||
Gui.VentCritterSelected += OnVentCritterSelected; // DeltaV - freeform ghosties
|
||||
Gui.TargetWindow.WarpClicked += OnWarpClicked;
|
||||
Gui.TargetWindow.OnGhostnadoClicked += OnGhostnadoClicked;
|
||||
Gui.GhostRespawnPressed += GuiOnGhostRespawnPressed; // Frontier
|
||||
@@ -173,6 +178,8 @@ public sealed class GhostUIController : UIController, IOnSystemChanged<GhostSyst
|
||||
Gui.RequestWarpsPressed -= RequestWarps;
|
||||
Gui.ReturnToBodyPressed -= ReturnToBody;
|
||||
Gui.GhostRolesPressed -= GhostRolesPressed;
|
||||
Gui.VentCritterPressed -= OnVentCritterPressed; // DeltaV - freeform ghosties
|
||||
Gui.VentCritterSelected -= OnVentCritterSelected; // DeltaV - freeform ghosties
|
||||
Gui.TargetWindow.WarpClicked -= OnWarpClicked;
|
||||
Gui.GhostRespawnPressed -= GuiOnGhostRespawnPressed; // Frontier
|
||||
|
||||
@@ -195,4 +202,21 @@ public sealed class GhostUIController : UIController, IOnSystemChanged<GhostSyst
|
||||
{
|
||||
_system?.OpenGhostRoles();
|
||||
}
|
||||
|
||||
// Begin DeltaV - freeform ghosties
|
||||
private void OnVentCritterPressed()
|
||||
{
|
||||
_net.SendSystemNetworkMessage(new DVSpawnableGhostRoleCooldownRequestEvent());
|
||||
}
|
||||
|
||||
private void OnVentCritterSelected(ProtoId<DVSpawnableGhostRolePrototype> role)
|
||||
{
|
||||
_net.SendSystemNetworkMessage(new DVSpawnableGhostRoleRequestEvent(role));
|
||||
}
|
||||
|
||||
private void OnVentCritterCooldownUpdate(DVSpawnableGhostRoleCooldownUpdateEvent msg, EntitySessionEventArgs args)
|
||||
{
|
||||
Gui?.VentCritterWindow.SetCooldownEnd(msg.CooldownEnd);
|
||||
}
|
||||
// End DeltaV - freeform ghosties
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
<Button Name="ReturnToBodyButton" Text="{Loc ghost-gui-return-to-body-button}" />
|
||||
<Button Name="GhostWarpButton" Text="{Loc ghost-gui-ghost-warp-button}" />
|
||||
<Button Name="GhostRolesButton" />
|
||||
<Button Name="VentCritterButton" Text="{Loc ghost-gui-spawn-vent-critter-button}" /> <!-- DeltaV: freeform ghosties -->
|
||||
<Button Name="GhostRespawnButton" Text="{Loc ghost-gui-respawn}" /> <!-- Frontier -->
|
||||
</BoxContainer>
|
||||
</widgets:GhostGui>
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
using Content.Client._DV.Ghost; // DeltaV - freeform ghosties
|
||||
using Content.Client.Stylesheets;
|
||||
using Content.Client.UserInterface.Systems.Ghost.Controls;
|
||||
using Content.Shared._DV.Ghost.Roles; // DeltaV - freeform ghosties
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
using Robust.Shared.Prototypes; // DeltaV - freeform ghosties
|
||||
using Robust.Shared.Timing; // Frontier
|
||||
using Content.Client._NF.UserInterface.Systems.Ghost.Controls; // Frontier
|
||||
|
||||
@@ -17,10 +20,13 @@ public sealed partial class GhostGui : UIWidget
|
||||
|
||||
public GhostTargetWindow TargetWindow { get; }
|
||||
public GhostRespawnRulesWindow RulesWindow { get; } // Frontier
|
||||
public DVSpawnableGhostRoleWindow VentCritterWindow { get; } // DeltaV - freeform ghosties
|
||||
|
||||
public event Action? RequestWarpsPressed;
|
||||
public event Action? ReturnToBodyPressed;
|
||||
public event Action? GhostRolesPressed;
|
||||
public event Action? VentCritterPressed; // DeltaV - freeform ghosties
|
||||
public event Action<ProtoId<DVSpawnableGhostRolePrototype>>? VentCritterSelected; // DeltaV - freeform ghosties
|
||||
public event Action? GhostRespawnPressed; // Frontier
|
||||
private int _prevNumberRoles;
|
||||
|
||||
@@ -31,6 +37,8 @@ public sealed partial class GhostGui : UIWidget
|
||||
TargetWindow = new GhostTargetWindow();
|
||||
RulesWindow = new GhostRespawnRulesWindow(); // Frontier
|
||||
RulesWindow.RespawnButton.OnPressed += _ => GhostRespawnPressed?.Invoke(); // Frontier
|
||||
VentCritterWindow = new DVSpawnableGhostRoleWindow(); // DeltaV - freeform ghosties
|
||||
VentCritterWindow.RoleSelected += role => VentCritterSelected?.Invoke(role); // DeltaV - freeform ghosties
|
||||
|
||||
MouseFilter = MouseFilterMode.Ignore;
|
||||
|
||||
@@ -38,12 +46,18 @@ public sealed partial class GhostGui : UIWidget
|
||||
ReturnToBodyButton.OnPressed += _ => ReturnToBodyPressed?.Invoke();
|
||||
GhostRolesButton.OnPressed += _ => GhostRolesPressed?.Invoke();
|
||||
GhostRolesButton.OnPressed += _ => GhostRolesButton.StyleClasses.Remove(StyleClass.Negative);
|
||||
VentCritterButton.OnPressed += _ =>
|
||||
{
|
||||
VentCritterPressed?.Invoke();
|
||||
VentCritterWindow.OpenCentered();
|
||||
}; // DeltaV - freeform ghosties
|
||||
GhostRespawnButton.OnPressed += _ => RulesWindow.OpenCentered(); // Frontier
|
||||
}
|
||||
|
||||
public void Hide()
|
||||
{
|
||||
TargetWindow.Close();
|
||||
VentCritterWindow.Close(); // DeltaV - freeform ghosties
|
||||
Visible = false;
|
||||
}
|
||||
|
||||
@@ -97,6 +111,7 @@ public sealed partial class GhostGui : UIWidget
|
||||
if (disposing)
|
||||
{
|
||||
TargetWindow.Dispose();
|
||||
VentCritterWindow.Dispose(); // DeltaV - freeform ghosties
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user