Skip to content

Commit

Permalink
FIX: Multi cluster grenade
Browse files Browse the repository at this point in the history
  • Loading branch information
ReeZer2 committed Dec 12, 2024
1 parent 86e7a2f commit 64860b2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Content.Server.Explosion.EntitySystems;
using Content.Shared.Whitelist;
using Robust.Shared.Containers;
using Robust.Shared.Prototypes;

Expand Down Expand Up @@ -106,6 +107,11 @@ public sealed partial class ClusterGrenadeComponent : Component
/// This is the end.
/// </summary>
public bool CountDown;

//ss220 cluster grenade whitelist start
[DataField]
public EntityWhitelist? Whitelist;
//ss220 cluster grenade whitelist end
}

public enum GrenadeType
Expand Down
11 changes: 8 additions & 3 deletions Content.Server/Explosion/EntitySystems/ClusterGrenadeSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Content.Server.Weapons.Ranged.Systems;
using System.Numerics;
using Content.Shared.Explosion.Components;
using Content.Shared.Whitelist;
using Robust.Server.Containers;
using Robust.Server.GameObjects;

Expand All @@ -21,6 +22,7 @@ public sealed class ClusterGrenadeSystem : EntitySystem
[Dependency] private readonly GunSystem _gun = default!;
[Dependency] private readonly TransformSystem _transformSystem = default!;
[Dependency] private readonly ContainerSystem _containerSystem = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelist = default!;

public override void Initialize()
{
Expand Down Expand Up @@ -53,11 +55,14 @@ private void OnClugUsing(Entity<ClusterGrenadeComponent> clug, ref InteractUsing

var component = clug.Comp;

// TODO: Should use whitelist.
if (component.GrenadesContainer.ContainedEntities.Count >= component.MaxGrenades ||
!HasComp<FlashOnTriggerComponent>(args.Used))
//ss220 cluster grenade whitelist start
if (component.GrenadesContainer.ContainedEntities.Count >= component.MaxGrenades)
return;

if (_whitelist.IsWhitelistFailOrNull(clug.Comp.Whitelist, args.Used))
return;
//ss220 cluster grenade whitelist end

_containerSystem.Insert(args.Used, component.GrenadesContainer);
UpdateAppearance(clug);
args.Handled = true;
Expand Down

0 comments on commit 64860b2

Please sign in to comment.