using Robust.Shared.Audio;
using Robust.Shared.Timing;
using System.Numerics;
+using Content.Shared.Damage.Components;
namespace Content.Server.Body.Systems;
return new HashSet<EntityUid>();
}
+ if (HasComp<GodmodeComponent>(bodyId))
+ return new HashSet<EntityUid>();
+
var xform = Transform(bodyId);
if (xform.MapUid is null)
return new HashSet<EntityUid>();
using Content.Server.Body.Systems;
+using Content.Server.Destructible;
+using Content.Server.Examine;
using Content.Server.Polymorph.Components;
using Content.Server.Popups;
using Content.Shared.Body.Components;
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly DamageableSystem _damageable = default!;
+ [Dependency] private readonly DestructibleSystem _destructible = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
[Dependency] private readonly SharedMapSystem _map = default!;
return;
}
- QueueDel(ent);
+ _destructible.DestroyEntity(ent);
}
private void OnExamined(EntityUid uid, ImmovableRodComponent component, ExaminedEvent args)
using Robust.Shared.Containers;
using Robust.Shared.Timing;
using System.Linq;
+using Content.Server.Construction.Completions;
using Content.Server.Jittering;
using Content.Shared.Jittering;
using Content.Shared.Power;
[Dependency] private readonly SharedAudioSystem _audioSystem = default!;
[Dependency] private readonly SharedAppearanceSystem _appearanceSystem = default!;
[Dependency] private readonly SharedContainerSystem _containerSystem = default!;
+ [Dependency] private readonly SharedDestructibleSystem _destructible = default!;
[Dependency] private readonly RandomHelperSystem _randomHelper = default!;
[Dependency] private readonly JitteringSystem _jitter = default!;
if (solution.Volume > containerSolution.AvailableVolume)
continue;
- var dev = new DestructionEventArgs();
- RaiseLocalEvent(item, dev);
-
- QueueDel(item);
+ _destructible.DestroyEntity(item);
}
_solutionContainersSystem.TryAddSolution(containerSoln.Value, solution);
[Dependency] private readonly ReactiveSystem _reaction = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly SharedDoAfterSystem _doAfter = default!;
+ [Dependency] private readonly SharedDestructibleSystem _destructible = default!;
[Dependency] private readonly SharedHandsSystem _hands = default!;
[Dependency] private readonly SharedInteractionSystem _interaction = default!;
[Dependency] private readonly SharedSolutionContainerSystem _solutionContainer = default!;
if (ev.Cancelled)
return;
+ var attemptEv = new DestructionAttemptEvent();
+ RaiseLocalEvent(food, attemptEv);
+ if (attemptEv.Cancelled)
+ return;
+
var afterEvent = new AfterFullyEatenEvent(user);
RaiseLocalEvent(food, ref afterEvent);
using Content.Shared.Damage.Components;
using Content.Shared.Damage.Events;
+using Content.Shared.Destructible;
using Content.Shared.Rejuvenate;
using Content.Shared.Slippery;
using Content.Shared.StatusEffect;
SubscribeLocalEvent<GodmodeComponent, BeforeStatusEffectAddedEvent>(OnBeforeStatusEffect);
SubscribeLocalEvent<GodmodeComponent, BeforeStaminaDamageEvent>(OnBeforeStaminaDamage);
SubscribeLocalEvent<GodmodeComponent, SlipAttemptEvent>(OnSlipAttempt);
+ SubscribeLocalEvent<GodmodeComponent, DestructionAttemptEvent>(OnDestruction);
}
private void OnSlipAttempt(EntityUid uid, GodmodeComponent component, SlipAttemptEvent args)
args.Cancelled = true;
}
+ private void OnDestruction(Entity<GodmodeComponent> ent, ref DestructionAttemptEvent args)
+ {
+ args.Cancel();
+ }
+
public virtual void EnableGodmode(EntityUid uid, GodmodeComponent? godmode = null)
{
godmode ??= EnsureComp<GodmodeComponent>(uid);
/// <summary>
/// Force entity to be destroyed and deleted.
/// </summary>
- public void DestroyEntity(EntityUid owner)
+ public bool DestroyEntity(EntityUid owner)
{
- var eventArgs = new DestructionEventArgs();
+ var ev = new DestructionAttemptEvent();
+ RaiseLocalEvent(owner, ev);
+ if (ev.Cancelled)
+ return false;
+ var eventArgs = new DestructionEventArgs();
RaiseLocalEvent(owner, eventArgs);
+
QueueDel(owner);
+ return true;
}
/// <summary>
}
}
+/// <summary>
+/// Raised before an entity is about to be destroyed and deleted
+/// </summary>
+public sealed class DestructionAttemptEvent : CancellableEntityEventArgs
+{
+
+}
+
/// <summary>
/// Raised when entity is destroyed and about to be deleted.
/// </summary>