Cleaner BoundUserInterfaces (#17736)
This commit is contained in:
@@ -4,7 +4,6 @@ using Content.Server.Administration.Logs;
|
||||
using Content.Server.Decals;
|
||||
using Content.Server.Nutrition.EntitySystems;
|
||||
using Content.Server.Popups;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.Crayon;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Decals;
|
||||
@@ -13,15 +12,15 @@ using Content.Shared.Interaction.Events;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
namespace Content.Server.Crayon;
|
||||
|
||||
public sealed class CrayonSystem : SharedCrayonSystem
|
||||
{
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly DecalSystem _decals = default!;
|
||||
[Dependency] private readonly PopupSystem _popup = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
@@ -33,8 +32,8 @@ public sealed class CrayonSystem : SharedCrayonSystem
|
||||
SubscribeLocalEvent<CrayonComponent, ComponentInit>(OnCrayonInit);
|
||||
SubscribeLocalEvent<CrayonComponent, CrayonSelectMessage>(OnCrayonBoundUI);
|
||||
SubscribeLocalEvent<CrayonComponent, CrayonColorMessage>(OnCrayonBoundUIColor);
|
||||
SubscribeLocalEvent<CrayonComponent, UseInHandEvent>(OnCrayonUse, before: new []{ typeof(FoodSystem) });
|
||||
SubscribeLocalEvent<CrayonComponent, AfterInteractEvent>(OnCrayonAfterInteract, after: new []{ typeof(FoodSystem) });
|
||||
SubscribeLocalEvent<CrayonComponent, UseInHandEvent>(OnCrayonUse, before: new[] { typeof(FoodSystem) });
|
||||
SubscribeLocalEvent<CrayonComponent, AfterInteractEvent>(OnCrayonAfterInteract, after: new[] { typeof(FoodSystem) });
|
||||
SubscribeLocalEvent<CrayonComponent, DroppedEvent>(OnCrayonDropped);
|
||||
SubscribeLocalEvent<CrayonComponent, ComponentGetState>(OnCrayonGetState);
|
||||
}
|
||||
@@ -67,11 +66,11 @@ public sealed class CrayonSystem : SharedCrayonSystem
|
||||
return;
|
||||
}
|
||||
|
||||
if(!_decals.TryAddDecal(component.SelectedState, args.ClickLocation.Offset(new Vector2(-0.5f,-0.5f)), out _, component.Color, cleanable: true))
|
||||
if (!_decals.TryAddDecal(component.SelectedState, args.ClickLocation.Offset(new Vector2(-0.5f, -0.5f)), out _, component.Color, cleanable: true))
|
||||
return;
|
||||
|
||||
if (component.UseSound != null)
|
||||
_audio.PlayPvs(component.UseSound, uid, AudioHelpers.WithVariation(0.125f));
|
||||
_audio.PlayPvs(component.UseSound, uid, AudioParams.Default.WithVariation(0.125f));
|
||||
|
||||
// Decrease "Ammo"
|
||||
component.Charges--;
|
||||
@@ -100,7 +99,7 @@ public sealed class CrayonSystem : SharedCrayonSystem
|
||||
if (component.UserInterface?.SubscribedSessions.Contains(actor.PlayerSession) == true)
|
||||
{
|
||||
// Tell the user interface the selected stuff
|
||||
_uiSystem.SetUiState(component.UserInterface, new CrayonBoundUserInterfaceState(component.SelectedState, component.SelectableColor, component.Color));
|
||||
UserInterfaceSystem.SetUiState(component.UserInterface, new CrayonBoundUserInterfaceState(component.SelectedState, component.SelectableColor, component.Color));
|
||||
}
|
||||
|
||||
args.Handled = true;
|
||||
|
||||
Reference in New Issue
Block a user