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

Photocopier pitka 2 [а мердж будит??] #52

Closed
wants to merge 45 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
29fb536
Central Command Uniform
AwareFoxy Aug 25, 2023
d422808
need rename
AwareFoxy Aug 25, 2023
5d77af7
Add files via upload
AwareFoxy Aug 25, 2023
4919748
Prototypes
AwareFoxy Aug 25, 2023
5fcafa6
Delete BansNotificationsSystem.cs
AwareFoxy Aug 28, 2023
36536e6
Add files via upload
AwareFoxy Aug 28, 2023
193d679
Add files via upload
AwareFoxy Aug 28, 2023
8b55ace
Update BanManager.cs
AwareFoxy Aug 28, 2023
a31b0cc
Add files via upload
AwareFoxy Aug 28, 2023
47e2edd
Delete deluzlox.txt
AwareFoxy Aug 28, 2023
a1df690
Add files via upload
AwareFoxy Aug 28, 2023
2fe4573
Delete Content.Shared/SS220/AnnounceTTS directory
AwareFoxy Aug 28, 2023
c7022cb
Add files via upload
AwareFoxy Aug 28, 2023
690b3d4
Delete Content.Server/SS220/Discord directory
AwareFoxy Aug 28, 2023
e6d0ba3
Delete Content.Server/SS220/PrimeWhitelist directory
AwareFoxy Aug 28, 2023
2316487
Add files via upload
AwareFoxy Aug 28, 2023
fcc45e1
Delete Content.Client/SS220/AnnounceTTS directory
AwareFoxy Aug 28, 2023
b5413e8
Add files via upload
AwareFoxy Aug 28, 2023
fd876c5
Add files via upload
AwareFoxy Aug 28, 2023
947c34d
Add files via upload
AwareFoxy Aug 28, 2023
6237afe
Merge pull request #7 from MyFriendHowAreYou/photocopier-ss221
AwareFoxy Aug 28, 2023
4f76d7d
otkat for merge
AwareFoxy Aug 28, 2023
84701d7
otkat dlya merga
AwareFoxy Aug 28, 2023
4e18278
Delete Content.Server/GameTicking/Events/BanEvent.cs
AwareFoxy Aug 28, 2023
35ae608
Delete Content.Server/GameTicking/Events/DepartmentBanEvent.cs
AwareFoxy Aug 28, 2023
1c65275
Delete Content.Server/GameTicking/Events/JobBanEvent.cs
AwareFoxy Aug 28, 2023
b8ba966
Add files via upload
AwareFoxy Aug 29, 2023
6578e0a
Merge pull request #8 from MyFriendHowAreYou/photocopier-ss221
AwareFoxy Aug 29, 2023
4642285
Update SlotFlags.cs
AwareFoxy Sep 1, 2023
b6436fa
revert slotflags(wrong branch)
AwareFoxy Sep 1, 2023
6c78561
Delete Content.Client/SS220/CryopodSSD directory
AwareFoxy Sep 1, 2023
cdbf931
Delete Content.Server/SS220/CryopodSSD directory
AwareFoxy Sep 1, 2023
02a0a0c
Delete Resources/Prototypes/SS220/CryopodSSD directory
AwareFoxy Sep 1, 2023
159eb95
Merge pull request #9 from MyFriendHowAreYou/photocopier-ss221
AwareFoxy Sep 1, 2023
a9114a0
Delete Resources/Maps/centcomm.yml
AwareFoxy Sep 2, 2023
8193834
Add files via upload
AwareFoxy Sep 2, 2023
f435674
smol fix
AwareFoxy Sep 2, 2023
b71bc76
Merge branch '13lackHawk:master-andromeda' into master-andromeda
AwareFoxy Sep 3, 2023
b290edc
Add files via upload
AwareFoxy Sep 10, 2023
3e07ab0
wrong branch
AwareFoxy Sep 10, 2023
08cbe56
Photocopier (systems and other)
AwareFoxy Sep 14, 2023
0d43a5b
Merge branch 'master-andromeda' of https://github.com/MyFriendHowAreY…
AwareFoxy Sep 14, 2023
5e3596b
minus centcom
AwareFoxy Sep 15, 2023
a964fe9
Add files via upload
AwareFoxy Sep 15, 2023
6dd87c5
Add files via upload
AwareFoxy Sep 15, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 10 additions & 33 deletions Content.Client/Paper/UI/PaperWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,12 @@
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Utility;
using Robust.Client.UserInterface.RichText;

