Port boxer from Nyano (#9080)

This commit is contained in:
Rane
2022-07-26 21:34:19 -04:00
committed by GitHub
parent 0abe64a94b
commit e36b155325
35 changed files with 359 additions and 60 deletions

View File

@@ -1,14 +1,15 @@
using Content.Server.Administration.Logs;
using Content.Server.CombatMode;
using Content.Server.Hands.Components;
using Content.Server.Pulling;
using Content.Server.Storage.Components;
using Content.Server.Weapon.Melee.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.Inventory;
using Content.Shared.Item;
using Content.Shared.Pulling.Components;
using Content.Shared.Weapons.Melee;
@@ -32,6 +33,8 @@ namespace Content.Server.Interaction
[Dependency] private readonly PullingSystem _pullSystem = default!;
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
[Dependency] private readonly InventorySystem _inventory = default!;
public override void Initialize()
{
@@ -259,17 +262,23 @@ namespace Content.Server.Interaction
// TODO: Make this saner?
// Attempt to do unarmed combat. We don't check for handled just because at this point it doesn't matter.
var used = user;
if (_inventory.TryGetSlotEntity(user, "gloves", out var gloves) && HasComp<MeleeWeaponComponent>(gloves))
used = (EntityUid) gloves;
if (wideAttack)
{
var ev = new WideAttackEvent(user, user, coordinates);
RaiseLocalEvent(user, ev, false);
var ev = new WideAttackEvent(used, user, coordinates);
RaiseLocalEvent(used, ev, false);
if (ev.Handled)
_adminLogger.Add(LogType.AttackUnarmedWide, LogImpact.Low, $"{ToPrettyString(user):user} wide attacked at {coordinates}");
}
else
{
var ev = new ClickAttackEvent(user, user, coordinates, target);
RaiseLocalEvent(user, ev, false);
var ev = new ClickAttackEvent(used, user, coordinates, target);
RaiseLocalEvent(used, ev, false);
if (ev.Handled)
{
if (target != null)