-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Описание PR <!-- Что вы изменили в этом пулл реквесте? --> добавила лаваленд, консоль шаттлов, крашеры и ещё пару приколов origin: DeltaV-Station/Delta-v#2419 DeltaV-Station/Delta-v#2380 DeltaV-Station/Delta-v#2445 DeltaV-Station/Delta-v#2434 ## Почему / Баланс <!-- Почему оно было изменено? Ссылайтесь на любые обсуждения или вопросы здесь. Пожалуйста, обсудите, как это повлияет на игровой баланс. --> было в сс13 ## Медиа <!-- Пулл реквесты, которые вносят внутриигровые изменения (добавление одежды, предметов, новых возможностей и т.д.), должны содержать медиа, демонстрирующие изменения. Небольшие исправления/рефакторы не требуют медиа. Если Вы не уверены в том, что Ваш пулл реквест требует медиа, спросите мейнтейнера. --> https://github.com/user-attachments/assets/1b6f616a-7b10-4d28-9fdb-c9ea2096fb22 - [X] Я прочитал(а) и следую [Руководство по созданию пулл реквестов](https://docs.spacestation14.com/en/general-development/codebase-info/pull-request-guidelines.html). Я понимаю, что в противном случае мой ПР может быть закрыт по усмотрению мейнтейнера. - [X] Я добавил скриншоты/видео к этому пулл реквесту, демонстрирующие его изменения в игре, **или** этот пулл реквест не требует демонстрации в игре **Чейнджлог** 🆑 Ratyyy - add: НТ открыло для посещения лаваленд - гиганскую планетарную планету! --------- Co-authored-by: KashRas2 <[email protected]> Co-authored-by: PyotrIgn <[email protected]>
- Loading branch information
1 parent
ddd2cc6
commit 15a0a80
Showing
234 changed files
with
50,489 additions
and
489 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
using Robust.Client.Animations; | ||
using Robust.Client.GameObjects; | ||
using Robust.Shared.Animations; | ||
using Robust.Shared.Timing; | ||
using Content.Shared.Animations; | ||
|
||
namespace Content.Client.Animations; | ||
|
||
public sealed class FlipOnHitSystem : SharedFlipOnHitSystem | ||
{ | ||
[Dependency] private readonly AnimationPlayerSystem _animationSystem = default!; | ||
[Dependency] private readonly IGameTiming _timing = default!; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<FlippingComponent, AnimationCompletedEvent>(OnAnimationComplete); | ||
SubscribeAllEvent<FlipOnHitEvent>(ev => PlayAnimation(GetEntity(ev.User))); | ||
} | ||
|
||
private void OnAnimationComplete(Entity<FlippingComponent> ent, ref AnimationCompletedEvent args) | ||
{ | ||
if (args.Key != FlippingComponent.AnimationKey) | ||
return; | ||
|
||
PlayAnimation(ent); | ||
} | ||
|
||
protected override void PlayAnimation(EntityUid user) | ||
{ | ||
if (!_timing.IsFirstTimePredicted) | ||
return; | ||
|
||
if (TerminatingOrDeleted(user)) | ||
return; | ||
|
||
if (_animationSystem.HasRunningAnimation(user, FlippingComponent.AnimationKey)) | ||
{ | ||
EnsureComp<FlippingComponent>(user); | ||
return; | ||
} | ||
|
||
RemComp<FlippingComponent>(user); | ||
|
||
var baseAngle = Angle.Zero; | ||
if (EntityManager.TryGetComponent(user, out SpriteComponent? sprite)) | ||
baseAngle = sprite.Rotation; | ||
|
||
var degrees = baseAngle.Degrees; | ||
|
||
var animation = new Animation | ||
{ | ||
Length = TimeSpan.FromMilliseconds(500), | ||
AnimationTracks = | ||
{ | ||
new AnimationTrackComponentProperty | ||
{ | ||
ComponentType = typeof(SpriteComponent), | ||
Property = nameof(SpriteComponent.Rotation), | ||
InterpolationMode = AnimationInterpolationMode.Linear, | ||
KeyFrames = | ||
{ | ||
new AnimationTrackProperty.KeyFrame(Angle.FromDegrees(baseAngle.Degrees), 0f), | ||
new AnimationTrackProperty.KeyFrame(Angle.FromDegrees(baseAngle.Degrees + 180), 0.25f), | ||
new AnimationTrackProperty.KeyFrame(Angle.FromDegrees(baseAngle.Degrees + 360), 0.25f), | ||
new AnimationTrackProperty.KeyFrame(Angle.FromDegrees(baseAngle.Degrees), 0f), | ||
} | ||
} | ||
} | ||
}; | ||
|
||
|
||
_animationSystem.Play(user, animation, FlippingComponent.AnimationKey); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace Content.Client.Animations; | ||
|
||
[RegisterComponent] | ||
public sealed partial class FlippingComponent : Component | ||
{ | ||
public const string AnimationKey = "flip"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,221 @@ | ||
using System.Linq; | ||
using Content.Shared.ADT.MiningShop; | ||
using Content.Shared.Mind; | ||
using Content.Shared.ADT.Salvage.Systems; | ||
using Content.Shared.Roles.Jobs; | ||
using JetBrains.Annotations; | ||
using Robust.Client.GameObjects; | ||
using Robust.Client.Player; | ||
using Robust.Client.ResourceManagement; | ||
using Robust.Client.UserInterface.CustomControls; | ||
using Robust.Shared.Prototypes; | ||
using Robust.Shared.Utility; | ||
using static System.StringComparison; | ||
using static Robust.Client.UserInterface.Controls.LineEdit; | ||
|
||
namespace Content.Client.ADT.MiningShop; | ||
|
||
[UsedImplicitly] | ||
public sealed class MiningShopBui : BoundUserInterface | ||
{ | ||
[Dependency] private readonly IPlayerManager _player = default!; | ||
[Dependency] private readonly IPrototypeManager _prototype = default!; | ||
[Dependency] private readonly IResourceCache _resource = default!; | ||
private readonly MiningPointsSystem _miningPoints; | ||
private MiningShopWindow? _window; | ||
public MiningShopBui(EntityUid owner, Enum uiKey) : base(owner, uiKey) | ||
{ | ||
_miningPoints = EntMan.System<MiningPointsSystem>(); | ||
} | ||
|
||
protected override void Open() | ||
{ | ||
_window = new MiningShopWindow(); | ||
_window.OnClose += Close; | ||
_window.Title = EntMan.GetComponentOrNull<MetaDataComponent>(Owner)?.EntityName ?? "MiningShop"; | ||
|
||
if (EntMan.TryGetComponent(Owner, out MiningShopComponent? vendor)) | ||
{ | ||
for (var sectionIndex = 0; sectionIndex < vendor.Sections.Count; sectionIndex++) | ||
{ | ||
var section = vendor.Sections[sectionIndex]; | ||
|
||
var uiSection = new MiningShopSection(); | ||
uiSection.Label.SetMessage(GetSectionName(section)); | ||
|
||
|
||
for (var entryIndex = 0; entryIndex < section.Entries.Count; entryIndex++) | ||
{ | ||
var entry = section.Entries[entryIndex]; | ||
var uiEntry = new MiningShopEntry(); | ||
|
||
if (_prototype.TryIndex(entry.Id, out var entity)) | ||
{ | ||
uiEntry.Texture.Textures = SpriteComponent.GetPrototypeTextures(entity, _resource) | ||
.Select(o => o.Default) | ||
.ToList(); | ||
uiEntry.Panel.Button.Label.Text = entry.Name?.Replace("\\n", "\n") ?? entity.Name; | ||
|
||
var name = entity.Name; | ||
var color = MiningShopPanel.DefaultColor; | ||
var borderColor = MiningShopPanel.DefaultBorderColor; | ||
var hoverColor = MiningShopPanel.DefaultBorderColor; | ||
|
||
uiEntry.Panel.Color = color; | ||
uiEntry.Panel.BorderColor = borderColor; | ||
uiEntry.Panel.HoveredColor = hoverColor; | ||
|
||
var msg = new FormattedMessage(); | ||
msg.AddText(name); | ||
msg.PushNewline(); | ||
|
||
if (!string.IsNullOrWhiteSpace(entity.Description)) | ||
msg.AddText(entity.Description); | ||
|
||
var tooltip = new Tooltip(); | ||
tooltip.SetMessage(msg); | ||
|
||
uiEntry.TooltipLabel.ToolTip = entity.Description; | ||
uiEntry.TooltipLabel.TooltipDelay = 0; | ||
uiEntry.TooltipLabel.TooltipSupplier = _ => tooltip; | ||
|
||
var sectionI = sectionIndex; | ||
var entryI = entryIndex; | ||
uiEntry.Panel.Button.OnPressed += _ => OnButtonPressed(sectionI, entryI); | ||
} | ||
|
||
uiSection.Entries.AddChild(uiEntry); | ||
} | ||
|
||
_window.Sections.AddChild(uiSection); | ||
} | ||
} | ||
_window.Express.OnPressed += _ => OnExpressDeliveryButtonPressed(); | ||
_window.Search.OnTextChanged += OnSearchChanged; | ||
|
||
Refresh(); | ||
|
||
_window.OpenCentered(); | ||
} | ||
|
||
private void OnButtonPressed(int sectionIndex, int entryIndex) | ||
{ | ||
var msg = new MiningShopBuiMsg(sectionIndex, entryIndex); | ||
SendMessage(msg); | ||
Refresh(); | ||
} | ||
|
||
private void OnExpressDeliveryButtonPressed() | ||
{ | ||
var msg = new MiningShopExpressDeliveryBuiMsg(); | ||
SendMessage(msg); | ||
Refresh(); | ||
} | ||
|
||
private void OnSearchChanged(LineEditEventArgs args) | ||
{ | ||
if (_window == null) | ||
return; | ||
|
||
foreach (var sectionControl in _window.Sections.Children) | ||
{ | ||
if (sectionControl is not MiningShopSection section) | ||
continue; | ||
|
||
var any = false; | ||
foreach (var entriesControl in section.Entries.Children) | ||
{ | ||
if (entriesControl is not MiningShopEntry entry) | ||
continue; | ||
|
||
if (string.IsNullOrWhiteSpace(args.Text)) | ||
entry.Visible = true; | ||
else | ||
entry.Visible = entry.Panel.Button.Label.Text?.Contains(args.Text, OrdinalIgnoreCase) ?? false; | ||
|
||
if (entry.Visible) | ||
any = true; | ||
} | ||
|
||
section.Visible = any; | ||
} | ||
} | ||
|
||
public void Refresh() | ||
{ | ||
if (_window == null || _player.LocalEntity == null) | ||
return; | ||
|
||
if (!EntMan.TryGetComponent(Owner, out MiningShopComponent? vendor)) | ||
return; | ||
|
||
List<string> names = new List<string>(); | ||
|
||
foreach (var order in vendor.OrderList) | ||
{ | ||
var name = _prototype.TryIndex(order.Id, out var entity) ? entity.Name : order.Name; | ||
if (name != null) | ||
names.Add(name); | ||
} | ||
var orders = string.Join(", ", names); | ||
|
||
var userpoints = _miningPoints.TryFindIdCard(_player.LocalEntity.Value)?.Comp?.Points ?? 0; | ||
|
||
_window.YourPurchases.Text = $"Заказы: {orders}"; | ||
|
||
_window.Express.Text = $"Экспресс доставка"; | ||
|
||
_window.PointsLabel.Text = $"Осталось очков: {userpoints}"; | ||
|
||
for (var sectionIndex = 0; sectionIndex < vendor.Sections.Count; sectionIndex++) | ||
{ | ||
var section = vendor.Sections[sectionIndex]; | ||
var uiSection = (MiningShopSection) _window.Sections.GetChild(sectionIndex); | ||
uiSection.Label.SetMessage(GetSectionName(section)); | ||
|
||
var sectionDisabled = false; | ||
|
||
for (var entryIndex = 0; entryIndex < section.Entries.Count; entryIndex++) | ||
{ | ||
var entry = section.Entries[entryIndex]; | ||
var uiEntry = (MiningShopEntry) uiSection.Entries.GetChild(entryIndex); | ||
var disabled = sectionDisabled; | ||
|
||
if (userpoints < entry.Price) | ||
{ | ||
disabled = true; | ||
} | ||
|
||
uiEntry.Price.Text = $"{entry.Price}P"; | ||
|
||
uiEntry.Panel.Button.Disabled = disabled; | ||
} | ||
} | ||
} | ||
|
||
protected override void Dispose(bool disposing) | ||
{ | ||
if (disposing) | ||
_window?.Dispose(); | ||
} | ||
|
||
protected override void ReceiveMessage(BoundUserInterfaceMessage message) | ||
{ | ||
switch (message) | ||
{ | ||
case MiningShopRefreshBuiMsg: | ||
Refresh(); | ||
break; | ||
} | ||
} | ||
|
||
private FormattedMessage GetSectionName(SharedMiningShopSection section) | ||
{ | ||
var name = new FormattedMessage(); | ||
name.PushTag(new MarkupNode("bold", new MarkupParameter(section.Name.ToUpperInvariant()), null)); | ||
name.AddText(section.Name.ToUpperInvariant()); | ||
|
||
name.Pop(); | ||
return name; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<controls:MiningShopButton | ||
xmlns="https://spacestation14.io" | ||
xmlns:controls="clr-namespace:Content.Client.ADT.MiningShop"> | ||
<BoxContainer Orientation="Horizontal"> | ||
<Label Name="Label" Access="Public" Align="Left" /> | ||
</BoxContainer> | ||
</controls:MiningShopButton> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using Robust.Client.AutoGenerated; | ||
using Robust.Client.UserInterface.Controls; | ||
using Robust.Client.UserInterface.XAML; | ||
|
||
namespace Content.Client.ADT.MiningShop; | ||
|
||
[GenerateTypedNameReferences] | ||
public sealed partial class MiningShopButton : Button | ||
{ | ||
public event Action? OnDrawModeChanged; | ||
|
||
public MiningShopButton() | ||
{ | ||
RobustXamlLoader.Load(this); | ||
} | ||
|
||
protected override void DrawModeChanged() | ||
{ | ||
OnDrawModeChanged?.Invoke(); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<cc:MiningShopEntry | ||
xmlns="https://spacestation14.io" | ||
xmlns:cc="clr-namespace:Content.Client.ADT.MiningShop" | ||
HorizontalExpand="True"> | ||
<BoxContainer Orientation="Horizontal"> | ||
<LayeredTextureRect Name="Texture" Access="Public" | ||
HorizontalExpand="False" VerticalExpand="False" /> | ||
<Label Name="Price" Access="Public" MinWidth="60" Align="Left" Margin="5 0 0 0" /> | ||
<Control MinWidth="5" /> | ||
<cc:MiningShopPanel Name="Panel" Access="Public" /> | ||
<Button Text="?" Name="TooltipLabel" Access="Public" ModulateSelfOverride="#00000000" /> | ||
</BoxContainer> | ||
</cc:MiningShopEntry> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using Robust.Client.AutoGenerated; | ||
using Robust.Client.UserInterface; | ||
using Robust.Client.UserInterface.XAML; | ||
|
||
namespace Content.Client.ADT.MiningShop; | ||
|
||
[GenerateTypedNameReferences] | ||
public sealed partial class MiningShopEntry : Control | ||
{ | ||
public MiningShopEntry() | ||
{ | ||
RobustXamlLoader.Load(this); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<cc:MiningShopPanel | ||
xmlns="https://spacestation14.io" | ||
xmlns:cc="clr-namespace:Content.Client.ADT.MiningShop" | ||
xmlns:graphics="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client" | ||
HorizontalExpand="True"> | ||
<PanelContainer VerticalExpand="True" HorizontalExpand="True" Margin="0" Name="Panel"> | ||
<PanelContainer.PanelOverride> | ||
<graphics:StyleBoxFlat BackgroundColor="#162031" BorderColor="#4972A1" | ||
BorderThickness="2" /> | ||
</PanelContainer.PanelOverride> | ||
<cc:MiningShopButton Name="Button" Access="Public" | ||
ModulateSelfOverride="#00000000" HorizontalExpand="True" /> | ||
</PanelContainer> | ||
</cc:MiningShopPanel> |
Oops, something went wrong.