namespace Content.Client.Paper.UI
{
[GenerateTypedNameReferences]
public sealed partial class PaperWindow : BaseWindow
[GenerateTypedNameReferences, Virtual]
public partial class PaperWindow : BaseWindow
{
private static Color DefaultTextColor = new(25, 25, 25);

// <summary>
// Size of resize handles around the paper
private const int DRAG_MARGIN_SIZE = 16;
Expand All @@ -30,23 +27,14 @@ public sealed partial class PaperWindow : BaseWindow

// If paper limits the size in one or both axes, it'll affect whether
// we're able to resize this UI or not. Default to everything enabled:
private DragMode _allowedResizeModes = ~DragMode.None;

private readonly Type[] _allowedTags = new Type[] {
typeof(BoldItalicTag),
typeof(BoldTag),
typeof(BulletTag),
typeof(ColorTag),
typeof(HeadingTag),
typeof(ItalicTag)
};
private DragMode _allowedResizeModes = ~DragMode.None;

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

// We can't configure the RichTextLabel contents from xaml, so do it here:
BlankPaperIndicator.SetMessage(Loc.GetString("paper-ui-blank-page-message"), null, DefaultTextColor);
BlankPaperIndicator.SetMessage(Loc.GetString("paper-ui-blank-page-message"));

// Hook up the close button:
CloseButton.OnPressed += _ => Close();
Expand All @@ -56,11 +44,8 @@ public PaperWindow()
/// Initialize this UI according to <code>visuals</code> Initializes
/// textures, recalculates sizes, and applies some layout rules.
/// </summary>
public void InitVisuals(EntityUid entity, PaperVisualsComponent visuals)
public void InitVisuals(PaperVisualsComponent visuals)
{
// Randomize the placement of any stamps based on the entity UID
// so that there's some variety in different papers.
StampDisplay.PlacementSeed = (int)entity;
var resCache = IoCManager.Resolve<IResourceCache>();

// Initialize the background:
Expand Down Expand Up @@ -200,34 +185,30 @@ public void Populate(SharedPaperComponent.PaperBoundUserInterfaceState state)
var msg = new FormattedMessage();
msg.AddMarkupPermissive(state.Text);

// For premade documents, we want to be able to edit them rather than
// replace them.
var shouldCopyText = 0 == Input.TextLength && 0 != state.Text.Length;
if (!wasEditing || shouldCopyText)
if (!wasEditing)
{
// We can get repeated messages with state.Mode == Write if another
// player opens the UI for reading. In this case, don't update the
// text input, as this player is currently writing new text and we
// don't want to lose any text they already input.
Input.TextRope = Rope.Leaf.Empty;
Input.CursorPosition = new TextEdit.CursorPos();
Input.InsertAtCursor(state.Text);
Input.InsertAtCursor(msg.ToString());
}

for (var i = 0; i <= state.StampedBy.Count * 3 + 1; i++)
{
msg.AddMarkupPermissive("\r\n");
}
WrittenTextLabel.SetMessage(msg, _allowedTags, DefaultTextColor);
WrittenTextLabel.SetMessage(msg);

WrittenTextLabel.Visible = !isEditing && state.Text.Length > 0;
BlankPaperIndicator.Visible = !isEditing && state.Text.Length == 0;

StampDisplay.RemoveAllChildren();
StampDisplay.RemoveStamps();
foreach(var stamper in state.StampedBy)
{
StampDisplay.AddStamp(new StampWidget{ StampInfo = stamper });
StampDisplay.AddChild(new StampWidget{ Stamper = stamper });
}
}

Expand All @@ -239,7 +220,7 @@ public void Populate(SharedPaperComponent.PaperBoundUserInterfaceState state)
/// </summary>
protected override DragMode GetDragModeFor(Vector2 relativeMousePos)
{
var mode = DragMode.None;
var mode = DragMode.Move;

// Be quite generous with resize margins:
if (relativeMousePos.Y < DRAG_MARGIN_SIZE)
Expand All @@ -260,10 +241,6 @@ protected override DragMode GetDragModeFor(Vector2 relativeMousePos)
mode |= DragMode.Right;
}

if((mode & _allowedResizeModes) == DragMode.None)
{
return DragMode.Move;
}
return mode & _allowedResizeModes;
}
}
Expand Down
49 changes: 49 additions & 0 deletions Content.Client/SS220/ButtScan/ButtScanBoundUI.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt

