Skip to content

Commit

Permalink
meow
Browse files Browse the repository at this point in the history
  • Loading branch information
Lyndomen committed Nov 21, 2024
1 parent d3bc8cf commit ec66c0f
Show file tree
Hide file tree
Showing 25 changed files with 8,610 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Content.Client/Administration/UI/Tabs/AdminTab/AdminTab.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:cc="clr-namespace:Content.Client.Administration.UI.CustomControls"
xmlns:at="clr-namespace:Content.Client.Administration.UI.Tabs.AdminTab"
xmlns:cdAdmin="clr-namespace:Content.Client._CD.Admin.UI"
Margin="4"
MinSize="50 50">
<BoxContainer Orientation="Vertical">
Expand All @@ -16,6 +17,7 @@
<cc:UICommandButton Command="callshuttle" Text="{Loc admin-player-actions-window-shuttle}" WindowType="{x:Type at:AdminShuttleWindow}"/>
<cc:CommandButton Command="adminlogs" Text="{Loc admin-player-actions-window-admin-logs}"/>
<cc:CommandButton Command="faxui" Text="{Loc admin-player-actions-window-admin-fax}"/>
<cc:UICommandButton Command="purgecharacterrecords" Text="{Loc admin-player-actions-window-cd-record-purge}" WindowType="{x:Type cdAdmin:ModifyCharacterRecords}"/>
</GridContainer>
</BoxContainer>
</Control>
10 changes: 10 additions & 0 deletions Content.Client/Humanoid/HumanoidAppearanceSystem.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
using System.Numerics; // CD
using Content.Shared.Humanoid;
using Content.Shared.Humanoid.Markings;
using Content.Shared.Humanoid.Prototypes;
using Content.Shared.Preferences;
using Robust.Client.GameObjects;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
using Robust.Client.Console; // CD

namespace Content.Client.Humanoid;

public sealed class HumanoidAppearanceSystem : SharedHumanoidAppearanceSystem
{
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly MarkingManager _markingManager = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly IClientConsoleHost _consoleHost = default!;

public override void Initialize()
{
Expand All @@ -30,6 +34,11 @@ private void UpdateSprite(HumanoidAppearanceComponent component, SpriteComponent
UpdateLayers(component, sprite);
ApplyMarkingSet(component, sprite);

var speciesPrototype = _prototypeManager.Index<SpeciesPrototype>(component.Species); // begin CD
var height = Math.Clamp(MathF.Round(component.Height, 1), speciesPrototype.MinHeight, speciesPrototype.MaxHeight); // should NOT be locked, at all

sprite.Scale = new Vector2(speciesPrototype.ScaleHeight ? height : 1f, height); // end CD

sprite[sprite.LayerMapReserveBlank(HumanoidVisualLayers.Eyes)].Color = component.EyeColor;
}

Expand Down Expand Up @@ -197,6 +206,7 @@ public override void LoadProfile(EntityUid uid, HumanoidCharacterProfile? profil
humanoid.Species = profile.Species;
humanoid.SkinColor = profile.Appearance.SkinColor;
humanoid.EyeColor = profile.Appearance.EyeColor;
humanoid.Height = profile.Height; // CD

UpdateSprite(humanoid, Comp<SpriteComponent>(uid));
}
Expand Down
14 changes: 14 additions & 0 deletions Content.Client/_CD/Admin/UI/ModifyCharacterRecords.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<DefaultWindow xmlns="https://spacestation14.io"
xmlns:cc="clr-namespace:Content.Client.Administration.UI.CustomControls"
Title="{Loc cd-actions-admin-modify-records}"
MinSize="300 300">
<BoxContainer Orientation="Vertical">
<LineEdit Name="EntityEdit" PlaceHolder="Entity" HorizontalExpand="True" />
<OptionButton Name="EntityEntryType" HorizontalExpand="True" />
<LineEdit Name="EntityEntryIndex" PlaceHolder="Index"/>
<BoxContainer Orientation="Horizontal" >
<cc:CommandButton Name="PurgeCommand" Text="{Loc cd-actions-admin-modify-reset}"/>
<cc:CommandButton Name="DelCommand" Text="{Loc cd-actions-admin-modify-del-entry}"/>
</BoxContainer>
</BoxContainer>
</DefaultWindow>
48 changes: 48 additions & 0 deletions Content.Client/_CD/Admin/UI/ModifyCharacterRecords.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using Content.Shared._CD.Records;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;

namespace Content.Client._CD.Admin.UI;

[GenerateTypedNameReferences]
public sealed partial class ModifyCharacterRecords : DefaultWindow
{
public ModifyCharacterRecords()
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);

foreach (var v in Enum.GetValues<CharacterRecordType>())
{
EntityEntryType.AddItem(v.ToString());
}

EntityEntryType.OnItemSelected += args =>
{
EntityEntryType.SelectId(args.Id);
UpdateCommands();
};

EntityEdit.OnTextChanged += _ => UpdateCommands();
EntityEntryIndex.OnTextChanged += _ => UpdateCommands();
}

private void UpdateCommands()
{
if (!int.TryParse(EntityEdit.Text, out var uid))
{
return;
}

if (!int.TryParse(EntityEntryIndex.Text, out var idx))
{
return;
}

var ty = (CharacterRecordType)EntityEntryType.SelectedId;

PurgeCommand.Command = $"purgecharacterrecords {uid}";
DelCommand.Command = $"delrecordentry {uid} {ty.ToString()} {idx}";
}
}
Loading

0 comments on commit ec66c0f

Please sign in to comment.