Gun tweaks (#8320)
This commit is contained in:
@@ -3,14 +3,17 @@ using Content.Server.CombatMode;
|
||||
using Content.Server.Hands.Components;
|
||||
using Content.Server.Pulling;
|
||||
using Content.Server.Storage.Components;
|
||||
using Content.Server.Weapon.Ranged.Barrels.Components;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.DragDrop;
|
||||
using Content.Shared.Input;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Item;
|
||||
using Content.Shared.Pulling.Components;
|
||||
using Content.Shared.Weapons.Melee;
|
||||
using Content.Shared.Weapons.Ranged.Components;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Containers;
|
||||
@@ -202,8 +205,13 @@ namespace Content.Server.Interaction
|
||||
{
|
||||
var item = hands.ActiveHandEntity;
|
||||
|
||||
if (item != null && !Deleted(item.Value))
|
||||
if (!Deleted(item))
|
||||
{
|
||||
var meleeVee = new MeleeAttackAttemptEvent();
|
||||
RaiseLocalEvent(item.Value, ref meleeVee);
|
||||
|
||||
if (meleeVee.Cancelled) return;
|
||||
|
||||
if (wideAttack)
|
||||
{
|
||||
var ev = new WideAttackEvent(item.Value, user, coordinates);
|
||||
|
||||
@@ -7,6 +7,7 @@ using Content.Server.Weapon.Ranged.Ammunition.Components;
|
||||
using Content.Server.Weapon.Ranged.Barrels.Components;
|
||||
using Content.Shared.Camera;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Popups;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Map;
|
||||
@@ -18,6 +19,11 @@ namespace Content.Server.Weapon.Ranged;
|
||||
|
||||
public sealed partial class GunSystem
|
||||
{
|
||||
private void OnMeleeAttempt(EntityUid uid, ServerRangedWeaponComponent component, ref MeleeAttackAttemptEvent args)
|
||||
{
|
||||
args.Cancelled = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tries to fire a round of ammo out of the weapon.
|
||||
/// </summary>
|
||||
@@ -138,6 +144,7 @@ public sealed partial class GunSystem
|
||||
}
|
||||
|
||||
#region Firing
|
||||
|
||||
/// <summary>
|
||||
/// Handles firing one or many projectiles
|
||||
/// </summary>
|
||||
@@ -242,5 +249,6 @@ public sealed partial class GunSystem
|
||||
hitscan.FireEffects(shooter, hitscan.MaxLength, angle);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -123,6 +123,7 @@ public sealed partial class GunSystem : EntitySystem
|
||||
|
||||
// SubscribeLocalEvent<ServerRangedWeaponComponent, ExaminedEvent>(OnGunExamine);
|
||||
SubscribeNetworkEvent<FirePosEvent>(OnFirePos);
|
||||
SubscribeLocalEvent<ServerRangedWeaponComponent, MeleeAttackAttemptEvent>(OnMeleeAttempt);
|
||||
}
|
||||
|
||||
private void OnFirePos(FirePosEvent msg, EntitySessionEventArgs args)
|
||||
|
||||
Reference in New Issue
Block a user