using Content.Client.Paper;
using Content.Client.SS220.ButtScan.UI;
using Content.Shared.Paper;
using Content.Shared.SS220.ButtScan;
using Robust.Client.GameObjects;

namespace Content.Client.SS220.ButtScan;

public sealed class ButtScanBoundUserInterface : BoundUserInterface
{
[Dependency] private readonly IEntityManager _entityMgr = default!;

private ButtScanWindow? _window;
private readonly EntityUid _paperEntity;

public ButtScanBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
IoCManager.InjectDependencies(this);
_paperEntity = owner;
}

/// <inheritdoc/>
protected override void Open()
{
_window = new ButtScanWindow();
_window.OnClose += Close;

if (_entityMgr.TryGetComponent<ButtScanComponent>(_paperEntity, out var scan) &&
_entityMgr.TryGetComponent<PaperVisualsComponent>(_paperEntity, out var paperVisuals))
_window.InitVisuals(scan, paperVisuals);

_window.OpenCentered();
}

protected override void UpdateState(BoundUserInterfaceState state)
{
base.UpdateState(state);
_window?.Populate((SharedPaperComponent.PaperBoundUserInterfaceState) state);
}

protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if(disposing)
_window?.Dispose();
}
}
9 changes: 9 additions & 0 deletions Content.Client/SS220/ButtScan/UI/ButtScanWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!-- © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt -->
<ui:ButtScanWindow xmlns="https://spacestation14.io"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ui="clr-namespace:Content.Client.SS220.ButtScan.UI"

MouseFilter="Stop"
Resizable="False"
SetSize="350 400">
</ui:ButtScanWindow>
68 changes: 68 additions & 0 deletions Content.Client/SS220/ButtScan/UI/ButtScanWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt

using Content.Client.Paper;
using Content.Client.Paper.UI;
using Content.Shared.Paper;
using Content.Shared.SS220.ButtScan;
using Robust.Client.AutoGenerated;
using Robust.Client.ResourceManagement;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using System.Numerics;

namespace Content.Client.SS220.ButtScan.UI;

[GenerateTypedNameReferences]
public sealed partial class ButtScanWindow : PaperWindow
{
[Dependency] private readonly IResourceCache _resCache = default!;

private readonly Vector2 _buttRectSize = new Vector2(300, 300);
private readonly Thickness _buttRectMargin = new(25, 25);

public readonly TextureRect ButtTextureRect;

public ButtScanWindow()
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);

var layers = new Control();
layers.HorizontalExpand = true;
layers.VerticalExpand = true;

ButtTextureRect = new TextureRect();
ButtTextureRect.Stretch = TextureRect.StretchMode.Scale;
ButtTextureRect.CanShrink = true;
ButtTextureRect.SetSize = _buttRectSize;
ButtTextureRect.Margin = _buttRectMargin;
ButtTextureRect.HorizontalAlignment = HAlignment.Center;
ButtTextureRect.VerticalAlignment = VAlignment.Center;

PaperBackground.AddChild(layers);
ScrollingContents.Orphan();
layers.AddChild(ButtTextureRect);
layers.AddChild(ScrollingContents);
}

