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

апстрим #30

Closed
wants to merge 29 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
7315d9f
Adds Lootable fridge (#351)
MutantMan2040 Jul 14, 2024
a65bc0c
map update
Peptide90 Jul 14, 2024
7a3a13f
Merge remote-tracking branch 'origin/master'
Peptide90 Jul 14, 2024
86a9695
Table and chair construction 1 (#353)
Peptide90 Jul 14, 2024
513a157
map update
Peptide90 Jul 14, 2024
bc5f5a4
Fixes door suffix (#352)
BlueHNT Jul 14, 2024
c088263
RadAway Phial and some changes (#350)
BlueHNT Jul 14, 2024
42b8633
Added maidclaws (#347)
Noliuss Jul 14, 2024
93ddd16
Merge remote-tracking branch 'origin/master'
Peptide90 Jul 14, 2024
388c38f
map update
Peptide90 Jul 14, 2024
55a52d4
Merge remote-tracking branch 'origin/master'
Peptide90 Jul 14, 2024
cf1582a
half hunger decay rate
Peptide90 Jul 14, 2024
7d61437
nospawn intercom
Peptide90 Jul 15, 2024
fdca353
Clothes pack 1 (#359)
Peptide90 Jul 15, 2024
5e8e87c
adds a short doafter to hypospray for when you use it on others (#358)
ScyronX Jul 15, 2024
49f91e8
Fixes fox ranger helmet / Updates balancing (#357)
BlueHNT Jul 15, 2024
983287d
Merge remote-tracking branch 'origin/master'
Peptide90 Jul 15, 2024
451bf74
robit progress
Peptide90 Jul 15, 2024
0ed8877
update
Peptide90 Jul 15, 2024
dc08f0c
eyebot music and lint fix
Peptide90 Jul 15, 2024
4f62eff
Update base_borg_chassis.yml
Peptide90 Jul 15, 2024
f23e347
Update borg_chassis.yml
Peptide90 Jul 15, 2024
caa2b83
Update base_borg_chassis.yml
Peptide90 Jul 15, 2024
4c92980
fix master
Peptide90 Jul 16, 2024
3eca788
Little Locale fixes and other. (#362)
Vonsant Jul 16, 2024
4d809ee
fix master
Peptide90 Jul 16, 2024
9eef148
Respawn button (#361)
Vonsant Jul 16, 2024
54f7307
Fix and Nerfs (#363)
BlueHNT Jul 16, 2024
6844945
Armor, Coats and Power Armors pack (#360)
BlueHNT Jul 16, 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
  •  
  •  
  •  
20 changes: 19 additions & 1 deletion Content.Client/Ghost/GhostSystem.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
using Content.Client._NF.Respawn;
using Content.Client.Movement.Systems;
using Content.Client.UserInterface.Systems.Ghost.Widgets;
using Content.Shared.Actions;
using Content.Shared.Ghost;
using Content.Shared.Mind;
using Robust.Client.Console;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.Player;
using Robust.Client.UserInterface;
using Robust.Shared.Player;
using Robust.Shared.Timing;

namespace Content.Client.Ghost
{
Expand All @@ -15,6 +20,19 @@ public sealed class GhostSystem : SharedGhostSystem
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly SharedActionsSystem _actions = default!;
[Dependency] private readonly ContentEyeSystem _contentEye = 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(_respawn.RespawnResetTime);
}
}

public int AvailableGhostRoleCount { get; private set; }

Expand Down Expand Up @@ -182,4 +200,4 @@ public void ToggleGhostVisibility()
GhostVisibility = !GhostVisibility;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<controls:FancyWindow xmlns="https://spacestation14.io"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
xmlns:graphics="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
Title="{Loc 'ghost-respawn-rules-window-title'}"
MinSize="500 350">
<ScrollContainer VerticalExpand="True" HorizontalExpand="True" HScrollEnabled="False" Margin="5">
<PanelContainer StyleClasses="Inset">
<PanelContainer.PanelOverride>
<graphics:StyleBoxFlat BackgroundColor="#303133"/>
</PanelContainer.PanelOverride>

<BoxContainer Orientation="Vertical" VerticalExpand="True" SeparationOverride="5">
<PanelContainer Name="TextContainer" StyleClasses="Inset" Margin="5">
<PanelContainer.PanelOverride>
<!-- <graphics:StyleBoxFlat BackgroundColor="#464950"/> -->
<graphics:StyleBoxFlat BackgroundColor="#303133"/>
</PanelContainer.PanelOverride>
</PanelContainer>

<Control VerticalExpand="True" VerticalAlignment="Stretch" />
<Button Name="ConfirmRespawnButton" Text="{Loc 'ghost-respawn-rules-window-confirm-button'}" Margin="5" />
</BoxContainer>
</PanelContainer>
</ScrollContainer>
</controls:FancyWindow>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using Content.Client.UserInterface.Controls;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Utility;

namespace Content.Client.UserInterface.Systems.Ghost.Controls
{
[GenerateTypedNameReferences]
public sealed partial class GhostRespawnRulesWindow : FancyWindow
{
public PanelContainer RulesContainer => TextContainer;
public RichTextLabel RulesLabel = new() { Margin = new Thickness(5, 5, 5, 5) };
public Button RespawnButton => ConfirmRespawnButton;

public GhostRespawnRulesWindow()
{
RobustXamlLoader.Load(this);

var message = new FormattedMessage();
message.AddMarkup(Loc.GetString("ghost-respawn-rules-window-rules"));
RulesLabel.SetMessage(message);
RulesContainer.AddChild(RulesLabel);
RulesLabel.SetPositionFirst();

RespawnButton.OnPressed += _ => Close();
}
}
}
44 changes: 40 additions & 4 deletions Content.Client/UserInterface/Systems/Ghost/GhostUIController.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
using Content.Client.Gameplay;
using Content.Client._NF.Respawn;
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 Content.Shared._NF.CCVar;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controllers;
using Robust.Shared.Configuration;
using Robust.Shared.Console;

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 IConfigurationManager _cfg = default!;
[Dependency] private readonly IConsoleHost _consoleHost = default!;

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

private GhostGui? Gui => UIManager.GetActiveUIWidgetOrNull<GhostGui>();

Expand Down Expand Up @@ -56,6 +63,11 @@ public void OnSystemUnloaded(GhostSystem system)
system.GhostRoleCountUpdated -= OnRoleCountUpdated;
}

private void UpdateRespawn(TimeSpan? timeOfDeath)
{
Gui?.UpdateRespawn(timeOfDeath);
}

public void UpdateGui()
{
if (Gui == null)
Expand All @@ -64,7 +76,10 @@ public void UpdateGui()
}

Gui.Visible = _system?.IsGhost ?? false;
Gui.Update(_system?.AvailableGhostRoleCount, _system?.Player?.CanReturnToBody);
Gui.Update(_system?.AvailableGhostRoleCount, _system?.Player?.CanReturnToBody,
_respawn?.RespawnResetTime,
_cfg.GetCVar(NF14CVars.RespawnTime)
);
}

private void OnPlayerRemoved(GhostComponent component)
Expand Down Expand Up @@ -120,10 +135,16 @@ public void LoadGui()
Gui.ReturnToBodyPressed += ReturnToBody;
Gui.GhostRolesPressed += GhostRolesPressed;
Gui.TargetWindow.WarpClicked += OnWarpClicked;
Gui.GhostRespawnPressed += GuiOnGhostRespawnPressed;

UpdateGui();
}

private void GuiOnGhostRespawnPressed()
{
_consoleHost.ExecuteCommand("ghostrespawn");
}

public void UnloadGui()
{
if (Gui == null)
Expand Down Expand Up @@ -153,4 +174,19 @@ private void GhostRolesPressed()
{
_system?.OpenGhostRoles();
}
}

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

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

private void OnRespawnReseted()
{
UpdateGui();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
<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="GhostRespawnButton" Text="{Loc ghost-gui-respawn}" />
</BoxContainer>
</widgets:GhostGui>
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
using Content.Client.Stylesheets;
using Content.Client.UserInterface.Systems.Ghost.Controls;
using Content.Shared._NF.CCVar;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Configuration;
using Robust.Shared.Timing;

namespace Content.Client.UserInterface.Systems.Ghost.Widgets;

[GenerateTypedNameReferences]
public sealed partial class GhostGui : UIWidget
{
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly IConfigurationManager _configurationManager = default!;

private TimeSpan? _timeOfDeath;
private float _minTimeToRespawn;

public GhostTargetWindow TargetWindow { get; }
public GhostRespawnRulesWindow RulesWindow { get; }

public event Action? GhostRespawnPressed;

public event Action? RequestWarpsPressed;
public event Action? ReturnToBodyPressed;
Expand All @@ -20,12 +32,22 @@ public GhostGui()
RobustXamlLoader.Load(this);

TargetWindow = new GhostTargetWindow();
RulesWindow = new GhostRespawnRulesWindow();

MouseFilter = MouseFilterMode.Ignore;

RulesWindow.RespawnButton.OnPressed += _ => GhostRespawnPressed?.Invoke();

GhostWarpButton.OnPressed += _ => RequestWarpsPressed?.Invoke();
ReturnToBodyButton.OnPressed += _ => ReturnToBodyPressed?.Invoke();
GhostRolesButton.OnPressed += _ => GhostRolesPressed?.Invoke();
GhostRespawnButton.OnPressed += _ => RulesWindow.OpenCentered();
}

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

public void Hide()
Expand All @@ -34,9 +56,11 @@ public void Hide()
Visible = false;
}

public void Update(int? roles, bool? canReturnToBody)
public void Update(int? roles, bool? canReturnToBody, TimeSpan? timeOfDeath, float minTimeToRespawn)
{
ReturnToBodyButton.Disabled = !canReturnToBody ?? true;
_timeOfDeath = timeOfDeath;
_minTimeToRespawn = minTimeToRespawn;

if (roles != null)
{
Expand All @@ -54,6 +78,28 @@ public void Update(int? roles, bool? canReturnToBody)
TargetWindow.Populate();
}

protected override void FrameUpdate(FrameEventArgs args)
{
if (_timeOfDeath is null)
{
GhostRespawnButton.Text = Loc.GetString("ghost-gui-respawn-button-allowed");
GhostRespawnButton.Disabled = false;
return;
}

var delta = (_minTimeToRespawn - _gameTiming.CurTime.Subtract(_timeOfDeath.Value).TotalSeconds);
if (delta <= 0)
{
GhostRespawnButton.Text = Loc.GetString("ghost-gui-respawn-button-allowed");
GhostRespawnButton.Disabled = false;
}
else
{
GhostRespawnButton.Text = Loc.GetString("ghost-gui-respawn-button-denied", ("time", $"{delta:f1}"));
GhostRespawnButton.Disabled = true;
}
}

protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
Expand All @@ -63,4 +109,4 @@ protected override void Dispose(bool disposing)
TargetWindow.Dispose();
}
}
}
}
22 changes: 22 additions & 0 deletions Content.Client/_NF/Respawn/RespawnSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using Content.Shared._NF.Respawn;

namespace Content.Client._NF.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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.Database;
using Content.Server.Body.Components;
using Content.Shared.DoAfter;
using Content.Shared.FixedPoint;
using Content.Shared.Forensics;
using Content.Shared.IdentityManagement;
Expand All @@ -22,6 +24,7 @@ namespace Content.Server.Chemistry.EntitySystems
public sealed partial class ChemistrySystem
{
[Dependency] private readonly UseDelaySystem _useDelay = default!;
[Dependency] private readonly SharedDoAfterSystem _doAfterSystem = default!;

private void InitializeHypospray()
{
Expand All @@ -30,6 +33,7 @@ private void InitializeHypospray()
SubscribeLocalEvent<HyposprayComponent, SolutionContainerChangedEvent>(OnSolutionChange);
SubscribeLocalEvent<HyposprayComponent, UseInHandEvent>(OnUseInHand);
SubscribeLocalEvent<HyposprayComponent, ComponentGetState>(OnHypoGetState);
SubscribeLocalEvent<HyposprayComponent, HyposprayDoAfterEvent>(HyposprayDoAfter);
}

private void OnHypoGetState(Entity<HyposprayComponent> entity, ref ComponentGetState args)
Expand Down Expand Up @@ -61,8 +65,29 @@ public void OnAfterInteract(Entity<HyposprayComponent> entity, ref AfterInteract
var target = args.Target;
var user = args.User;

TryDoInject(entity, target, user);
if (target != user && HasComp<BloodstreamComponent>(target))
{
_doAfterSystem.TryStartDoAfter(new DoAfterArgs(EntityManager, user, TimeSpan.FromSeconds(1), new HyposprayDoAfterEvent(), entity.Owner, target: target, used: user)
{
BreakOnUserMove = true,
BreakOnDamage = true,
BreakOnTargetMove = true,
MovementThreshold = 0.1f,
});
}
else
{
TryDoInject(entity, target, user);
}
}

private void HyposprayDoAfter(Entity<HyposprayComponent> entity, ref HyposprayDoAfterEvent args)
{
if (args.Cancelled || args.Handled || args.Args.Target == null)
return;
TryDoInject(entity, args.Args.Target.Value, args.Args.User);
args.Handled = true;
}

public void OnAttack(Entity<HyposprayComponent> entity, ref MeleeHitEvent args)
{
Expand Down
Loading
Loading