More DoAfter Changes (#14609)

* 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>
This commit is contained in:
Leon Friedrich
2023-04-03 13:13:48 +12:00
committed by GitHub
parent 9e66fac805
commit 19277a2276
170 changed files with 3042 additions and 2954 deletions

View File

@@ -2,6 +2,7 @@
using Content.Server.Maps;
using Content.Server.Tools.Components;
using Content.Shared.Database;
using Content.Shared.DoAfter;
using Content.Shared.Interaction;
using Content.Shared.Maps;
using Content.Shared.Tools.Components;
@@ -22,6 +23,9 @@ public sealed partial class ToolSystem
private void OnLatticeCutComplete(EntityUid uid, LatticeCuttingComponent component, LatticeCuttingCompleteEvent args)
{
if (args.Cancelled)
return;
var gridUid = args.Coordinates.GetGridUid(EntityManager);
if (gridUid == null)
return;
@@ -50,10 +54,6 @@ public sealed partial class ToolSystem
private bool TryCut(EntityUid toolEntity, EntityUid user, LatticeCuttingComponent component, EntityCoordinates clickLocation)
{
ToolComponent? tool = null;
if (component.ToolComponentNeeded && !TryComp<ToolComponent?>(toolEntity, out tool))
return false;
if (!_mapManager.TryGetGrid(clickLocation.GetGridUid(EntityManager), out var mapGrid))
return false;
@@ -71,24 +71,8 @@ public sealed partial class ToolSystem
|| tile.IsBlockedTurf(true))
return false;
var toolEvData = new ToolEventData(new LatticeCuttingCompleteEvent(clickLocation, user), targetEntity: toolEntity);
if (!UseTool(toolEntity, user, null, component.Delay, new[] {component.QualityNeeded}, toolEvData, toolComponent: tool))
return false;
return true;
}
private sealed class LatticeCuttingCompleteEvent : EntityEventArgs
{
public EntityCoordinates Coordinates;
public EntityUid User;
public LatticeCuttingCompleteEvent(EntityCoordinates coordinates, EntityUid user)
{
Coordinates = coordinates;
User = user;
}
var ev = new LatticeCuttingCompleteEvent(clickLocation);
return UseTool(toolEntity, user, toolEntity, component.Delay, component.QualityNeeded, ev);
}
}