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

Сверхматерия! #869

Draft
wants to merge 77 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
fff0d39
System/Components upload
M1and1B Dec 2, 2024
b7ec5ae
Добавил ТГ газы в код СМа
M1and1B Dec 2, 2024
e70c580
Пофиксил ошибки в коде. Загрузил спрайты, прототипы, звуки.
M1and1B Dec 2, 2024
d314573
ClothingGrantComponentComponent upload
M1and1B Dec 3, 2024
306ed36
ЛОКАЛИЗАЦИЯ, ЭХУУУ
M1and1B Dec 9, 2024
2eb8df0
Возможность купить СМ. Нужно переделать прототип коробки
M1and1B Dec 9, 2024
c84b818
Убрал заказ в карго. Убрал Деллам Теслы и Сингулярности. Добавлен Дел…
M1and1B Dec 12, 2024
549617b
Удаление мусора.
M1and1B Dec 12, 2024
8ec0a0b
Закинул цель на воровство осколка. Больше локализации.
M1and1B Dec 12, 2024
f2f24dc
Ище больше локализации. Теперь Анти-Ноблиум должен хуярить СМ.
M1and1B Dec 12, 2024
cb31779
Правки локализации.
M1and1B Dec 13, 2024
9a29102
Анти-Ноблиум дамажит. Выбор вида оповещений.
M1and1B Dec 13, 2024
35e4579
Фикс глупых ошибок. Чуть чуть ище ФТЛа
M1and1B Dec 13, 2024
7e7e8df
Доделал выбор оповещения.
M1and1B Dec 14, 2024
d00a08b
Кастом оповещения при Каскаде.
M1and1B Dec 14, 2024
56d5fb9
Наконец-то работа над каскадом.
M1and1B Dec 14, 2024
4051324
Спаун каскадного СМа
M1and1B Dec 15, 2024
1f972a3
Уменьшение времени до расслоения.
M1and1B Dec 15, 2024
ec2eb06
Теперь дамаг он анти-ноблия уменьшается, когда стабильность кристалла…
M1and1B Dec 16, 2024
6dc1409
Файлы под UI
M1and1B Dec 16, 2024
04c07fe
Делаем консоль. Нужны баг-фиксы
M1and1B Dec 17, 2024
9af93d5
NOW SUPERMATTER WITH RAINBOW COLOR
M1and1B Dec 17, 2024
5fa2003
Revert "NOW SUPERMATTER WITH RAINBOW COLOR"
M1and1B Dec 17, 2024
6adb985
NOW SUPERMATTER SUPPORTS LGBTQK+
M1and1B Dec 17, 2024
57c7941
Revert "NOW SUPERMATTER SUPPORTS LGBTQK+"
M1and1B Dec 17, 2024
b08f6c7
NOW SUPERMATTER SUPPORTS LGBT
M1and1B Dec 17, 2024
f358f88
Немного фиксов для консоли
M1and1B Dec 18, 2024
1650f7c
Ище фиксы
M1and1B Dec 19, 2024
63515a3
Локалка теперь хотя-бы работает.
M1and1B Dec 19, 2024
10f23c3
Bugfix#1
M1and1B Dec 20, 2024
dc7417d
fix#2
M1and1B Dec 20, 2024
6ff36dd
fix#3
M1and1B Dec 20, 2024
d666f2d
Merge branch 'master' into SuperMatter
M1and1B Dec 20, 2024
3f8db3a
Вырезаем консоль
M1and1B Dec 23, 2024
e307155
КАКОГО ХУЯ ВСЁ ПОЛОМАЛОСЬ
M1and1B Dec 23, 2024
ef926a8
Я такой тупой
M1and1B Dec 23, 2024
b86ca8e
Залил новых спрайтов. CCVarы всё заруинили.
M1and1B Dec 23, 2024
3f2b8b6
Пофиксил работу CCVars
M1and1B Dec 24, 2024
1eb68b9
Замена консольки
M1and1B Dec 24, 2024
47d98fc
чёт ище тут накидал(очень весело, форил)
M1and1B Dec 24, 2024
1133158
Тот самый ребаланс газов, пополнил гайдбук.
M1and1B Dec 24, 2024
8923723
По какой-то причине все забили на пару. Цвета под каждый газ завезу з…
M1and1B Dec 24, 2024
b08cfe4
GUIDEBOOK NOW SUPPORTS разноцветность
M1and1B Dec 25, 2024
de01ae8
Залил спрайты для кудзу СМа
M1and1B Dec 25, 2024
dba4b34
Предпоследний коммит до выхода из драфта!
M1and1B Dec 29, 2024
7d168b1
saves for later
M1and1B Jan 2, 2025
1d6610f
Merge branch 'AdventureTimeSS14:master' into SuperMatter
M1and1B Jan 20, 2025
db53fd8
Update supermatter.ftl
jungarikjan Jan 21, 2025
19dc80e
я ебал
M1and1B Feb 13, 2025
152a8c9
СУКА Я СДЕЛАЛ НАХУЙ.
M1and1B Feb 15, 2025
af60e09
Забыл логирование убрать блятьб
M1and1B Feb 15, 2025
255784b
Фикс локали и небольшие приколы со спрайтами.
M1and1B Feb 15, 2025
e6fa155
Начало делать цель сранную
M1and1B Feb 15, 2025
b1ffb5f
Доделал цель. Осталось мелочь фиксов и добавить получение ноблия
M1and1B Feb 16, 2025
5151d69
Update Resources/Prototypes/Entities/Clothing/Head/hardsuit-helmets.yml
M1and1B Feb 16, 2025
c75aa8b
Update Resources/Prototypes/Entities/Objects/Specific/Medical/morgue.yml
M1and1B Feb 16, 2025
ea93921
Update Resources/Prototypes/Entities/Mobs/Player/admin_ghost.yml
M1and1B Feb 16, 2025
ce7cc3f
Перенос систем/компонентов в папки ADT
M1and1B Feb 16, 2025
f2ae6c5
Merge branch 'SuperMatter' of https://github.com/M1and1B/space_statio…
M1and1B Feb 16, 2025
3bf3a76
Update Resources/Prototypes/Entities/Structures/Power/Generation/Sing…
M1and1B Feb 16, 2025
b1cf7b3
Update Resources/Prototypes/Entities/Structures/Power/Generation/Tesl…
M1and1B Feb 16, 2025
a828047
Ище больше переноса компонентиков
M1and1B Feb 16, 2025
21b57fa
Update Resources/Prototypes/Entities/Clothing/Head/hardsuit-helmets.yml
M1and1B Feb 16, 2025
fa0e6bb
Update Resources/Prototypes/Entities/Clothing/Head/hardsuit-helmets.yml
M1and1B Feb 16, 2025
0c8cd67
Update Resources/Prototypes/Entities/Clothing/OuterClothing/hardsuits…
M1and1B Feb 16, 2025
a6a3fd9
Update Resources/Prototypes/Entities/Clothing/OuterClothing/hardsuits…
M1and1B Feb 16, 2025
243d15b
Update Resources/Prototypes/Entities/Clothing/OuterClothing/hardsuits…
M1and1B Feb 16, 2025
95a0cee
Update Resources/Prototypes/Entities/Clothing/OuterClothing/hardsuits…
M1and1B Feb 16, 2025
803bb24
Update Resources/Prototypes/Entities/Clothing/Head/hardsuit-helmets.yml
M1and1B Feb 16, 2025
e352c28
Merge branch 'SuperMatter' of https://github.com/M1and1B/space_statio…
M1and1B Feb 16, 2025
c8cf394
Ище больше правок
M1and1B Feb 16, 2025
96b74b0
fix
M1and1B Feb 16, 2025
6ce31d1
Merge branch 'AdventureTimeSS14:master' into SuperMatter
M1and1B Feb 16, 2025
f11637c
return
M1and1B Feb 16, 2025
3f74b98
Начало переноса консоли.
M1and1B Feb 16, 2025
342db2d
Залил консольку, осталось баги пофиксить блинб
M1and1B Feb 17, 2025
99ac60b
Чуть фиксов.
M1and1B Feb 17, 2025
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using Content.Client.ADT.Supermatter.Systems;
using Content.Shared.ADT.Supermatter.Components;

