DoAfter fixes (#15127)

This commit is contained in:
Leon Friedrich
2023-04-04 18:28:55 +12:00
committed by GitHub
parent 463bf869e6
commit df3dae9093
4 changed files with 14 additions and 9 deletions

View File

@@ -233,6 +233,9 @@ namespace Content.Server.Construction
BreakOnTargetMove = false, BreakOnTargetMove = false,
BreakOnUserMove = true, BreakOnUserMove = true,
NeedHand = false, NeedHand = false,
// allow simultaneously starting several construction jobs using the same stack of materials.
CancelDuplicate = false,
BlockDuplicate = false,
}; };
if (await _doAfterSystem.WaitDoAfter(doAfterArgs) == DoAfterStatus.Cancelled) if (await _doAfterSystem.WaitDoAfter(doAfterArgs) == DoAfterStatus.Cancelled)
@@ -481,13 +484,13 @@ namespace Content.Server.Construction
// We do this to be able to move the construction to its proper position in case it's anchored... // We do this to be able to move the construction to its proper position in case it's anchored...
// Oh wow transform anchoring is amazing wow I love it!!!! // Oh wow transform anchoring is amazing wow I love it!!!!
var wasAnchored = EntityManager.GetComponent<TransformComponent>(structure).Anchored; // ikr
EntityManager.GetComponent<TransformComponent>(structure).Anchored = false; var xform = Transform(structure);
var wasAnchored = xform.Anchored;
EntityManager.GetComponent<TransformComponent>(structure).Coordinates = ev.Location; xform.Anchored = false;
EntityManager.GetComponent<TransformComponent>(structure).LocalRotation = constructionPrototype.CanRotate ? ev.Angle : Angle.Zero; xform.Coordinates = ev.Location;
xform.LocalRotation = constructionPrototype.CanRotate ? ev.Angle : Angle.Zero;
EntityManager.GetComponent<TransformComponent>(structure).Anchored = wasAnchored; xform.Anchored = wasAnchored;
RaiseNetworkEvent(new AckStructureConstructionMessage(ev.Ack)); RaiseNetworkEvent(new AckStructureConstructionMessage(ev.Ack));
_adminLogger.Add(LogType.Construction, LogImpact.Low, $"{ToPrettyString(user):player} has turned a {ev.PrototypeName} construction ghost into {ToPrettyString(structure)} at {Transform(structure).Coordinates}"); _adminLogger.Add(LogType.Construction, LogImpact.Low, $"{ToPrettyString(user):player} has turned a {ev.PrototypeName} construction ghost into {ToPrettyString(structure)} at {Transform(structure).Coordinates}");

View File

@@ -229,7 +229,7 @@ namespace Content.Server.Power.EntitySystems
private void OnToolFinished(EntityUid uid, ApcComponent component, ApcToolFinishedEvent args) private void OnToolFinished(EntityUid uid, ApcComponent component, ApcToolFinishedEvent args)
{ {
if (!args.Cancelled) if (args.Cancelled)
return; return;
component.IsApcOpen = !component.IsApcOpen; component.IsApcOpen = !component.IsApcOpen;

View File

@@ -65,7 +65,7 @@ namespace Content.Server.Repairable
delay *= component.SelfRepairPenalty; delay *= component.SelfRepairPenalty;
// Can the tool actually repair this, does it have enough fuel? // Can the tool actually repair this, does it have enough fuel?
args.Handled = !_toolSystem.UseTool(args.Used, args.User, uid, delay, component.QualityNeeded, new RepairFinishedEvent(), component.FuelCost); args.Handled = _toolSystem.UseTool(args.Used, args.User, uid, delay, component.QualityNeeded, new RepairFinishedEvent(), component.FuelCost);
} }
} }
} }

View File

@@ -88,6 +88,7 @@ public sealed partial class RevenantSystem
var searchDoAfter = new DoAfterArgs(uid, revenant.SoulSearchDuration, new SoulEvent(), uid, target: target) var searchDoAfter = new DoAfterArgs(uid, revenant.SoulSearchDuration, new SoulEvent(), uid, target: target)
{ {
BreakOnUserMove = true, BreakOnUserMove = true,
BreakOnDamage = true,
DistanceThreshold = 2 DistanceThreshold = 2
}; };
@@ -142,6 +143,7 @@ public sealed partial class RevenantSystem
{ {
DistanceThreshold = 2, DistanceThreshold = 2,
BreakOnUserMove = true, BreakOnUserMove = true,
BreakOnDamage = true,
RequireCanInteract = false, // stuns itself RequireCanInteract = false, // stuns itself
}; };