Files
OldThink/Content.Server/Humanoid/Systems/HumanoidAppearanceSystem.Modifier.cs
Remuchi 3515e87f74 [Feat] Тонкие спрайты снова в строю (#102)
* Revert "Hair Overhaul (#19298)"

This reverts commit 9491f322de.

# Conflicts:
#	Resources/Textures/Mobs/Customization/human_hair.rsi/a.png
#	Resources/Textures/Mobs/Customization/human_hair.rsi/afro.png
#	Resources/Textures/Mobs/Customization/human_hair.rsi/afro2.png
#	Resources/Textures/Mobs/Customization/human_hair.rsi/bigafro.png
#	Resources/Textures/Mobs/Customization/human_hair.rsi/cornrows2.png
#	Resources/Textures/Mobs/Customization/human_hair.rsi/emofringe.png
#	Resources/Textures/Mobs/Customization/human_hair.rsi/keanu.png
#	Resources/Textures/Mobs/Customization/human_hair.rsi/long.png
#	Resources/Textures/Mobs/Customization/human_hair.rsi/long2.png
#	Resources/Textures/Mobs/Customization/human_hair.rsi/long3.png
#	Resources/Textures/Mobs/Customization/human_hair.rsi/meta.json
#	Resources/Textures/Mobs/Customization/human_hair.rsi/modern.png
#	Resources/Textures/Mobs/Customization/human_hair.rsi/quiff.png

* add: возврат системы тонкоспрайтов

* fix: небольшие фиксы после реверта причесок

* add: старые текстуры для slim бодитайпа

* fix: фикс причесок после апстрима
2024-02-24 10:06:32 +00:00

113 lines
3.4 KiB
C#

using Content.Server.Administration.Managers;
using Content.Shared.Administration;
using Content.Shared.Humanoid;
using Content.Shared.Verbs;
using Robust.Server.GameObjects;
using Robust.Shared.Player;
using Robust.Shared.Utility;
namespace Content.Server.Humanoid;
public sealed partial class HumanoidAppearanceSystem
{
[Dependency] private readonly IAdminManager _adminManager = default!;
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
private void OnVerbsRequest(EntityUid uid, HumanoidAppearanceComponent component, GetVerbsEvent<Verb> args)
{
if (!TryComp<ActorComponent>(args.User, out var actor))
{
return;
}
if (!_adminManager.HasAdminFlag(actor.PlayerSession, AdminFlags.Fun))
{
return;
}
args.Verbs.Add(new Verb
{
Text = "Modify markings",
Category = VerbCategory.Tricks,
Icon = new SpriteSpecifier.Rsi(new("/Textures/Mobs/Customization/reptilian_parts.rsi"), "tail_smooth"),
Act = () =>
{
_uiSystem.TryOpen(uid, HumanoidMarkingModifierKey.Key, actor.PlayerSession);
_uiSystem.TrySetUiState(
uid,
HumanoidMarkingModifierKey.Key,
new HumanoidMarkingModifierState(component.MarkingSet, component.Species,
component.BodyType,
component.Sex,
component.SkinColor,
component.CustomBaseLayers
));
}
});
}
private void OnBaseLayersSet(
EntityUid uid,
HumanoidAppearanceComponent component,
HumanoidMarkingModifierBaseLayersSetMessage message)
{
if (message.Session is not { } player
|| !_adminManager.HasAdminFlag(player, AdminFlags.Fun))
{
return;
}
if (message.Info == null)
{
component.CustomBaseLayers.Remove(message.Layer);
}
else
{
component.CustomBaseLayers[message.Layer] = message.Info.Value;
}
Dirty(uid, component);
if (message.ResendState)
{
_uiSystem.TrySetUiState(
uid,
HumanoidMarkingModifierKey.Key,
new HumanoidMarkingModifierState(component.MarkingSet, component.Species,
component.BodyType,
component.Sex,
component.SkinColor,
component.CustomBaseLayers
));
}
}
private void OnMarkingsSet(
EntityUid uid,
HumanoidAppearanceComponent component,
HumanoidMarkingModifierMarkingSetMessage message)
{
if (message.Session is not { } player
|| !_adminManager.HasAdminFlag(player, AdminFlags.Fun))
{
return;
}
component.MarkingSet = message.MarkingSet;
Dirty(uid, component);
if (message.ResendState)
{
_uiSystem.TrySetUiState(
uid,
HumanoidMarkingModifierKey.Key,
new HumanoidMarkingModifierState(component.MarkingSet, component.Species,
component.BodyType,
component.Sex,
component.SkinColor,
component.CustomBaseLayers
));
}
}
}