public void InitVisuals(ButtScanComponent scan, PaperVisualsComponent visuals)
{
base.InitVisuals(visuals);

var contentImage = _resCache.GetResource<TextureResource>(scan.ButtTexturePath);
ButtTextureRect.Texture = contentImage;
}

public new void Populate(SharedPaperComponent.PaperBoundUserInterfaceState state)
{
base.Populate(state);
BlankPaperIndicator.Visible = false;
}

// Drag by grabbing anywhere
protected override DragMode GetDragModeFor(Vector2 relativeMousePos)
{
return DragMode.Move;
}
}
101 changes: 101 additions & 0 deletions Content.Client/SS220/CryopodSSD/AfkSSDSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
// © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt

using System.Linq;
using Content.Server.Afk;
using Content.Server.GameTicking;
using Content.Server.Mind.Components;
using Content.Server.Preferences.Managers;
using Content.Shared.Body.Components;
using Content.Shared.CCVar;
using Content.Shared.Preferences;
using Robust.Server.Player;
using Robust.Shared.Configuration;
using Robust.Shared.Enums;
using Robust.Shared.Network;
using Robust.Shared.Timing;
using Robust.Shared.Utility;

namespace Content.Server.SS220.CryopodSSD;

public sealed class AfkSSDSystem : EntitySystem
{
[Dependency] private readonly CryopodSSDSystem _cryopodSSDSystem = default!;
[Dependency] private readonly IServerPreferencesManager _preferencesManager = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly IConfigurationManager _cfg = default!;

private float _afkTeleportTocryo;

private readonly Dictionary<(EntityUid, NetUserId), (TimeSpan, bool)> _entityEnteredSSDTimes = new();

public override void Initialize()
{
base.Initialize();

_cfg.OnValueChanged(CCVars.AfkTeleportToCryo, SetAfkTeleportToCryo, true);
_playerManager.PlayerStatusChanged += OnPlayerChange;
}

private void SetAfkTeleportToCryo(float value)
=> _afkTeleportTocryo = value;

public override void Shutdown()
{
base.Shutdown();

_cfg.UnsubValueChanged(CCVars.AfkTeleportToCryo, SetAfkTeleportToCryo);
_playerManager.PlayerStatusChanged -= OnPlayerChange;
}

public override void Update(float frameTime)
{
base.Update(frameTime);
foreach (var pair in _entityEnteredSSDTimes.Where(uid => HasComp<MindContainerComponent>(uid.Key.Item1)))
{
if (pair.Value.Item2 && IsTeleportAfkToCryoTime(pair.Value.Item1)
&& _cryopodSSDSystem.TeleportEntityToCryoStorageWithDelay(pair.Key.Item1))
{
_entityEnteredSSDTimes.Remove(pair.Key);
}
}
}

private bool IsTeleportAfkToCryoTime(TimeSpan time)
{
var timeOut = TimeSpan.FromSeconds(_afkTeleportTocryo);
return _gameTiming.CurTime - time > timeOut;
}

private void OnPlayerChange(object? sender, SessionStatusEventArgs e)
{

switch (e.NewStatus)
{
case SessionStatus.Disconnected:
if (e.Session.AttachedEntity is null
|| !HasComp<MindContainerComponent>(e.Session.AttachedEntity)
|| !HasComp<BodyComponent>(e.Session.AttachedEntity))
{
break;
}

if (!_preferencesManager.TryGetCachedPreferences(e.Session.UserId, out var preferences)
|| preferences.SelectedCharacter is not HumanoidCharacterProfile humanoidPreferences)
{
break;
}
_entityEnteredSSDTimes[(e.Session.AttachedEntity.Value, e.Session.UserId)]
= (_gameTiming.CurTime, humanoidPreferences.TeleportAfkToCryoStorage);
break;
case SessionStatus.Connected:
if (_entityEnteredSSDTimes
.TryFirstOrNull(item => item.Key.Item2 == e.Session.UserId, out var item))
{
_entityEnteredSSDTimes.Remove(item.Value.Key);
}

break;
}
}
}
Loading