| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- 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.OpenUi(uid, HumanoidMarkingModifierKey.Key, actor.PlayerSession);
- _uiSystem.SetUiState(
- uid,
- HumanoidMarkingModifierKey.Key,
- new HumanoidMarkingModifierState(component.MarkingSet, component.Species,
- component.Sex,
- component.SkinColor,
- component.CustomBaseLayers
- ));
- }
- });
- }
- private void OnBaseLayersSet(EntityUid uid, HumanoidAppearanceComponent component,
- HumanoidMarkingModifierBaseLayersSetMessage message)
- {
- if (!_adminManager.HasAdminFlag(message.Actor, 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.SetUiState(
- uid,
- HumanoidMarkingModifierKey.Key,
- new HumanoidMarkingModifierState(component.MarkingSet, component.Species,
- component.Sex,
- component.SkinColor,
- component.CustomBaseLayers
- ));
- }
- }
- private void OnMarkingsSet(EntityUid uid, HumanoidAppearanceComponent component,
- HumanoidMarkingModifierMarkingSetMessage message)
- {
- if (!_adminManager.HasAdminFlag(message.Actor, AdminFlags.Fun))
- {
- return;
- }
- component.MarkingSet = message.MarkingSet;
- Dirty(uid, component);
- if (message.ResendState)
- {
- _uiSystem.SetUiState(
- uid,
- HumanoidMarkingModifierKey.Key,
- new HumanoidMarkingModifierState(component.MarkingSet, component.Species,
- component.Sex,
- component.SkinColor,
- component.CustomBaseLayers
- ));
- }
- }
- }
|