Skip to content

Commit

Permalink
Merge branch 'master' into tsd
Browse files Browse the repository at this point in the history
  • Loading branch information
Schrodinger71 committed Sep 7, 2024
2 parents 2916358 + 4a4a68d commit 9406133
Show file tree
Hide file tree
Showing 468 changed files with 622,516 additions and 683,586 deletions.
2 changes: 1 addition & 1 deletion Content.Benchmarks/MapLoadBenchmark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public async Task Cleanup()
PoolManager.Shutdown();
}

public static readonly string[] MapsSource = { "Empty", "Satlern", "Box", "Bagel", "Dev", "CentComm", "Core", "TestTeg", "Packed", "Omega", "Reach", "Meta", "Marathon", "MeteorArena", "Fland", "Oasis", "Cog" };
public static readonly string[] MapsSource = { "Empty", "Satlern", "Box", "Bagel", "Dev", "CentComm", "Core", "TestTeg", "Packed", "Omega", "Reach", "Meta", "Marathon", "MeteorArena", "Fland", "Oasis" };

[ParamsSource(nameof(MapsSource))]
public string Map;
Expand Down
66 changes: 66 additions & 0 deletions Content.Client/ADT/SlimeHair/SlimeHairBoundUserInterface.cs
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);
}
}
9 changes: 9 additions & 0 deletions Content.Client/ADT/SlimeHair/SlimeHairWindow.xaml
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>
48 changes: 48 additions & 0 deletions Content.Client/ADT/SlimeHair/SlimeHairWindow.xaml.cs
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") });
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ namespace Content.Client.SurveillanceCamera;
[RegisterComponent]
public sealed partial class ActiveSurveillanceCameraMonitorVisualsComponent : Component
{
public float TimeLeft = 10f;
public float TimeLeft = 2f; //ADT

public Action? OnFinish;
}
8 changes: 5 additions & 3 deletions Content.Client/VendingMachines/UI/VendingMachineMenu.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ public void Populate(EntityUid entityUid, List<VendingMachineInventoryEntry> inv
};
var vendComp = _entityManager.GetComponent<VendingMachineComponent>(entityUid); //ADT-Economy
//ADT-Economy-End

if (inventory.Count == 0 && VendingContents.Visible)
{
SearchBar.Visible = false;
Expand Down Expand Up @@ -123,6 +124,7 @@ public void Populate(EntityUid entityUid, List<VendingMachineInventoryEntry> inv

if (!_prototypeManager.TryIndex(entry.ID, out var prototype))
continue;

//ADT-Economy-Start
var price = 0;
if (!vendComp.AllForFree)
Expand All @@ -142,12 +144,12 @@ public void Populate(EntityUid entityUid, List<VendingMachineInventoryEntry> inv
}

var itemName = Identity.Name(dummy, _entityManager);
var itemText = $"{itemName} [{entry.Amount}]";
var itemText = $" [{price}$] {itemName} [{entry.Amount}]"; //ADT-Economy

if (itemText.Length > longestEntry.Length)
longestEntry = itemText;

listData.Add(new VendorItemsListData(prototype.ID, itemText, i, price));
listData.Add(new VendorItemsListData(prototype.ID, itemText, i));
}

VendingContents.PopulateList(listData);
Expand All @@ -163,4 +165,4 @@ private void SetSizeAfterUpdate(int longestEntryLength, int contentCount)
}
}

public record VendorItemsListData(EntProtoId ItemProtoID, string ItemText, int ItemIndex, int price) : ListData;
public record VendorItemsListData(EntProtoId ItemProtoID, string ItemText, int ItemIndex) : ListData;
5 changes: 3 additions & 2 deletions Content.IntegrationTests/Tests/PostMapInitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public sealed class PostMapInitTest
"Reach",
"Train",
"Oasis",
"Cog",
// "Cog",
// ADT-Start
"ADT_Astra",
"ADT_Avrit",
Expand All @@ -95,7 +95,8 @@ public sealed class PostMapInitTest
"ADT_Saltern",
"ADT_Packed",
"ADT_Train",
"ADT_Gemini"
"ADT_Gemini",
"ADT_Aspid"
// ADT-End
};

Expand Down
61 changes: 61 additions & 0 deletions Content.Server/ADT/SlimeHair/SlimeHairComponent.cs
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;

}
30 changes: 30 additions & 0 deletions Content.Server/ADT/SlimeHair/SlimeHairSystem.Abilities.cs
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;
}
}
Loading

0 comments on commit 9406133

Please sign in to comment.