-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
<!-- ЭТО ШАБЛОН ВАШЕГО PULL REQUEST. Текст между стрелками - это комментарии - они не будут видны в PR. --> ## Описание PR Легендарный фикс вендоматов, возвращение причесок слаймов, а также... Керфус? <!-- Ниже опишите ваш Pull Request. Что он изменяет? На что еще это может повлиять? Постарайтесь описать все внесённые вами изменения! --> **Медиа** Да что такое фотопленка. <!-- Если приемлемо, добавьте скриншоты для демонстрации вашего PR. Если ваш PR представляет собой визуальное изменение, добавьте скриншоты, иначе он может быть закрыт. --> **Проверки** <!-- Выполнение всех следующих действий, если это приемлемо для вида изменений сильно ускорит разбор вашего PR --> - [ ] PR полностью завершён и мне не нужна помощь чтобы его закончить. - [ ] Я внимательно просмотрел все свои изменения и багов в них не нашёл. - [ ] Я запускал локальный сервер со своими изменениями и всё протестировал. - [ ] Я добавил скриншот/видео демонстрации PR в игре, **или** этот PR этого не требует. **Изменения** <!-- Здесь вы можете написать список изменений, который будет автоматически добавлен в игру, когда ваш PR будет принят. В журнал изменений следует помещать только то, что действительно важно игрокам. В списке изменений тип значка не является часть предложения, поэтому явно указывайте - Добавлен, Удалён, Изменён. плохо: - add: Новый инструмент для инженеров хорошо: - add: Добавлен новый инструмент для инженеров Вы можете указать своё имя после символа 🆑 именно оно будет отображаться в журнале изменений (иначе будет использоваться ваше имя на GitHub) Например: 🆑 Ian --> 🆑 KashRas2 - add: Возвращена возможность менять прически слаймам. - add: Отдел разработок Нанотрейзен представляет новую модель боргов для командования - Керфус. - fix: Починены цены в вендоматах после апстрима. - fix: Спрайт голограммы банкомата сбоку получило недостающие пиксели. --------- Co-authored-by: KashRas2 <[email protected]>
- Loading branch information
Showing
39 changed files
with
1,109 additions
and
3 deletions.
There are no files selected for viewing
66 changes: 66 additions & 0 deletions
66
Content.Client/ADT/SlimeHair/SlimeHairBoundUserInterface.cs
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,66 @@ | ||
using Content.Shared.Humanoid.Markings; | ||
using Content.Shared.ADT.SlimeHair; | ||
using Robust.Client.GameObjects; | ||
using Robust.Client.UserInterface; | ||
|
||
namespace Content.Client.ADT.SlimeHair; | ||
|
||
public sealed class SlimeHairBoundUserInterface : BoundUserInterface | ||
{ | ||
[ViewVariables] | ||
private SlimeHairWindow? _window; | ||
|
||
public SlimeHairBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) | ||
{ | ||
} | ||
|
||
protected override void Open() | ||
{ | ||
base.Open(); | ||
|
||
_window = this.CreateWindow<SlimeHairWindow>(); | ||
|
||
_window.OnHairSelected += tuple => SelectHair(SlimeHairCategory.Hair, tuple.id, tuple.slot); | ||
_window.OnHairColorChanged += args => ChangeColor(SlimeHairCategory.Hair, args.marking, args.slot); | ||
_window.OnHairSlotAdded += delegate () { AddSlot(SlimeHairCategory.Hair); }; | ||
_window.OnHairSlotRemoved += args => RemoveSlot(SlimeHairCategory.Hair, args); | ||
|
||
_window.OnFacialHairSelected += tuple => SelectHair(SlimeHairCategory.FacialHair, tuple.id, tuple.slot); | ||
_window.OnFacialHairColorChanged += | ||
args => ChangeColor(SlimeHairCategory.FacialHair, args.marking, args.slot); | ||
_window.OnFacialHairSlotAdded += delegate () { AddSlot(SlimeHairCategory.FacialHair); }; | ||
_window.OnFacialHairSlotRemoved += args => RemoveSlot(SlimeHairCategory.FacialHair, args); | ||
} | ||
|
||
private void SelectHair(SlimeHairCategory category, string marking, int slot) | ||
{ | ||
SendMessage(new SlimeHairSelectMessage(category, marking, slot)); | ||
} | ||
|
||
private void ChangeColor(SlimeHairCategory category, Marking marking, int slot) | ||
{ | ||
SendMessage(new SlimeHairChangeColorMessage(category, new(marking.MarkingColors), slot)); | ||
} | ||
|
||
private void RemoveSlot(SlimeHairCategory category, int slot) | ||
{ | ||
SendMessage(new SlimeHairRemoveSlotMessage(category, slot)); | ||
} | ||
|
||
private void AddSlot(SlimeHairCategory category) | ||
{ | ||
SendMessage(new SlimeHairAddSlotMessage(category)); | ||
} | ||
|
||
protected override void UpdateState(BoundUserInterfaceState state) | ||
{ | ||
base.UpdateState(state); | ||
|
||
if (state is not SlimeHairUiState data || _window == null) | ||
{ | ||
return; | ||
} | ||
|
||
_window.UpdateState(data); | ||
} | ||
} |
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,9 @@ | ||
<DefaultWindow xmlns="https://spacestation14.io" | ||
xmlns:humanoid="clr-namespace:Content.Client.Humanoid" | ||
Title="{Loc 'slime-hair-window-title'}" | ||
MinSize="600 400"> | ||
<BoxContainer> | ||
<humanoid:SingleMarkingPicker Name="HairPicker" Category="Hair" /> | ||
<humanoid:SingleMarkingPicker Name="FacialHairPicker" Category="FacialHair" /> | ||
</BoxContainer> | ||
</DefaultWindow> |
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,48 @@ | ||
using Content.Shared.Humanoid.Markings; | ||
using Content.Shared.ADT.SlimeHair; | ||
using Robust.Client.AutoGenerated; | ||
using Robust.Client.UserInterface.Controls; | ||
using Robust.Client.UserInterface.CustomControls; | ||
using Robust.Client.UserInterface.XAML; | ||
|
||
namespace Content.Client.ADT.SlimeHair; | ||
|
||
[GenerateTypedNameReferences] | ||
public sealed partial class SlimeHairWindow : DefaultWindow | ||
{ | ||
public Action<(int slot, string id)>? OnHairSelected; | ||
public Action<(int slot, Marking marking)>? OnHairColorChanged; | ||
public Action<int>? OnHairSlotRemoved; | ||
public Action? OnHairSlotAdded; | ||
|
||
public Action<(int slot, string id)>? OnFacialHairSelected; | ||
public Action<(int slot, Marking marking)>? OnFacialHairColorChanged; | ||
public Action<int>? OnFacialHairSlotRemoved; | ||
public Action? OnFacialHairSlotAdded; | ||
|
||
public SlimeHairWindow() | ||
{ | ||
RobustXamlLoader.Load(this); | ||
|
||
HairPicker.OnMarkingSelect += args => OnHairSelected!(args); | ||
HairPicker.OnColorChanged += args => OnHairColorChanged!(args); | ||
HairPicker.OnSlotRemove += args => OnHairSlotRemoved!(args); | ||
HairPicker.OnSlotAdd += delegate { OnHairSlotAdded!(); }; | ||
|
||
FacialHairPicker.OnMarkingSelect += args => OnFacialHairSelected!(args); | ||
FacialHairPicker.OnColorChanged += args => OnFacialHairColorChanged!(args); | ||
FacialHairPicker.OnSlotRemove += args => OnFacialHairSlotRemoved!(args); | ||
FacialHairPicker.OnSlotAdd += delegate { OnFacialHairSlotAdded!(); }; | ||
} | ||
|
||
public void UpdateState(SlimeHairUiState state) | ||
{ | ||
HairPicker.UpdateData(state.Hair, state.Species, state.HairSlotTotal); | ||
FacialHairPicker.UpdateData(state.FacialHair, state.Species, state.FacialHairSlotTotal); | ||
|
||
if (!HairPicker.Visible && !FacialHairPicker.Visible) | ||
{ | ||
AddChild(new Label { Text = Loc.GetString("magic-mirror-component-activate-user-has-no-hair") }); | ||
} | ||
} | ||
} |
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
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,61 @@ | ||
using Content.Shared.DoAfter; | ||
using Robust.Shared.Prototypes; | ||
using Robust.Shared.Audio; | ||
|
||
namespace Content.Server.ADT.SlimeHair; | ||
|
||
/// <summary> | ||
/// Allows humanoids to change their appearance mid-round. | ||
/// </summary> | ||
[RegisterComponent] | ||
public sealed partial class SlimeHairComponent : Component | ||
{ | ||
[DataField] | ||
public DoAfterId? DoAfter; | ||
|
||
/// <summary> | ||
/// Magic mirror target, used for validating UI messages. | ||
/// </summary> | ||
[DataField] | ||
public EntityUid? Target; | ||
|
||
/// <summary> | ||
/// doafter time required to add a new slot | ||
/// </summary> | ||
[DataField, ViewVariables(VVAccess.ReadWrite)] | ||
public TimeSpan AddSlotTime = TimeSpan.FromSeconds(2); | ||
|
||
/// <summary> | ||
/// doafter time required to remove a existing slot | ||
/// </summary> | ||
[DataField, ViewVariables(VVAccess.ReadWrite)] | ||
public TimeSpan RemoveSlotTime = TimeSpan.FromSeconds(2); | ||
|
||
/// <summary> | ||
/// doafter time required to change slot | ||
/// </summary> | ||
[DataField, ViewVariables(VVAccess.ReadWrite)] | ||
public TimeSpan SelectSlotTime = TimeSpan.FromSeconds(2); | ||
|
||
/// <summary> | ||
/// doafter time required to recolor slot | ||
/// </summary> | ||
[DataField, ViewVariables(VVAccess.ReadWrite)] | ||
public TimeSpan ChangeSlotTime = TimeSpan.FromSeconds(1); | ||
|
||
/// <summary> | ||
/// Sound emitted when slots are changed | ||
/// </summary> | ||
[DataField] | ||
public SoundSpecifier ChangeHairSound = new SoundPathSpecifier("/Audio/ADT/slime-hair.ogg") | ||
{ | ||
Params = AudioParams.Default.WithVolume(-1f), | ||
}; | ||
|
||
[DataField("hairAction")] | ||
public EntProtoId Action = "ActionSlimeHair"; | ||
|
||
[DataField, AutoNetworkedField] | ||
public EntityUid? ActionEntity; | ||
|
||
} |
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,30 @@ | ||
using Content.Shared.ADT.SlimeHair; | ||
using Robust.Shared.Player; | ||
|
||
namespace Content.Server.ADT.SlimeHair; | ||
|
||
/// <summary> | ||
/// Allows humanoids to change their appearance mid-round. | ||
/// </summary> | ||
public sealed partial class SlimeHairSystem | ||
{ | ||
private void InitializeSlimeAbilities() | ||
{ | ||
SubscribeLocalEvent<SlimeHairComponent, SlimeHairActionEvent>(SlimeHairAction); | ||
} | ||
|
||
private void SlimeHairAction(EntityUid uid, SlimeHairComponent comp, SlimeHairActionEvent args) | ||
{ | ||
if (args.Handled) | ||
return; | ||
|
||
if (!TryComp<ActorComponent>(uid, out var actor)) | ||
return; | ||
|
||
_uiSystem.TryOpenUi(uid, SlimeHairUiKey.Key, actor.Owner); | ||
|
||
UpdateInterface(uid, comp); | ||
|
||
args.Handled = true; | ||
} | ||
} |
Oops, something went wrong.