* Marking coloring WIP * EnsureDefault now supports coloring! * Now markings have coloring when they get added * Many things * yml files * cleanup * Some requested changes * Nullable type and WIP caching * Time to resolve that thing with deprecated hair fields * Latest reviews + im still trying to use these hair markings * FirstOrDefault thing and Tattoo docs * IDK * It's now works a bit more properly in preferences GUI * THEY SYNCING! However preferences GUI still broken and doesn't work properly * Markings now updating when changing in GUI. However they still don't work properly with bald humanoids * Forgor... * Default hair-colored markings will not color to hair if there is no hair * Fixed default colors for customizable markings * Fixed bug in prefs GUI that set current hair to null * Now markings that must match skin color because of limb (e.x. Slimes) - will match skin color * final tweaks: if hair uses skin color then markings will use skin color as hair color (slimes) * fix * fixed dirty. no more funni invis bug * Mirrors and client profile loading * default colors soon TM * review + better coloring * Hardcode is gone * diona markings * oh my god * fixed CategoryColoring * cool fallback, clean up and some other tweaks * code style * more style * a
104 lines
3.2 KiB
C#
104 lines
3.2 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.Server.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 ResourcePath("/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.SkinColor,
|
|
component.CustomBaseLayers
|
|
));
|
|
}
|
|
});
|
|
}
|
|
|
|
private void OnBaseLayersSet(EntityUid uid, HumanoidAppearanceComponent component,
|
|
HumanoidMarkingModifierBaseLayersSetMessage message)
|
|
{
|
|
if (message.Session is not IPlayerSession 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(component);
|
|
|
|
if (message.ResendState)
|
|
{
|
|
_uiSystem.TrySetUiState(
|
|
uid,
|
|
HumanoidMarkingModifierKey.Key,
|
|
new HumanoidMarkingModifierState(component.MarkingSet, component.Species,
|
|
component.SkinColor,
|
|
component.CustomBaseLayers
|
|
));
|
|
}
|
|
}
|
|
|
|
private void OnMarkingsSet(EntityUid uid, HumanoidAppearanceComponent component,
|
|
HumanoidMarkingModifierMarkingSetMessage message)
|
|
{
|
|
if (message.Session is not IPlayerSession player
|
|
|| !_adminManager.HasAdminFlag(player, AdminFlags.Fun))
|
|
{
|
|
return;
|
|
}
|
|
|
|
component.MarkingSet = message.MarkingSet;
|
|
Dirty(component);
|
|
|
|
if (message.ResendState)
|
|
{
|
|
_uiSystem.TrySetUiState(
|
|
uid,
|
|
HumanoidMarkingModifierKey.Key,
|
|
new HumanoidMarkingModifierState(component.MarkingSet, component.Species,
|
|
component.SkinColor,
|
|
component.CustomBaseLayers
|
|
));
|
|
}
|
|
|
|
}
|
|
}
|