Update trivial components to use auto comp states (#20539)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
using Content.Shared.Access;
|
||||
using Content.Shared.Access.Components;
|
||||
using Content.Shared.Access.Systems;
|
||||
using Content.Shared.Containers.ItemSlots;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.Prototypes;
|
||||
using static Content.Shared.Access.Components.AccessOverriderComponent;
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace Content.Client.Access.UI
|
||||
{
|
||||
base.Open();
|
||||
|
||||
List<string> accessLevels;
|
||||
List<ProtoId<AccessLevelPrototype>> accessLevels;
|
||||
|
||||
if (EntMan.TryGetComponent<AccessOverriderComponent>(Owner, out var accessOverrider))
|
||||
{
|
||||
@@ -33,7 +33,7 @@ namespace Content.Client.Access.UI
|
||||
|
||||
else
|
||||
{
|
||||
accessLevels = new List<string>();
|
||||
accessLevels = new List<ProtoId<AccessLevelPrototype>>();
|
||||
_accessOverriderSystem.Log.Error($"No AccessOverrider component found for {EntMan.ToPrettyString(Owner)}!");
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Content.Client.Access.UI
|
||||
private readonly Dictionary<string, Button> _accessButtons = new();
|
||||
|
||||
public AccessOverriderWindow(AccessOverriderBoundUserInterface owner, IPrototypeManager prototypeManager,
|
||||
List<string> accessLevels)
|
||||
List<ProtoId<AccessLevelPrototype>> accessLevels)
|
||||
{
|
||||
RobustXamlLoader.Load(this);
|
||||
IoCManager.InjectDependencies(this);
|
||||
@@ -31,7 +31,7 @@ namespace Content.Client.Access.UI
|
||||
|
||||
foreach (var access in accessLevels)
|
||||
{
|
||||
if (!prototypeManager.TryIndex<AccessLevelPrototype>(access, out var accessLevel))
|
||||
if (!prototypeManager.TryIndex(access, out var accessLevel))
|
||||
{
|
||||
_logMill.Error($"Unable to find accesslevel for {access}");
|
||||
continue;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using Content.Shared.Access;
|
||||
using Content.Shared.Access.Components;
|
||||
using Content.Shared.Access.Systems;
|
||||
using Content.Shared.Containers.ItemSlots;
|
||||
using Content.Shared.CrewManifest;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.Prototypes;
|
||||
using static Content.Shared.Access.Components.IdCardConsoleComponent;
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace Content.Client.Access.UI
|
||||
protected override void Open()
|
||||
{
|
||||
base.Open();
|
||||
List<string> accessLevels;
|
||||
List<ProtoId<AccessLevelPrototype>> accessLevels;
|
||||
|
||||
if (EntMan.TryGetComponent<IdCardConsoleComponent>(Owner, out var idCard))
|
||||
{
|
||||
@@ -32,7 +32,7 @@ namespace Content.Client.Access.UI
|
||||
}
|
||||
else
|
||||
{
|
||||
accessLevels = new List<string>();
|
||||
accessLevels = new List<ProtoId<AccessLevelPrototype>>();
|
||||
_idCardConsoleSystem.Log.Error($"No IdCardConsole component found for {EntMan.ToPrettyString(Owner)}!");
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Content.Client.Access.UI
|
||||
private string? _lastJobProto;
|
||||
|
||||
public IdCardConsoleWindow(IdCardConsoleBoundUserInterface owner, IPrototypeManager prototypeManager,
|
||||
List<string> accessLevels)
|
||||
List<ProtoId<AccessLevelPrototype>> accessLevels)
|
||||
{
|
||||
RobustXamlLoader.Load(this);
|
||||
IoCManager.InjectDependencies(this);
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
using System.Linq;
|
||||
using Content.Shared.Alert;
|
||||
using Content.Shared.Mobs.Systems;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Client.Alerts;
|
||||
@@ -27,7 +25,7 @@ public sealed class ClientAlertsSystem : AlertsSystem
|
||||
SubscribeLocalEvent<AlertsComponent, PlayerAttachedEvent>(OnPlayerAttached);
|
||||
SubscribeLocalEvent<AlertsComponent, PlayerDetachedEvent>(OnPlayerDetached);
|
||||
|
||||
SubscribeLocalEvent<AlertsComponent, ComponentHandleState>(ClientAlertsHandleState);
|
||||
SubscribeLocalEvent<AlertsComponent, AfterAutoHandleStateEvent>(ClientAlertsHandleState);
|
||||
}
|
||||
protected override void LoadPrototypes()
|
||||
{
|
||||
@@ -65,16 +63,10 @@ public sealed class ClientAlertsSystem : AlertsSystem
|
||||
SyncAlerts?.Invoke(this, alertsComponent.Alerts);
|
||||
}
|
||||
|
||||
private void ClientAlertsHandleState(EntityUid uid, AlertsComponent component, ref ComponentHandleState args)
|
||||
private void ClientAlertsHandleState(EntityUid uid, AlertsComponent component, ref AfterAutoHandleStateEvent args)
|
||||
{
|
||||
var componentAlerts = (args.Current as AlertsComponentState)?.Alerts;
|
||||
if (componentAlerts == null)
|
||||
return;
|
||||
|
||||
component.Alerts = new Dictionary<AlertKey, AlertState>(componentAlerts);
|
||||
|
||||
if (_playerManager.LocalPlayer?.ControlledEntity == uid)
|
||||
SyncAlerts?.Invoke(this, componentAlerts);
|
||||
SyncAlerts?.Invoke(this, component.Alerts);
|
||||
}
|
||||
|
||||
private void OnPlayerAttached(EntityUid uid, AlertsComponent component, PlayerAttachedEvent args)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using Content.Shared.BarSign;
|
||||
using Content.Shared.Power;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Client.BarSign;
|
||||
@@ -13,33 +12,29 @@ public sealed class BarSignSystem : VisualizerSystem<BarSignComponent>
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<BarSignComponent, ComponentHandleState>(OnHandleState);
|
||||
SubscribeLocalEvent<BarSignComponent, AfterAutoHandleStateEvent>(OnAfterAutoHandleState);
|
||||
}
|
||||
|
||||
private void OnHandleState(EntityUid uid, BarSignComponent component, ref ComponentHandleState args)
|
||||
private void OnAfterAutoHandleState(EntityUid uid, BarSignComponent component, ref AfterAutoHandleStateEvent args)
|
||||
{
|
||||
if (args.Current is not BarSignComponentState state)
|
||||
return;
|
||||
|
||||
component.CurrentSign = state.CurrentSign;
|
||||
UpdateAppearance(component);
|
||||
UpdateAppearance(uid, component);
|
||||
}
|
||||
|
||||
protected override void OnAppearanceChange(EntityUid uid, BarSignComponent component, ref AppearanceChangeEvent args)
|
||||
{
|
||||
UpdateAppearance(component, args.Component, args.Sprite);
|
||||
UpdateAppearance(uid, component, args.Component, args.Sprite);
|
||||
}
|
||||
|
||||
private void UpdateAppearance(BarSignComponent sign, AppearanceComponent? appearance = null, SpriteComponent? sprite = null)
|
||||
private void UpdateAppearance(EntityUid id, BarSignComponent sign, AppearanceComponent? appearance = null, SpriteComponent? sprite = null)
|
||||
{
|
||||
if (!Resolve(sign.Owner, ref appearance, ref sprite))
|
||||
if (!Resolve(id, ref appearance, ref sprite))
|
||||
return;
|
||||
|
||||
AppearanceSystem.TryGetData<bool>(sign.Owner, PowerDeviceVisuals.Powered, out var powered, appearance);
|
||||
AppearanceSystem.TryGetData<bool>(id, PowerDeviceVisuals.Powered, out var powered, appearance);
|
||||
|
||||
if (powered
|
||||
&& sign.CurrentSign != null
|
||||
&& _prototypeManager.TryIndex(sign.CurrentSign, out BarSignPrototype? proto))
|
||||
&& sign.Current != null
|
||||
&& _prototypeManager.TryIndex(sign.Current, out BarSignPrototype? proto))
|
||||
{
|
||||
sprite.LayerSetState(0, proto.Icon);
|
||||
sprite.LayerSetShader(0, "unshaded");
|
||||
|
||||
@@ -3,7 +3,6 @@ using Content.Shared.Buckle;
|
||||
using Content.Shared.Buckle.Components;
|
||||
using Content.Shared.Vehicle.Components;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Client.Buckle;
|
||||
|
||||
@@ -15,20 +14,12 @@ internal sealed class BuckleSystem : SharedBuckleSystem
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<BuckleComponent, ComponentHandleState>(OnBuckleHandleState);
|
||||
SubscribeLocalEvent<BuckleComponent, AfterAutoHandleStateEvent>(OnBuckleAfterAutoHandleState);
|
||||
SubscribeLocalEvent<BuckleComponent, AppearanceChangeEvent>(OnAppearanceChange);
|
||||
}
|
||||
|
||||
private void OnBuckleHandleState(EntityUid uid, BuckleComponent component, ref ComponentHandleState args)
|
||||
private void OnBuckleAfterAutoHandleState(EntityUid uid, BuckleComponent component, ref AfterAutoHandleStateEvent args)
|
||||
{
|
||||
if (args.Current is not BuckleComponentState state)
|
||||
return;
|
||||
|
||||
component.Buckled = state.Buckled;
|
||||
component.BuckledTo = EnsureEntity<BuckleComponent>(state.BuckledTo, uid);
|
||||
component.LastEntityBuckledTo = EnsureEntity<BuckleComponent>(state.LastEntityBuckledTo, uid);
|
||||
component.DontCollide = state.DontCollide;
|
||||
|
||||
ActionBlocker.UpdateCanMove(uid);
|
||||
|
||||
if (!TryComp<SpriteComponent>(uid, out var ownerSprite))
|
||||
@@ -38,11 +29,11 @@ internal sealed class BuckleSystem : SharedBuckleSystem
|
||||
return;
|
||||
|
||||
// Adjust draw depth when the chair faces north so that the seat back is drawn over the player.
|
||||
// Reset the draw depth when rotated in any other direction.
|
||||
// TODO when ECSing, make this a visualizer
|
||||
// This code was written before rotatable viewports were introduced, so hard-coding Direction.North
|
||||
// and comparing it against LocalRotation now breaks this in other rotations. This is a FIXME, but
|
||||
// better to get it working for most people before we look at a more permanent solution.
|
||||
// Reset the draw depth when rotated in any other direction.
|
||||
// TODO when ECSing, make this a visualizer
|
||||
// This code was written before rotatable viewports were introduced, so hard-coding Direction.North
|
||||
// and comparing it against LocalRotation now breaks this in other rotations. This is a FIXME, but
|
||||
// better to get it working for most people before we look at a more permanent solution.
|
||||
if (component is { Buckled: true, LastEntityBuckledTo: { } } &&
|
||||
Transform(component.LastEntityBuckledTo.Value).LocalRotation.GetCardinalDir() == Direction.North &&
|
||||
TryComp<SpriteComponent>(component.LastEntityBuckledTo, out var buckledSprite))
|
||||
|
||||
@@ -3,7 +3,6 @@ using Content.Shared.Clothing.Components;
|
||||
using Content.Shared.Clothing.EntitySystems;
|
||||
using Content.Shared.Inventory;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Client.Clothing.Systems;
|
||||
@@ -27,7 +26,7 @@ public sealed class ChameleonClothingSystem : SharedChameleonClothingSystem
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<ChameleonClothingComponent, ComponentHandleState>(HandleState);
|
||||
SubscribeLocalEvent<ChameleonClothingComponent, AfterAutoHandleStateEvent>(HandleState);
|
||||
|
||||
PrepareAllVariants();
|
||||
_proto.PrototypesReloaded += OnProtoReloaded;
|
||||
@@ -44,12 +43,8 @@ public sealed class ChameleonClothingSystem : SharedChameleonClothingSystem
|
||||
PrepareAllVariants();
|
||||
}
|
||||
|
||||
private void HandleState(EntityUid uid, ChameleonClothingComponent component, ref ComponentHandleState args)
|
||||
private void HandleState(EntityUid uid, ChameleonClothingComponent component, ref AfterAutoHandleStateEvent args)
|
||||
{
|
||||
if (args.Current is not ChameleonClothingComponentState state)
|
||||
return;
|
||||
component.SelectedId = state.SelectedId;
|
||||
|
||||
UpdateVisuals(uid, component);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,15 +17,6 @@ public sealed class CuffableSystem : SharedCuffableSystem
|
||||
|
||||
SubscribeLocalEvent<CuffableComponent, ComponentShutdown>(OnCuffableShutdown);
|
||||
SubscribeLocalEvent<CuffableComponent, ComponentHandleState>(OnCuffableHandleState);
|
||||
SubscribeLocalEvent<HandcuffComponent, ComponentHandleState>(OnHandcuffHandleState);
|
||||
}
|
||||
|
||||
private void OnHandcuffHandleState(EntityUid uid, HandcuffComponent component, ref ComponentHandleState args)
|
||||
{
|
||||
if (args.Current is not HandcuffComponentState state)
|
||||
return;
|
||||
|
||||
component.OverlayIconState = state.IconState;
|
||||
}
|
||||
|
||||
private void OnCuffableShutdown(EntityUid uid, CuffableComponent component, ComponentShutdown args)
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
using System.Linq;
|
||||
using Content.Shared.Ghost;
|
||||
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.GameStates;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Utility;
|
||||
using static Content.Shared.Humanoid.HumanoidAppearanceState;
|
||||
|
||||
namespace Content.Client.Humanoid;
|
||||
|
||||
@@ -21,34 +17,20 @@ public sealed class HumanoidAppearanceSystem : SharedHumanoidAppearanceSystem
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<HumanoidAppearanceComponent, ComponentHandleState>(OnHandleState);
|
||||
SubscribeLocalEvent<HumanoidAppearanceComponent, AfterAutoHandleStateEvent>(OnHandleState);
|
||||
}
|
||||
|
||||
private void OnHandleState(EntityUid uid, HumanoidAppearanceComponent component, ref ComponentHandleState args)
|
||||
private void OnHandleState(EntityUid uid, HumanoidAppearanceComponent component, ref AfterAutoHandleStateEvent args)
|
||||
{
|
||||
if (args.Current is not HumanoidAppearanceState state)
|
||||
return;
|
||||
|
||||
ApplyState(uid, component, Comp<SpriteComponent>(uid), state);
|
||||
UpdateSprite(component, Comp<SpriteComponent>(uid));
|
||||
}
|
||||
|
||||
private void ApplyState(EntityUid uid, HumanoidAppearanceComponent component, SpriteComponent sprite, HumanoidAppearanceState state)
|
||||
private void UpdateSprite(HumanoidAppearanceComponent component, SpriteComponent sprite)
|
||||
{
|
||||
component.Sex = state.Sex;
|
||||
component.Species = state.Species;
|
||||
component.Age = state.Age;
|
||||
component.SkinColor = state.SkinColor;
|
||||
component.EyeColor = state.EyeColor;
|
||||
component.HiddenLayers = new(state.HiddenLayers);
|
||||
component.PermanentlyHidden = new(state.PermanentlyHidden);
|
||||
|
||||
component.CustomBaseLayers = state.CustomBaseLayers.ShallowClone();
|
||||
|
||||
UpdateLayers(component, sprite);
|
||||
ApplyMarkingSet(component, sprite);
|
||||
|
||||
ApplyMarkingSet(uid, state.Markings, component, sprite);
|
||||
|
||||
sprite[sprite.LayerMapReserveBlank(HumanoidVisualLayers.Eyes)].Color = state.EyeColor;
|
||||
sprite[sprite.LayerMapReserveBlank(HumanoidVisualLayers.Eyes)].Color = component.EyeColor;
|
||||
}
|
||||
|
||||
private static bool IsHidden(HumanoidAppearanceComponent humanoid, HumanoidVisualLayers layer)
|
||||
@@ -60,7 +42,7 @@ public sealed class HumanoidAppearanceSystem : SharedHumanoidAppearanceSystem
|
||||
component.BaseLayers.Clear();
|
||||
|
||||
// add default species layers
|
||||
var speciesProto = _prototypeManager.Index<SpeciesPrototype>(component.Species);
|
||||
var speciesProto = _prototypeManager.Index(component.Species);
|
||||
var baseSprites = _prototypeManager.Index<HumanoidSpeciesBaseSpritesPrototype>(speciesProto.SpriteSet);
|
||||
foreach (var (key, id) in baseSprites.Sprites)
|
||||
{
|
||||
@@ -73,7 +55,7 @@ public sealed class HumanoidAppearanceSystem : SharedHumanoidAppearanceSystem
|
||||
foreach (var (key, info) in component.CustomBaseLayers)
|
||||
{
|
||||
oldLayers.Remove(key);
|
||||
SetLayerData(component, sprite, key, info.ID, sexMorph: false, color: info.Color); ;
|
||||
SetLayerData(component, sprite, key, info.Id, sexMorph: false, color: info.Color);
|
||||
}
|
||||
|
||||
// hide old layers
|
||||
@@ -161,12 +143,14 @@ public sealed class HumanoidAppearanceSystem : SharedHumanoidAppearanceSystem
|
||||
|
||||
// We need to ensure hair before applying it or coloring can try depend on markings that can be invalid
|
||||
var hairColor = _markingManager.MustMatchSkin(profile.Species, HumanoidVisualLayers.Hair, out var hairAlpha, _prototypeManager)
|
||||
? profile.Appearance.SkinColor.WithAlpha(hairAlpha) : profile.Appearance.HairColor;
|
||||
? profile.Appearance.SkinColor.WithAlpha(hairAlpha)
|
||||
: profile.Appearance.HairColor;
|
||||
var hair = new Marking(profile.Appearance.HairStyleId,
|
||||
new[] { hairColor });
|
||||
|
||||
var facialHairColor = _markingManager.MustMatchSkin(profile.Species, HumanoidVisualLayers.FacialHair, out var facialHairAlpha, _prototypeManager)
|
||||
? profile.Appearance.SkinColor.WithAlpha(facialHairAlpha) : profile.Appearance.FacialHairColor;
|
||||
? profile.Appearance.SkinColor.WithAlpha(facialHairAlpha)
|
||||
: profile.Appearance.FacialHairColor;
|
||||
var facialHair = new Marking(profile.Appearance.FacialHairStyleId,
|
||||
new[] { facialHairColor });
|
||||
|
||||
@@ -200,69 +184,60 @@ public sealed class HumanoidAppearanceSystem : SharedHumanoidAppearanceSystem
|
||||
|
||||
DebugTools.Assert(IsClientSide(uid));
|
||||
|
||||
var state = new HumanoidAppearanceState(markings,
|
||||
new(),
|
||||
new(),
|
||||
customBaseLayers,
|
||||
profile.Sex,
|
||||
profile.Gender,
|
||||
profile.Age,
|
||||
profile.Species,
|
||||
profile.Appearance.SkinColor,
|
||||
profile.Appearance.EyeColor);
|
||||
humanoid.MarkingSet = markings;
|
||||
humanoid.PermanentlyHidden = new HashSet<HumanoidVisualLayers>();
|
||||
humanoid.HiddenLayers = new HashSet<HumanoidVisualLayers>();
|
||||
humanoid.CustomBaseLayers = customBaseLayers;
|
||||
humanoid.Sex = profile.Sex;
|
||||
humanoid.Gender = profile.Gender;
|
||||
humanoid.Age = profile.Age;
|
||||
humanoid.Species = profile.Species;
|
||||
humanoid.SkinColor = profile.Appearance.SkinColor;
|
||||
humanoid.EyeColor = profile.Appearance.EyeColor;
|
||||
|
||||
ApplyState(uid, humanoid, Comp<SpriteComponent>(uid), state);
|
||||
UpdateSprite(humanoid, Comp<SpriteComponent>(uid));
|
||||
}
|
||||
|
||||
private void ApplyMarkingSet(EntityUid uid,
|
||||
MarkingSet newMarkings,
|
||||
HumanoidAppearanceComponent humanoid,
|
||||
SpriteComponent sprite)
|
||||
private void ApplyMarkingSet(HumanoidAppearanceComponent humanoid, SpriteComponent sprite)
|
||||
{
|
||||
// skip this entire thing if both sets are empty
|
||||
if (humanoid.MarkingSet.Markings.Count == 0 && newMarkings.Markings.Count == 0)
|
||||
return;
|
||||
|
||||
// I am lazy and I CBF resolving the previous mess, so I'm just going to nuke the markings.
|
||||
// Really, markings should probably be a separate component altogether.
|
||||
|
||||
ClearAllMarkings(uid, humanoid, sprite);
|
||||
|
||||
humanoid.MarkingSet = new(newMarkings);
|
||||
ClearAllMarkings(humanoid, sprite);
|
||||
|
||||
foreach (var markingList in humanoid.MarkingSet.Markings.Values)
|
||||
{
|
||||
foreach (var marking in markingList)
|
||||
{
|
||||
if (_markingManager.TryGetMarking(marking, out var markingPrototype))
|
||||
ApplyMarking(uid, markingPrototype, marking.MarkingColors, marking.Visible, humanoid, sprite);
|
||||
ApplyMarking(markingPrototype, marking.MarkingColors, marking.Visible, humanoid, sprite);
|
||||
}
|
||||
}
|
||||
|
||||
humanoid.ClientOldMarkings = new MarkingSet(humanoid.MarkingSet);
|
||||
}
|
||||
|
||||
private void ClearAllMarkings(EntityUid uid, HumanoidAppearanceComponent humanoid,
|
||||
SpriteComponent sprite)
|
||||
private void ClearAllMarkings(HumanoidAppearanceComponent humanoid, SpriteComponent sprite)
|
||||
{
|
||||
foreach (var markingList in humanoid.ClientOldMarkings.Markings.Values)
|
||||
{
|
||||
foreach (var marking in markingList)
|
||||
{
|
||||
RemoveMarking(marking, sprite);
|
||||
}
|
||||
}
|
||||
|
||||
humanoid.ClientOldMarkings.Clear();
|
||||
|
||||
foreach (var markingList in humanoid.MarkingSet.Markings.Values)
|
||||
{
|
||||
foreach (var marking in markingList)
|
||||
{
|
||||
RemoveMarking(uid, marking, sprite);
|
||||
RemoveMarking(marking, sprite);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ClearMarkings(EntityUid uid, List<Marking> markings, HumanoidAppearanceComponent humanoid,
|
||||
SpriteComponent spriteComp)
|
||||
{
|
||||
foreach (var marking in markings)
|
||||
{
|
||||
RemoveMarking(uid, marking, spriteComp);
|
||||
}
|
||||
}
|
||||
|
||||
private void RemoveMarking(EntityUid uid, Marking marking,
|
||||
SpriteComponent spriteComp)
|
||||
private void RemoveMarking(Marking marking, SpriteComponent spriteComp)
|
||||
{
|
||||
if (!_markingManager.TryGetMarking(marking, out var prototype))
|
||||
{
|
||||
@@ -286,8 +261,7 @@ public sealed class HumanoidAppearanceSystem : SharedHumanoidAppearanceSystem
|
||||
spriteComp.RemoveLayer(index);
|
||||
}
|
||||
}
|
||||
private void ApplyMarking(EntityUid uid,
|
||||
MarkingPrototype markingPrototype,
|
||||
private void ApplyMarking(MarkingPrototype markingPrototype,
|
||||
IReadOnlyList<Color>? colors,
|
||||
bool visible,
|
||||
HumanoidAppearanceComponent humanoid,
|
||||
@@ -393,7 +367,7 @@ public sealed class HumanoidAppearanceSystem : SharedHumanoidAppearanceSystem
|
||||
foreach (var marking in markingList)
|
||||
{
|
||||
if (_markingManager.TryGetMarking(marking, out var markingPrototype) && markingPrototype.BodyPart == layer)
|
||||
ApplyMarking(uid, markingPrototype, marking.MarkingColors, marking.Visible, humanoid, sprite);
|
||||
ApplyMarking(markingPrototype, marking.MarkingColors, marking.Visible, humanoid, sprite);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
using Content.Shared.Humanoid;
|
||||
using Content.Shared.Humanoid.Markings;
|
||||
using Robust.Client.GameObjects;
|
||||
using static Content.Shared.Humanoid.HumanoidAppearanceState;
|
||||
|
||||
namespace Content.Client.Humanoid;
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
using Robust.Shared.Prototypes;
|
||||
using static Content.Shared.Humanoid.HumanoidAppearanceState;
|
||||
|
||||
namespace Content.Client.Humanoid;
|
||||
|
||||
@@ -76,7 +75,7 @@ public sealed partial class HumanoidMarkingModifierWindow : DefaultWindow
|
||||
continue;
|
||||
}
|
||||
|
||||
modifier.SetState(true, layerInfo.ID ?? string.Empty, layerInfo.Color ?? Color.White);
|
||||
modifier.SetState(true, layerInfo.Id ?? string.Empty, layerInfo.Color ?? Color.White);
|
||||
}
|
||||
|
||||
var eyesColor = Color.White;
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using Content.Client.Items;
|
||||
using Content.Shared.Implants;
|
||||
using Content.Shared.Implants.Components;
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Client.Implants;
|
||||
|
||||
@@ -12,17 +11,12 @@ public sealed class ImplanterSystem : SharedImplanterSystem
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<ImplanterComponent, ComponentHandleState>(OnHandleImplanterState);
|
||||
SubscribeLocalEvent<ImplanterComponent, AfterAutoHandleStateEvent>(OnHandleImplanterState);
|
||||
SubscribeLocalEvent<ImplanterComponent, ItemStatusCollectMessage>(OnItemImplanterStatus);
|
||||
}
|
||||
|
||||
private void OnHandleImplanterState(EntityUid uid, ImplanterComponent component, ref ComponentHandleState args)
|
||||
private void OnHandleImplanterState(EntityUid uid, ImplanterComponent component, ref AfterAutoHandleStateEvent args)
|
||||
{
|
||||
if (args.Current is not ImplanterComponentState state)
|
||||
return;
|
||||
|
||||
component.CurrentMode = state.CurrentMode;
|
||||
component.ImplantOnly = state.ImplantOnly;
|
||||
component.UiUpdateNeeded = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Lathe;
|
||||
using Content.Shared.Materials;
|
||||
using Content.Shared.Research.Prototypes;
|
||||
@@ -24,7 +23,7 @@ public sealed partial class LatheMenu : DefaultWindow
|
||||
public event Action<BaseButton.ButtonEventArgs>? OnServerListButtonPressed;
|
||||
public event Action<string, int>? RecipeQueueAction;
|
||||
public event Action<string, int>? OnEjectPressed;
|
||||
public List<string> Recipes = new();
|
||||
public List<ProtoId<LatheRecipePrototype>> Recipes = new();
|
||||
|
||||
/// <summary>
|
||||
/// Default volume for a sheet if the material's entity prototype has no material composition.
|
||||
@@ -115,7 +114,7 @@ public sealed partial class LatheMenu : DefaultWindow
|
||||
var recipesToShow = new List<LatheRecipePrototype>();
|
||||
foreach (var recipe in Recipes)
|
||||
{
|
||||
if (!_prototypeManager.TryIndex<LatheRecipePrototype>(recipe, out var proto))
|
||||
if (!_prototypeManager.TryIndex(recipe, out var proto))
|
||||
continue;
|
||||
|
||||
if (SearchBar.Text.Trim().Length != 0)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using Content.Client.Interactable;
|
||||
using Content.Shared.Climbing;
|
||||
using Content.Shared.DragDrop;
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Client.Movement.Systems;
|
||||
|
||||
@@ -12,19 +11,9 @@ public sealed class ClimbSystem : SharedClimbSystem
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<ClimbingComponent, ComponentHandleState>(OnClimbingState);
|
||||
SubscribeLocalEvent<ClimbableComponent, CanDropTargetEvent>(OnCanDragDropOn);
|
||||
}
|
||||
|
||||
private static void OnClimbingState(EntityUid uid, ClimbingComponent component, ref ComponentHandleState args)
|
||||
{
|
||||
if (args.Current is not ClimbingComponent.ClimbModeComponentState climbModeState)
|
||||
return;
|
||||
|
||||
component.IsClimbing = climbModeState.Climbing;
|
||||
component.OwnerIsTransitioning = climbModeState.IsTransitioning;
|
||||
}
|
||||
|
||||
protected override void OnCanDragDropOn(EntityUid uid, ClimbableComponent component, ref CanDropTargetEvent args)
|
||||
{
|
||||
base.OnCanDragDropOn(uid, component, ref args);
|
||||
|
||||
@@ -3,7 +3,6 @@ using Content.Client.Message;
|
||||
using Content.Shared.Points;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Client.Points;
|
||||
|
||||
@@ -17,17 +16,12 @@ public sealed class PointSystem : SharedPointSystem
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<PointManagerComponent, ComponentHandleState>(OnHandleState);
|
||||
SubscribeLocalEvent<PointManagerComponent, AfterAutoHandleStateEvent>(OnHandleState);
|
||||
SubscribeLocalEvent<CharacterInfoSystem.GetCharacterInfoControlsEvent>(OnGetCharacterInfoControls);
|
||||
}
|
||||
|
||||
private void OnHandleState(EntityUid uid, PointManagerComponent component, ref ComponentHandleState args)
|
||||
private void OnHandleState(EntityUid uid, PointManagerComponent component, ref AfterAutoHandleStateEvent args)
|
||||
{
|
||||
if (args.Current is not PointManagerComponentState state)
|
||||
return;
|
||||
|
||||
component.Points = new(state.Points);
|
||||
component.Scoreboard = state.Scoreboard;
|
||||
_characterInfo.RequestCharacterInfo();
|
||||
}
|
||||
|
||||
|
||||
@@ -2,10 +2,6 @@ using Content.Client.Items;
|
||||
using Content.Client.Radiation.UI;
|
||||
using Content.Shared.Radiation.Components;
|
||||
using Content.Shared.Radiation.Systems;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
namespace Content.Client.Radiation.Systems;
|
||||
|
||||
@@ -14,19 +10,12 @@ public sealed class GeigerSystem : SharedGeigerSystem
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<GeigerComponent, ComponentHandleState>(OnHandleState);
|
||||
SubscribeLocalEvent<GeigerComponent, AfterAutoHandleStateEvent>(OnHandleState);
|
||||
SubscribeLocalEvent<GeigerComponent, ItemStatusCollectMessage>(OnGetStatusMessage);
|
||||
}
|
||||
|
||||
private void OnHandleState(EntityUid uid, GeigerComponent component, ref ComponentHandleState args)
|
||||
private void OnHandleState(EntityUid uid, GeigerComponent component, ref AfterAutoHandleStateEvent args)
|
||||
{
|
||||
if (args.Current is not GeigerComponentState state)
|
||||
return;
|
||||
|
||||
component.CurrentRadiation = state.CurrentRadiation;
|
||||
component.DangerLevel = state.DangerLevel;
|
||||
component.IsEnabled = state.IsEnabled;
|
||||
component.User = EnsureEntity<GeigerComponent>(state.User, uid);
|
||||
component.UiUpdateNeeded = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ using Robust.Client.Input;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Input;
|
||||
using Robust.Shared.Input.Binding;
|
||||
using Robust.Shared.Map;
|
||||
@@ -49,7 +48,6 @@ namespace Content.Client.Tabletop
|
||||
.Register<TabletopSystem>();
|
||||
|
||||
SubscribeNetworkEvent<TabletopPlayEvent>(OnTabletopPlay);
|
||||
SubscribeLocalEvent<TabletopDraggableComponent, ComponentHandleState>(HandleComponentState);
|
||||
SubscribeLocalEvent<TabletopDraggableComponent, ComponentRemove>(HandleDraggableRemoved);
|
||||
SubscribeLocalEvent<TabletopDraggableComponent, AppearanceChangeEvent>(OnAppearanceChange);
|
||||
}
|
||||
@@ -148,13 +146,6 @@ namespace Content.Client.Tabletop
|
||||
_window.OnClose += OnWindowClose;
|
||||
}
|
||||
|
||||
private void HandleComponentState(EntityUid uid, TabletopDraggableComponent component, ref ComponentHandleState args)
|
||||
{
|
||||
if (args.Current is not TabletopDraggableComponentState state) return;
|
||||
|
||||
component.DraggingPlayer = state.DraggingPlayer;
|
||||
}
|
||||
|
||||
private void OnWindowClose()
|
||||
{
|
||||
if (_table != null)
|
||||
|
||||
@@ -39,7 +39,7 @@ public sealed partial class GunSystem
|
||||
else if (component.UnspawnedCount > 0)
|
||||
{
|
||||
component.UnspawnedCount--;
|
||||
ent = Spawn(component.FillProto, coordinates);
|
||||
ent = Spawn(component.Proto, coordinates);
|
||||
EnsureShootable(ent.Value);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user