mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-09-30 16:17:27 +00:00
* Merge BreakOnWeightlessMove and BreakOnMove. Provide different theshold for weightless movement.
* Adjust WeightlessMovementThresholds. Put a thing I forgot to put in the doafterargs.
* Make DoAfterArgs only use OnMove to determine whether to check for
movement and MoveThreshold to determine the threshold regardless of
weightlessness. Gave DistanceThreshold a default value which will always
be checked now.
* Fix issue introduced by merge.
* Use interaction system for determining whether a distance is within range
* Fix incorrect doafter args introduced by previous merge.
Forgor to commit these.
* Exorcise ghost.
The execution system should have been deleted when I merged previously.
For a reason I cannot comprehend it came back, but only the execution
system.
* Exorcise ghost Pt. 2
* Allow for movement check to be overriden in zero g and adjust doafter args where needed.
You can now override checking for movement in zero g with the BreakOnWeightlessMove bool. By default it will check.
The following doafters were made to ignore the movement check in zero g:
- Healing yourself with healing items,
- Removing embedded projectiles,
- Using tools like welders and crowbars
* Adjust distance for cuffing/uncuffing to work. Make injections not break on weightless movement.
* Fix evil incorrect and uneeded comments
(cherry picked from commit 362d56981f)
70 lines
2.4 KiB
C#
70 lines
2.4 KiB
C#
using Content.Server.Engineering.Components;
|
|
using Content.Shared.DoAfter;
|
|
using Content.Shared.Hands.EntitySystems;
|
|
using Content.Shared.Verbs;
|
|
using JetBrains.Annotations;
|
|
|
|
namespace Content.Server.Engineering.EntitySystems
|
|
{
|
|
[UsedImplicitly]
|
|
public sealed class DisassembleOnAltVerbSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<DisassembleOnAltVerbComponent, GetVerbsEvent<AlternativeVerb>>(AddDisassembleVerb);
|
|
}
|
|
private void AddDisassembleVerb(EntityUid uid, DisassembleOnAltVerbComponent component, GetVerbsEvent<AlternativeVerb> args)
|
|
{
|
|
if (!args.CanInteract || !args.CanAccess || args.Hands == null)
|
|
return;
|
|
|
|
AlternativeVerb verb = new()
|
|
{
|
|
Act = () =>
|
|
{
|
|
AttemptDisassemble(uid, args.User, args.Target, component);
|
|
},
|
|
Text = Loc.GetString("disassemble-system-verb-disassemble"),
|
|
Priority = 2
|
|
};
|
|
args.Verbs.Add(verb);
|
|
}
|
|
|
|
public async void AttemptDisassemble(EntityUid uid, EntityUid user, EntityUid target, DisassembleOnAltVerbComponent? component = null)
|
|
{
|
|
if (!Resolve(uid, ref component))
|
|
return;
|
|
if (string.IsNullOrEmpty(component.Prototype))
|
|
return;
|
|
|
|
if (component.DoAfterTime > 0 && TryGet<SharedDoAfterSystem>(out var doAfterSystem))
|
|
{
|
|
var doAfterArgs = new DoAfterArgs(EntityManager, user, component.DoAfterTime, new AwaitedDoAfterEvent(), null)
|
|
{
|
|
BreakOnMove = true,
|
|
};
|
|
var result = await doAfterSystem.WaitDoAfter(doAfterArgs);
|
|
|
|
if (result != DoAfterStatus.Finished)
|
|
return;
|
|
}
|
|
|
|
if (component.Deleted || Deleted(uid))
|
|
return;
|
|
|
|
if (!TryComp<TransformComponent>(uid, out var transformComp))
|
|
return;
|
|
|
|
var entity = EntityManager.SpawnEntity(component.Prototype, transformComp.Coordinates);
|
|
|
|
_handsSystem.TryPickup(user, entity);
|
|
|
|
EntityManager.DeleteEntity(uid);
|
|
}
|
|
}
|
|
}
|