Skip to content

Commit

Permalink
если пустая гильза в стволе -> Кнопки "казнь" не будет
Browse files Browse the repository at this point in the history
  • Loading branch information
Rinary1 committed Oct 17, 2024
1 parent 6c2a3f1 commit caf7c53
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Content.Server/_Sunrise/Execution/ExecutionSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
using Robust.Shared.Audio.Systems;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
using Robust.Shared.Containers;

namespace Content.Server._Sunrise.Execution;

Expand All @@ -29,6 +30,7 @@ namespace Content.Server._Sunrise.Execution;
/// </summary>
public sealed class ExecutionSystem : EntitySystem
{
[Dependency] private readonly SharedContainerSystem _containerSystem = default!;
[Dependency] private readonly SharedDoAfterSystem _doAfterSystem = default!;
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
Expand Down Expand Up @@ -168,6 +170,15 @@ private bool CanExecuteWithGun(EntityUid weapon, EntityUid victim, EntityUid use
// We must be able to actually fire the gun
if (!TryComp<GunComponent>(weapon, out var gun) && _gunSystem.CanShoot(gun!))
return false;

if (_containerSystem.TryGetContainer(weapon, "gun_chamber", out var chamberContainer))
{
foreach (var contained in chamberContainer.ContainedEntities)
{
if (TryComp<CartridgeAmmoComponent>(contained, out var cartridge) && cartridge.Spent)
return false;
}
}

return true;
}
Expand Down

0 comments on commit caf7c53

Please sign in to comment.