namespace Content.Client.ADT.Supermatter.Components;

[RegisterComponent]
[Access(typeof(SupermatterVisualizerSystem))]
public sealed partial class SupermatterVisualsComponent : Component
{
[DataField("crystal", required: true)]
public Dictionary<SupermatterCrystalState, PrototypeLayerData> CrystalVisuals = default!;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using Content.Shared.ADT.Supermatter.Components;

namespace Content.Client.ADT.Supermatter.Consoles;

public sealed class SupermatterConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : BoundUserInterface(owner, uiKey)
{
[ViewVariables]
private SupermatterConsoleWindow? _menu;

protected override void Open()
{
_menu = new SupermatterConsoleWindow(this, Owner);
_menu.OpenCentered();
_menu.OnClose += Close;
}

protected override void UpdateState(BoundUserInterfaceState state)
{
base.UpdateState(state);

var castState = (SupermatterConsoleBoundInterfaceState)state;
_menu?.UpdateUI(castState.Supermatters, castState.FocusData);
}

public void SendFocusChangeMessage(NetEntity? netEntity)
{
SendMessage(new SupermatterConsoleFocusChangeMessage(netEntity));
}

protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (!disposing)
return;

_menu?.Parent?.RemoveChild(_menu);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<controls:FancyWindow xmlns="https://spacestation14.io"
xmlns:ui="clr-namespace:Content.Client.Pinpointer.UI"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
Title="{Loc 'supermatter-console-window-title'}"
Resizable="True"
SetSize="700 400"
MinSize="700 400">
<BoxContainer Orientation="Vertical">
<!-- Main display -->
<BoxContainer Orientation="Horizontal" VerticalExpand="True" HorizontalExpand="True">
<!-- Supermatter list -->
<BoxContainer Orientation="Vertical" VerticalExpand="True" HorizontalExpand="True" Margin="10 0 10 10">
<!-- Supermatters (entries added by C# code) -->
<BoxContainer VerticalExpand="True" HorizontalExpand="True" Margin="0 10 0 0">
<ScrollContainer HorizontalExpand="True">
<BoxContainer Name="SupermattersTable" Orientation="Vertical" VerticalExpand="True" HorizontalExpand="True" Margin="0 0 0 10" />
</ScrollContainer>
</BoxContainer>
</BoxContainer>
</BoxContainer>

<!-- Footer -->
<BoxContainer Orientation="Vertical">
<PanelContainer StyleClasses="LowDivider" />
<BoxContainer Orientation="Horizontal" Margin="10 2 5 0" VerticalAlignment="Bottom">
<Label Text="{Loc 'supermatter-console-window-flavor-left'}" StyleClasses="WindowFooterText" />
<Label Text="{Loc 'supermatter-console-window-flavor-right'}" StyleClasses="WindowFooterText"
HorizontalAlignment="Right" HorizontalExpand="True" Margin="0 0 5 0" />
<TextureRect StyleClasses="NTLogoDark" Stretch="KeepAspectCentered"
VerticalAlignment="Center" HorizontalAlignment="Right" SetSize="19 19"/>
</BoxContainer>
</BoxContainer>
</BoxContainer>
</controls:FancyWindow>
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
using Content.Client.Message;
using Content.Client.UserInterface.Controls;
using Content.Shared.ADT.Supermatter.Components;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Timing;
using System.Diagnostics.CodeAnalysis;
using System.Linq;

namespace Content.Client.ADT.Supermatter.Consoles;

[GenerateTypedNameReferences]
public sealed partial class SupermatterConsoleWindow : FancyWindow
{
private readonly IEntityManager _entManager;

private readonly EntityUid? _owner;
private NetEntity? _trackedEntity;
private SupermatterConsoleEntry[]? _supermatters = null;

public event Action<NetEntity?>? SendFocusChangeMessageAction;

private bool _autoScrollActive = false;
private bool _autoScrollAwaitsUpdate = false;

public SupermatterConsoleWindow(SupermatterConsoleBoundUserInterface userInterface, EntityUid? owner)
{
RobustXamlLoader.Load(this);
_entManager = IoCManager.Resolve<IEntityManager>();
_owner = owner;

// Set the tracked supermatter for persistence
if (_entManager.TryGetComponent<SupermatterConsoleComponent>(_owner, out var console))
_trackedEntity = console.FocusSupermatter;

// Set supermatter monitoring message action
SendFocusChangeMessageAction += userInterface.SendFocusChangeMessage;
}

public void UpdateUI(SupermatterConsoleEntry[] supermatters, SupermatterFocusData? focusData)
{
if (_owner == null)
return;

if (!_entManager.TryGetComponent<SupermatterConsoleComponent>(_owner.Value, out var console))
return;

if (_trackedEntity != focusData?.NetEntity)
{
SendFocusChangeMessageAction?.Invoke(_trackedEntity);
focusData = null;
}

// Retain supermatter data for use inbetween updates
_supermatters = supermatters;

// Clear excess children from the tables
var supermattersCount = _supermatters.Length;

while (SupermattersTable.ChildCount > supermattersCount)
SupermattersTable.RemoveChild(SupermattersTable.GetChild(SupermattersTable.ChildCount - 1));

// Update all entries in each table
for (var index = 0; index < _supermatters.Length; index++)
{
var entry = _supermatters.ElementAt(index);
UpdateUIEntry(entry, index, SupermattersTable, console, focusData);
}

// If no alerts are active, display a message
if (supermattersCount == 0)
{
var label = new RichTextLabel()
{
HorizontalExpand = true,
VerticalExpand = true,
HorizontalAlignment = HAlignment.Center,
VerticalAlignment = VAlignment.Center,
};

label.SetMarkup(Loc.GetString("supermatter-console-window-no-supermatters"));

SupermattersTable.AddChild(label);
}

// Auto-scroll re-enable
if (_autoScrollAwaitsUpdate)
{
_autoScrollActive = true;
_autoScrollAwaitsUpdate = false;
}
}

private void UpdateUIEntry(SupermatterConsoleEntry entry, int index, Control table, SupermatterConsoleComponent console, SupermatterFocusData? focusData = null)
{
// Make new UI entry if required
if (index >= table.ChildCount)
{
var newEntryContainer = new SupermatterEntryContainer(entry.NetEntity);

// On click
newEntryContainer.FocusButton.OnButtonUp += args =>
{
if (_trackedEntity == newEntryContainer.NetEntity)
_trackedEntity = null;
else
_trackedEntity = newEntryContainer.NetEntity;

// Send message to console that the focus has changed
SendFocusChangeMessageAction?.Invoke(_trackedEntity);
};

// Add the entry to the current table
table.AddChild(newEntryContainer);
}

// Update values and UI elements
var tableChild = table.GetChild(index);

if (tableChild is not SupermatterEntryContainer)
{
table.RemoveChild(tableChild);
UpdateUIEntry(entry, index, table, console, focusData);

return;
}

var entryContainer = (SupermatterEntryContainer)tableChild;

entryContainer.UpdateEntry(entry, entry.NetEntity == _trackedEntity, focusData);
}

protected override void FrameUpdate(FrameEventArgs args)
{
AutoScrollToFocus();
}

private void AutoScrollToFocus()
{
if (!_autoScrollActive)
return;

if (SupermattersTable.Parent is not ScrollContainer scroll)
return;

if (!TryGetVerticalScrollbar(scroll, out var vScrollbar))
return;

if (!TryGetNextScrollPosition(out float? nextScrollPosition))
return;

vScrollbar.ValueTarget = nextScrollPosition.Value;

if (MathHelper.CloseToPercent(vScrollbar.Value, vScrollbar.ValueTarget))
_autoScrollActive = false;
}

private static bool TryGetVerticalScrollbar(ScrollContainer scroll, [NotNullWhen(true)] out VScrollBar? vScrollBar)
{
vScrollBar = null;

foreach (var child in scroll.Children)
{
if (child is not VScrollBar castChild)
continue;

vScrollBar = castChild;
return true;
}

return false;
}

private bool TryGetNextScrollPosition([NotNullWhen(true)] out float? nextScrollPosition)
{
nextScrollPosition = null;

if (SupermattersTable.Parent is not ScrollContainer scroll)
return false;

if (scroll.Children.ElementAt(0) is not BoxContainer container ||
!container.Children.Any())
return false;

// Exit if the heights of the children haven't been initialized yet
if (!container.Children.Any(x => x.Height > 0))
return false;

nextScrollPosition = 0;

foreach (var control in container.Children)
{
if (control == null || control is not SupermatterEntryContainer)
continue;

if (((SupermatterEntryContainer)control).NetEntity == _trackedEntity)
return true;

nextScrollPosition += control.Height;
}

// Failed to find control
nextScrollPosition = null;

return false;
}
}
Loading
Loading