Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mech Blacklist #2007

Merged
merged 4 commits into from
Sep 14, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
using System.Numerics;
using System.Numerics;
using System.Threading;
using Content.Shared.DoAfter;
using Robust.Shared.Audio;
using Robust.Shared.Containers;
using Content.Shared.Whitelist; // Frontier

namespace Content.Server.Mech.Equipment.Components;

Expand Down Expand Up @@ -51,4 +52,10 @@ public sealed partial class MechGrabberComponent : Component

[DataField, ViewVariables(VVAccess.ReadOnly)]
public DoAfterId? DoAfter;

/// <summary>
/// Frontier - If any entities on the blacklist then UnanchorOnHit won't work on anything else.
/// </summary>
[DataField]
public EntityWhitelist? Blacklist;
}
12 changes: 12 additions & 0 deletions Content.Server/Mech/Equipment/EntitySystems/MechGrabberSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
using Robust.Shared.Map;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Components;
using Content.Shared.Whitelist; // Frontier
using Content.Shared.Buckle.Components; // Frontier
using Content.Shared.Buckle; // Frontier

namespace Content.Server.Mech.Equipment.EntitySystems;

Expand All @@ -30,6 +33,8 @@ public sealed class MechGrabberSystem : EntitySystem
[Dependency] private readonly InteractionSystem _interaction = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly TransformSystem _transform = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelist = default!; // Frontier
[Dependency] private readonly SharedBuckleSystem _buckle = default!;

/// <inheritdoc/>
public override void Initialize()
Expand Down Expand Up @@ -139,6 +144,9 @@ private void OnInteract(EntityUid uid, MechGrabberComponent component, UserActiv
return;
}

if (_whitelist.IsBlacklistPass(component.Blacklist, target)) // Frontier: Blacklist
return;

if (Transform(target).Anchored)
return;

Expand Down Expand Up @@ -182,6 +190,10 @@ private void OnMechGrab(EntityUid uid, MechGrabberComponent component, DoAfterEv
if (!_mech.TryChangeEnergy(equipmentComponent.EquipmentOwner.Value, component.GrabEnergyDelta))
return;

if (TryComp<StrapComponent>(args.Args.Target, out var strapComp) && strapComp.BuckledEntities != null) // Frontier: Remove people from chairs
foreach (var buckleUid in strapComp.BuckledEntities)
_buckle.TryUnbuckle(buckleUid, buckleUid, true);
whatston3 marked this conversation as resolved.
Show resolved Hide resolved

_container.Insert(args.Args.Target.Value, component.ItemContainer);
_mech.UpdateUserInterface(equipmentComponent.EquipmentOwner.Value);

Expand Down
11 changes: 3 additions & 8 deletions Content.Shared/Weapons/Melee/MeleeThrowOnHitSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Content.Shared.Construction.Components;
using Content.Shared.Weapons.Melee.Components;
using Content.Shared.Weapons.Melee.Events;
using Content.Shared.Whitelist;
using Content.Shared.Whitelist; // Frontier
using Robust.Shared.Physics;
using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Events;
Expand All @@ -19,7 +19,7 @@ public sealed class MeleeThrowOnHitSystem : EntitySystem
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelist = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelist = default!; // Frontier

/// <inheritdoc/>
public override void Initialize()
Expand Down Expand Up @@ -49,12 +49,7 @@ private void OnMeleeHit(Entity<MeleeThrowOnHitComponent> ent, ref MeleeHitEvent

if (comp.UnanchorOnHit && HasComp<AnchorableComponent>(hit))
{
if (comp.Whitelist != null) // Frontier
{
if (_whitelist.IsWhitelistPass(comp.Whitelist, hit))
_transform.Unanchor(hit, Transform(hit));
}
else // Frontier
if (_whitelist.IsWhitelistPassOrNull(comp.Whitelist, hit)) // Frontier
_transform.Unanchor(hit, Transform(hit));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
- type: Sprite
state: mecha_clamp
- type: MechGrabber
blacklist: # Frontier
components:
- Anomaly
- Mech
maxContents: 8
- type: UIFragment
ui: !type:MechGrabberUi
Expand All @@ -38,6 +42,10 @@
- type: Sprite
state: mecha_clamp_small
- type: MechGrabber
blacklist: # Frontier
components:
- Anomaly
- Mech
maxContents: 4
grabDelay: 3
grabEnergyDelta: 20
Expand Down
Loading