* DoAfters * Compact Clone() * Fix mice and cuffables * Try generalize attempt events * moves climbabledoafter event to shared, fixes issue with climbable target * Fix merge (cuffing) * Make all events netserializable * handful of doafter events moved * moves the rest of the events to their respective shared folders * Changes all mentions of server doafter to shared * stop stripping cancellation * fix merge errors * draw paused doafters * handle unpausing * missing netserializable ref * removes break on stun reference * removes cuffing state reference * Fix tools * Fix door prying. * Fix construction * Fix dumping * Fix wielding assert * fix rev * Fix test * more test fixes --------- Co-authored-by: keronshb <keronshb@live.com>
55 lines
1.7 KiB
C#
55 lines
1.7 KiB
C#
using Content.Shared.Construction.Components;
|
|
using Content.Shared.Containers.ItemSlots;
|
|
using Content.Shared.DoAfter;
|
|
using Content.Shared.Interaction;
|
|
using Content.Shared.Pulling.Components;
|
|
using Content.Shared.Tools.Components;
|
|
using Robust.Shared.Serialization;
|
|
|
|
namespace Content.Shared.Construction.EntitySystems;
|
|
|
|
public abstract class SharedAnchorableSystem : EntitySystem
|
|
{
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<AnchorableComponent, InteractUsingEvent>(OnInteractUsing,
|
|
before: new[] { typeof(ItemSlotsSystem) }, after: new[] { typeof(SharedConstructionSystem) });
|
|
}
|
|
|
|
private void OnInteractUsing(EntityUid uid, AnchorableComponent anchorable, InteractUsingEvent args)
|
|
{
|
|
if (args.Handled)
|
|
return;
|
|
|
|
// If the used entity doesn't have a tool, return early.
|
|
if (!TryComp(args.Used, out ToolComponent? usedTool) || !usedTool.Qualities.Contains(anchorable.Tool))
|
|
return;
|
|
|
|
args.Handled = true;
|
|
TryToggleAnchor(uid, args.User, args.Used, anchorable, usingTool: usedTool);
|
|
}
|
|
|
|
public virtual void TryToggleAnchor(EntityUid uid, EntityUid userUid, EntityUid usingUid,
|
|
AnchorableComponent? anchorable = null,
|
|
TransformComponent? transform = null,
|
|
SharedPullableComponent? pullable = null,
|
|
ToolComponent? usingTool = null)
|
|
{
|
|
// Thanks tool system.
|
|
|
|
// TODO tool system is fixed now, make this actually shared.
|
|
}
|
|
|
|
[Serializable, NetSerializable]
|
|
protected sealed class TryUnanchorCompletedEvent : SimpleDoAfterEvent
|
|
{
|
|
}
|
|
|
|
[Serializable, NetSerializable]
|
|
protected sealed class TryAnchorCompletedEvent : SimpleDoAfterEvent
|
|
{
|
|
}
|
|
}
|