action refactor proper ecs edition (#27422)
This commit is contained in:
@@ -2,6 +2,7 @@ using System.Numerics;
|
||||
using Content.Client.Actions;
|
||||
using Content.Client.Decals.Overlays;
|
||||
using Content.Shared.Actions;
|
||||
using Content.Shared.Actions.Components;
|
||||
using Content.Shared.Decals;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Graphics;
|
||||
@@ -21,9 +22,12 @@ public sealed class DecalPlacementSystem : EntitySystem
|
||||
[Dependency] private readonly IPrototypeManager _protoMan = default!;
|
||||
[Dependency] private readonly InputSystem _inputSystem = default!;
|
||||
[Dependency] private readonly MetaDataSystem _metaData = default!;
|
||||
[Dependency] private readonly SharedActionsSystem _actions = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||
[Dependency] private readonly SpriteSystem _sprite = default!;
|
||||
|
||||
public static readonly EntProtoId DecalAction = "BaseMappingDecalAction";
|
||||
|
||||
private string? _decalId;
|
||||
private Color _decalColor = Color.White;
|
||||
private Angle _decalAngle = Angle.Zero;
|
||||
@@ -152,19 +156,12 @@ public sealed class DecalPlacementSystem : EntitySystem
|
||||
Cleanable = _cleanable,
|
||||
};
|
||||
|
||||
var actionId = Spawn(null);
|
||||
AddComp(actionId, new WorldTargetActionComponent
|
||||
{
|
||||
// non-unique actions may be considered duplicates when saving/loading.
|
||||
Icon = decalProto.Sprite,
|
||||
Repeat = true,
|
||||
ClientExclusive = true,
|
||||
CheckCanAccess = false,
|
||||
CheckCanInteract = false,
|
||||
Range = -1,
|
||||
Event = actionEvent,
|
||||
IconColor = _decalColor,
|
||||
});
|
||||
var actionId = Spawn(DecalAction);
|
||||
var action = Comp<ActionComponent>(actionId);
|
||||
var ent = (actionId, action);
|
||||
_actions.SetEvent(actionId, actionEvent);
|
||||
_actions.SetIcon(ent, decalProto.Sprite);
|
||||
_actions.SetIconColor(ent, _decalColor);
|
||||
|
||||
_metaData.SetEntityName(actionId, $"{_decalId} ({_decalColor.ToHex()}, {(int) _decalAngle.Degrees})");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user